EE 308
Homework #11
Due March 31, 1996
- Write the master program to implement Lab 11. This program
needs to be typed. Be sure to do the following:
- Set up PIA Port A3--A0 as inputs, and PIA Port A4 as an output.
Program the PIA so an interrupt is generated on the falling edge of CA1.
- Set up PIA Port B as an output. No interrupt should be generated on CB1.
- Set up the SPI to be a master, with speed, clock phase, and clock polarity
to match the MC68HC68T1 Real Time Clock (RTC).
- Set up the RTC to generate an interrupt once a second.
- Write an IRQ interrupt service routine which will be executed when
the button is pushed. In this ISR you should read PIA Port A, select the
slave, send the data
to SPI, wait until the data transfer is finished, and deselect the slave.
- Write an XIRQ interrupt service routine which will select the RTC,
read the current value of the seconds over the SPI, write this value to PIA
Port B, and deselect the RTC.
- Write the slave program to implement Lab 11. This program
needs to be typed. Be sure to do the following:
- Set up the SPI as a slave, with clock phase and polarity matching the
master's.
- Set up PIA Port B as an output, with no interrupt generated on CB1.
- Define four global variables each of which will hold the value for one of
the four patterns (in the case of the T-Bird, it will hold the index value of
the T-Bird table). Initialize these to 0.
- Define a global array for the T-Bird table. Declare the array to be on
type const, and initialize it when your define it.
- Define a global variable which will hold the pattern to implement on the
LEDs. Initialize this to 0.
- In your IRQ interrupt service routine, update the pattern global variable
(described above) to indicate which pattern to display. Also in this ISR,
change the update rate as told by the master.
- In your RTI interrupt service routine, look at the pattern global variable
to determine which pattern to display, and update the global variable for that
pattern.
- Make sure you do not remain in either of the interrupt service routines
for very long. Neither of the routines should use while,
for or do loops.
Bill Rison,
<rison@ee.nmt.edu >