Quiz 3 Study Guide
While I always hope to cover all the material and examples in the lecture material, I typically run out of time before material. Here are some of the lectures where you can find problems and examples you can work on at home.
- Lecture 01 to 09 Programming and Lab Basics (Load-Store, SREG, Branching and Looping, Subroutines, GPIO)
- Lectures 10 to 12 Interrupts , for example lecture 11 page 15 “Practice Problems”
- Lecture 13 AVR Indirect Addressing Modes – pages 11 and 16 Program Examples
- Lecture 14 AVR Logic and Shift – Page 5 Knight Rider, examples in slides, and Questions page 14
- Lecture 15 AVR Stack Operations – Review example on page 6
You can find review question in the AVR Final Review document under the corresponding lecture headings.
Lecture 01 to 09 Programming and Lab Basics
- Given two numbers, calculate the difference, signed and unsigned relationship.
- For a given arithmetic operation (add or subtract) define the state of SREG bits H, S, V, N, Z, C.
- Know how to simulate a call to ReadSwitches.
- Know how to save and restore the Status Register (SREG)
- Know the methods for sending information to and from a subroutine.
- Be prepared to write a program to send data to and receive data from a subroutine. Specifically, in a register or one of the SREG bits. Your program will not be required to implement a stack frame.
- Be able to identify code which violates one or more of the rules for working with a subroutine or an interrupt service routine. For example the code jumps out of a subroutine, a push is not matched to a pop instruction, or a ret instruction is used to end an ISR.
Lecture 10 to 12 – Interrupts
- Understand how an ISR is different from and similar to a subroutine.
- Be able to locate interrupts within the Interrupt Vector Table (IVT) and the priority of each.
- Know how to configure an interrupt to be triggered based on the nature of the input signal (low logic level, logic change, falling or rising edge.
- Know how to enable a given external interrupt(s). This external interrupt(s) might be one of our two dedicated external interrupt lines or one or more of our pin-change interrupt lines.
- Know what happens when an interrupt is triggered and what if any registers are placed on the stack.
- Given our ground bounce (low-pass filter) circuit be able to generate the output for a given clock a button input condition.
Lecture 13 – Indirect Addressing Mode
- What does defining a table actually do? Does it give addresses for constants that already exist in program memory or does it do something else?
- What is an index and why is it used?
- If the least significant bit selects whether ZL or ZH is used, is one of them (ZL or ZH) a 7 bit register?
- Do the mnemonics “low” and “high” automatically correspond to the low and high bytes of the Z-register?
- Specifically for lab 10, why is the index equal to 20*row+col?
- What register pair is found in the source operand address field of an lpm instruction?
- What register numbers correspond to pre-defined mnemonics ZH:ZL?
Lecture 14 – Indirect Addressing Mode
- Be able to clear, set, and toggle bits, including setting a bit pattern (see page 12)
- Know how to test if one or more bits are set or cleared.
- Understand multiplication and division by 2 using shift instructions.
Lecture 15 – AVR Stack Operations
- Understand the difference between the difference between a LIFO and a FIFO stack
- Understand the difference between an implicit and explicit stack operation.
- Given the address of an rcall instruction, the address where the called subroutine begins, and the value of the stack pointer before the call; be prepared to calculate what the stack pointer will be equal to after the call instruction; at the beginning of the subroutine and the contents of the stack.
- Be able to identify the code within a subroutine that will result in stack incoherence or a poorly formed series of pushes and pops.