BCD display
Four DIP switches set a number in binary and a CD4511 shows it as a digit on a seven-segment display. There is no microcontroller in it: the simulator solves the 5 parts as a circuit, so it runs the moment you press Run, and nothing needs compiling.
BeginnerRuns in your browser. Free, and no account needed.
How it works
There is no microcontroller in this one, so nothing is compiled: the simulator solves the circuit itself. The file in the editor is the notes that come with it.
// Binary in, decimal out: a CD4511 decoding four switches.
//
// Switch 1 is worth 1, switch 2 is worth 2, switch 3 is worth 4 and switch 4
// is worth 8. Click the levers (up is ON) and the display shows the total:
//
// off off off off -> 0 on on on off -> 7
// on off off off -> 1 off off off on -> 8
// off on off off -> 2 on off off on -> 9
//
// That is BCD, binary-coded decimal: one decimal digit in four bits. Try
// 10 to 15 (switches 2 and 4 on is 10): the 4511 blanks the display, because
// those codes are not a decimal digit. And look at the 6 and the 9, which have
// no tails on a 4511, unlike most displays driven from a microcontroller.
//
// The 4511 has three more pins that are tied off here: LT (lamp test) and BI
// (blanking) to 5 V, and LE (latch enable) to ground so the display follows
// the switches. Move LE to 5 V and the digit freezes whatever the switches do.
Parts list
7 parts, plus the jumper wires. Every one is in the editor's parts bin.
How it is wired
14 connections, pin by pin, read from the circuit itself. Each line is one set of pins joined together, by a jumper wire or a breadboard strip.
- 5 V: 4-way DIP switch pin 4B; 4-way DIP switch pin 3B; 4-way DIP switch pin 2B; 4-way DIP switch pin 1B; CD4511 7-segment driver pin LT; CD4511 7-segment driver pin BI; CD4511 7-segment driver pin VDD
- Ground: 4-resistor network pin C; CD4511 7-segment driver pin LE; CD4511 7-segment driver pin VSS; Resistor, 100 Ω pin 2
- 4-way DIP switch pin 1A; 4-resistor network pin 4; CD4511 7-segment driver pin A
- 4-way DIP switch pin 2A; 4-resistor network pin 3; CD4511 7-segment driver pin B
- 4-way DIP switch pin 3A; 4-resistor network pin 2; CD4511 7-segment driver pin C
- 4-way DIP switch pin 4A; 4-resistor network pin 1; CD4511 7-segment driver pin D
- CD4511 7-segment driver pin e; Seven segment display pin E
- CD4511 7-segment driver pin d; Seven segment display pin D
- CD4511 7-segment driver pin c; Seven segment display pin C
- CD4511 7-segment driver pin b; Seven segment display pin B
- CD4511 7-segment driver pin a; Seven segment display pin A
- CD4511 7-segment driver pin g; Seven segment display pin G
- CD4511 7-segment driver pin f; Seven segment display pin F
- Seven segment display pin COM1; Resistor, 100 Ω pin 1
Change it and keep it
Open it in the editor, change the circuit or the code, and keep your version in a free account.