0% found this document useful (0 votes)
8 views13 pages

EEE 3103 - Binary-Error Detection-Gray Codes

The document covers binary codes, including Binary Coded Decimal (BCD), Excess-3, and 2421 codes, explaining their representations and properties. It also discusses error detection methods using parity bits and introduces the Gray code, which features single bit changes between code words. These concepts are essential in digital electronics for data representation and error checking.

Uploaded by

mahmudhasansami
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views13 pages

EEE 3103 - Binary-Error Detection-Gray Codes

The document covers binary codes, including Binary Coded Decimal (BCD), Excess-3, and 2421 codes, explaining their representations and properties. It also discusses error detection methods using parity bits and introduces the Gray code, which features single bit changes between code words. These concepts are essential in digital electronics for data representation and error checking.

Uploaded by

mahmudhasansami
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

EEE 3103:Digital Electronics-I

Binary Codes, Error Detection Code, & Gray Code


Reference: Digital Design by M. Morris Mano & Michael D. Ciletti [5th Edition]
Digital Fundamentals by Thomas L. Floyd [11th Edition]

Prepared by-
Baizeed Ahmed Bhuiyan
Lecturer (Grade-I)
Department of Electrical and Electronic Engineering
Ahsanullah University of Science and Technology
❑ BINARY CODES:
Decimal BCD Excess-3 8 4 -2 -1 2421
8421
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
➢ BCD stands for Binary Coded Decimal
❑Binary-Coded Decimal Code
Although the binary number system is the most natural system for a computer because it is
readily represented in today’s electronic technology, most people are more accustomed to the
decimal system. One way to resolve this difference is to convert decimal numbers to binary,
perform all arithmetic calculations in binary, and then convert the binary results back to decimal.
This method requires that we store decimal numbers in the computer so that they can be
converted to binary. Since the computer can accept only binary values, we must represent the
decimal digits by means of a code that contains 1’s and 0’s. It is also possible to perform the
arithmetic operations directly on decimal numbers when they are stored in the computer in
coded form.
A number with k decimal digits will require 4k bits in BCD. Decimal 396 is represented in BCD
with 12 bits as 0011 1001 0110, with each group of 4 bits representing one decimal digit. A
decimal number in BCD is the same as its equivalent binary number only when the number is
between 0 and 9. A BCD number greater than 10 looks different from its equivalent binary
number, even though both contain 1’s and 0’s. Moreover, the binary combinations 1010 through
1111 are not used and have no meaning in BCD. Consider decimal 185 and its corresponding
value in BCD and binary:
(185)10 = (0001 1000 0101)BCD = (10111001)2
The 2421 and the excess‐3 codes are examples of self‐complementing
codes. Such codes have the property that the 9’s complement of a
decimal number is obtained directly by changing 1’s to 0’s and 0’s to
1’s (i.e., by complementing each bit in the pattern). For example,
decimal 395 is represented in the excess‐3 code as 0110 1100 1000.
The 9’s complement of 604 is represented as 1001 0011 0111, which
is obtained simply by complementing each bit of the code (as with the
1’s complement of binary numbers). The excess‐3 code has been used
in some older computers because of its self-complementing property.
Excess‐3 is an unweighted code in which each coded combination is
obtained from the corresponding binary value plus 3. Note that the
BCD code is not self‐complementing.
Decimal BCD 2421
8421
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
❑ Parity Method for Error Detection
Many systems use a parity bit as a means for bit error detection.
A parity bit tells if the number of 1s is odd or even. Any group
of bits contain either an even or an odd number of 1s. A parity
bit is attached to a group of bits to make the total number of 1s
in a group always even or always odd. An even parity bit makes
the total number of 1s even, and an odd parity bit makes the
total odd. A given system operates with even or odd parity, but
not both. For instance, if a system operates with even parity, a
check is made on each group of bits received to make sure the
total number of 1s in that group is even. If there is an odd
number of 1s, an error has occurred.
❑ Error Detection Code: Even Parity Odd Parity
Message Parity Bit Message Parity Bit
0000 0000
0001 0001
0010 0010
0011 0011
0100 0100
0101 0101
0110 0110
0111 0111
1000 1000
1001 1001
1010 1010
1011 1011
1100 1100
1101 1101
1110 1110
1111 1111
Transmit Receive Check
Even Even Ok
Even Odd Error
Odd Odd Ok
Odd Even Error
❑The Gray Code
The Gray code is unweighted and is not an arithmetic code; that is,
there are no specific weights assigned to the bit positions. The
important feature of the Gray code is that it exhibits only a single bit
change from one code word to the next in sequence. This property is
important in many applications, such as shaft position encoders, where
error susceptibility increases with the number of bit changes between
adjacent numbers in a sequence.
Like binary numbers, the Gray code can have any number of bits.
❑ Gray Code: Decimal Binary Code Gray Code
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
10 1010
11 1011
12 1100
13 1101
14 1110
15 1111

You might also like