Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Converting BCD to Binary using combinational logic

Status
Not open for further replies.
I am trying to make a Binary Calendar for a project. The O/P is a series of LEDs showing, in binary form, dd - mm - yy. I have chosen to use the MSF signal from the atomic clock in Rugby UK as the I/P, to make it super accurate. Bit pointless for a calendar but hey, it makes the system easier as there is no user I/P.

However, the MSF signal is BCD encoded! I have searched TTL and CMOS databases for a BCD-Binary IC. TTL used to do one it seems, but like with all fancy TTL ICs, it's discontinued. Does anyone know of a way to convert BCD to binary using regular combinational logic gates? Preferably using as little space as possible! Any suggestions would be most apprietiated! Thanks.
 
I assume you want to convert two BCD digits to binary so that the dd digits are converted to binary and then repeat the same circuit for the mm and yy digits. Is this true?

If so, the simplest solution I can think of (having given it 5 minutes thought) is to use counters.

Load the BCD digits into a pair of decade counters that are configured to count down and clock it simultaneously with a pair of 4 bit binary counters (set initially to zero) configured to count up. When the decade counters reach zero, stop the count and the binary value will be stored in the binary counters.
 
ljcox,

Yes you are right. I want to convert (as an example) 15 BCD to 15 binary. Thanks for your response, I hadn't thought of using counters at all!!! (DUH)
 
canadianpoet2012 said:
ljcox,

Yes you are right. I want to convert (as an example) 15 BCD to 15 binary. Thanks for your response, I hadn't thought of using counters at all!!! (DUH)

You're welcome.

Another way to do it would be to use adder ICs. I posted the reverse circuit some days ago. See my response (dated Feb 15) to the post by "jupiter669" entitled "4-bit binary to decimal into dual 7 segment displays".

To convert from a 2 digit BCD to binary, you would have to multiply the Tens digit by 10 and then add the units digit.

There are several options. Here are some examples.

To multiply by ten you could either multiply by 5 and then by 2 or vice versa. Multiplication by 2 is easy, you simply shift the binary point one place. This can be done in the wiring.

To multiply by 5, you could either add the tens digit 5 times or add 5 N times where N is the tens digit. The units digit could be added first or last - which ever is simpler in hardware. But ensure that the units digit is NOT multipled by 2.

Len
 
This sort of thing is usually done with a micro-controller, a PIC would do it nicely and drastically reduce your component count.

Maplin also sell an MSF to Serial decoder IC, code MK73Q, although it is rather expensive.
 
Here is an even simpler suggestion.

The diagram shows a proposal for the Day digits, the month digit conversion is a sub set of this one.

The year digit conversion is more complex since 10 tens digits must be converted.

Nigel,
I assume he is doing it as an exercise in digital design.

Len
 

Attachments

  • BCD_-_Binary.gif
    BCD_-_Binary.gif
    8.3 KB · Views: 2,596
Well, thank you very much for all your suggestions. I did consider using a PIC, but I don't have the right equipment to do it! :(

However I do like ljcox's 4-bit binary counter idea very much! I had an incling that binary counters may help, but I couldn't think how to design it!

The reason I'm doing it is for fun!!!! Sad though that may be! I am on a 3 year BEng course in electronic engineering! Although I'm not enjoying it at all, I still have a very keen interest in electronics, and make small but complex circuits and 'things' as a hobby! I'm sure I'm not the only one!
 
Len,

Thanks again for your circuit diagram for converting BCD to binary. I have simulated your suggestion and its seems to work fine. I have made a similar circuit for the Month digits. However I am having great problems working out how to convert the Year digits. It is 8 bits in BCD with a 7 bit O/P in binary. I think I may have missed the point. I have tried several times now to use the same layout as you, but I always end up with far more than 7 bits on my O/P! Please can you advise!? Thanks.
 
Here is part of the Year logic. It is more complex since there are 10 tens digits this time. You can use the same adder circuit, it simply has more inputs for the tens digits.

I'll leave you to do work out the logic for f and g. Let me know if you need help. Please check my binary arithmetic and Boolean algebra, I'm not immune to mistakes.

Len
 

Attachments

  • BCD_-_Binary_year.gif
    BCD_-_Binary_year.gif
    12.9 KB · Views: 1,381
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top