Exercise 5.4: Double Dabble

You are not logged in.

Please Log In for full access to this page.

In the previous exercise, we built circuits that calculate in Binary.

  • Binary: 1111
  • Human Readable: 15

To display binary values (like on a 7-segment display), we need conversion. The algorithm we use for this is called Double Dabble (or Shift-Add-3).

1) The Double Dabble Algorithm

Computers find it hard to divide by 10. Instead of division, we use a clever trick called Shift-Add-3.

How it Works

We take our binary number and shift it into "bins" representing our decimal digits (Ones, Tens, Hundreds). However, a 4-bit binary digit can go up to 16, but a decimal digit can only go up to 9.

  • The Rule: If any 4-bit BCD column is 5 or greater, we must add 3 to it before the next shift.

Why Add 3? When converting binary to decimal, we need to ensure that each 4-bit group (BCD digit) stays valid (0-9). If a group becomes \ge 5, we add 3. This correction prevents invalid BCD digits (like 1010=10).

Example: Converting 15 (1111)

Let's trace the conversion of the binary number 1111.

Operation Tens Column Ones Column Remaining Binary Note
Start 0000 0000 1111 Initial State
Shift 1 0000 0001 111
Shift 2 0000 0011 11 Value is 3 (<5), keep going.
Shift 3 0000 0111 1 Value is 7 (\ge5)! ADD 3.
Add 3 0000 1010 1 7 + 3 = 10 (1010)
Shift 4 0001 0101 - The '1' from Ones shifts to Tens.
Result 1 5 15

In the Double Dabble algorithm, when do you add 3 to a column?

2) The Hardware: Double Dabble & Decoders

Implementing this logic requires two specific Integrated Circuits (ICs). One to do the math (Double Dabble), and one to drive the lights (Decoder).

The 74185 Binary-to-BCD Converter

This is the "Double Dabble Chip". It is a chip designed to perform the conditional "Add 3" logic we learned above.

Figure 1: The 74185 IC. Inputs are pure Binary (Pin 1, 2, 6, etc.), and outputs are BCD (Pin 9, 10, 11, etc.). Note the "Enable" pin which must be grounded.
  • Function: Converts 6-bit Binary input into 6-bit BCD output.
  • Cascading: You can connect multiple 74185 chips together to convert larger numbers (8-bit, 16-bit, etc.).
  • Usage: Simply connect your binary source (switches or adder output) to the Binary Inputs and take the BCD Outputs to the next stage.

System Flow: Binary Inputs \to 74185 (Double Dabble) \to BCD Signals \to 7447 (Decoder) \to 7-Segment Display

3) Practical Exercise

Task: Build (or simulate) a 5-bit Binary to Decimal display system.

Required Components:

  1. Binary Inputs: 5 Switches (for numbers up to 31).
  2. Conversion Logic: 74185 IC (or logic simulation).
  3. Drivers: Two 7447 Decoder ICs (one for the Ones digit, one for the Tens digit).
  4. Display: Two 7-Segment Common Anode Displays.

Steps:

  1. Set your Binary Input to 11111 (Decimal 31).
  2. Route the signals through your Double Dabble logic (74185).
  3. Connect the 4-bit "Ones" BCD output to the first 7447 Decoder.
  4. Connect the 4-bit "Tens" BCD output to the second 7447 Decoder.
  5. Connect the outputs of the 7447s (pins a-g) to the respective pins on your displays.
Figure 2: Example of the completed 74185 circuit.

Final Submission

Upload a video (15 seconds) showing your full conversion circuit. Set the input switches to '11111' and clearly show the display reading '31'. Then switch to '00000' to show it clearing to '00'.
 No file selected