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?
 

ciitv

Junior Member level 2
Joined
Dec 7, 2005
Messages
21
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,463
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
 

silvio

Advanced Member level 3
Joined
Dec 31, 2001
Messages
715
Helped
105
Reputation
210
Reaction score
16
Trophy points
1,298
Location
Romania
Activity points
11,468
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.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top