Excess Code_gray code,paritycode
Excess Code_gray code,paritycode
BCD and Gray code representations and Error Detecting code and
Hamming code
Codes
• Computer/digital circuits process data in binary format.
• Binary data is usually represented using particular format/code
• For example , (1000001)2 is represented as
• ______ in binary
• ______ in BCD
• _______ in ASCII code
Binary coded decimal (BCD) number representation
• It is sometimes desirable to manipulate numbers in decimal instead of
converting them binary .
- Decimal to binary and binary to decimal conversion process is complex.
• One popular code to represent decimal digits is BCD.
• Each decimal digit is represented by its 4 bit equivalent
• Conversion is much easier
• Examples
• Decimal 238 BCD: 0010 0011 1000 The six 4 bit combinations
1010,1011,1100,1101,1110 and
• Decimal 12.39 BCD:0001 0010 . 0011 1001 1111 are unused
BCD Binary
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
Addition of BCD numbers
• When we add two BCD numbers,we may have to go for a correction step
where 6(0110) is added to one of the nibbles.
1,Either when a nibble is one of the six invalid combinations, or
2, There is a carry in from the previous nibble.
• Examples
• 23+46 23+48 28+39
1
01101110
1,
2, How gray code is self-reflecting code?
Error Detection codes-parity codes
• Digital signals are processed and transmitted from one system to
another system.
• When these binary signals are transmitted from one location
(transmitter) to another location (receiver) , transmission error occur
because of electrical noise in the transmission channel.
• Because of this error 0 is detected as ‘1’ and ‘1’ is detected as ‘0’
• When codes like BCD , ASCII etc are transmitted there is always a
finite probability of occurrence of error in single bit.
• The probability of occurrence of error in two or more bit
simultaneously is substantially smaller
• If an occurrence of error is known, appropriate action, like
retransmitting the data, can be taken. One of the methods of
improving data integrity is to encode the data in a suitable manner.
Criteria of minimum distance of the
codeword
• It is useful property of error detecting code.
• The minimum distance of a code is smallest number of bits in which
any two code words differ. (= changes in number of bit position in two
codewords)
• Example: the minimum distance between 01001 and 11100 is
_______
Valid or invalid codeword
• For detecting single bit error, distance between a pair of codeword
must be atleast 2.
• For example: C1 : 1 0 0 0 1
C2 : 1 0 0 0 0
• Therefore, for detection of ‘k’ errors , distance must be at-least (k+1)
5 0 0 1 0 1
6 1 0 1 1 0 C1=b1Ꚛb3Ꚛb5Ꚛb7
C2= b2Ꚛb3Ꚛb6Ꚛb7
7 0 0 1 1 1 C3= b4Ꚛb5Ꚛb6Ꚛb7
8 1 1 0 0 0
9 0 1 0 0 1
How to correct the bits
• Calculate the three check bits
• C1=b1Ꚛb3Ꚛb5Ꚛb7
• C2= b2Ꚛb3Ꚛb6Ꚛb7
• C3= b4Ꚛb5Ꚛb6Ꚛb7
• C3C2C1=000 no error
• C3C2C1 gives the error position
Construct hamming code for 0110.use even parity?
If hamming code sequence 1100110 is transmitted, due to error it is transmitted as 1110110.Locate thr position of
error using parity check and correct the sequence
Thankyou