Question about the capability of r0-r15 AVR registers

Status
Not open for further replies.

nu_jhaa

Newbie level 4
Joined
Feb 3, 2006
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,313
HI all! is anybody know why r16-r28 can supply all of operations? and r0-r15 are't?
 

Re: AVR registers

even i've tried looking for this answer. but haven't found a logical one yet. most websites bring this point and end it there.
but i guess AVR designers tried to sqeeze in more instructions that occupy 1 word
 

Re: AVR registers

Even if you'll ever find the answer to this question, that would change your programming approach ?

Most of the AVR instruction have a single 16-bit word format.
As you probably notice, only 8 instructions suffers of the drawbacks of the AVR architecture.
These are : ANDI, CBR, SBR, SER, CPI, LDI, SBCI and SUBI.
More exactly when an immediate constant is involved in the operation with register.
Since the constant is stored on 8 bits (range 0 - 255) and 4 bits are reserved for operation code, from the 16-bit word format, there are only 4 bits left available for designed register.
Because with 4 bits you can have only 16 value, you can ask why the AVR designer choose the upper ones, r16-r31.
Well, the answer is because the r26-r31 are already used as indirect address pointers (alterable as well but in narrow range (0 - 63) with ADIW and SBIW).
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…