Chapter 9 · Book pp. 127–134
Applied Digital Circuits 3: the Decoder IC
เรียน-เล่น-รู้ กับวงจรดิจิทัลขั้นประยุกต์ 3 - ไอซีวงจรถอดรหัส
Binary is hard to read at a glance. To show a result as a decimal digit, 0 to 9, you need a decoder and a display — here a 7-segment LED. In Chapter 8 a 4-bit counter gave 0000 to 1111; even counting only to 1001, the result is not easy to read straight away. A decoder fixes that. This chapter simulates it in Tinkercad and builds it for real.
9.1 How a decoder works หลักการทำงาน
A 7-segment display decoder converts binary (or another base, such as decimal) into a pattern on a display with 7 segments, each switched on or off independently. It can show 0–9 and some letters, such as A, b, C, d, E, F, g, h, I, J, L, n, O, P, q, r, S, t and u. You find them in calculators, digital clocks and measuring instruments.
- Input — binary data, such as 4 bits (0000 to 1001) for 0 to 9, or decimal 0 to 9 if the circuit takes decimal directly.
- Decoder — turns the input into signals that control each segment.
- Output (display) — here a 7-segment LED with segments a, b, c, d, e, f and g. Each segment is on or off according to the data.
In short:
- The input, say binary 0010 (2), is decoded to light only segments a, b, g, e and d.
- The right logic levels must go to each segment:
- Common cathode: give “1” to each segment pin, through a current-limiting resistor, and “0” (ground) to the common pin.
- Common anode: give “0” to each segment pin and “1” (the supply) to the common pin.
Many decoder ICs exist, for different displays. The one chosen here, and which Tinkercad can simulate, is the 4511: a CMOS BCD decoder for 7-segment LEDs. It works with common-cathode displays.
9.2 7-segment LED basics LED ตัวเลข 7 ส่วน
- A 7-segment display is 7 LEDs in one package, arranged as a figure 8. Each LED is a segment, named a, b, c, d, e, f and g.
- An eighth LED, dp, is the decimal point.
- The LEDs share one pin. If all cathodes are joined it is common cathode: connect the common pin to ground and give + to each anode. If all anodes are joined it is common anode: connect the common pin to + and give ground to each segment’s cathode.
- Displays come as single digits, doubles and more. A single digit has 10 pins: a–g, dp and two common pins (joined inside, so you can use just one). A double digit has 20 pins.
About Figs 9-2 and 9-3
The book describes the segment layout, the two wiring types (Fig 9-2) and the 4511 display patterns (Fig 9-3), but those pictures are not printed. The widget below shows the same ideas.
9.3 The 4511 IC แนะนำไอซี 4511
The 4511 decodes BCD (Binary Coded Decimal) to drive a 7-segment LED. Several makers produce it under different numbers, such as CD4511 and MC14511. If the binary input is above 1001, the 4511 does not decode it and the display stays blank. It drives common-cathode displays.
| Pin | Name | Job |
|---|---|---|
| 6, 2, 1, 7 | D, C, B, A | Binary inputs. D is the MSB, A the LSB |
| 3 | LT (Lamp Test) | “0” turns every output to “1” (all segments on). Keep it at “1” in normal use |
| 4 | BL (Blanking) | “0” blanks the display (still decodes, but nothing lights). Keep it at “1” in normal use |
| 5 | LE (Latch Enable) | “0”: decodes normally. “1”: holds the last decoded result. Connect to “0” / ground in normal use |
| 9, 10, 11, 12, 13, 15, 14 | a, b, c, d, e, f, g | Outputs to segments a–g of a common-cathode display |
| 16 / 8 | Vcc / GND | Supply / ground |
Connecting the 4511
- LE (pin 5) to ground.
- BL (pin 4) and LT (pin 3) to the supply, or through 4.7–10 kΩ pull-up resistors.
- Inputs D C B A to a source of binary data, such as outputs QD–QA of a counter IC.
- Outputs a–g to the segment anodes of the display, each through a 220–510 Ω resistor to limit the current.
- The display’s common pin (common cathode) to ground.
- A 2–5 V supply to Vcc (pin 16).
- GND (pin 8) to ground.
9.4 Testing the CD4511 ทดลองใช้งานไอซี CD4511
- Set the input with the 4-way DIP switch SW1. OFF sends “1” to the CD4511; ON sends “0”. The four bits go to inputs D C B A and are decoded onto outputs a–g.
- Fig 9-4 uses just one resistor on the common pin to save parts, so the brightness changes from digit to digit (more segments lit = dimmer). It saves 6 resistors and fits on a small breadboard.
- For even brightness, give every segment its own resistor, as in Fig 9-5.
🛠️ Lab 9.1 · Decode 4 bits
- Build the circuit in Tinkercad (Fig 9-6). In the 7-segment display’s settings, set Common = Cathode. Slide the 4 DIP switches to each input in Table 9-1 and watch the display.
- Build it with real parts (Fig 9-7) and repeat step 1.
You will find the display shows only 0 to 9. For inputs 1010 to 1111 (10 to 15) it shows nothing — so this experiment is also good practice at converting binary to decimal.
Segments for each digit
| Digit | D C B A | a | b | c | d | e | f | g |
|---|---|---|---|---|---|---|---|---|
| 0 | 0000 | 1 | 1 | 1 | 1 | 1 | 1 | 0 |
| 1 | 0001 | 0 | 1 | 1 | 0 | 0 | 0 | 0 |
| 2 | 0010 | 1 | 1 | 0 | 1 | 1 | 0 | 1 |
| 3 | 0011 | 1 | 1 | 1 | 1 | 0 | 0 | 1 |
| 4 | 0100 | 0 | 1 | 1 | 0 | 0 | 1 | 1 |
| 5 | 0101 | 1 | 0 | 1 | 1 | 0 | 1 | 1 |
| 6 | 0110 | 0 | 0 | 1 | 1 | 1 | 1 | 1 |
| 7 | 0111 | 1 | 1 | 1 | 0 | 0 | 0 | 0 |
| 8 | 1000 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
| 9 | 1001 | 1 | 1 | 1 | 0 | 0 | 1 | 1 |
| — | 1010–1111 | all 0 (blank) | ||||||
🛠️ Activity · Decoder challenges
- Before each switch setting, convert the binary to decimal and predict the digit. Remember ON = “0”.
- Connect LT (pin 3) to ground for a moment. What do you see, and why is it useful?
- Connect BL (pin 4) to ground. What happens?
- Join Chapter 8 and Chapter 9: drive the CD4511 inputs from the 74HC93’s QD–QA and press the clock button. What happens after 9?
- Then make the counter a BCD counter (Chapter 8, 8.4) so it never goes blank.
Check yourself
Chapter 9 has a worked test but no exercises, so these questions are my own, based on its pages.