Program requirements:
Lab 4 is similar to Lab 3; it just sets up and uses
PORT C for both input and some output.
-Input 8 bits on PORT C that are either 2 BCD digits
or one of three Seven Segment code digits (This will take
reading three bytes in a row, with handshaking).
The handshake protocol listed below determines whether
to consider the input as BCD or Seven Segment.
-Translate input from PORT C to a binary value (notice this takes
2 bytes for a large enough binary number to hold 999).
-Save up to 100 translated binary valuesvalues (These
must be 16 bit values, because 3 seven segment digits could
be the number 999).
-Check for illegal input values.
-Count the number of values translated(notice three seven
segments count as one binary store).
-Count the number of read bytes containing illegal inputs.
-Stop execution when then count of illegal reads his 255
-Wait for Dump and then a Reset-to-0 handshake when the number
of translated values hits 100.
-After any Reset-to-0 the program should go back to reading input bytes.
-output all (up to 100) stored values on the serial port,
when the handshake protocol says to Dump values. Notice, the intent
of this lab
is to study I/O setup on bi-directional PORT C, therefore
you do not need to put any simulator device to monitor the output
on the serial port.
-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 C ready to be read, and input values are 2 BCD digits |
| 0 | 1 | 1 | . | . | . | . | . | . | . | . | Port C ready for next byte to be read, and Input values are Seven Segment |
| 1 | 0 | 1 | . | . | . | . | . | . | . | . | Dump all Stored Values on serial port |
| x | x | 0 | . | . | . | . | . | . | . | . | No new data, and no action yet, set PORT C for input |
| 1 | 1 | 1 | . | . | . | . | . | . | . | . | Reset-to-0 all counts and output stored binary value count on PORT C. |
| . | . | . | . | . | . | . | . | 0 | 1 | Ready to read Port C | |
| . | . | . | . | . | . | . | . | . | 1 | 0 | Finished reading port C |
| . | . | . | . | 0 | 0 | . | . | 1 | . | . | Error on Data Conversion |
| . | . | . | . | . | . | 0 | 1 | . | . | 0 | Serial Output of values in progress |
| . | . | . | . | . | . | 1 | 0 | . | . | . | Serial Output of values finished |
| . | . | . | . | 0 | 1 | . | . | 0 | . | . | BCD successfully converted and stored |
| . | . | . | . | 1 | 0 | . | . | 0 | . | . | Seven Segment successfully converted and stored |
| . | . | . | 1 | . | . | . | . | . | . | 0 | Number of stored values is 100. |
Feel free to email comments and suggestions to John_M_Acken@acken.com