9
\$\begingroup\$

I have a ATmega32 board laying around and I figure it would be perfect to start off with microcontrollers. I once did some babbling in embedded C (thats when I got this board) but the flow was stopped due to some things. Now I have two questions:

  1. What is the best free resource to start off with C for the avr series. I know of AVR-GCC but was looking for some tutorials or free books to start me off.

  2. Should I directly jump to C or go through ASM first? I see there are many asm books around. So what is a better option?

While searching the Internet, I found the Arduino bootloader for ATmega32 here http://retrointerfacing.com/?p=30 but the problem is I a hesitant to do some tinkering with the fuse bits and all. Is it safe to do so?

\$\endgroup\$

5 Answers 5

5
\$\begingroup\$

Join AVR Freaks. You'll find lots of resources and help if you get stuck.

\$\endgroup\$
6
\$\begingroup\$

The avr-libc documentation is a great source of information for C on AVRs. Here's another one.

Personally, I prefer working in C. Making use of avr-libc gives you good code portability within the AVR family. However, if you're doing anything timing critical, you may have to resort to ASM.

If you have a parallel or "high voltage" AVR programmer then you can always reprogram the fuse bits. If you're using serial (In-System-Programming, ISP) then be careful not to disable the SPIEN or RESETENABLE bits as these will prevent you from being able to reprogram.

There's an Arduino HV programming shield available.

\$\endgroup\$
4
\$\begingroup\$

I would start off with C. You may need an occasional snippet of ASM but for most applications that would be about it. The exception would be a bootloader if you decide to roll your own.

Dave Mellis put an AVR tutorial up on the MIT HLT wiki. He discusses setting up the tools for the ATmega328 but it seems generic enough to help you with different devices. See

http://hlt.media.mit.edu/wiki/index.php/AVR_Programming

The libraries and examples at the Atmel site seem to be good. I have used a number of snippets from their app-notes. The I2C (TWI) library I use in my RTC code comes from the Atmel site.

\$\endgroup\$
3
\$\begingroup\$

I would go with Arduino first. Lots of books, tutorials and example code. And a great and nice community. Then if you are familiar with Arduino, try out C with AVR-GCC.

I can not recommend ASM these days. There maybe some corners where you may have to use ASM but most things can be solved with plain C. With ASM you can learn some very details about how a microcontroller is working, but if you want to make things happen faster, I would stick to C or C++.

\$\endgroup\$
2
  • \$\begingroup\$ problem is its very hard to obtain an arduino where I live. I am planning to make one for my own but that too is not working out (read don't have time). \$\endgroup\$
    – Rick_2047
    Commented Mar 24, 2010 at 8:13
  • \$\begingroup\$ if you have the ability to program the chip, then you can load the Arduino firmware on it, then use the serial link + bootloader for subsequent work. \$\endgroup\$
    – gallamine
    Commented Jan 27, 2011 at 21:09
0
\$\begingroup\$

You can start off from C programming for microcontrollers by Joe Pardue. Use AVRStudio5 and stick to http://avrfreaks.net ,you can get a lot of cool and helpful guys here.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.