# Digital Logic Design Circuits: Conversion from Binary to BCD

Joined Apr 14, 2017
2
I want to design a logical circuit to convert any binary number to its BCD using a comparator and an adder.

Any explanation on how to do it would be appreciated. Thanks.

#### MrAl

Joined Jun 17, 2014
7,849
Hi,

They make binary to BCD converter chips you use more than one for more bits.
Dont remember the part number offhand.

#### djsfantasi

Joined Apr 11, 2010
6,962
Hi,

They make binary to BCD converter chips you use more than one for more bits.
Dont remember the part number offhand.
Are you sure? There was one, but it was discontinued

#### Dodgydave

Joined Jun 22, 2012
9,666
Cd4028

#### djsfantasi

Joined Apr 11, 2010
6,962
That's a BCD to Decimsl converter. He needs a binary to BCD converter.

For purpose of illustration, take the decimsl 42. In binary it is represented by 0b00101010. However in BCD, it is represented by 0x42 or by the following 8 bits.
0b01000010.

One way to implement this isvwitj an EPROM with a 255 byte lookup table.

#### WBahn

Joined Mar 31, 2012
26,301
I want to design a logical circuit to convert any binary number to its BCD using a comparator and an adder.

Any explanation on how to do it would be appreciated. Thanks.

Any binary number? Even one that has two trillion bits? Both positive and negative? Non-integer values too? If not, then what are the constraints?

Do you want to do this combinatorially or sequentially?

#### dl324

Joined Mar 30, 2015
11,894
I want to design a logical circuit to convert any binary number to its BCD using a comparator and an adder.

Any explanation on how to do it would be appreciated. Thanks.
Since this is homework help, you need to show your best effort before anyone can attempt to guide you.

How many bits do you need?

Can you post the wording of the problem in its entirety?

You might get some clues from a schematic for 74185 which performs 6 bit binary to BCD conversion.

EDIT: 74185 does the conversion using a 256 bit ROM...

Last edited:

Joined Apr 14, 2017
2

Any binary number? Even one that has two trillion bits? Both positive and negative? Non-integer values too? If not, then what are the constraints?

Do you want to do this combinatorially or sequentially?
A binary adder. Let's say i want to convert a 4-bit number,only positive integers. And I want to do it combinatorially. Thanks!

#### WBahn

Joined Mar 31, 2012
26,301
The easiest way to do a 4-bit number is with a look-up table. You only have 16 possibilities. You can also design a combinatorial circuit that has four inputs and five outputs (since the second BCD digit can only take on the values of 0 or 1, you can hard tie the upper three bits of it to 0). The low bit of the first digit is trivial, so that only leaves you with four outputs that you need to design logic for.

#### crutschow

Joined Mar 14, 2008
25,660
Note that combinatorial circuits get increasingly complex for converting more than 4-bits to BCD.

Below is a circuit from an an old Fairchild TTL book using an adder.

#### MrAl

Joined Jun 17, 2014
7,849
Hi,

Yes, the chip i was thinking of was the old 74185 chip which does 6 bits.
To get more bits, you have to add more chips. For 16 bits though i think you need 16 chips which is quite a lot of chips. Yes you can use a ROM instead.

It sounds like this OP wants to do it in pure combinatorial logic like with nand and nor gates or whatever. Only 4 bits should be easy.

#### djsfantasi

Joined Apr 11, 2010
6,962
J
I want to design a logical circuit to convert any binary number to its BCD using a comparator and an adder.

Any explanation on how to do it would be appreciated. Thanks.
Since this is homework help, you need to show your best effort before anyone can attempt to guide you.

How many bits do you need?

Can you post the wording of the problem in its entirety?

You might get some clues from a schematic for 74185 which performs 6 bit binary to BCD conversion.

EDIT: 74185 does the conversion using a 256 bit ROM...
Note that the 74185 has been discontinued and may be difficult to source. The major suppliers (Digikey,Mouser) don't have it. Recommending it is a common mistake.

#### dl324

Joined Mar 30, 2015
11,894
Note that the 74185 has been discontinued and may be difficult to source. The major suppliers (Digikey,Mouser) don't have it. Recommending it is a common mistake.
Since this is posted in Homework Help, it's unlikely that the OP is looking for a commercially available solution. It's a design exercise.

I said the OP might get some clues from the schematic and then updated my post to indicate no schematic was available because it uses a look up table.

The datasheet does give an algorithm for doing the conversion.