Setup AVR Eclipse plugin to work with WinAVR

Probably many of you (including me) are using Programmers Notepad or AVR Studio to set up AVR projects. Each of them has advantages and disadvantages. For instance, Programmers, Notepad is a great GUI, but there are many manual routines required to start compiling projects – like setting up makefile, creating file dependencies, etc. AVR Studio is a great solution that generates makefiles automatically, and it has a great simulator for immediate debugging. So why would we need another IDE? Actually, Eclipse IDE is one of the best open-source tools that programmers widely use – so it is optimized for managing projects, code writing with auto-complete functionality. So why not give it a try. So let’s set up an Eclipse environment to work with AVR. First of all, let’s download Eclipse from https://www.eclipse.org/downloads/ site. Choose Eclipse IDE for C/C++ Developers as we want to program AVR in C. Open it (no need to install), then go to HELP->Install New Software… Click Add… and in the Add Site dialogue box, enter the URL where the AVR Eclipse plugin is located (https://avr-eclipse.sourceforge.net/updatesite/ )

Continue reading

Easy start with AVR EEPROM using WinAVR

AVR microcontrollers are loaded with some amount of EEPROM (Electronically Erasable Read-Only Memory ) memory. This is a handy feature allowing developers to store program parameters like service information, constants, menu strings, etc. Atmel states that AVR EEPROM memory can be rewritten over 1000000 times. Reading is unlimited. In this article, I am going to show how to store data to EEPROM by defining variables. For this, we need to include eeprom.h header from avr directory (#include “avr/eeprom.h” ). Then we can write a simple variable declaration using the simple attribute EEMEM: EEMEM keyword indicates to the compiler that variables are stored in EEPROM, and it creates a separate .eep file that has to be written to chip separately. Se what I have got after compiling the above code: You can see compiler information about compiled code sizes. The bold line is indicating the size of occupied EEPROM memory. In this particular case, we see that size is 8 bytes: one-byte variable, one word (two bytes), and a five-byte array – total 8bytes. Open .eep file located in the project folder. The compiler compiled Intel Hex File of EEPROM data: :0800000054657374005555109E :00000001FF The first line shows 8-byte data stored at…

Continue reading