EE 308 -- LAB 11
Synchronous Serial Communications on the 68HC11
In this lab, one HC11 board (the master) will be used to send instructions
to another HC11 board (the slave). The master HC11 will send a byte to
the slave HC11. The slave HC11 will display a pattern of LEDs depending
on the value it receives. The master will read the time from the Real
Time Clock, and write it to its terminal. The system should use the SPI
to communicate between the two boards and the RTC.
The lower two bits of the input word will tell which pattern to implement,
and the next two bits will tell the rate at which the display should update:
Switch | Display | | Switch | Update |
1:0 | Mode | | 3:2 | Rate |
0:0 | Increment | | 0:0 | 4 ms |
0:1 | Decrement | | 0:1 | 8 ms |
1:0 | Flash | | 1:0 | 16 ms |
1:1 | T-Bird | | 1:1 | 33 ms |
-
Connect two HC11 EVBU boards together as shown below. The switch going to the
CA1 line on the Master HC11 should be one of the debounced switches on
your protoboard. (Note: Only the master RTC should be active. You need to
make sure the slave RTC remains idle by writing a 0 to Bit 5 of Port D on the
slave board.)
Figure 1: Connection of two HC11 EVBU boards for serial communication.
- Program the master HC11 board as follows:
- When the switch is pressed, the falling edge should generate a IRQ
interrupt. In the interrupt service routine, the master will read the dip
switches connected to its PIA Port A0-A3, send that number to the slave
over the SPI. It will then return from the interrupt service routine.
- The MC68HC68T1 Real Time Clock should be programmed to generate an
interrupt on the XIRQ line every second.
- In the XIRQ interrupt service routine, the master should read the
current time from its Real Time Clock, and set a global variable telling the
main program that a new time is available.
- In the main program, the master should monitor the new time flag. When
a new time is available the master should display that time on the PC terminal
using BUFFALO routines, such as in Lab 7.
- Program the slave HC11 board as follows:
-
An interrupt will be generated when the slave receives data on its
SPI port. In the interrupt service routine, the slave should read the
value from SPDR, change a global variable which will control the
display mode, and change the RTI interrupt rate.
- The slave should use the RTI interrupt to update its display based on
the instructions received from the master.
- Initially, the slave should run in the increment mode, with a 33 ms
update rate.
- Connect your logic analyzer to the master's CA1, MOSI,
MISO, SCLK, IRQ, tt PIA Port A Bits 3--0, tt PIA
Port A Bit 4, and E Clock lines.
- Trigger your
logic analyzer of the falling edge of the master's CA1 line. Measure
the following times, and compare (where appropriate) to the values specified
on the MC6821 data sheet and the 68HC11 Technical Data Manual:
- The time from the falling edge on CA1 to data being sent over the
SPI. This is how long it takes the master to get into the CA1
interrupt service routine, read Port A, and send the data.
- The SPI clock frequency.
- Determine on which SCLK edge the data is valid, and whether the
data is sent with the most significant bit or least significant bit first.
Bill Rison,
<rison@ee.nmt.edu
>
Tue March 31 1998
© 1998, New Mexico Tech