← Circuits with Tinkercad

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.

Fig 9-1Logic symbol of a BCD to 7-segment decoder: inputs A0–A3 (weights 1, 2, 4, 8) and outputs a–g

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.

  1. 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.
  2. Decoder — turns the input into signals that control each segment.
  3. 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:

  1. The input, say binary 0010 (2), is decoded to light only segments a, b, g, e and d.
  2. 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.

Next: 7-segment LEDs →

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.

8️⃣ Try it: light the segments

Choose a digit (BCD input)

Next: the 4511 IC →

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.

PinNameJob
6, 2, 1, 7D, C, B, ABinary inputs. D is the MSB, A the LSB
3LT (Lamp Test)“0” turns every output to “1” (all segments on). Keep it at “1” in normal use
4BL (Blanking)“0” blanks the display (still decodes, but nothing lights). Keep it at “1” in normal use
5LE (Latch Enable)“0”: decodes normally. “1”: holds the last decoded result. Connect to “0” / ground in normal use
9, 10, 11, 12, 13, 15, 14a, b, c, d, e, f, gOutputs to segments a–g of a common-cathode display
16 / 8Vcc / GNDSupply / ground
Table 9-1Truth table of the 4511 BCD to 7-segment decoder: LT = 0 lights all segments; BL = 0 blanks it; with LE = 0, BL = 1, LT = 1 inputs 0000–1001 show 0–9 and 1010–1111 show nothing; LE = 1 holds the last value

Connecting the 4511

  1. LE (pin 5) to ground.
  2. BL (pin 4) and LT (pin 3) to the supply, or through 4.7–10 kΩ pull-up resistors.
  3. Inputs D C B A to a source of binary data, such as outputs QD–QA of a counter IC.
  4. Outputs a–g to the segment anodes of the display, each through a 220–510 Ω resistor to limit the current.
  5. The display’s common pin (common cathode) to ground.
  6. A 2–5 V supply to Vcc (pin 16).
  7. GND (pin 8) to ground.

Next: testing the CD4511 →

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.
Fig 9-4Test circuit for the CD4511 BCD to 7-segment decoder, with one 220 Ω resistor on the display’s common pin
Fig 9-5The same test with a current-limiting resistor on every segment (R5–R11, 7 × 220 Ω)

🛠️ Lab 9.1 · Decode 4 bits

  1. 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.
  2. Build it with real parts (Fig 9-7) and repeat step 1.
Fig 9-6Testing the CD4511 on Tinkercad by simulation. Set the 7-segment display’s Common to Cathode
Fig 9-7Testing the CD4511 with real parts on a breadboard. Scan the QR code for the demo video

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.

Next: review →

Segments for each digit

DigitD C B Aabcdefg
000001111110
100010110000
200101101101
300111111001
401000110011
501011011011
601100011111
701111110000
810001111111
910011110011
—1010–1111all 0 (blank)

🛠️ Activity · Decoder challenges

  1. Before each switch setting, convert the binary to decimal and predict the digit. Remember ON = “0”.
  2. Connect LT (pin 3) to ground for a moment. What do you see, and why is it useful?
  3. Connect BL (pin 4) to ground. What happens?
  4. 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?
  5. 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.

1. What does a BCD to 7-segment decoder do?
2. Which segments light to show the digit 2?
3. With a common-cathode display, what must you do to light a segment?
4. What is the dp segment for?
5. The 4511 receives the input 1100 (12). What does the display show?
6. In normal use, what should LT, BL and LE be?
7. Which 4511 input is the MSB?
8. Fig 9-4 uses one resistor on the common pin. What is the downside?
9. In Tinkercad, what must you set on the 7-segment display for this circuit?