Main Menu
Home
AVR News
Atmel AVR
AVR Development Tools
Valuable Tools
WinAVR toolset
Makefile for WinAVR
AVR Virtual Simulators
Hardware for prototyping
GCC and AVR-GCC
Short introduction to C
AVR-GCC Tutorial
Example AVR Projects
AVR-GCC articles
WinAVR Site Map
Scienceprog FORUM
ScienceProg BLOG
Disclaimer
WinARM Tutorial
Login Form





Lost Password?
No account yet? Register
Latest comments
Programming AVR ADC module...
hi please send me example usart with...
More...

Measuring motor speed and...
main.c: In function...
More...

Running TX433 and RX433 RF...
(Hopefully this is not a re-post). I am...
More...

Running TX433 and RX433 RF...
I just bnought a pair of the RX/TX 433...
More...

Accessing AVR microcontroller...
You need to read PORTD 5th bit and...
More...

Syndicate
Friendly sites

Latest News
Enumeration of variables
Written by Administrator   
Thursday, 14 September 2006

This is similar to #define preprocessor where you can describe a set of constatnts. Using preprocessor we use:

#define zero 0

#define one 1

#define two 3

But there is an alternative of using enumerating using keyword enum:

enum (zero=0,one, two); //zero=0, one=1; two=2

By default enumeration assigns values from 0 and up.

Now you can use enumeration like in following example:


Be first to comment this article Read more...
More about C types in AVR-GCC
Written by Administrator   
Wednesday, 13 September 2006

Char types

As it is important to understand variable types in AVR-GCC lest take a deeper look at this.

Choosing proper variable type sometimes may be crucial in designing embedded software as microcontroller resources are limited. Choice of proper variable type may save lots of time and space of your program.

What is common variable type in 8 bit system? Of course byte or so called char type. Char name comes from word “character” because char type usually is used to store character symbols (ASCII). Char type can have values from -128 to +127 while unsigned char may have values from 0 to 256. Some compilers may use byte type instead of unsigned char.


Be first to comment this article Read more...
Accessing AVR microcontroller ports with WinAVR GCC
Written by Administrator   
Wednesday, 06 September 2006
Last Updated ( Wednesday, 06 September 2006 )

All AVR ports have Read-modify-write functionality when used as genera I/O ports. Direction of separate port pin can be changed. Each pin buffer has symmetric capability to drive and sink source. Pin driver is strong enough to drive LED directly , but it is not recommended. All port pins have selectable pull-up resistors. All pins have protection diodes to both VCC and GND.

Each port consists of three registers DDRx, PORTx and PINx (where x means port letter). DDRx register selects direction of port pins. If logic one is written to DDRx then port is configured to be as output. Zero means that port is configured as input. If DDRx is written zero and PORTx is written logic “1” then port is configured as input with internal pull-up resistor. Otherwise if PORTx is written to zero, then port is configured as input but pins are set to tri-state and you might need to connect external pull-up resistors.

If PORTx is written to logic “1” and DDRx is set to “1”, then port pin is driven high. And if PORTx=0, then port is driven low.


User comments (2) Read more...
Pointers to structures in embedded C
Written by Administrator   
Tuesday, 05 September 2006

Sometimes you might like to manipulate the members of structures in more generalized way. This can be done by using pointer reference to structure. Sometimes it is easier to pass pointer to structure than passing entire structure to function.

Structure pointer can be declared very easily:

struct structure_tag_name *variable;

For instance:


Be first to comment this article Read more...
<< Start < Prev 1 2 3 4 5 6 7 8 9 10 Next > End >>

Results 46 - 50 of 69

© 2008 WinAVR AVR-GCC Tutorial
Joomla! is Free Software released under the GNU/GPL License.