Binary Codes For Decimal Digits
Binary Codes For Decimal Digits
n 2b
Example: 10 decimal digits (0-9) can be
represented by 4-bit binary code.
CODE
FOR
DECIMAL
DIGITS
PAGE 1
7421 code
Weighted code with weights 7-4-2-1.
For decimal number 7, choose code with least number of 1s.
Biquinary code
Weighted code with weight 5-0-4-3-2-1-0.
A seven-bit code with error-detection properties.
Each decimal digit consists of (5) 0s and (2) 1s placed in the
corresponding columns.
Always use weights 5 or 0 at the left side.
5311 code
Weighted code with weights 5-3-1-1.
In 5311 code, if a number has more than one representation, choose
the code with least number of 1s and use first the 1 from extreme
right.
DECIMAL
5311
NUMBER
0
0000
1
0001
2
0011
3
0100
4
0101
5
1000
6
1001
7
1011
8
1100
9
1101
PAGE 2
DECIMAL
NUMBER
0
1
2
3
4
5
6
7
GRAY CODE
DECIMAL
NUMBER
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
GRAY CODE
000
001
011
010
110
111
101
100
0000
0001
0011
0010
0110
0111
0101
0100
1100
1101
1111
1110
1010
1011
1001
1000
1 0 1
0 1 0 1
1 1 1
Binary
Gray Code
PAGE 3
14
1 1 1 0
0 1 1 1 0
1 0 0 1
Binary
Gray Code
14
1 1 1
/ /
1 0 1
Gary Code
1 0 0 1
/ / /
1 1 1 0
Gray Code
Binary
Binary
number of 1s is odd
number of 1s is even
PAGE 4
ASCII TABLE
PAGE 5
EBCDIC TABLE
PAGE 6
DRILL PROBLEMS
I. Fill the table below.
DEC NBCD 84-2-1
CODE
2421
CODE
5421
CODE
5311
CODE
XCS-3
CODE
BIQUINARY
GRAY
CODE
0110
1001
0111
1111
1001000
II. Express the word COE in ASCII using even parity generator and odd parity generator.
Answer:
ASCII with even parity =____________________________________________2
ASCII with odd parity = ____________________________________________2
REFERENCES
[1] Thomas, Floyd L., Digital Fundamentals, 4th Edition, Macmillan Publishing
Company, New York, 1990
[2] Mano, M. and Kime, C., Logic and Computer Design Fundamentals, 2nd Edition,
Prentice Hall Intl., N.J., 2001
[3] Mano, M., Digital Design, 2nd Edition, Prentice Hall, N.J, 1991
[4] Hall, D., Microprocessors and Interfacing: Programming and Hardware, 2nd
Edition, Glencoe Division of Macmillan/McGraw-Hill School Publishing Company,
1992
[5] Tocci, R. and Widmer, N., Digital Systems: Principles and Applications, 8th
Edition, Prentice Hall Inc., N.J., 2001
[6] Swidlec Lecture Notes by Edzel Lapira, DLSU
NOTES004 BINARY CODE FOR DECIMAL DIGITS
DIGITAL SYSTEM I LECTURE NOTES by Engr. Analene Montesines-Nagayo
PAGE 7