Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Converting binary to BCD with basic gates

Status
Not open for further replies.

IainMcPhee

Junior Member level 2
Joined
Jul 18, 2005
Messages
21
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
1,565
I was wondering if anyone knows any logic that can convert Binary to BCD with the basic gates, ie AND, OR, XOR, etc.

I know how to add BCD, convert to and from decimal, but I cannot figure out this seemingly simple task.

I would like to know so that I may incorporate it into my relay computer...

Thank You
 

Re: Binary to BCD

you should be able to do the transformation by first doing a mapping. Use the truth tables and the graphical method for each output bit.

Many years ago there were commercial ICs for this. Try looking through an old TTL data book. They will have diagrams of the logic inside the chips. 74185 is one example.

[added later] The 74185 turns out to really be a ROM. http://www.geocities.com/templarser/registers.html shows several circuits for conversion.

One stupid question, Why not do the math in binary and save the relays that to the conversion?

[added even later] http://electro-tech-online.com/viewtopic.php?t=14362&view=next is another discussion. It claims that the circuitry would be very large. Older logic circuits were serial and clocked to save on parts. You should look into this to save on relays. I think the early HP pocket calculators were also serial.
 

    IainMcPhee

    Points: 2
    Helpful Answer Positive Rating
Binary to BCD

If the number is less than or equal to 9 then obviously binary is equivalent to BCD.
If the number is 10 and above then add 6 to it.
And the last 4 digits of this number's binary form will give your BCD representation's unit's digit.
For example say you want BCD of 12.
Add 6 to it and you get 18.
18 has binar representation given by 10010.
Taking the last 4 digits we get 0010 which is the binary representation of 2.

For BCD representation of numbers from 20 to 29 add 12 to the number and perform the same operation. Similarly you can work with other numbers.
 

Re: Binary to BCD

Older logic circuits were serial and clocked to save on parts. You should look into this to save on relays.
The problem, however, is that the savings on relays of doing it serially is that I would have to make a shift register to convert to serial. Everything is parallel. Another problem is clocking. My clock frequency is ~ 1hz (clock is a car turn signal flasher). This means that converting large numbers may take minutes!
However, a relay shift register is basically two relays per bit. The adder I can do with four per bit. This means that it is not as comlex as one would think. Also, I can reduce large blocks of logic gates down to a few relays. For instance:
The XOR normally consists of an AND gate, an OR gate, and a NAND gate. I can do one with two relays.

Therefor, I think that all shall be ok, and I thank you for the help.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top