Double Dabble

You are not logged in.

Please Log In for full access to the web site.
Note that this link will take you to an external site (https://accounts.google.com) to authenticate, and then you will be redirected back 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.

In this exercise and the subsequent project, you will have to read the relevant datasheet carefully to understand how to connect all the inputs and outputs.

Figure 1: The 74185 IC. Inputs are pure binary (pins 10, 11, 12, 13, 14), and outputs are BCD (pins 1, 2, 3, 4, 5, 6). Note that "enable" (pin 15) must be grounded for the IC to function.
  • 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.
  • Note: In the inputs, A is the least significant bit and E is the most significant bit, and for the output, Y1 is least significant and Y6 is most significant. 74185 does not use pins Y7 and Y8, and those are internally unconnected

Refer to this to see how to connect the inputs and outputs. Note that the datasheet is for two different ICs, 74184 and 74185, and that the input/output diagrams for 74185 are on pages 7 and 8.

Use this link if the file does not open below:

Refer to Figs. 4 and 5 above for up to 8 bits of input. Note that the least significant input bit always goes directly to the output, bypassing the IC.

System Flow: Binary Inputs \to 74185 (Double Dabble) \to BCD Signals \to 7448 (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 7448 Decoder ICs (one for the Ones digit, one for the Tens digit).
  4. Display: Two 7-Segment Common Cathode 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 (least significant digit) to the first 7448 Decoder.
  4. Connect the 4-bit "Tens" BCD output (most significant digit) to the second 7448 Decoder.
  5. Connect the outputs of the 7448s (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


In this module's project, you'll make a simple 4-bit calculator that can add two binary numbers.