AVR Instruction Set |
|
Here you can find the basic Atmel AVR instruction set. A more comprehensive document for 8-bit AVR instruction set in PDF format can be found here.
The AVR instruction set is more orthogonal than most eight-bit microcontrollers, in particular the PIC microcontrollers with which AVR competes today. 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. The mostly-regular instruction set makes programming it using C (or even Pascal) compilers pretty straightforward.
The data address space consists of the register file, I/O registers, and SRAM. The AVRs have 32 single-byte registers and are classified as 8-bit RISC devices.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: skips and jumps to address. Skips (SBxx) test an arbitrary bit in a register or I/O and skip the next instruction if the test was true. Conditional branches (BRxx) can test an ALU flag and jump to specified address.
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.
|