Use fixed integer types to enhance portability

If you have programmed anything with C you should be familiar with common data types like char, unsigned char, int, unsigned int, long int, long long int, etc. It is really hard to tell by looks of type how many bytes this variable takes on memory and how it looks in different system. For instance in 8-bit AVR-GCC compiler int is 16-bit type, while in ARM-GCC int is 32-bit. So int size is dependent on platform, compiler and runtime libraries. And switching between systems may trick you if you are not careful enough. You can always check the size of variable by using sizeof() function. What to do if you need your code to be portable between different systems. Some great libraries could work on any system including 8-bit, 16-bit, … Continue reading

AVR at a glance

Any AVR microcontroller is an 8 bit computer in a chip designed and manufactured by ATMEL Corporation. It has some RAM memory and ROM (Flash) as well. To make things more attractive and useful there is also an EEPROM memory. Including AVR core CPU all these are more than enough to say that it is a small computer where you can execute programs stored in Flash memory, run them while operating data in SRAM and storing some constant values in EEPROM. Comparing to real computer that sits on your table you can say that AVR core is a CPU like AMD or Pentium. Flash memory would be your hard drive where programs are stored, RAM is RAM nothing to add there. EEPROM probably can be compared to some media device … Continue reading