Double Dabble
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 |
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.
- 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,
Ais the least significant bit andEis the most significant bit, and for the output,Y1is least significant andY6is most significant. 74185 does not use pinsY7andY8, 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:
- Binary Inputs: 5 Switches (for numbers up to 31).
- Conversion Logic: 74185 IC (or logic simulation).
- Drivers: Two 7448 Decoder ICs (one for the Ones digit, one for the Tens digit).
- Display: Two 7-Segment Common Cathode Displays.
Steps:
- Set your Binary Input to
11111(Decimal 31). - Route the signals through your Double Dabble logic (74185).
- Connect the 4-bit "Ones" BCD output (least significant digit) to the first 7448 Decoder.
- Connect the 4-bit "Tens" BCD output (most significant digit) to the second 7448 Decoder.
- Connect the outputs of the 7448s (pins a-g) to the respective pins on your displays.
Final Submission
In this module's project, you'll make a simple 4-bit calculator that can add two binary numbers.