You have two weeks to work on this lab. This lab is due at the end of your assigned lab period the week of November 12th.
Program requirements:
The same basic functionality as Lab 5, but
add the handshake and functionality in a subroutine that does
Seven Segment check and conversion. For the Seven Segment Code see Valvano Table 8.7 on page 448.
Input 8 bits on PORT E that are either 2 BCD digits or one of two Seven Segment code digits (This will take reading two
bytes in a row, with handshaking). The handshake protocol listed below determines whether to consider the input as BCD or
Seven Segment.
Test for legal input values.
Count the number of illegal values input, and stop when the error count hits 255.
output all 1's on Port C when error value is detected.
convert legal input to binary value.
Store up to 100 binary values in memory.
Output the converted result to Port C.
-Count the number of values translated.
-output all (up to 100) stored values on the Port C,
When count of stored values hits 100
or
when the handshake protocol says to Dump values.
-Use PORT A and PORT B for the following handshake protocol:
| Port A | Port B | ||||||||||
| a2 | a1 | a0 | b7 | b6 | b5 | b4 | b3 | b2 | b1 | b0 | . |
| 0 | 0 | 1 | . | . | . | . | . | . | . | . | Port E ready to be read, and input values are 2 BCD digits |
| 0 | 1 | 1 | . | . | . | . | . | . | . | . | Port E ready to be read, and input values are Seven Segment |
| 1 | 0 | 1 | . | . | . | . | . | . | . | . | Dump all Stored Values on Port C |
| 0 | 0 | 0 | . | . | . | . | . | . | . | . | No new data, and no action yet |
| 1 | 1 | 0 | . | . | . | . | . | . | . | . | Byte received from dump, ready for another byte |
| 1 | 1 | 1 | . | . | . | . | . | . | . | . | Reset-to-0 all counts |
| . | . | . | . | . | . | . | . | . | 0 | 1 | Ready to read Port E |
| . | . | . | . | . | . | . | . | . | 1 | 0 | Finished reading port E |
| . | . | . | . | 0 | 0 | . | . | 1 | . | . | Error on Data Conversion |
| . | . | . | . | . | . | 0 | 1 | . | . | 0 | Output of values in progress |
| . | . | . | . | . | . | 1 | 0 | . | . | . | Output of values finished |
| . | . | . | . | 0 | 1 | . | . | 0 | . | . | BCD successfully converted and stored |
| . | . | . | 1 | . | . | . | . | . | . | 0 | Number of stored values is 100. |
For this lab, use the following simulator setup:
Use keypad for input on Port A.
Use 8 switches for input on Port E, for input of either BCD or Seven Segment codes.
Hook the LCD to Port C for output of converted values.
Hook the LEDs to Port B pins for the I/O handshake protocol.
Feel free to email comments and suggestions to John_M_Acken@acken.com