EE 308 -- LAB 9
Parallel Communications using the MC6821 PIA
In this lab, one HC11 board (the master) will be used to query another HC11
board (the slave) about its status. The master HC11 will send a byte to the
slave HC11. The slave HC11 will return to the master the value in its
corresponding register -- e.g., if the master sends the slave the number
0x2B, the slave will return the value of its BAUD register
0x102B. In this manner, the master can find out the value of any register
inside the slave.
-
Connect two HC11 EVBU boards together as shown below. The switch going to the
TIC1 line on the Master HC11 should be one of the debounced switches on
your protoboard.
Figure 1: Connection of two HC11 EVBU boards for parallel communication.
- Program the master HC11 board as follows:
- When the switch is pressed, the falling edge should generate a
Timer Input Capture 1 interrupt. In the interrupt service routine, the master
will read the dip switches connected to its Port E, send that number to the
slave over its PIA Port B, and wait for the the acknowledgment that the
slave has read the data. It will then return from the interrupt service
routine.
Now that you have more memory in you HC11, you no longer need to put your C
program in EEPROM. Use the following line to compile your program:
icc11 -l prog.c -btext:0x2000 -bdata:0x000 -d_stack:0xfff
This will put your program at address 0x2000, so in BUFFALO give
the command g 2000 to run your program.
- When the slave returns the value of the appropriate register to the
master on the master's PIA Port A, an interrupt will be generated. In the
interrupt service routine, the master will read the value on its PIA
Port A, and display that value on the PC's display.
- Program the slave HC11 board as follows:
- An interrupt will be generated when the slave receives data on its
PIA Port A. In the interrupt service routine, the slave should read the
value from PIA Port A, find the contents of the appropriate internal
register, and write that value to PIA Port B. It should wait for the
acknowledgment that the master has read the data, then return from the
interrupt service routine.
- Verify that the system works properly. For example, have the master
determine the value of the slave's BAUD register, and verify that it is
9600.
- Connect your logic analyzer to the master's PIA Port B, CB1,
CB2, TIC1, IRQ and E Clock lines, and to the slave's
IRQ and E Clock lines. Trigger your logic analyzer of the falling edge
of the master's TIC1 line. Measure the following times, and compare
(where appropriate) to the values specified on the MC6821 data sheet:
- The time from the falling edge on TIC1 to new data on the master's
PIA Port B. This is how long it takes the master to get into the TIC1
interrupt service routine, read Port E, and send the data to PIA Port B.
- The time from the master's E clock going low to new data on the
master's PIA Port B. This is time tPDW on the MC6821 data sheet.
- The time from new data on the master's PIA Port B to CB2 going
low. This is time tDC on the MC6821 data sheet.
- The time from the master's E Clock going high to CB2 going
low. This is time tDC on the MC6821 data sheet.
- The time from the master's E Clock going high to CB2 going
high. This is time tRS1 on the MC6821 data sheet.
- The time CB2 is low. This is time PWCT on the MC6821 data
sheet.
- The time from the slave's CA1 going low to the slave's IRQ
going low. This is time tRS3 on the MC6821 data sheet.
- The time from the slave's E clock going high to the slave's
IRQ going high. This is time tIR on the MC6821 data sheet.
Bill Rison,
<rison@ee.nmt.edu >
Fri Mar 22 1996
© 1996, New Mexico Tech