EveryCircuit
Contact
Reviews
Home
592azy2circuitdude
modified 1 year ago

4 Bit Hex to Decimal - Binary to BCD

7
0
574
06:27:08
Please read instructions on how to operate the circuit! This is a hexadecimal to decimal and/or a binary to BCD (Binary Coded Decimal) converter. The left 7-segment display shows the hex (binary) number, and the right two 7-segment displays show the equivalent decimal (BCD) number. Here is the upgraded 8-bit version for those interested https://everycircuit.com/circuit/6747473873469440 INSTRUCTIONS: 1) Set the binary number using the 4 logic sources on the left. You can see immediately on the left 7-segment display the hex equivalent of the binary number you enter. 2) Allow time for the right 7-segment displays to reset to 00. They will then show the decimal equivalent of the hex number you entered. In this case, it is set to convert "A" Hex (1010 binary) to "10" Dec (0001 0000 BCD). GENERAL: Binary numbers are the way digital logic circuits store data (0 or 1). Hex is a convenient way to show a binary number. BCD is a form of binary that only allows 0000 to 1001 (0 to 9). It is easy to map this to a decimal number. The algorithm to convert between these two systems is called the Double-Dabble (aka the Shift-Add-Three) method. DETAILS: The clock (green waveform) is set to pulse 4 times for the 4 bit binary number. These 4 pulses shift in the binary number as serial data starting with the MSB (blue waveform). The top four D-Type flip-flops hold the first BCD group. As the binary number shifts in, the output number gets checked if it exceeds 0101 (5). If it does, 0011 (3) is added to it using the logic gates. Overflow bits are shifted out to the last D-Type flip-flop. This is how the Double-Dabble algorithm changes the binary to BCD (amazingly)! In this particular case, the algorithm would go like BCD BIN OPP DEC 0 0000 1010 Start 00 0 0001 010 Shift 1 01 0 0010 10 Shift 0 02 0 0101 0 Shift 1 05 1 0000 Done Add 3 and Shift 0 10 The answer is 1 0000 BCD, which maps to 10 DEC. The reset signal (orange waveform) is active low. So when it is low, the clock pulses reset the D-Type flip-flops back to all zeros. This effectively resets the system so it can read in a new number.
published 2 years ago

EveryCircuit is an easy to use, highly interactive circuit simulator and schematic capture tool. Real-time circuit simulation, interactivity, and dynamic visualization make it a must have application for professionals and academia. EveryCircuit user community has collaboratively created the largest searchable library of circuit designs. EveryCircuit app runs online in popular browsers and on mobile phones and tablets, enabling you to capture design ideas and learn electronics on the go.

Copyright © 2025 by MuseMaze, Inc.     Terms of use     Privacy policy