Author Topic: AVR assembly question  (Read 1828 times)

0 Members and 1 Guest are viewing this topic.

Offline benjiTopic starter

  • Supreme Robot
  • *****
  • Posts: 832
  • Helpful? 0
AVR assembly question
« 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
good ol' BeNNy

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: AVR assembly question
« Reply #1 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 . . .

Offline izua

  • Supreme Robot
  • *****
  • Posts: 682
  • Helpful? 0
Re: AVR assembly question
« Reply #2 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
Check out my homepage for in depth tutorials on microcontrollers and electronics.

Offline benjiTopic starter

  • Supreme Robot
  • *****
  • Posts: 832
  • Helpful? 0
Re: AVR assembly question
« Reply #3 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?
good ol' BeNNy

Offline izua

  • Supreme Robot
  • *****
  • Posts: 682
  • Helpful? 0
Re: AVR assembly question
« Reply #4 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
Check out my homepage for in depth tutorials on microcontrollers and electronics.

 


Get Your Ad Here