Spring 2008
At the time of the midterm exam, a student should be able to:
Timers
- Calculate the number of programmed timer events that occur in a given
amount of time. For example, calculate the number of timer overflow
events on Timer/Counter0 that would occur in 2 s if the timer were
configured to divide a 16 MHz system clock by 1024 to generate the
timer clock.
- Write C device driver subroutines to control timer events.
- Write C ISRs to respond to timer events.
Interrupts
- Compare and contrast polled and interrupt-driven systems.
- Indicate where the interrupt vector table is located in memory.
- Describe the purpose of the interrupt vector table.
- Explain the purpose for having specific control registers associated
with particular interrupts.
- List the port pins that are shared as the external (global) interrupt pins.
- List example on-chip device interrupts.
- Explain the purpose of the I bit in the
SREG register.
- Compare and contrast normal subroutines and ISRs.
- Write a simple interrupt service routine in C.
- Write a simple C program that initializes everything needed to
enable a particular interrupt service routine.
C Programming Language
- Use C block (/* */) and inline (//) comment delimiters.
- Describe the basic syntax used to declare a C function.
- State the purpose of the void keyword.
- Described the use of the #include, #define, #ifndef, #ifdef, and #endif
preprocessor directives.
- Use preprocessor directives to control header file conditional
compilation.
- List and describe each of the C fundamental data types.
- Describe how the C99 standard enhances C data typing.
- Justify using C99 data types rather than C fundamental data types in
embedded systems.
- Compare and contrast global variables and function variables.
- Describe how variables are made visible across files.
- State the type qualifier often needed with global variables modified
by interrupt service subroutines.
- Use if-else, do-while, while, for, and switch flow control structures.
- Use the C inequality, equality, mathematic, bitwise, and assignment
operators.
- Compare and contrast passing values and pointers as function parameters.
- Justify the use of function prototypes.
- Describe how C arrays are declared, initialized, and indexed.
- Describe the use of pointers to directly access memory and the use of
pointers in call-by-reference function parameters.
- Use pointer declaration and pointer dereferencing in C functions.
- Use pointer arithmetic with pre/post increment and pre/post decrement
operators to move through data in memory.
- Compare and contrast initialized pointers, null pointers, and dangling
pointers.
- State how null pointers can be used in conditional statements to prevent
memory access violations.
- State the name of the header file that declares I/O control registers
by name.
- State the name of the header file that declares the C99 types.
- State the name of the header file that assigns names to the jump vectors
and declares the sei and cli functions.
Mixing C and Assembly
- Understand the GNU compiler's use of temporary and saved registers.
In particular,
- Explain the differences in how the GNU compiler handles temporary and
saved registers.
- Describe the steps that must be taken when using a temporary register
in an assembly function that was called from C.
- Describe the steps that must be taken when using a temporary register
in assembly that calls a C function.
- Describe the steps that must be taken when using a saved register
in an assembly function that was called from C.
- Describe the steps that must be taken when using a saved register
in assembly that calls a C function.
- State which register GCC assumes contains zero at all times and
describe how to accomodate this when writing assembly code that is
mixed with C.
- Demonstrate proper use of the GCC assembler syntax (be aware of the syntax
differences between GCC and the AVR assembler).
- Describe how parameters are passed between C and assembly functions.
- Describe the purpose of an object file
(.o).
- Explain the purpose of the linker used when compiling programs with GCC.
- Translate functions written in assembly into C functions.
- Indicate when the extern and
.global keywords are required and explain
what they do.
- Interpret disassembled C code.
- Explain how local variables (inside C functions) are stored in memory.
|