EE 308 -- LAB 04
Parallel Ports and Subroutines
Introduction
Ports B and C are the easiest HC11 parallel ports to understand and use. For this week's lab, you will create programs to write to Port B, and read from Port C. You will use the Port C input to control the Port B output. You will test your programs by connecting Port B to 8 LEDs, and vary the Port B output by changing Port C inputs between to 5 volts and ground.
Pre-Lab
Find the P4 MCU I/O Port Connector in the Universal Evaluation Board User's Manual, and locate the Port B and C pins. Write programs to implement (i) a binary up counter, (ii) a binary down counter, (iii) a flasher, and (iv) a turn signal. Samples from the sequences that you should generate are shown in Fig. 1. You will use eight LEDs to see the Port B output. Your eyes act as a low pass filter on flash rate: include an appropriate delay between LED on and LED off so that you can easily and comfortably see them flash -- use a subroutine to implement the delay. Use Port C bits 1 and 0 to control which of the Port B functions are performed as shown in Fig. 2.
Write all programs before coming to lab. Be mindful of the delay requirement before changing the display or reading the Port C pins to determine if you should switch to a new function. When you switch between functions, the new function should start up where it ended when it was last activated.
The Lab
Start with one function only, say, the one to increment Port B. Begin by testing it with no delay subroutine on the simulator. When it works there, put it onto your EVBU. Use a logic probe on the P4 pins to see if they are pulsing. Then wire Port B to 8 LEDs, and test the increment Port B program with the delay subroutine. Once you have this working, wire up one of the Port C bits, and get it to switch between two functions. Again, test your new function on the simulator first with no delay subroutine. After you get this second function working, then wire up both bits 1 and 0 on Port C and get your complete program working.
PC 1 | PC 0 | Port B Function |
---|---|---|
0 | 0 | Up Counter |
0 | 1 | Down Counter |
1 | 0 | Flasher |
1 | 1 | Turn Signal |