Society of Robots - Robot Forum

Software => Software => Topic started by: benji on April 06, 2008, 09:50:42 AM

Title: AVR assembly question
Post by: benji on April 06, 2008, 09:50:42 AM
im doing some avr assembly coding for interfacing an optical mouse sensor
i chose assembly simply because i want to know whats going on every single cycle.
in the atmega8 datasheet it says you can use the R registers , R0 >>>> R32
while using R0>>R15 it doesnt recognize it, so im using R16 >>>R32
why is that?
also in the datasheet when examples are provided they are using R16 and not R0
there should be a reason for that? any idea?

another question about avr studio 4
when i press the build button it doesnt build it and it writes (error excuting)
i changed the code and still the same
then i wrote one operation in the code and the same happened  :-\

help
Title: Re: AVR assembly question
Post by: Admin on April 06, 2008, 11:49:25 AM
Stupid check: When you start a project in AVR Studio, you have to tell it to use the Assembler and not the GNU compiler . . .
Title: Re: AVR assembly question
Post by: izua on April 06, 2008, 12:40:02 PM
registers 0 to 15 have a few limitations to the operations that can be performed on them.
you can't use ldi for example
Title: Re: AVR assembly question
Post by: benji on April 06, 2008, 03:48:46 PM
Quote
Stupid check: When you start a project in AVR Studio, you have to tell it to use the Assembler and not the GNU compiler . . .
,, im using the assembler  ,,Stupid  ;D

Quote
registers 0 to 15 have a few limitations to the operations that can be performed on them.
you can't use ldi for example

thanks for the info,, is this mentioned somewhere in the datasheet?
Title: Re: AVR assembly question
Post by: izua on April 06, 2008, 05:29:29 PM
i'm not sure.
it's because of the instruction size, they had to crunch in many instructions, a tradeoff for parameter size

check out this tutorial for more info: http://www.avr-asm-tutorial.net/avr_en/beginner/REGISTER.html#Unterschied