
Video: Redstone Calculator Tutorial Part 3 - BCD to Binary by mattbatwings
How to build it
- Build an 8-Bit Vertical Carry-Cancel Adder
Construct an 8-bit vertical carry-cancel adder with bit 1 at the bottom and bit 128 at the top. Place a redstone lamp on each of the 8 vertical outputs so you can easily read the binary value while debugging.
- Add the Repeater Lock Tower
Place a repeater coming out of each of the 8 output lamps. Run a vertical slab tower alongside the repeaters leading into side-facing repeaters so all 8 outputs are locked by default and hold their current state.
- Wire the ×2 and ×8 Bit-Shift Loop (Top Bit)
Starting at the 5th bit from the bottom (the highest bit that can be shifted without overflowing 8 bits), pull the signal after the locked repeater and split it into two upward staircases with repeaters: one connecting to the adder input 1 bit higher (bit 6) and the other connecting to the input 3 bits higher (bit 8).
- Stack the Bit-Shift Modules Downward
Replicate the two-branch upward shift wiring for the 4th, 3rd, 2nd, and 1st bits underneath. Each bit's locked output will now feed back into the adder at N+1 (×2) and N+3 (×8), automatically multiplying the stored value by 10.
- Create the 1, 2, 4, 8 BCD Input Bus
Bring four parallel input lines (labeled 8, 4, 2, and 1) plus a common signal trigger line down to the bottom of the adder. Add repeaters on the input lines so the incoming keypad digit reaches the adder cleanly.
- Connect BCD Lines 1, 2, and 4
Route the '1', '2', and '4' BCD input lines directly into the free inputs on the 1st, 2nd, and 4th bit layers of the vertical adder using solid blocks and redstone dust.
- Wire the BCD 8 Line via Carry-In
Because both inputs on the 4th layer (value 8) are already occupied by the ×2 and ×8 feedback lines from lower bits, split the '8' BCD line using slabs so it simultaneously powers the 4, 2, 1, and bottom Carry-In (1) inputs (4 + 2 + 1 + 1 = 8).
- Build the Pulse Generator for the Latch
Connect the common keypad signal line to a sticky piston holding a solid block with 2-tick repeaters to create a short monostable pulse. Route this pulse to temporarily depower the vertical lock tower, allowing the newly added sum to overwrite the old stored value.
- Install the Instant Clear Pistons
Place 5 sticky pistons facing the lower output lamps (the bits connected to the feedback loop) and power them via a slab tower connected to the lock torch so they stay extended holding the lamps in place. Wiring a Clear button to depower both the lock line and these pistons will retract the lamps, breaking the feedback loop so the stored number clears immediately instead of slowly cycling out.
- Duplicate for Numbers A and B
For a full calculator, build or WorldEdit-copy a second identical BCD-to-binary unit. Split the BCD input bus so it runs to both machines, and link both clear lines to your master Clear button.
How it works
Converting decimal digits entered one at a time (e.g., pressing 1, then 2, then 3) into a single binary number uses the formula (Current_Total × 10) + New_Digit:
- Synchronous Addition: The core of the converter is an 8-bit vertical Carry-Cancel Adder, which computes any 8-bit sum in a constant 4 redstone ticks.
- Multiplying by 10 via Bit Shifting: In binary, shifting a number up by 1 position multiplies it by 2, and shifting it up by 3 positions multiplies it by 8. Since
(N × 2) + (N × 8) = N × 10, routing each output bit back into the adder inputs atbit + 1andbit + 3multiplies the stored value by 10 without needing a separate multiplier circuit. - 8-Input Carry Workaround: Bit 4 (value 8) receives feedback from both Bit 1 (shifted up 3) and Bit 3 (shifted up 1), leaving no open input for the BCD
8line. The circuit solves this by feeding the8input into the free4,2,1, andCarry-In (1)lines simultaneously. - Piston Loop Break: Merely unlocking the repeaters to clear the register takes a long time because the feedback loop keeps adding the decaying signal to itself. Retracting the output lamps with sticky pistons physically severs the feedback loop while the lock is released, zeroing the register in a single pulse.
Tips & variations
- 8-Bit Limit (255 Max): Because the converter is 8 bits tall, the maximum value it can hold is
11111111in binary, or 255. Entering a number higher than 255 will overflow the top bit. - Use Lamps for Debugging: Keep redstone lamps at the output of every adder layer and along the feedback lines. Since lamps act as solid opaque blocks when powered by repeaters, they let you visually verify the stored total and the
×10predicted value at a glance. - WorldEdit Pasting Tip: If you use
//copyand//paste -ato stack the diagonal bit-shift staircases, double-check the redstone dust after pasting, as overlapping air blocks can occasionally pop off dust or repeaters.





