10-Dec-2019 - Binary - Codes - 3
10-Dec-2019 - Binary - Codes - 3
Binary Codes
• Bit – binary digit
• An n-bit binary code is a group of n bits that assumes up
to 2n distinct combinations of 1’s and 0’s, with each
combination representing one element of the set that is
being coded
• Minimum number of bits to code 2n distinct quantities is n
Decimal Codes
J.Saira Banu
Self Complementary Code
• 9’s complement of the decimal number is obtained by changing 1’s
to 0’s and 0’s to 1’s
• Ex: 395 in 2 4 2 1 code is 0011 1111 1011
9’s complement of 395 = 604 in 2 4 2 1 is 1100 0000 0100
Examples of self complementary codes –
• 8 4 -2 -1 code
• 2 4 2 1 code
• Excess-3 code
Error detection codes
• Used to detect errors during transmission
• A parity bit is an extra bit included with a message to
make the total number of 1’s either odd or even
• The message including the parity bit is transferred to the
destination
• In the receiving end, all the incoming bits are applied to a
“parity check” network to check the proper parity
adopted.
• An error is detected if the checked parity does not
correspond to the adopted one.
Parity bit generation
Reflected code
• Number in reflected code
changes by only one bit
as it proceeds from one
number to the next.
• It is a non weighted
code.
• Also known as gray
code
• There are many possible
gray codes
• One possibility is shown
here
Alphanumeric Code
• It is a binary code of a group of elements
consisting of the ten decimal digits, the 26 letters
of alphabets and special symbols.
1. 7 bit ASCII code (American Standard Code for
Information Interchange)
– lower case + upper case + numerals+special
+control characters
– 94 Graphic printing characters.
– 34 Non-printing characters
2. 8 bit EBCDIC –Extended BCD Interchange code
ASCII Code
Control Characters in ASCII
References
• M. Morris Mano – Digital Logic and
Computer Design PHI – 5th Edition- 2004.
pp. 12 - 20