Lecture 5 Binary Codes
Lecture 5 Binary Codes
Lecture 5 Binary Codes
Weighted codes
o BCD (8421)
o 6311
o 2421
o 642-3
o 84-2-1
Non_ Weighted codes
o Excess-3
o Gray
Alphanumeric codes.
o EBCDIC
o ASCII
Error detection codes (Parity).
Weighted codes and non-weighted codes are used to represent the decimal
numbers.
Alphanumeric codes are used to represent the numeric and nonnumeric data
(characters).
Error detection codes are used to detect the errors during the data
transmission.
Weighted codes use 4 binary digits to represent (0-9) decimal numbers.
2. BCD code (8421 code)
Simplest form: each decimal digit is replaced by its binary equivalent.
937.25
(937.25)= (100100110111.00100101)BCD
𝟖𝟓𝟒𝟏𝟎 = 100001010100(BCD)
BCD is inefficient, e.g. to represent 999 and 999999 bits needed:
o 10 and 20 in binary numbers
o 12 and 24 for BCD code.
Solution:
Divide the BCD number into four-bit groups and convert each to decimal:
6 8 3 9
0110100000111001(BCD) = 683910
BCD is used in interfacing between a digit device and a human being, e.g.
digital voltmeter (DVM).
a) 564810
b) 100011012
Solution:
3. Alphanumeric codes
A complete alphanumeric code would include the 26 lowercase characters, 26
uppercase characters, 10 numeric digits, etc.
There are many choices of codes sets to represent alphanumeric characters and
several control characters.
Two well accepted code sets are used for information coding:
o EBCDIC code: extended binary coded decimal interchange code.
o ASCII Code: American standard code for information interchange: The
ASCII code is a seven-bit code, and so it has 27 =128 possible code groups.
Example: Write the ASCII code for the message: The email is
Answer: