Charles Tritt
/
21_7segmentTest2_v5
Modified, multi-file version of my orginal 7-segment test program.
display.cpp@112:2af5a1ac47d5, 2021-11-10 (annotated)
- Committer:
- CSTritt
- Date:
- Wed Nov 10 14:51:10 2021 +0000
- Revision:
- 112:2af5a1ac47d5
Modified multi-file version of my original 7-segment test program.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
CSTritt | 112:2af5a1ac47d5 | 1 | #include "display.h" |
CSTritt | 112:2af5a1ac47d5 | 2 | |
CSTritt | 112:2af5a1ac47d5 | 3 | void display(int disVal, BusOut &disBus){ |
CSTritt | 112:2af5a1ac47d5 | 4 | // 7-segment, active low look-up-table. Displays Hex 0 to F, dp, all off |
CSTritt | 112:2af5a1ac47d5 | 5 | // and all on. |
CSTritt | 112:2af5a1ac47d5 | 6 | const int lutAL[] = { |
CSTritt | 112:2af5a1ac47d5 | 7 | 0b00000011, // 0 = 0 |
CSTritt | 112:2af5a1ac47d5 | 8 | 0b10011111, // 1 = 1 |
CSTritt | 112:2af5a1ac47d5 | 9 | 0b00100101, // 2 = 2 |
CSTritt | 112:2af5a1ac47d5 | 10 | 0b00001101, // 3 = 3 |
CSTritt | 112:2af5a1ac47d5 | 11 | 0b10011001, // 4 = 4 |
CSTritt | 112:2af5a1ac47d5 | 12 | 0b01001001, // 5 = 5 |
CSTritt | 112:2af5a1ac47d5 | 13 | 0b01000001, // 6 = 6 |
CSTritt | 112:2af5a1ac47d5 | 14 | 0b00011111, // 7 = 7 |
CSTritt | 112:2af5a1ac47d5 | 15 | 0b00000001, // 8 = 8 |
CSTritt | 112:2af5a1ac47d5 | 16 | 0b00001001, // 9 = 9 |
CSTritt | 112:2af5a1ac47d5 | 17 | 0b00010001, // 10 = a |
CSTritt | 112:2af5a1ac47d5 | 18 | 0b11000001, // 11 = b |
CSTritt | 112:2af5a1ac47d5 | 19 | 0b11100101, // 12 = c |
CSTritt | 112:2af5a1ac47d5 | 20 | 0b10000101, // 13 = d |
CSTritt | 112:2af5a1ac47d5 | 21 | 0b01100001, // 14 = e |
CSTritt | 112:2af5a1ac47d5 | 22 | 0b01110001, // 15 = f |
CSTritt | 112:2af5a1ac47d5 | 23 | 0b11111110, // 16 = dp |
CSTritt | 112:2af5a1ac47d5 | 24 | 0b11111111, // 17 = All off |
CSTritt | 112:2af5a1ac47d5 | 25 | 0b00000000 // 18 = All on |
CSTritt | 112:2af5a1ac47d5 | 26 | //abcdefg_dp – 7-segement output codes 0 to 18. |
CSTritt | 112:2af5a1ac47d5 | 27 | }; |
CSTritt | 112:2af5a1ac47d5 | 28 | disBus = lutAL[disVal]; |
CSTritt | 112:2af5a1ac47d5 | 29 | } |