Society of Robots - Robot Forum

General Misc => Misc => Topic started by: LXE on September 08, 2010, 08:15:53 AM

Title: I want to learn AVR Assembler.
Post by: LXE on September 08, 2010, 08:15:53 AM
Hello, I'm new around here because I've been to another website community and got banned for no reason at all.
So I've decided to come here to SOR, Pleased to meet you!  ;D

I'm not going to say which community, because it's a well known one and I highly respect it so therefore it's rude to point the finger.

So I want to learn how to program AVR chips in AVR Assembler, and I would like to know where to find good sources of information.

I know you need a programmer and AVR-ISP, STK600 or something like that and I've got experience with the Arduino as well.
So please help me!
Title: Re: I want to learn AVR Assembler.
Post by: garrettg84 on September 08, 2010, 09:07:22 AM
So I want to learn how to program AVR chips in AVR Assembler, and I would like to know where to find good sources of information.
Good luck! Here's a link:
http://www.avr-asm-tutorial.net/avr_en/index.html (http://www.avr-asm-tutorial.net/avr_en/index.html)
Any reason you've chosen assembly and not C? I use AVR Studio 4 by the way. It has the ability to compile C and ASM.

I know you need a programmer and AVR-ISP, STK600 or something like that and I've got experience with the Arduino as well.
So please help me!

You said you have experience with Arduino, if you actually HAVE an Arduino, you may not need a programmer.
http://code.google.com/p/mega-isp/wiki/AvrispArduino (http://code.google.com/p/mega-isp/wiki/AvrispArduino)

I have an AVR-ISP and it works great. I haven't tried the above solution, but it should work fine.
Title: Re: I want to learn AVR Assembler.
Post by: LXE on September 08, 2010, 06:44:51 PM
Don't worry, I do have one. It's a NICTA ed1 board which is Arduino Duemilanove compatible and most of the I/O have been taken up leaving the serial connection and two analog I/O. I'm planning on getting a new AVR microcontroller and hence I want to learn AVR assembler.
If I learn AVR assembler, I'll have more options of chips to work with.

And please don't assume that newcomers don't know anything, I've been on my previous Robot community more then long enough to know the difference between an AVR and an Arduino.
Title: Re: I want to learn AVR Assembler.
Post by: Soeren on September 09, 2010, 06:32:21 AM
Hi,

If I learn AVR assembler, I'll have more options of chips to work with.
Au contraire.
Using assembler, you are bound to a certain core, with a high level language, you can recompile code for "any" core (perhaps with small adjustments).


And please don't assume that newcomers don't know anything, I've been on my previous Robot community more then long enough to know the difference between an AVR and an Arduino.
Well, an Arduino is a board driven by an AVR controller, so I don't see the relevance in that comparison (it's like saying "I know the difference between a car and a car engine"). Had you stayed a bit longer on that other board, you would have known the assembler/high level language thing too.

I'd advice a bit of Googling and reading, then you can ask informed questions, showing that you did your own foot work, instead of just expecting others to do it.
Title: Re: I want to learn AVR Assembler.
Post by: LXE on September 09, 2010, 08:11:18 AM
AVR is the car and Arduino is the engine to make it run faster.

Well, I want to learn it because it does expand my options. Which means, I can also program non- Arduino compatible AVR chips as well.

Attiny, and Xmega aren't Arduino compatible you know.
Title: Re: I want to learn AVR Assembler.
Post by: amando96 on September 09, 2010, 08:24:11 AM
Quote
Arduino is the engine to make it run faster.

Actually no, the arduino really slows down processing speed, the digitalWrite() function takes like 121(?) (http://www.billporter.info/?p=308) clock cycles to change the pin state. which I quite a lot.

Quote
don't assume that newcomers don't know anything

Never saw such an assumption, just a user being nice and helpful.

I recommend learning C, I learned ASM for PICs, but it takes a while to get used to, and more complicated code is hell in ASM, in C it's much easier, especially with arduino background.
Title: Re: I want to learn AVR Assembler.
Post by: LXE on September 09, 2010, 08:41:14 AM
OMG Is that you amando96 from LMR?
Title: Re: I want to learn AVR Assembler.
Post by: z.s.tar.gz on September 09, 2010, 11:14:55 AM
OMG is that the stupidest comment ever on SoR? (sadly it's not...)

Seriously though asm is a good thing to learn. Not because it's an easy or efficient to program in language (because it's not) but because you learn how the controller works.

In tune with your car analogies, it's like taking off everything but the driver's seat, frame, and engine and driving around. It isn't exactly fun or practical for the long term but you get to see all the moving parts.
Title: Re: I want to learn AVR Assembler.
Post by: Ro-Bot-X on September 09, 2010, 03:20:20 PM
In tune with your car analogies, it's like taking off everything but the driver's seat, frame, and engine and driving around. It isn't exactly fun or practical for the long term but you get to see all the moving parts.

Nicely said!
Title: Re: I want to learn AVR Assembler.
Post by: Webbot on September 09, 2010, 05:48:00 PM
Assembler is hard to learn, hard to write, and a pain to debug! Portability of assembler is non-existent and can result in spectacular system crashes!

But having said that: it does run fast if written properly (or slow if written badly!). So can be of use in time critical sections of code.

So its a question of whether you are able to write better assembler than the optimising compiler generates for your C code.

In most conditions then the answer is: just use C.

I've got many decades of assembler experience (over a large selection of cpus) under my belt and when viewing the code from a decent C compiler then its often hard to know how to do it better.


Title: Re: I want to learn AVR Assembler.
Post by: garrettg84 on September 09, 2010, 07:50:50 PM
Don't worry, I do have one. It's a NICTA ed1 board which is Arduino Duemilanove compatible and most of the I/O have been taken up leaving the serial connection and two analog I/O. I'm planning on getting a new AVR microcontroller and hence I want to learn AVR assembler.
If I learn AVR assembler, I'll have more options of chips to work with.

And please don't assume that newcomers don't know anything, I've been on my previous Robot community more then long enough to know the difference between an AVR and an Arduino.

I wasn't meaning to offend, just pointing you in the best direction I could with your post info. I make no assumptions on anyone's skills. Good luck on your adventure.

There is ZERO difference between AVR and Arduino. Arduino is a simple implementation of an AVR chip with the added benefit of an integrated development environment, a boot loader for USB/Serial ISP, a common library, and a common hardware pin out design. You can program a naked AVR chip from the Arduino IDE, just the same as you can program an Arduino from AVR Studio.