Please give this circuit time to load and run as this is really stretching EveryCircuit's abilities. 8 bit hexadecimal to decimal or binary to BCD (Binary Coded Decimal) converter. (As far as I know, the only circuit on EveryCircuit that can do it with 8 bits!). By default, it converts AD hex to 173 Dec.
INSTRUCTIONS:
1) Enter the binary number of your choice on the 8 logic buttons on the left. The hex equivalent will be displayed immediately on the left 7-segment displays.
2) Be patient! Allow the three 7-segment displays on the right to reset to all 0, then go to the equivalent decimal number.
GENERAL:
I used the Double-Dabble algorithm (aka the Shift-Add-Three method). If you'd like more info on how this works, I refer you to my 4-bit version of this circuit. https://everycircuit.com/circuit/6548980953251840
Blue waveform: Serial data of the binary number
Output of upper center OR gate.
Green waveform: Clock
Output of center right AND gate
Orange waveform: Reset signal (active low)
Output of center logic train
DETAILS:
I used the left and upper AND and OR gates to change the binary inputs to serial data. I cascaded two and a half Double-Dabble circuits together (right logic gates and flip-flops groups). This gave me 3 groups of BCD numbers (00 0000 0000). Since I wanted to convert an 8-bit binary number with a max decimal value of 255, I needed 3 groups. In the case of converting 1010 1101 binary (AD hex) to 173 decimal (01 0111 0011 BCD), the algorithm would go like
BCD BIN OPP DEC
00 0000 0000 1010 1101 start 000
00 0000 0001 010 1101 shift 1 001
00 0000 0010 10 1101 shift 0 002
00 0000 0101 0 1101 shift 1 005
00 0001 0000 1101 +3 shift 0 010
00 0010 0001 101 shift 1 021
00 0100 0011 01 shift 1 043
00 1000 0110 1 shift 0 086
01 0111 0011 Done +3 on 2 col shift 1 173
173 Dec = 1010 1101 Bin is correct.
NOTE:
I haven't tested all the numbers. If you find one that is wrong, let me know in a comment.
|