BCD (Binary Coded Decimal)
·
It represents 0 to 9 digits.
·
4-bits binary = 1-bit BCD.
·
Invalid BCD numbers are 1010, 1011, 1100, 1101,
1110 and 1111.
Decimal Digit BCD
0 1 2 3 4 5 6 7 8 9
(decimal number)
0000 0001
0010 0011 0100
0101 0110 0111
1000 1001 (BCD code)
Convert
BCD code into Decimal number
(10000110)2
Step 1: break the given number in 4, 4-bit.
1000 0110
Step 2: convert these 4-bit into their respective decimal numbers.
1000 0110
8 6
Given BCD is (86)10 in Decimal number.
Convert
Decimal number into BCD code
(453)10
Step 1: convert each decimal digit into 4-bit of binary number.
4 5 3
0100 0101 0011
Step 2: join these binary digits.
(010001010011)2
BCD
Addition
23 →
00100011
+15 → 00010101
38 → 00111000
BCD
Subtraction
86-41=?
41 → 01000001 → 2’s compliment → 10111111 → -41
86 → 10000110
-41 → 10111111
45 → 1 01000101
Here left most 1 is discarded.
Note:
If
answer of addition or subtraction of BCD numbers is invalid, then add +6 or -6
respectively to their answers to get valid answer.
0 comments :
Post a Comment