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
Latest comments
Measuring motor speed and...
Dear Administrator The code above...
More...

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...

Friendly sites

Related Items:

Recommended sites


More about C types in AVR-GCC PDF Print E-mail
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.

User types

C language allows defining user types. For this typedef keyword is used:

typedef unsigned char byte; //create byte type

typedef unsigned int word; //create word type

In other words defining custom types description structure is used:

typedef standard_type custom_type;

WinAVR compiler has predefined custom types:

typedef signed char int8_t; //located in header file inttypes.h

typedef unsigned char uint8_t; //located in header file inttypes.h

typedef int int16_t; //located in header file inttypes.h

typedef unsigned int uint16_t; //located in header file inttypes.h

typedef long int32_t; //located in header file inttypes.h

typedef unsigned long uint32_t; //located in header file inttypes.h

typedef long long int64_t; //located in header file inttypes.h

typedef unsigned long long uint64_t; //located in header file inttypes.h

typedef struct {int quot; int rem} div_t; //located in header file stdlib.h. It is used for standard function ldiv();


Related Items:

   

Users' Comments  
 

Average user rating

 


Add your comment
Only registered users can comment an article. Please login or register.

No comment posted



mXcomment 1.0.6 © 2007-2008 - visualclinic.fr
License Creative Commons - Some rights reserved
< Prev   Next >

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