What is BCD code?
In computing and electronic systems, binary-coded decimal (BCD) is used to encode decimal numbers (base-10 numbers) in a binary form where each decimal digit is represented by a nibble (4 bits).
For instance decimal number 5 is represented as 0101 in BCD as 5 = 4 + 1
The 10 digits in BCD:
|Decimal Digit||BCD Nibble|
Numbers larger than 9, having two or more digits in the decimal system, are expressed one digit at a time using on nibble per digit. For example, the decimal number 365 is encoded as:
A lot of electronic devices use 7-segment displays (Watch, alarm clock, calculator etc.).
Typically 7-segment displays consist of seven individual coloured LED’s (called the segments). Each segment can be turned on or off to create a unique pattern/combination. Each segment is identified using a letter between A to G as follows:
The 10 descimal digits can be displayed on a seven-segment display as follows:
BCD to 7-Segment Display: Truth Tables & Karnaugh Maps
We will use four inputs A,B,C and D to represent the four BCD digits as ABCD (A is the most significant digit, D is the less significant digit). When creating an electronic circuit we could use 4 switches to represent these 4 inputs.
We will need 7 outputs one for each segment. So let’s investigate each segment one at a time.
|BCD: 0000||BCD: 0010||BCD: 0011||BCD: 0101|
|BCD: 0110||BCD: 0111||BCD: 1000||BCD: 1001|
Segment A should be off for the following values:
|BCD: 0001||BCD: 0100|
Segment A should also be off for the following BCD values which are not used to represent decimal digits values from 0 to 9:
Note that these values could be used to represent hexadecimal values A to F (10 to 15). Here we will not display anything instead.
Hence the Truth Table for Segment A is as follows:
This Truth table can be represented using a Karnaugh Map:
BCD to 7-Segment Display: Boolean Expressions
The Karnaugh maps will help us define the Boolean Expressions associated with each of the 7 segments.
BCD to 7-Segment Display: Logic Gates Diagrams
We can now convert each Boolean expression into a Logic Gates circuit to link our 4 inputs (switches) to our 7-segment display using a range of logic gates.
Logic Gates Diagram:
You can now recreate your logic gates circuit using logic.ly to test if it behaves as expected for all 16 BCD entries.
e.g. For Segment A:
BCD to 7-Segment Display Integrated Circuit
All these 7 logic gates diagrams can all be integrated into one single integrated circuit: The CD74HCT4511E is a CMOS logic high-speed BCD to 7-segment Latch/Decoder/Driver with four inputs and is used to use these 4 inputs (BCD nibble) to control the display of a 7-segment display.
Hex/BCD to 7-Segment Display Integrated Circuit
A very similar approach can be used to display hexadecimal digits as these are also based on a nibble per digit.
The extra values that we discarded previously (BCD: 1010, 1011, 1100, 1101, 1110, 1111) can be used to represent the extra 6 digits available in hexadecimal: