AVR Help

I recently bought an Atmel AVR and I have been looking around for some help, especially at avrfreaks.net and their forums. But I need some help getting started with it because I am no programmer YET.

  1. I do not even know how to load code in either C or ASM form.
  2. I do not know how to write code.
  3. I do not know how to use winavr and avrstudio.

Help with #1 would be especially appreciated


There are a couple of robotic kits that i have worked with recently that use Atmel products. What is handy is that they both come with test programs as well as the software you need to modify and load them into the processor. It makes them quite easy to use and offers a great learning opportunity. The kits are Asuro and Crash Bobby, both of which are advertised in SERVO magazine as well as being the subject of a couple of tweak articles in past issues.

Have fun!


Which AVR chip are you using? Do you have a bare chip, or is it on some sort of robot controller board? Which programmer do you have?

If you’re using the ATMega16 or ATMega32, you may find the docs and sample code for the SRS Workshop Robot useful:


You’ll have to modify the source code to adjust which pins/registers are used for which function (unless you’re using Larry Barello’s ARC board) but the code starts out with very basic stuff which should be enough to get started and customize.

If you’re using another AVR chip, the basic idea is the same, but the names of the registers used for input and output may change significantly.

I finally got the AVR working and to be programmabled. all it took was an hour on the phone with tech support!

Now I just need to find where to how to program it in C. Things like defining the outputs and just simple C so i can play around with it. Does anyone know where to find how to define the outputs in C code?

For example can I just say portB = 0b00001101?

In the board right now I have an atmega8515

PORTB actually, C is case sensitive, also don’t forget the semi-colons (:wink: at the end, and you’re good.

Also read up on your Data Direction Registers and to read pin states (when set to input) use PINB (or PINA…PIND…etc) as in
if(PINB == 0b10110000)
do stuff

Have fun, good luck.