Lesson 4. The CD4511B decoder
In picturesAfter this lesson the library has the CD4511B — it turns a binary code into a digit on a 7-segment display. The CD4029 counts, the CD4511 shows.
4.1. Idea: seven strokes
A digit on the display is seven segments a–g. Each digit lights its own set: 1 — b c, 8 — all seven. A decoder is a table: the code D C B A at the input, seven wires at the output.
4.2. Idea: latch, blanking, lamp test
LE= 0 — the code goes straight through;LE= 1 — the CD4511 holds the last digit (a latch onTGswitches);BL= 0 — the display is blank;LT= 0 — all segments light up: a check that none is burnt out.
In this kit LT, BL are at 1 and LE at 0: we just show the number.
4.3. Idea: a switch on two transistors
TG is an nmos and a pmos in parallel. One passes 0 well, the other passes 1; together — any signal. The gates always get opposite signals: N = 1 and P = 0 — closed.
4.4. Build
The same project. The library needs the lesson 0 gates, NOR3, NOR4 and CD4029 (lesson 3).
Step 1. Chip TG — a switch on a pair of transistors
As on the TI drawings: nmos and pmos in parallel between A and B. N = 1 and P = 0 — the switch is closed, N = 0 and P = 1 — open. The gates always get opposite signals.
| Part | Pin | Label |
|---|---|---|
| Input port | output | A |
| Input port | output | N |
| Input port | output | P |
| Output port | input | B |
| nmos | gate drain source | N A B |
| pmos | gate drain source | P A B |
Ctrl+G → name TG. Legs: inputs A, N, P; outputs B.
Step 2. Chip CD4511 — BCD → 7-segment decoder with a latch
Package pins from the TI datasheet: 1 B, 2 C, 3 LT, 4 BL, 5 LE, 6 D, 7 A, 9 e, 10 d, 11 c, 12 b, 13 a, 14 g, 15 f; 8 — VSS, 16 — VDD. Inside — TI Fig. 8: latches on TG (LE = 0 — transparent, LE = 1 — holds), a decoder on NOR3/NOR4, blanking BL = 0 (all segments off), lamp test LT = 0 (all lit), NOT drivers at the output. Codes 10–15 — blank.
| Part | Pin | Label |
|---|---|---|
| Input port | output | B |
| Input port | output | C |
| Input port | output | LT |
| Input port | output | BL |
| Input port | output | LE |
| Input port | output | D |
| Input port | output | A |
| Output port | input | e |
| Output port | input | d |
| Output port | input | c |
| Output port | input | b |
| Output port | input | a |
| Output port | input | g |
| Output port | input | f |
| NOT | I0 O0 | A n1 |
| NOT | I0 O0 | B n2 |
| NOT | I0 O0 | C n3 |
| NOT | I0 O0 | D n4 |
| NOT | I0 O0 | LE n5 |
| TG | A N P B | n1 n5 n6 n7 |
| TG | A N P B | n2 n5 n6 n8 |
| TG | A N P B | n3 n5 n6 n9 |
| TG | A N P B | n4 n5 n6 n10 |
| NOT | I0 O0 | n5 n6 |
| TG | A N P B | n11 n6 n5 n7 |
| NOT | I0 O0 | n7 n12 |
| NOT | I0 O0 | n12 n11 |
| TG | A N P B | n13 n6 n5 n8 |
| NOT | I0 O0 | n8 n14 |
| NOT | I0 O0 | n14 n13 |
| TG | A N P B | n15 n6 n5 n9 |
| NOT | I0 O0 | n9 n16 |
| NOT | I0 O0 | n16 n15 |
| TG | A N P B | n17 n6 n5 n10 |
| NOT | I0 O0 | n10 n18 |
| NOT | I0 O0 | n18 n17 |
| NOR3 | A B C Y | n11 n13 n15 n19 |
| NOR | I0 I1 O0 | n13 n16 n20 |
| NOR3 | A B C Y | n15 n13 n12 n21 |
| NOR3 | A B C Y | n11 n14 n15 n22 |
| NOR3 | A B C Y | n12 n14 n15 n23 |
| NOR3 | A B C Y | n12 n13 n16 n24 |
| NOR3 | A B C Y | n11 n14 n16 n25 |
| NAND | I0 I1 O0 | n15 n13 n26 |
| NAND | I0 I1 O0 | n26 n18 n27 |
| NOR4 | A B C D Y | n11 n14 n16 n18 n28 |
| NOR4 | A B C D Y | n12 n14 n16 n18 n29 |
| NAND | I0 I1 O0 | BL n27 n30 |
| NOR4 | A B C D Y | n30 n23 n21 n28 n31 |
| NOR3 | A B C Y | n30 n22 n21 n32 |
| NOR | I0 I1 O0 | n30 n24 n33 |
| NOR4 | A B C D Y | n30 n23 n19 n25 n34 |
| NOR3 | A B C Y | n30 n12 n23 n35 |
| NOR4 | A B C D Y | n30 n28 n20 n19 n36 |
| NOR4 | A B C D Y | n30 n19 n28 n29 n37 |
| NOR | I0 I1 O0 | n31 n38 n39 |
| NOR | I0 I1 O0 | n32 n38 n40 |
| NOR | I0 I1 O0 | n33 n38 n41 |
| NOR | I0 I1 O0 | n34 n38 n42 |
| NOR | I0 I1 O0 | n35 n38 n43 |
| NOR | I0 I1 O0 | n36 n38 n44 |
| NOR | I0 I1 O0 | n37 n38 n45 |
| NOT | I0 O0 | LT n38 |
| NOT | I0 O0 | n39 a |
| NOT | I0 O0 | n40 b |
| NOT | I0 O0 | n41 c |
| NOT | I0 O0 | n42 d |
| NOT | I0 O0 | n43 e |
| NOT | I0 O0 | n44 f |
| NOT | I0 O0 | n45 g |
Ctrl+G → name CD4511. Legs: inputs B, C, LT, BL, LE, D, A; outputs e, d, c, b, a, g, f.
Step 3. CD4029 counter, switch, generator, button
Clock — 1Hz. Reset — RST. The CD4029 counts in decade (BD = 0); Reset goes to PE: while the button is pressed the counter loads J = 0000. Free inputs — to GND.
| Part | Pin | Label |
|---|---|---|
| Power | output | VCC |
| Ground | output | GND |
| Input (switch) | output | UD |
| Clock | output | CLOCK |
| Button «Reset» | output | RST |
| CD4029 | PE Q4 J4 J1 CI Q1 BD UD Q2 J2 J3 Q3 CLOCK | RST U3 GND GND GND U0 GND UD U1 GND GND U2 CLOCK |
Step 4. The CD4511 decoder
| Part | Pin | Label |
|---|---|---|
| CD4511 | B C LT BL LE D A e d c b a g f | U1 U2 VCC VCC GND U3 U0 Ue Ud Uc Ub Ua Ug Uf |
Step 5. Display
- Place a Segment LCD (the palette, the display icon next to the dot display).
- ⚙ → the Size field:
24×30(click the number, type, Enter). - The right panel Stamps → size L 21 → section Digits → the first tile (an eight without a point) → click the centre of the field →
Esc. S(select) → click the top segment →Enter(New pin) → namea→ Enter. The same clockwise: top rightb, bottom rightc, bottomd, bottom lefte, top leftf, middleg.- Close the editor: the body has seven legs
a–g. Labels on the legs:
| Part | Pin | Label |
|---|---|---|
| Segment LCD | a b c d e f g | Ua Ub Uc Ud Ue Uf Ug |
4.5. Check
Clock—1Hz. Press Reset — the display shows 0.UD= 1: 0, 1, 2 … 9, 0 — the digit changes on every clock.UD= 0: counting down — 0, 9, 8 …
| Switch UD | Display | What it is |
|---|---|---|
| 1 | 0 → 9 → 0 | counting up |
| 0 | 9 → 0 → 9 | counting down |
| Reset | 0 | PE = 1: zero loaded |
After the check delete the probe — TG, CD4511 stay in the library. Keep the display (without labels): lesson 6 copies it.
Lesson 4 paste (Cmd+I)
You need the lesson 0 gates, NOR3, NOR4 and CD4029 (lesson 3). The paste does not place the display — place it by hand ("Display" step): after the stamp the segments are named S1…S7, you give them the names a–g.
# Lesson 4 — CD4511B: a BCD to 7-segment decoder with a latch (TI Fig. 8); CD4029 counter → CD4511 → a digit.# Paste: Cmd+I into the same project (lesson 0 gates, NOR3, NOR4 and CD4029 from lesson 3 needed). chip TG { portIn(A) portIn(N) portIn(P) portOut(B) nmos(N, A, B) pmos(P, A, B)} chip CD4511 { portIn(B) portIn(C) portIn(LT) portIn(BL) portIn(LE) portIn(D) portIn(A) portOut(e) portOut(d) portOut(c) portOut(b) portOut(a) portOut(g) portOut(f) NOT(A, n1) NOT(B, n2) NOT(C, n3) NOT(D, n4) NOT(LE, n5) TG(A=n1, N=n5, P=n6, B=n7) TG(A=n2, N=n5, P=n6, B=n8) TG(A=n3, N=n5, P=n6, B=n9) TG(A=n4, N=n5, P=n6, B=n10) NOT(n5, n6) TG(A=n11, N=n6, P=n5, B=n7) NOT(n7, n12) NOT(n12, n11) TG(A=n13, N=n6, P=n5, B=n8) NOT(n8, n14) NOT(n14, n13) TG(A=n15, N=n6, P=n5, B=n9) NOT(n9, n16) NOT(n16, n15) TG(A=n17, N=n6, P=n5, B=n10) NOT(n10, n18) NOT(n18, n17) NOR3(A=n11, B=n13, C=n15, Y=n19) NOR(n13, n16, n20) NOR3(A=n15, B=n13, C=n12, Y=n21) NOR3(A=n11, B=n14, C=n15, Y=n22) NOR3(A=n12, B=n14, C=n15, Y=n23) NOR3(A=n12, B=n13, C=n16, Y=n24) NOR3(A=n11, B=n14, C=n16, Y=n25) NAND(n15, n13, n26) NAND(n26, n18, n27) NOR4(A=n11, B=n14, C=n16, D=n18, Y=n28) NOR4(A=n12, B=n14, C=n16, D=n18, Y=n29) NAND(BL, n27, n30) NOR4(A=n30, B=n23, C=n21, D=n28, Y=n31) NOR3(A=n30, B=n22, C=n21, Y=n32) NOR(n30, n24, n33) NOR4(A=n30, B=n23, C=n19, D=n25, Y=n34) NOR3(A=n30, B=n12, C=n23, Y=n35) NOR4(A=n30, B=n28, C=n20, D=n19, Y=n36) NOR4(A=n30, B=n19, C=n28, D=n29, Y=n37) NOR(n31, n38, n39) NOR(n32, n38, n40) NOR(n33, n38, n41) NOR(n34, n38, n42) NOR(n35, n38, n43) NOR(n36, n38, n44) NOR(n37, n38, n45) NOT(LT, n38) NOT(n39, a) NOT(n40, b) NOT(n41, c) NOT(n42, d) NOT(n43, e) NOT(n44, f) NOT(n45, g)} power(VCC)ground(GND)input(UD)clock(CLOCK)button{label="Reset"}(RST)CD4029(PE=RST, Q4=U3, J4=GND, J1=GND, CI=GND, Q1=U0, BD=GND, UD=UD, Q2=U1, J2=GND, J3=GND, Q3=U2, CLOCK=CLOCK)CD4511(B=U1, C=U2, LT=VCC, BL=VCC, LE=GND, D=U3, A=U0, e=Ue, d=Ud, c=Uc, b=Ub, a=Ua, g=Ug, f=Uf)¿No te sale? Algo no funciona →