Questions and Answers
Which of the following is NOT an operand location for an AVR instruction?
An AVR instruction can only be one word long.
False
What is the first field of an AVR instruction called?
opcode
The addressing modes of a machine are the various ways used by its instructions to access different _______ that are to be processed.
Signup and view all the answers
Match the following AVR addressing modes with their descriptions:
Signup and view all the answers
Which instruction is an example of Relative Program Addressing?
Signup and view all the answers
The instruction 'IN R25,$16' is classified under Immediate-Register pair Mode.
Signup and view all the answers
What does the instruction 'ADIW R25:R24, 20' accomplish?
Signup and view all the answers
The instruction to load a value directly from data space is called __________.
Signup and view all the answers
Match the addressing modes to their examples:
Signup and view all the answers
Study Notes
Addressing Modes Overview
- Addressing modes define how instructions access operands in a machine.
- Instructions sharing the same addressing mode exhibit: consistent length, binary syntax, number of fields, and fetch & execution cycles.
Operand Locations
- AVR instruction operands can be located in:
- Register file
- I/O Memory
- SRAM
- Program memory (Flash)
AVR Instruction Format
- AVR instructions are either one word (16 bits) or two words (32 bits).
- The first field is always the opcode; additional fields (operands) depend on the addressing mode.
Instruction Format Types
- Format 1: Opcode only (6 bits).
- Format 2: One word (16 bits) or two words (32 bits).
- Format 3: One word (16 bits) or two words (32 bits).
AVR Addressing Modes
- Register Direct: Involves 1 or 2 registers.
- Immediate Mode: Loads immediate values into registers.
- I/O Direct: Accesses I/O memory locations directly.
- Data Direct: Direct data space access (LDS, STS).
-
Data Indirect: Accesses data via pointers:
- Pre-decrement mode
- Post-increment mode
- Code Memory Addressing: Access to program memory.
- Indirect Program Addressing: Includes IJMP and ICALL.
- Relative Program Addressing: RJMP and RCALL, where offsets range from -2K to 2K.
Examples of Addressing Modes
-
Register Direct:
- MOVW R17:R16, R1:R0
-
Immediate-Single Register Mode:
- LDI R16, 78
- ANI R31, $F0
-
Immediate-Register Pair Mode:
- ADIW R25:R24, 20
- SBIW R31:R30, $F0
-
I/O Direct:
- IN R25, $16 (PIN B address)
- OUT $18, R16 (PORT B address)
-
Data Direct:
- LDS R16, 0x1000
- Data Indirect: Uses Rd/Rr options for flexible data referencing.
-
Program Memory Addressing:
- LPM R3, Z
-
Indirect Program Addressing Examples:
- IJMP, ICALL
-
Relative Program Addressing Examples:
- RJMP, RCALL
Assignment Note
- Explore the addressing mode for each of the 132 AVR instructions based on the instruction set summary.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Description
Explore the fundamentals of AVR addressing modes and instruction format in this quiz. Learn about the different types of addressing modes and their significance in accessing operands. Perfect for students aiming to deepen their understanding of microcontroller programming.