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.

a resource for converting binary to BCD

Status
Not open for further replies.

maark6000

Member level 5
Joined
Jan 15, 2013
Messages
92
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
2,270
I often see people asking "how to convert binary to BCD," and I suppose they could mean the pencil and paper shift-3 etc. method, but they could also be asking the question regarding an actual schematic. This is especially frustrating for students whose textbooks may be asking them that question assuming that the 74LS184 and 74LS185A chips are still being manufactured. In looking at the datasheet for those chips, I noticed that the chip only had five inputs. If you wanted to convert large numbers, you simply used more chips in an elaborately arranged fashion shown in the datasheet.

It dawned on me that writing out the logic statements for these 5 inputs wouldn't be that hard, and that creating the actual logic circuit for each output also wouldn't be that hard. So, for those interested, here are the logic statements. My inputs are the actual binary numbers, not the pin inputs to the chip. So if DCBA = 0110, that'd be binary 6. I'll call my outputs Y0 thru Y6, but since Y0 = A (the LSB's in binary and BCD are always the same), that makes Y1 the second BCD number, but also the correctly named first output of the chip. Also, A is A, A' is NOT A.

Y0 = A

Y1 = F'ED'C'B' + F'E'DCB' + F'EDC'B + FEDC'B' + F'E'D'B + FE'D'B' + F'D'CB + FD'CB' + FE'DB + FDCB

Y2 = FE'D'C'B + FED'CB + E'D'CB' + F'EC'B' + F'E'CB + F'EDC' + EDC'B' + FE'DC

Y3 = F'E'DC'B' + F'ED'C'B + FED'C'B' + F'EDCB' + FE'D'CB + FEDC'B

Y4 = F'ED'C' + F'E'DB + F'E'DC + F'DCB + FEDC' + FE'D' + FD'B + FD'C

Y5 = FE'D' + F'EC +F'ED + EDC


As you can see, not pretty. You can see why the chip was in fact a ROM. To see how complicated things can get, here is an image of the schematic necessary for just one of the output pins, in this case Y2:

CCM_zps72c1d8a5.jpg

You would need to create something similar for each pin, although Y5 wouldn't be too hard.

Anyway, an interesting exercise and one I hope will be of some value to those learning logic circuits.

Cheers, Mark
 
Last edited by a moderator:

Hi Mark,

Thanks for sharing, it brought back fond memories of being at Uni, in the late 70's when we did lots of this type of problem.

Binary to BCD (or ASCII) is also a question that crops up quite often in software.
 

here is a somewhat more elegant approach. it uses 10 74LS151 MUX chips, 2 quad OR gates, and a hex 7406 inverter. It replicates the function of the 74LS184, and gives the correct outputs, essentially doing what the 184's did for binary to BCD. It can only convert up to decimal 39 as shown, as decimal 40 (0100 0000 bcd) is 7 bits, but it'd be pretty easy to cheat and rig up the logic function for "Y6" to get you to decimal 63 (111111 binary). I haven't built the schematic myself, the fan out of the inverters may be questionable. It doesn't quite show up in the pic, but on the left from top to bottom are the binary inputs, F E D C B (remember A = Y0), and on the right are the outputs of the chip Y5 - Y1 from top to bottom. If anybody is interested in the actual CircuitMaker file, I'll certainly send it to ya.

Cheers,
 

Attachments

  • 74184 MUX.JPG
    74184 MUX.JPG
    85.6 KB · Views: 67
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top