Here we will talk about the four type of codes that is:
Let's start with BCD code.
Binary Coded Decimal (BCD) code is the simplest binary code to represent a decimal number.
In BCD code, a decimal number is represent by 4-binary bit. If a decimal number consist of two or more than two digit, then each decimal digit is individually represented by 4-bit binary equivalent. For example, (278)10 in BCD is represented as given in the following photo:
Therefore we can say that the number 278 in binary is represented as 0010 0111 1000 or (278)10 = 0010 0111 1000.
BCD code is a weighed code, that is the weight of four binary bits which represent an individual digits are 8, 4, 2, 1 modern computer perform subtraction using complements and there is a difficulty in forming complements when number are represented by BCD codes.
In Excess-3 code, 3 is added to the individual digit of a decimal number then these binary equivalent are written. For example, (278)10 in excess-3 code is represented by 0101101011. This code is not a weighted code.
2421 code is another BCD code. It is weighed code. For example, 6 is 1100 and 3 is 0011.
The gray code is a binary code. The binary bits are arranged in such a way that only one binary bit changes at a time when we make a change from any number to the next.
Gray code is reflected code. This code is used in shaft encodes which indicates the angular position of a shaft in digital form. Shaft position encoder disks are used as sensors. It is not a weighted code. Gray code can be constructed using the following properties:
The table given below shows an example of all the four type of code converted into each other.
|Decimal No.||BCD (8421)||Excess-3 Code||2421 Code||Gray Code|
© Copyright 2021. All Rights Reserved.