DickCappels
- Joined Aug 21, 2008
- 10,187
Sounds like an exciting project.
To decode the 7 segment display, you can make a table of 1 byte constants in program memory. Bit 0 could correspond to segment a, Bit 1 corresponds to segment b, etc. Write a 1 for each segment that would be lit for each number.
The first entry in the table would be for the zero character, the second for the 1 character, etc. Use an index into the table, starting at zero, compare the incoming 7 segment data with the byte at which the index is pointing. When the contents of the table matches the incoming 7 segments, you have found the value of the 7 segment display and the answer is the value of the index register.
Sorry, I cannot remember exactly how to do this in an 8051.
To decode the 7 segment display, you can make a table of 1 byte constants in program memory. Bit 0 could correspond to segment a, Bit 1 corresponds to segment b, etc. Write a 1 for each segment that would be lit for each number.
The first entry in the table would be for the zero character, the second for the 1 character, etc. Use an index into the table, starting at zero, compare the incoming 7 segment data with the byte at which the index is pointing. When the contents of the table matches the incoming 7 segments, you have found the value of the 7 segment display and the answer is the value of the index register.
Sorry, I cannot remember exactly how to do this in an 8051.