Skip to content

VLSIFacts

Let's Program the Transistors

  • Home
  • DHD
    • Digital Electronics
    • Fault Tolerant System Design
    • TLM
    • Verification
    • Verilog
    • VHDL
    • Xilinx
  • Embedded System
    • 8085 uP
    • 8086 uP
    • 8051 uC
  • VLSI Technology
    • Analog Electronics
    • Memory Devices
    • VLSI Circuits
  • Interview
    • Interview Experience
    • Training Experience
    • Question Bank
  • Notifications
  • QUIZ
  • Community
  • Job Board
  • Contact Us

Binary Coded Decimal

Posted on March 14, 2023June 19, 2025 By vlsifacts No Comments on Binary Coded Decimal

You must have seen the digital clock in the railway station or at many other places. The hour, minute and second digits are seven-segment displays that deal with binary coded decimal (BCD) numbers. In this particular article, we will learn about the BCD code.

BCD is a way to express each decimal digit in binary. Each decimal digit starting from 0 to 9 has its own BCD code, which is the 4-bit unsigned binary equivalent of the digit. And using these individual BCD codes, we can write the BCD value of any large decimal number. For example, decimal number 13 can be represented as “0001_0011” (‘_’ is given for ease of reading). In the above example, you can observe that we just replaced ‘1’ and ‘3’ with their 4-bit binary equivalents.

Rule: To convert a decimal number to its BCD, just replace each digit of the decimal number with its 4-bit binary equivalent.

We need to understand that though BCD is a binary representation of decimal numbers, this is not the same as binary equivalent of a decimal number. To realize this, we will take the same example, which is the decimal number 13. The binary equivalent of 13 is “1101”, whereas the corresponding BCD is “00010011”. Even though the use of binary numbers is more efficient in a digital system, most human beings prefer to deal with decimal numbers. Thereby, the BCD code provides an excellent interface to binary systems, for example, keypad inputs and digital readouts.

Example:
How many bits would be required to encode decimal numbers 0 to 99 in straight binary and BCD codes?

Solution:
Total number of decimals to be represented (0 to 99) = 100 = 102 = 26.64
Therefore, the number of bits required for straight binary encoding = 7
The number of bits required for BCD encoding = 8 (4 bits for each digit)

Packed and Unpacked BCD Numbers

The BCD code of a decimal digit is a group of four binary bits. In the case of unpacked BCD numbers, each group of 4 binary bits is stored in a register of a digital system. However, if the register size is 8-bit or more, then every storage of the BCD number wastes a lot of memory locations. In the case of an 8-bit register, the lower 4 bits store the BCD number, and the upper 4 bits store zeros. To save the memory locations, BCD numbers can be stored in packed form. In the case of a packed BCD number, an 8-bit register can hold two BCD digits, one in upper 4-bits and another in lower 4-bits. Most computer processors store BCD in packed form.

Here is the Assembly Language Program for Unpacking the Packed BCD number in 8085 Microprocessor.

8421 BCD code

The most popular BCD code is the 8421 code. The designation 8421 indicates the binary weights of four bits used in the BCD (23, 22, 21, 20). Though there are different types of BCD codes, due to the popularity of the 8421 code, in general, BCD refers to the 8421 code unless otherwise stated.

The following series of articles will cover different concepts of BCD codes.

Different Types of BCD Codes
Decimal to BCD Conversion and Vice Versa
Binary to BCD Conversion and Vice Versa
BCD Addition
Excess-3 Code

Previous           Table of Content           Next

Spread the Word

  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on X (Opens in new window) X
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Pinterest (Opens in new window) Pinterest
  • Click to share on Tumblr (Opens in new window) Tumblr
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to email a link to a friend (Opens in new window) Email
  • Click to print (Opens in new window) Print

Like this:

Like Loading...

Related posts:

  1. What are the Different Types of BCD Codes
  2. Assembly Language Program for Unpacking the Packed BCD number in 8085 Microprocessor
  3. How to Convert Decimal to BCD and BCD to Decimal
  4. BCD Addition
Digital Electronics Tags:8421 BCD Code, BCD Code, Binary Coded Decimal, Packed BCD numbers, Unpacked BCD Numbers

Post navigation

Previous Post: Esperanto’s ET-SoC-1 Chip Integrates more than 1000 RISC-V Cores for Energy Efficient ML Recommendation
Next Post: What are the Different Types of BCD Codes

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Top Posts & Pages

  • ASCII Code
  • Different Coding Styles of Verilog Language
  • Circuit Design of a 4-bit Binary Counter Using D Flip-flops
  • Truth Tables, Characteristic Equations and Excitation Tables of Different Flipflops
  • NAND and NOR gate using CMOS Technology

Copyright © 2025 VLSIFacts.

Powered by PressBook WordPress theme

Subscribe to Our Newsletter

%d