BINARY CODED DECIMAL: B.C.D.
• ANOTHER METHOD TO REPRESENT DECIMAL NUMBERS • USEFUL BECAUSE MANY DIGITAL DEVICES PROCESS + DISPLAY NUMBERS IN TENS
IN BCD EACH NUMBER IS DEFINED BY A BINARY CODE OF 4 BITS. *** 8 – 4 – 2 – 1 MOST COMMON CODE 8 – 4 – 2 – 1 CODE INDICATES THE WEIGHT OF EACH BIT 23 – 22 – 21 – 20 E.G. 934 = 1001 0011 0100 9 3 4 FOR EACH DIGIT A BINARY [NORMAL] CODE IS ALLOCATED. OHER REPRESENTATION FORMS ARE 2-4-2-1 AND EXCESS-3
Ovidiu Ghita
Page 77
Digital Electronics, 2003
BINARY 8-4-2-1 2-4-2-1 EXCESS-3 NOT USED 0000 0 0 NOT USED 0001 1 1 NOT USED 0010 2 2 0011 3 3 0 0100 4 4 1 NOT USED 0101 2 5 NOT USED 0110 3 6 NOT USED 0111 4 7 NOT USED 1000 5 8 NOT USED 1001 6 9 NOT USED NOT USED 1010 7 NOT USED 1011 5 8 NOT USED 1100 6 9 NOT USED NOT USED 1101 7 NOT USED NOT USED 1110 8 NOT USED NOT USED 1111 9
• WE WILL USE 8-4-2-1 BCD • DECIMAL NUMBERS > 9 MAY BE OBTAINED WHEN ADDING TWO DECIMAL DIGITS (RANGE: 0-18) I.E. 0 + 0 ÷ 9 + 9. ONLY 0o9 HAVE THE CORRECT BCD CODE.
• WE NEED TO CORRECT THE OTHERS
Ovidiu Ghita Page 78
Digital Electronics, 2003
DECIMAL UNCORECTED CORRECTED BCD SUM BCD SUM C’3 S’3 S’2 S’1 S’0 CN S3 S2 S1 S0 0 0 0 0 0 0 0 0 0 9 10 11 12 13 14 15 16 17 18 19 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 1 1 0 0 1 1 0 0 1 1 1 0 1 0 1 0 1 0 1 0 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 1 1 1 0 0 0 0 0 1 1 0 0 1 1 0 0 1 0 1 0 1 0 1 0 1 0 1
1 1 1 1
1 1 1 1 1 1 1 1 1 1
• 0o9 ONLY LEGAL CODES
E.G. 19 = 1 9 = 0001 1001 = 11001 THUS, FOR SUMS BETWEEN 10 o 18 MUST SUBTRACT 10 AND PRODUCE A CARRY SUBTRACT 10 = 10102 COMPLEMENT = 0110 >> ADD 2’s
Ovidiu Ghita
Page 79
Digital Electronics, 2003
4-BIT BCD ADDER
TO ADD TWO DIGITS FOR SUMS >9 WE NEED TO ADD 2’s COMPLEMENT of 1010 TO THE UNCORRECTED RESULT (S’3 S’2 S’1 S’0) CORRECTION IS ALSO NEEDED WHEN A CARRY OUT (C’3) IS GENERATED [NUMBERS 16 o 18] >>>> A DECODER IS REQUIRED TO DETECT WHEN CARRY OUT (CN) TO THE NEXT STAGE IS NEEDED