Coding AVRs with C?

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hi - I've done a small bit of coding on AVRs with AVR assembler. I've done
enough that I can get a circuit to flash, a group of leds to count up, or
something else simple like that. But I'd really like to learn C for the
AVR. Does anybody have a suggestion for a good place to start? I have never
coded in C, so I need to start from the absolute basics. Thanks so much!

-Michael Noone

Re: Coding AVRs with C?
On Fri, 19 Nov 2004 18:53:35 GMT, Michael Noone

Quoted text here. Click to load it

Are you already familiar with C?  If not, get a good reference like
Kernighan and Ritchie or Harbison and Steele.  If you are, look at
more advanced books like van der Linden's "Expert C Programming" and
Heathfield et. al "C Unleashed" (which, unlike some other "Unleashed"
books, is quite good).

Of course you'll need tools.  You don't say what platform you'll be
using, but avr-gcc is very good, and is probably hosted on your
system.  If you're on Windoze, WinAVR is a complete solution: avr-gcc,
gdb, insight, chip programmer, editor/ide.

CodeVisionAVR makes programming AVRs in C almost trivial.  Available
in the U.S. from Programming resources (www.prllc.com).  There's also
a book, Embedded C Programming and the Atmel AVR by Barnett et. al.
that makes use of this tool.  I've heard it's pretty good, but I've
never looked at it myself.  CVAVR is $150 for the standard edition,
$90 for the "Light" edition (does not support ATmega parts), a free
evaluation download (http://www.hpinfotech.ro/cvavre.zip ), well
supported, and easy to use.  The book is about $68 from prllc, which
is few dollars cheaper than Amazon.

More expensive options are available, e.g., from IAR.  Also look at
www.avrfreaks.com if you can stand the slow, ugly web interface.

HTH,

                               -=Dave
--
Change is inevitable, progress is not.

Re: Coding AVRs with C?
snipped-for-privacy@hotmail.com (Dave Hansen) wrote in

Quoted text here. Click to load it

Nope - I don't know C at all. I was hoping to learn C through AVR
programming, instead of first learning C on a computer and then moving
to AVRs. I'm on a Windows XP system, but if needs be I can install a
linux distro. WinAVR looks quite nice though. Oh, if it matters at all I
use an Atmel AVRISP in combination with AVR Studio on my xp system.
Currently my AVR of choice is the AT90S8515, though I've been eyeing the
ATMEGA32... It looks mighty sexy... Thanks,

Michael

Re: Coding AVRs with C?
On Fri, 19 Nov 2004 20:45:52 GMT, Michael Noone

[...]
Quoted text here. Click to load it

If you're comfortable in assembler, or with using pointers in any
other language, I'd still suggest getting K&R.  It's an easy read and
doesn't talk down to you.  Most of C isn't platform specific, and most
of the book will apply to the AVR as much as anything else.

The Barnett et. al. book might be a quicker way in, since it's
specific to the AVR.  I've heard good things about it, but I haven't
looked at it myself.  And CVAVR makes it really (really) easy.

Quoted text here. Click to load it

I'm more familiar with Windoze tools anyway.  WinAVR, CVAVR, and IAR
are all Windoze development host systems.  As is AVR Studio.

Quoted text here. Click to load it

I think the AT90S8515 is (or is about to be) obsolete -- I know the
AT90S8535 has been replaced by the ATmega8535.

Quoted text here. Click to load it

It's a nice part, but... sexy?  You need to get out more often.  ;-)

I've been using the ATmega16 for most things lately.  Basically a
mega32 with less memory.  You can get an awful lot done in 16k on an
AVR, even when writing in C...

Regards,

                               -=Dave
--
Change is inevitable, progress is not.

Re: Coding AVRs with C?
Quoted text here. Click to load it

It is far more easy to learn C in a PC environment. Go and see if you can
buy or download a cheap or free Turbo C version 3 or so. Then you can write
in C, compile, run and debug on a friendly platform.

If you want to start learing C on an embedded processor, you effectively
have to learn two things at once: learn C and learn to start the code
running on an embedded processor.

Quoted text here. Click to load it

The AT90S8515 is obsolete for some time already.

Meindert



Re: Coding AVRs with C?
Quoted text here. Click to load it
write

I think if He wants to program C for the AVR in the end, then it
may save some time learning the AVR specific things,
and run with the AVR Simulator.

Quoted text here. Click to load it



But there is the ATmega8515 replacement.which should work as well.

--
Best Regards
Ulf at atmel dot com
We've slightly trimmed the long signature. Click to see the full one.
Re: Coding AVRs with C?
On Fri, 19 Nov 2004 18:53:35 GMT, Michael Noone

Quoted text here. Click to load it

Start out on www.avrfreaks.net by this

http://www.avrfreaks.net/phpBB2/viewtopic.php?t22%514

Then go to the avr beginners site referenced there , then have a look
at the free GCC C compiler called WinAvr (referenced in above link)

Carsten


Re: Coding AVRs with C?

Quoted text here. Click to load it

For the unwary, I'd recommend a Pascal http://www.e-lab.de
or a basic (.. google )
And if a C, then perhaps http://www.imagecraft.com

Rene
--
Ing.Buero R.Tschaggelar - http://www.ibrtses.com
& commercial newsgroups - http://www.talkto.net

Site Timeline