Counting clock
A program counter built from NAND gates, counting one step clock tick at a time, with its LOAD tied to 0 by a constant bit. There is no microcontroller in it: the simulator solves the 6 parts as a circuit, so it runs the moment you press Run, and nothing needs compiling.
IntermediateRuns 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 program counter, built from NAND gates, counting on a step clock.
//
// Press Run. RESET starts at 1: click the clock once and the counter loads 0.
// Click RESET to 0, then click the clock: every click is one tick, and every
// tick adds one. Set the clock's mode to run and it counts by itself.
//
// LOAD is tied to 0 by a constant bit, so the counter never jumps. Wire a
// switch to LOAD instead and a tick with it on loads IN, which is how a CPU
// jumps to another instruction.
//
// The PC chip is a REG8, an INC8 and two MUX8s. Unpack it to look inside.
Parts list
409 parts, plus the jumper wires. Every one is in the editor's parts bin.
- 1 × Number switch
- 5 × Constant bit
- 1 × Bit switch
- 1 × Step clock
- 400 × Logic gate
- 1 × Number display
How it is wired
19 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.
- Number switch pin D0; PC chip pin IN0
- Number switch pin D1; PC chip pin IN1
- Number switch pin D2; PC chip pin IN2
- Number switch pin D3; PC chip pin IN3
- Number switch pin D4; PC chip pin IN4
- Number switch pin D5; PC chip pin IN5
- Number switch pin D6; PC chip pin IN6
- Number switch pin D7; PC chip pin IN7
- Constant bit pin Q; PC chip pin LOAD
- Bit switch pin Q; PC chip pin RESET
- Step clock pin CLK; PC chip pin CLK
- PC chip pin OUT0; Number display pin D0
- PC chip pin OUT1; Number display pin D1
- PC chip pin OUT2; Number display pin D2
- PC chip pin OUT3; Number display pin D3
- PC chip pin OUT4; Number display pin D4
- PC chip pin OUT5; Number display pin D5
- PC chip pin OUT6; Number display pin D6
- PC chip pin OUT7; Number display pin D7
Change it and keep it
Open it in the editor, change the circuit or the code, and keep your version in a free account.