Definitions of AVR INSTRUCTIONS
**1. Register Operations:**
* **Set:** Instructions like `CLR` and `SER` set specific bits to 1 in a register.
* **Copy:** Instructions like `MOV`, `LDS`, and `LD` move data from one register or memory location to another.
* **Store:** Instructions like `STS` and `ST` save data from a register to memory.
**2. Arithmetic Operations:**
* **Addition:** Instructions like `INC`, `ADD`, and `ADC` perform additions on data, with `ADC` handling carry bits.
* **Subtraction:** Instructions like `DEC`, `SUB`, and `SBC` perform subtractions on data, with `SBC` handling borrow bits.
**3. Shift and Rotate Operations:**
* **Shift:** Instructions like `LSL` and `LSR` shift data bits left or right by a specified number of positions.
* **Rotate:** Instructions like `ROL`, `ROR`, and `ASR` perform rotations on data, moving bits circularly within the register.
* **Nibble exchange:** `SWAP` exchanges the upper and lower 4-bit nibbles of a byte.
**4. Logical Operations:**
* **AND:** Instructions like `AND` and `ANDI` perform bitwise AND operations, leaving only bits set in both operands.
* **OR:** Instructions like `OR` and `ORI` perform bitwise OR operations, setting bits if either operand has them set.
* **Exclusive-Or:** `EOR` performs bitwise XOR operations, setting bits if only one operand has them set.
* **Ones-complement:** `COM` inverts all bits in the operand.
* **Twos-complement:** `NEG` takes the two's complement of the operand (negative equivalent).
**5. Bit Operations:**
* **Change:** Instructions like `SBR`, `CBR`, and `BST` set, clear, or test individual bits within a register or memory location.
**6. Status Bit Operations:**
* **Set:** Instructions like `SEZ` and `SEC` set specific flag bits in the Status Register (SREG) based on conditions.
* **Clear:** Instructions like `CLZ` and `CLC` clear specific flag bits in SREG.
**7. Comparison Operations:**
* **CP, CPC, CPI:** Compare data values without affecting the operands or flags.
* **TST:** Tests data value without affecting flags, useful for checking non-zero conditions.
**8. Control Transfer Operations:**
* **Unconditional Jump:** Instructions like `RJMP` and `JMP` immediately transfer program execution to another address.
* **Subroutine Call:** Instructions like `RCALL` and `CALL` jump to a subroutine and save the return address for later.
* **Return:** Instructions like `RET` and `RETI` return from a subroutine to the calling program.
* **Conditional Branch:** Instructions like `BRBS` and `BRCC` jump based on specific conditions like zero flag state or carry flag value.
* **Skip:** Instructions like `SBRC` and `SBIS` skip the next instruction if a specific bit condition is met.
**9. Miscellaneous Operations:**
* **No Operation:** `NOP` performs no operation, useful for timing delays or instruction alignment.
* **Sleep:** `SLEEP` puts the microcontroller into a low-power state until an interrupt wakes it.
* **Watchdog Reset:** `WDR` resets the microcontroller if the watchdog timer reaches its limit.
This detailed classification with definitions should provide a solid foundation for
understanding the diverse functionalities of AVR instructions and their applications in assembly programming.
Comments
Post a Comment