In previous post you have seen how to install AVR plugin in eclipse IDE. In this post you are going to see how to use the plugin. First of all you will need to create a new project. Go to menu bar and select “new” and from the submenu select “C Project”.
By expanding the folder “AVR cross target application “choose Empty Project” and “AVR-CGG toolchain” from the toolchain list .Type down the project’s name, and then hit next.
Here you can click on advance setting but that will be explained in a coming post, when we come to explain avr-dude. Anyway make sure that both list items are ticked and proceed to the next form.
Choose your microcontroller type and its clock frequency (this is similar to #define F_CPU 8000000UL) in WINAVR.
In the “Project Explorer” tab right click on your project and choose “New > Source File” from the pop up menu. Similar way you can add a header file or C class file. Type in the file name and you must type the file’s extension witch is “.c” in this case.
Write in your code ,note that if you press “ctrl” + ”space” the IDE can suggest to you thing to write .Also there is some useful tab under the work space tab from these tabs you can see what are the supported register , ports and interrupts for you MCU.
To compile your code you’ll need to save your work because eclipse will not save it for you. Then click on the small arrow near the hammer icon in the tools bar and choose “Debug” .The errors will be displayed in the problems tab and so the warnings . This will generate new folder in the project explorer bar called Debug. If you browse the folder you will notice that the hex file is not there yet, that’s because we haven’t built the project yet. To build the project tick on “Release” from the same menu you clicked debug and new folder will be add to the project explorer called release and the contains the “.hex” file .