Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top