7-Segment Display
A numeric display built from seven bar-shaped LEDs, labeled a through g, arranged in a figure-eight. In PaizLogic it takes a 4-bit bus on its single input and lights the segment pattern for that value's hexadecimal digit, 0 through F. Internally, choosing which segments to light for each digit is a combinational function of the four input bits, exactly the job that a BCD-to-seven-segment decoder chip does in real hardware.
Segment map for 0-F
Wire four switches through a Splitter (or an INPUT set to 4 bits) into the display and step through the values. The table shows which of segments a-g light for every hexadecimal digit; a 1 means that segment is on. For example, value 4 lights b, c, f and g, and value 8 lights all seven segments.
| Hex | a | b | c | d | e | f | g |
|---|---|---|---|---|---|---|---|
| 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 |
| 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 |
| 2 | 1 | 1 | 0 | 1 | 1 | 0 | 1 |
| 3 | 1 | 1 | 1 | 1 | 0 | 0 | 1 |
| 4 | 0 | 1 | 1 | 0 | 0 | 1 | 1 |
| 5 | 1 | 0 | 1 | 1 | 0 | 1 | 1 |
| 6 | 1 | 0 | 1 | 1 | 1 | 1 | 1 |
| 7 | 1 | 1 | 1 | 0 | 0 | 0 | 0 |
| 8 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
| 9 | 1 | 1 | 1 | 1 | 0 | 1 | 1 |
| A | 1 | 1 | 1 | 0 | 1 | 1 | 1 |
| b | 0 | 0 | 1 | 1 | 1 | 1 | 1 |
| C | 1 | 0 | 0 | 1 | 1 | 1 | 0 |
| d | 0 | 1 | 1 | 1 | 1 | 0 | 1 |
| E | 1 | 0 | 0 | 1 | 1 | 1 | 1 |
| F | 1 | 0 | 0 | 0 | 1 | 1 | 1 |
Decoder driving the display
In real circuits you rarely wire logic straight to the segments. A BCD-to-seven-segment decoder such as the TI SN74LS47 takes the 4-bit number and computes the seven segment signals for you. PaizLogic's 7-SEG has that decoding built in, so the 4-bit bus is all you connect, but understanding the decoder explains why segment g is off for 0 and 1 yet on for every digit that needs a middle bar.
Counter counting on the display
Wire a Clock into a 4-bit Counter and the counter bus into the 7-SEG. On every clock edge the display walks 0, 1, 2 ... 9, A ... F and wraps back to 0, a complete single-digit hex counter with no decoder wiring on your part. Add a second Counter and display, chained by the first counter's carry, and you have a two-digit count.
Citations
- Texas Instruments. (2016). SN54LS47, SN74LS47 BCD-to-seven-segment decoders/drivers [Data sheet]. Reference 1
- Maxim Integrated. (2003). MAX7219/MAX7221 serially interfaced, 8-digit LED display drivers [Data sheet]. Reference 2
- Mano, M. M., & Ciletti, M. D. (2018). Digital design: With an introduction to the Verilog HDL, VHDL, and SystemVerilog (6th ed.). Pearson.