Fundamentals of Logic Design , Spring Semester, 2023
Non pure binary codes
Tutorial -2
Some weighted BCD codes ( complete the table)
Dec 8421 4221 7421 5211 74-2-1 84-2-1 -3642
0 0000 0000 0000 0000 0000
1 0001 0001 0001 0001 0111
2 0010 0010 0010 0011 0110
3 0011 0011 0011 0101 0101
4 0100 0110 0100 0111 0100
5 0101 0111 0101 1000 1010
6 0110 1010 0110 1001 1001
7 0111 1011 0111 1011 1000
8 1000 1110 1001 1101 1111
9 1001 1111 1010 1111 1110
Examples
convert 739 to 74-2-1 BCD word ?
solution : 1001 0101 0011
1. If 1001 0001 0011 is an 8421 BCD word , what is the code word for the same
number in 5211 BCD Word ?
Ans : convert 8421 word to decimal > which is (913)
then to 5211 BCD word > which is ( 1111 0001 0101 )
Parity codes
A Simple method of error detection is to use an additional bit , called parity bit , with
each binary word. Odd and even parity coding can be used
Even and odd parity coded binary numbers
Binary numbers Even parity binary Odd parity binary
0000 0000 10000
0001 10001 0001
0010 10010 0010
0011 0011 10011
0100 10100 0100
0101 0101 10101
0110 0110 10110
0111 10111 0111
1000 11000 1000
1001 1001 11001
1Page Ismail yusif
Fundamentals of Logic Design , Spring Semester, 2023
Non pure binary codes
Tutorial -2
"m out of n " codes
An alternative method of detecting errors is to uses m out of n code , where n
represents the total number of bits in binary word, where m must be set to 1 . If more
or less than n bits are set to 1 , then errors are present.
Example : Devise a "2 out of 5 "code to represent the decimal digit 0 to 9 ?
Ans:
" 2 in 5" Decimal digit
00011 0
00101 1
00110 2
01001 3
01010 4
01100 5
10001 6
10010 7
10100 8
11000 9
Example :
in the following bar code a wide black bar represent 1 , and the narrow black bar 0, if
the bar code uses " 2 out of 5 " coding what is its decimal value ? .
Ans: scanning the code from left to Right in group of 5 bits
00110 10001 01010 11000 00110
The decimal value 26492
Challenge
1. Convert the following decimal numbers to Excess-3 code? " non weighted code "
(a) 3 (b 87 (c) 349
2. What is the Gray code ? is used for ? write the list of the Gray code from
0...9 ( Mano page 41)
2Page Ismail yusif
Fundamentals of Logic Design , Spring Semester, 2023
Non pure binary codes
Tutorial -2
ASCII Character Code (Morris mano page 42 )
Many applications of digital computers require the handling not only of numbers, but also of
other characters or symbols, such as the letters of the alphabet. The standard binary code
for the alphanumeric characters is the American Standard Code for Information
Interchange (ASCII), which uses seven bits to code 128 characters, as shown in Table
3. Decode the following ASCII code: 1010011 1110100 1100101 1110110
1100101 0100000 1001010 1101111 1100010 1110011.
Ans : Steve Jobs
4. The following is a string of ASCII characters whose bit patterns have been
converted into hexadecimal for compactness: 73 F4 E5 76 E5 4A EF 62 73.
Of the eight bits in each pair of digits, the leftmost is a parity bit. The
remaining bits are the ASCII code.
a) Convert the string to bit form and decode the ASCII.
b) Determine the parity used: odd or even?
5. To insert an ASCII character in word document , press and hold down ALT
while typing the character code for example , 0179 for degree( ) symbol
.(use numeric keyboard)
3Page Ismail yusif