Professional Documents
Culture Documents
2
AVR Registers
3
AVR Registers
General purpose registers
The following register pairs can work as
address indexes
X, R26:R27
Y, R28:R29
Z, R31:R31
Bit 7 6 5 4 3 2 1 0
Bit 7 6 5 4 3 2 1 0
Bit 7 6 5 4 3 2 1 0
Bit 7 6 5 4 3 2 1 0
Bit 7 6 5 4 3 2 1 0
Bit 7 6 5 4 3 2 1 0
16
EEPROM Memory Space
Covers Data EEPROM Memory
8-bit EEPROM 0x0000
memory
Use to permanently EEPROM Memory
store large set of data (64~4K bytes)
Can be accessed
using load and store 8 bits
instructions with
special control bit
settings
End address
Not covered in this
course 17
AVR Instruction Format
For AVR, almost all instructions are 16 bits
long
add Rd, Rr
sub Rd, Rr
mul Rd, Rr
brge k
Few instructions are 32 bits long
lds Rd, k ( 0 k 65535 )
loads 1 byte from the SRAM to a register.
18
AL Instructions
Arithmetic Logic
addition E.g. AND Rd, Rr
E.g. ADD Rd, Rr Shift
Subtraction E.g. LSL Rd
E.g. SUB Rd, Rr
Increment/decrement
E.g INC Rd
Multiplication
E.g. MUL Rd, Rr
17
Transfer Instructions
Memory
GP register
E.g. MOV Rd, Rr Data memory
E.g. LD Rd, X ST X, Rr
I/O registers
Program memory
E.g. IN Rd, PORTA
E.g. LPM
OUT PORTB, Rr
EEPROM memory
Stack Not covered in this
PUSH Rr course
POP Rd
Immediate values
E.g. LDI Rd, K8
18
Program
Branch
Control Instructions
Call subroutine
20
Juego de instrucciones: Aritmticas y
lgicas
21
Juego de instrucciones: Aritmticas y
lgicas
- Resta aritmtica
- Sin acarreo
- Con dato inmediato
- Con acarreo
- Con dato inmediato y acarreo
- Con dato inmediato y con registros de
16 bits.
22
Juego de instrucciones: Aritmticas y
lgicas
- Comparacin
- 2 registros sin acarreo
- 1 registro con dato
inmediato
- 2 registros con acarreo
- INCrementa y
DECrementa
23
Juego de instrucciones: Aritmticas y
lgicas
-NEG (Ca2)
24
Microcontrolador
AT90S2313
Juego de instrucciones: Aritmticas y
lgicas
- AN
D
- OR
- EOR
- CO
25
M
Bibliografa
http://www.atmel.com/images/Atmel-0856-AVR-
Instruction-Set-Manual.pdf
http://www.cse.unsw.edu.au/~cs2121/LectureNotes/we
ek4_notes.pdf
https://www.dte.us.es/tec_inf/itig/microele/docu/curso0
506/tema4/tema4_parte1_micro_0506.pdf
26