Decimal to BCD Conversion (8421, 5421, 2421 Codes) – Digital Electronics

Introduction

In Digital Electronics, Binary Coded Decimal (BCD) is a way to represent decimal numbers (0–9) in binary form.
Instead of converting the whole decimal number into a binary equivalent, each decimal digit is represented separately by a 4-bit binary code.

There are different types of BCD codes depending on the weights assigned to each binary digit:

  • 8421 Code (Natural BCD, Weighted Code)

  • 5421 Code (Weighted Code)

  • 2421 Code (Self-Complementing Weighted Code)

Let’s understand each one in detail.

1. 8421 BCD Code (Natural Binary Coded Decimal)

This is the most common BCD code.

  • Each digit has positional weights: 8, 4, 2, 1

  • Decimal numbers 0–9 are represented as 0000–1001

      Decimal    8421 BCD
00000
10001
20010
30011
40100
50101
60110
70111
81000
91001

Example: Convert Decimal 59 into 8421 BCD

  • 5 → 0101

  • 9 → 1001
    So, 59 = 0101 1001 (BCD)


2. 5421 BCD Code

In this system, the weights are: 5, 4, 2, 1

  • Each decimal digit 0–9 is represented by a unique combination of these weights.

        Decimal        5421 BCD
00000
10001
20010
30011
40100
51000
61001
71010
81011
91100

Example: Convert Decimal 59 into 5421 BCD

  • 5 → 1000

  • 9 → 1100
    So, 59 = 1000 1100 (BCD in 5421 code)



3. 2421 BCD Code

This is a self-complementing code, meaning:

  • The code for a digit and its 9’s complement add up to 1111.

  • Weights: 2, 4, 2, 1

 Decimal2421 BCD
00000
10001
20010
30011
40100
51011
61100
71101
81110
91111

Example: Convert Decimal 59 into 2421 BCD

  • 5 → 1011

  • 9 → 1111
    So, 59 = 1011 1111 (BCD in 2421 code)



  • 8421 BCD → Most practical, widely used in calculators, clocks, and digital systems.

  • 5421 BCD → Alternative weighted code, less common.

  • 2421 BCD → Self-complementing code, useful for error checking and arithmetic simplifications.

Mastering these codes is essential for Digital Electronics, Computer Science, and Competitive Exams (GATE, ESE, etc.).


Click here to download:



Comments

Popular posts from this blog

Decimal Number Conversion

Excess-3 (XS-3) Code in Digital Electronics – Explained with Examples