Lesson 4. The CD4511B decoder

In pictures

After 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.

abcdefg00000abcdef10001bc20010abdeg30011abcdg40100bcfg50101acdfg60110cdefg70111abc81000abcdefg91001abcfgcodes 10–15 (1010–1111) — display blank
The seven segments a–g and which of them light for each digit. Under each digit — its code D C B A at the CD4511 input and the segments at the output: that is the decoder table.

4.2. Idea: latch, blanking, lamp test

  • LE = 0 — the code goes straight through; LE = 1 — the CD4511 holds the last digit (a latch on TG switches);
  • 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.

PartPinLabel
Input portoutputA
Input portoutputN
Input portoutputP
Output portinputB
nmosgate
drain
source
N
A
B
pmosgate
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.

PartPinLabel
Input portoutputB
Input portoutputC
Input portoutputLT
Input portoutputBL
Input portoutputLE
Input portoutputD
Input portoutputA
Output portinpute
Output portinputd
Output portinputc
Output portinputb
Output portinputa
Output portinputg
Output portinputf
NOTI0
O0
A
n1
NOTI0
O0
B
n2
NOTI0
O0
C
n3
NOTI0
O0
D
n4
NOTI0
O0
LE
n5
TGA
N
P
B
n1
n5
n6
n7
TGA
N
P
B
n2
n5
n6
n8
TGA
N
P
B
n3
n5
n6
n9
TGA
N
P
B
n4
n5
n6
n10
NOTI0
O0
n5
n6
TGA
N
P
B
n11
n6
n5
n7
NOTI0
O0
n7
n12
NOTI0
O0
n12
n11
TGA
N
P
B
n13
n6
n5
n8
NOTI0
O0
n8
n14
NOTI0
O0
n14
n13
TGA
N
P
B
n15
n6
n5
n9
NOTI0
O0
n9
n16
NOTI0
O0
n16
n15
TGA
N
P
B
n17
n6
n5
n10
NOTI0
O0
n10
n18
NOTI0
O0
n18
n17
NOR3A
B
C
Y
n11
n13
n15
n19
NORI0
I1
O0
n13
n16
n20
NOR3A
B
C
Y
n15
n13
n12
n21
NOR3A
B
C
Y
n11
n14
n15
n22
NOR3A
B
C
Y
n12
n14
n15
n23
NOR3A
B
C
Y
n12
n13
n16
n24
NOR3A
B
C
Y
n11
n14
n16
n25
NANDI0
I1
O0
n15
n13
n26
NANDI0
I1
O0
n26
n18
n27
NOR4A
B
C
D
Y
n11
n14
n16
n18
n28
NOR4A
B
C
D
Y
n12
n14
n16
n18
n29
NANDI0
I1
O0
BL
n27
n30
NOR4A
B
C
D
Y
n30
n23
n21
n28
n31
NOR3A
B
C
Y
n30
n22
n21
n32
NORI0
I1
O0
n30
n24
n33
NOR4A
B
C
D
Y
n30
n23
n19
n25
n34
NOR3A
B
C
Y
n30
n12
n23
n35
NOR4A
B
C
D
Y
n30
n28
n20
n19
n36
NOR4A
B
C
D
Y
n30
n19
n28
n29
n37
NORI0
I1
O0
n31
n38
n39
NORI0
I1
O0
n32
n38
n40
NORI0
I1
O0
n33
n38
n41
NORI0
I1
O0
n34
n38
n42
NORI0
I1
O0
n35
n38
n43
NORI0
I1
O0
n36
n38
n44
NORI0
I1
O0
n37
n38
n45
NOTI0
O0
LT
n38
NOTI0
O0
n39
a
NOTI0
O0
n40
b
NOTI0
O0
n41
c
NOTI0
O0
n42
d
NOTI0
O0
n43
e
NOTI0
O0
n44
f
NOTI0
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.

PartPinLabel
PoweroutputVCC
GroundoutputGND
Input (switch)outputUD
ClockoutputCLOCK
Button «Reset»outputRST
CD4029PE
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

PartPinLabel
CD4511B
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

  1. Place a Segment LCD (the palette, the display icon next to the dot display).
  2. ⚙ → the Size field: 24 × 30 (click the number, type, Enter).
  3. The right panel Stamps → size L 21 → section Digits → the first tile (an eight without a point) → click the centre of the field → Esc.
  4. S (select) → click the top segment → Enter (New pin) → name a → Enter. The same clockwise: top right b, bottom right c, bottom d, bottom left e, top left f, middle g.
  5. Close the editor: the body has seven legs a–g. Labels on the legs:
PartPinLabel
Segment LCDa
b
c
d
e
f
g
Ua
Ub
Uc
Ud
Ue
Uf
Ug

4.5. Check

  1. Clock — 1Hz. Press Reset — the display shows 0.
  2. UD = 1: 0, 1, 2 … 9, 0 — the digit changes on every clock.
  3. UD = 0: counting down — 0, 9, 8 …
Switch UDDisplayWhat it is
10 → 9 → 0counting up
09 → 0 → 9counting down
Reset0PE = 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)

Stuck? Something doesn't work →