Atmel AVR instruction set

Atmel AVR instruction set

Here is the basic Atmel AVR instruction set.

Arithmetic operations work on registers R0-R31 but not directly on RAM and take one clock cycle, except for multiplication and word-wide addition (ADIW and SBIW) which take two cycles.

RAM and I/O space can be accessed only by copying to or from registers. Indirect access (including optional postincrement, predecrement or constant displacement) is possible through registers X, Y, and Z. All accesses to RAM takes two clock cycles. Moving between registers and I/O is one cycle. Moving eight or sixteen bit data between registers or constant to register is also one cycle. Reading program memory (LPM) takes three cycles.

There are two types of conditional branches: jumps to address and skips. Conditional branches (BRxx) can test an ALU flag and jump to specified address. Skips (SBxx) test an arbitrary bit in a register or I/O and skip the next instruction if the test was true.

AVR instruction set
Arithmetic Bit & Others Transfer Jump Branch Call
ADD Rd, Rr
ADC Rd, Rr
ADIW Rd+1:Rd, K6

SUB Rd, Rr
SUBI Rd, K8
SBC Rd, Rr
SBCI Rd, K8
SBIW Rd+1:Rd, K6

INC Rd
DEC Rd

AND Rd, Rr
ANDI Rd, K8
OR Rd, Rr
ORI Rd, K8
EOR Rd, Rr

COM Rd
NEG Rd
CP Rd, Rr
CPC Rd, Rr
CPI Rd, K8
SWAP Rd

LSR Rd
ROR Rd
ASR Rd

MUL Rd, Rr
MULS Rd, Rr
MULSU Rd, Rr
FMUL Rd, Rr
FMULS Rd, Rr
FMULSU Rd, Rr

BSET s
BCLR s
SBI A, b
CBI A, b
BST Rd, b
BLD Rd, b

NOP
BREAK
SLEEP
WDR

MOV Rd, Rr
MOVW Rd+1:Rd, Rr+1:Rr

IN Rd, A
OUT A, Rr

PUSH Rr
POP Rr

LDI Rd, K8
LDS Rd, K16

LD Rd, X
LD Rd, -X
LD Rd, X+

LDD Rd, Y+K6
LD Rd, -Y
LD Rd, Y+

LDD Rd, Z+K6
LD Rd, -Z
LD Rd, Z+

STS K16, Rr

ST X, Rr
ST -X, Rr
ST X+, Rr

STD Y+K6, Rr
ST -Y, Rr
ST Y+, Rr

STD Z+K6, Rr
ST -Z, Rr
ST Z+, Rr

LPM
LPM Rd, Z
LPM Rd, Z+
ELPM
ELPM Rd, Z
ELPM Rd, Z+

SPM

RJMP K12
IJMP
EIJMP
JMP K22

CPSE Rd, Rr

SBRC Rr, b
SBRS Rr, b

SBIC A, b
SBIS A, b

BRBC s, K7
BRBS s, K7

RCALL K12
ICALL
EICALL
CALL K22

RET
RETI

Instruction set inheritance

Not all instructions are implemented in all AVR controllers. This is the case of the instructions performing multiplications, extended loads/jumps/calls, long jumps, and power control.

See also

* Atmel AVR

External links

* [http://users.rcn.com/rneswold/avr/ GNU Development Environment]
** [http://www.linuxfocus.org/English/November2004/article352.shtml Programming the AVR microcontroller with GCC] by Guido Socher
** [http://users.rcn.com/rneswold/avr/ A GNU Development Environment for the AVR Microcontroller] by Rich Neswold
** [http://gcc.gnu.org/onlinedocs/gcc-3.3.5/gcc/AVR-Options.html AVR Options] in GCC-AVR
* [http://www.atmel.com/dyn/resources/prod_documents/DOC0856.PDF Atmel AVR instruction set PDF(149 pages)]


Wikimedia Foundation. 2010.

Игры ⚽ Нужно решить контрольную?

Look at other dictionaries:

  • Atmel AVR — AVR logo. Atmel AVR ATmega8 in 28 pin DIP . The AVR is a …   Wikipedia

  • Instruction set — An instruction set, or instruction set architecture (ISA), is the part of the computer architecture related to programming, including the native data types, instructions, registers, addressing modes, memory architecture, interrupt and exception… …   Wikipedia

  • Reduced Instruction Set Computing — (RISC) (engl. für Rechnen mit reduziertem Befehlssatz) ist eine bestimmte Designphilosophie für Prozessoren. Es steht im Gegensatz zum CISC Prozessor Design. Inhaltsverzeichnis 1 Konsequenzen des RISC Befehlssatzes 2 Geschichte 3 Eigenschaften …   Deutsch Wikipedia

  • Reduced instruction set computer — The acronym RISC (pronounced risk ), for reduced instruction set computing, represents a CPU design strategy emphasizing the insight that simplified instructions which do less may still provide for higher performance if this simplicity can be… …   Wikipedia

  • Reduced Instruction Set Computer — (RISC) (engl. für Rechner mit reduziertem Befehlssatz) ist eine Designphilosophie für Computerprozessoren, die einfache Maschinenbefehle bevorzugt. Der Begriff wurde 1980 von David A. Patterson und Carlo H. Séquin geprägt.[1] Die Beschränkung auf …   Deutsch Wikipedia

  • Atmel AT89 series — The Atmel AT89 series is an Intel 8051 compatible family of 8 bit microcontrollers (µCs) manufactured by the Atmel Corporation.Based on the Intel 8051 core, the AT89 series remains very popular as general purpose microcontrollers, due to their… …   Wikipedia

  • Instruction pipeline — Pipelining redirects here. For HTTP pipelining, see HTTP pipelining. Basic five stage pipeline in a RISC machine (IF = Instruction Fetch, ID = Instruction Decode, EX = Execute, MEM = Memory access, WB = Register write back). In the fourth clock… …   Wikipedia

  • Rabbit Semiconductor — is the company which designs and sells the Rabbit family of microcontrollers and microcontroller modules.For development, it provides Dynamic C, a limited, largely incompatible dialect of C with proprietary structures for multitasking.Rabbit… …   Wikipedia

  • AVR32 — The AVR32 is a 32 bit RISC microprocessor architecture designed by Atmel. The microprocessor architecture was designed by a handful of people educated at the Norwegian University of Science and Technology, including lead designer Øyvind Strøm,… …   Wikipedia

  • Atmega32 — ATtiny, ATmega und ATXmega Mikrocontroller Atmel AVR ist eine 8 Bit Mikrocontroller Familie des US amerikanischen Herstellers Atmel. Die Controller dieser Familie sind wegen ihres einfachen Aufbaus und ihrer leichten Programmierbarkeit auch bei… …   Deutsch Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”