Full adder
Three 74HC chips add two bits and a carry, with the sum and carry on LEDs. There is no microcontroller in it: the simulator solves the 10 parts as a circuit, so it runs the moment you press Run, and nothing needs compiling.
AdvancedRuns 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.
// A full adder: three chips, two LEDs, one bit of arithmetic.
//
// Set A, B and the carry-in on the three slide switches and read the answer:
//
// A B Cin carry sum
// 0 0 0 0 0 0 + 0 + 0 = 0
// 1 0 0 0 1 1 + 0 + 0 = 1
// 1 1 0 1 0 1 + 1 + 0 = 2
// 1 1 1 1 1 1 + 1 + 1 = 3
//
// Sum is A xor B xor Cin: two XOR gates from the 74HC86 in series.
// Carry is (A and B) or ((A xor B) and Cin): two ANDs from the 74HC08 into one
// OR from the 74HC32.
//
// Chain eight of these, carry-out to carry-in, and you have the adder in an
// 8-bit CPU. That is the whole trick: there is nothing else in there.
//
// Watch the wires while you flip a switch: the canvas tints each net by its
// logic level, so you can follow a 1 through the XOR and out of the carry.
Parts list
12 parts, plus the jumper wires. Every one is in the editor's parts bin.
- 1 × Full-size breadboard
- 1 × Power, 5 V
- 3 × Slide switch
- 1 × 74HC86 quad XOR
- 1 × 74HC08 quad AND
- 1 × 74HC32 quad OR
- 2 × Resistor, 220 Ω
- 1 × LED, green
- 1 × LED, red
How it is wired
12 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: Slide switch (1) pin 3; Slide switch (2) pin 3; Slide switch (3) pin 3; 74HC86 quad XOR pin VCC; 74HC08 quad AND pin VCC; 74HC32 quad OR pin VCC
- Ground: Slide switch (1) pin 1; Slide switch (2) pin 1; Slide switch (3) pin 1; 74HC86 quad XOR pin GND; 74HC08 quad AND pin GND; 74HC32 quad OR pin GND; LED, green pin C; LED, red pin C
- Slide switch (1) pin 2; 74HC86 quad XOR pin 1A; 74HC08 quad AND pin 1A
- Slide switch (2) pin 2; 74HC86 quad XOR pin 1B; 74HC08 quad AND pin 1B
- Slide switch (3) pin 2; 74HC86 quad XOR pin 2B; 74HC08 quad AND pin 2B
- 74HC86 quad XOR pin 1Y; 74HC86 quad XOR pin 2A; 74HC08 quad AND pin 2A
- 74HC86 quad XOR pin 2Y; Resistor, 220 Ω (1) pin 1
- 74HC08 quad AND pin 1Y; 74HC32 quad OR pin 1A
- 74HC08 quad AND pin 2Y; 74HC32 quad OR pin 1B
- 74HC32 quad OR pin 1Y; Resistor, 220 Ω (2) pin 1
- Resistor, 220 Ω (1) pin 2; LED, green pin A
- Resistor, 220 Ω (2) pin 2; LED, red pin A
Change it and keep it
Open it in the editor, change the circuit or the code, and keep your version in a free account.