
ECE 331 Spring 2009 Homework 11-Solution
Due Wed April 29 at the beginning of class.
1. The table to the right represents the stack contents at an instant in time.
a. If the main program just jumped to a subroutine, what is the subroutine
return address (i.e., where will it return after the subroutine is complete)?
Return address is the last thing stored on the stack before
jumping to the subroutine. The two-byte return address is
stored low bit first, then high byte. So the return address is
$4356.
b. If accA then IY were pushed to the stack before calling a subroutine that is
currently being executed, what was the value in accA?
The top of the stack holds the return address (2 bytes). IY (2
bytes) was pushed on after accA on thus occupies the next 2
locations from the top. Thus, accA would have the value $21.
c. If the subroutine currently being executed pushed IX to the stack, what is the subroutine return
address?
Two bytes of IX would occupy the top of the stack, so the return address. So the
return address is $73D2.
2. Briefly describe the following timer functions
a. Input capture
Captures and stores the free running counter value when a signal transition is
observed on a specific timer port pin.
b. Output compare
Generates an output signal at a specific value of the free running counter.
c. Pulse accumulator
Counts pulses (signal transitions) on a specific timer port pin.
3. In the world of microcontrollers, what is an exception?
Break (disruption) in normal program flow.
4. List two types of resets generated by internal factors.
Computer Operating Properly (COP) Reset, Clock Monitor Reset
5. What is the purpose of an interrupt?
Enables a microcontroller to respond to higher priority events than the normal
program.
6. Exception priority:
a. What exception has the highest priority?
Power-On Reset
b. What interrupt has the highest priority?
Unimplemented Instruction (SWI is wrong but acceptable)
c. Of maskable and non-maskable interrupts, which has the highest priority?
Non-maskable
c. PC
b. accA