Allowed materials:
Atmel Reference
Guide(s)
2-sided note sheet
Calculator
Introduction and number systems
Microcontroller components
Name some subsystems found in a Microcontroller that are typically not found on a Microprocessor.
Name some subsystems found in both a Microcontroller as well as a Microprocessor.
State the purpose of the following computer parts: Program Counter, ALU, memory (SRAM, EEPROM, EEPROM/Flash/etc.), Ports, Registers
List the various types of memories on the Atmega32 and describe the purpose of each.
Programmer’s model (Registers)
Describe the Atmega32 register set (R0-R31, X, Y, Z, SP, PC, SREG, MCUCSR)
Addressing, Instruction Cycles
Write a simple program that uses various Atmega32 addressing modes for load/store (immediate, direct, indexed (X, Y, Z), both to Data and Program memory (load only for Program Memory). Keep in mind that LPM can only index the Z register, while LD/ST can index X, Y, or Z.
Calculate the cycle count and execution time for short instruction sequences (given the number of cycles per instruction).
Describe the difference in addressing between Program and Data memory.
Tools - Assembler & directives
Use the appropriate section (.CSEG, .DSEG, .ESEG) for code and various types of data.
Use .DEF and .EQU to assign aliases to registers and labels to memory addresses.
Use labels to define and refer to instruction and data addresses.
Be able to determine the address value assigned by the assembler to a label.
Reserve/allocate memory (initialized and uninitialized) of byte or word size apporpriately for Program Flash, SRAM, or EEPROM.
Instruction set
Use logical instructions (AND, OR, ANDI, ORI, SBR, SBI, CLI etc) instructions to implement bit manipulations.
State the basic SREG manipulations performed by bit, comparison, and arithmetic operations and be able to determine all such manipulations by referring to the Atmega32 instruction set summary.
Use the RJMP and RCALL instructions and explain the primary purpose of each.
Make appropriate use of conditional (signed, unsigned, etc.) branches.
Use the load/store, shift/rotate, increment/decrement, add/subtract, jump/branch, call/return instructions to implement short programs.
Analyze (determine memory and register (including SREG) contents) short assembly language programs.
Program, Data, and EEPROM Memory
Describe where (which memory) instruction code, non-volatile data, volatile data, and stack data is placed.
Explain the differences in addressing between Program (Flash) and Data (SRAM) Memory.
Explain the differences in how the contents of Program and Data Memory is retained during power cycle on the Atmega32.
Write the directives that allocate space in either Program or Data Memory.
Explain the difference between the directives for allocating space in Program vs. Data Memory.
Explain how values in Program memory is initialized vs. how values in Data memory are initialized.
Write a simple subroutine that retrieves values from both Program and Data memory. Be familiar with the instructions that use the "Z+" syntax for indexing.
Write a simple subroutine that writes values to Data memory.
Explain how values in EEPROM are read or written using the various EEPROM I/O registers (as opposed to dedicated instructions).
Subroutines and the Stack
Explain the difference between CALL/RCALL and JMP/RJMP, and how each is properly used.
Explain how the instructions CALL, RCALL, and RET are used and how they manipulate the stack.
Explain the instructions PUSH, POP, and how they manipulate the stack.
Write a simple assembly subroutine.
Write a simple assembly program that calls an assembly subroutine.
Given sample code, explain how the Stack is manipulated by various instructions such as RCALL, CALL, PUSH, POP, RETI, and RET.
Explain why the SREG should be pushed and popped from the stack during an ISR.
Interrupts
Explain the difference between polled and interrupt-driven systems
Explain the purpose of the interrupt vector table (Program memory 0x0 through 0x29).
Explain the purpose of having specific control registers associated with particular interrupts; explain in general what the special-purpose control registers are used for w.r.t External Interrupts, vs those used for ADC Interrupts.
Explain the function of the I bit in SREG vs. the function of specific enable bits in various interrupt control registers.
Exaplin the difference between the RETI instruction for returning from an ISR vs a RET instruction for returning from a normal subroutine.
Write a simple assembly interrupt service routine.
Write a simple assembly program that initializes the vector for a specific interrupt.
Given sample code, explain how the Stack is manipulated by an interrupt.
A/D conversion
Explain the purpose and capabilities of the A/D conversion subsystem on the Atmega32 microcontroller.
Explain how PortA on the Atmega32 can be used as both a pure digital I/O as well as an analog input port.
Given the spec for a particular control register, explain what the various bits within the control register do - ie. how they affect the operation of the ADC.
USART
Explain how a byte of data can be transmitted serially over a wire by sequentially modulating the voltage applied to the wire.
Explain the concept of serial data transmission speed: the time rate at which the voltage applied to the wire is modulated.
Explain how the serial data transmission of the bits comprising the data bytes can be augmented with start bits, stop bits, or parity bits.
Explain the purpose of parity bits, start bits, and stop bits.
Given the documentation for a particular control register, explain what the various bits within the control register do - ie. how they affect the operation of the USART.
Watchdog Timer
Explain the function of the Watchdog timer
Explain how to determine if the Watchdog timer caused a system reset
Given appropriate documentation, write a simple subroutine to configure the Watchdog timer to timeout after a specified time period.
Explain/write the instructions necessary to disable the Watchdog timer.
Timer/Counter system
Given a specific CPU frequency, scale factor, and Counter register byte-size, calculate how long it takes for the Counter to overflow.
Describe the Output Compare feature.
Given a specific CPU frequency, scale factor, Counter register byte-size, and Output Compare register value, calculate how long it takes for the Counter to tick to reach the Output Compare value.
Determine the number of overflow or Output Compare cycles needed to time a specific time duration.
Describe the Input Capture feature.
Describe the Output Comparator feature.
Given a specified time duration, compute how many T/C "ticks" correspond to that time, based on CPU clock speed and T/C prescaler value.