Professional Documents
Culture Documents
DIGITAL ELECTRONIC
• Binary-to-Decimal conversion
• Decimal-to binary conversion
• Octal number system
• Hexadecimal number system
• Binary Coded Decimal (BCD) Code
• Alphanumerical code
• Parity method for error detection
AND Gate
1
0
Octal (base 8)
Hexadecimal
(base16)
• (13)10
• (0.625)10
2)
0625 x 2 = 1.250
0.250 x 2 = 0.500
0.500 x 2 = 1.000
• Answer (0.625)10=0.1012
rohana sapawi/digital electronics 11
Converting binary to decimal
• We can use the same trick to convert binary, or base 2, numbers to
decimal. The only difference is that the weights are powers of 2.
• For example, here is 1101.01 in binary:
1) 110112
(1 x 24) + (1 x 23) + (0 x 22) + (1 x 21) + (1 x 20)
16 + 8+ 0 + 2+ 1 = 2710
2) (110110101
x 27) +(0 x 226) +(1 x 25) +(1 x 24) + (0 x 23) + (1 x 22)
+ (0 x 21) + (1 x 20)
128 + 0 + 32 + 16 + 0+ 4 +
0 + 1
= 18110
rohana sapawi/digital electronics 13
The Growth of Binary Numbers
n 2n n 2n
0 20=1 8 28=256
1 21=2 9 29=512
2 22=4 10 210=1024
3 23=8 11 211=2048
4 24=16 12 212=4096
3728 = 3 X 82 + 7 X 81 +2 X 80
= 3 X 64 + 7 x 8 +2 X 1
= 25010
175/ 8 = 21 rem 7
21 / 8 = 2 rem 5
2 / 8 = 0 rem 2
2 3 5 2 3 100 4
101 5
Thus 100111010100112 = 235238 110 6
111 7
rohana sapawi/digital electronics 17
Converting octal to binary
To convert a octal: 235238
2 3 5 2 3 binary octal
000 0
001 1
010 011 101 010 011 010 2
011 3
100 4
101 5
Thus 235238 = 100111010100112 110 6
111 7
rohana sapawi/digital electronics 18
Base 16 is useful too
• The hexadecimal system uses 16 digits: Decimal
Decimal Binary
Binary Hex
Hex
00 0000
0000 00
0123456789ABCDEF
11 0001
0001 11
• You can convert between base 10 and 22 0010
0010 22
base 16 using techniques like the ones we 33 0011
0011 33
just showed for converting between 44 0100
0100 44
decimal and binary. 55 0101
0101 55
• For our purposes, base 16 is most useful 66 0110
0110 66
as a “shorthand” notation for binary 77 0111
0111 77
numbers. 88 1000
1000 88
99 1001
1001 99
– Since 16 = 24, one hexadecimal digit
10
10 1010
1010 AA
is equivalent to 4 binary digits. 11 1011 BB
11 1011
– It’s often easier to work with a 12 1100 CC
12 1100
number like B4 instead of 10110100. 13 1101 DD
13 1101
• Hex is frequently used to specify things 14
14 1110
1110 EE
like 32-bit IP addresses and 24-bit colors. 15
15 1111
1111 FF
• Binary coded decimal (BCD) represents each decimal digit with four
bits
– Ex. 0011 0010 1001 = 32910
3 2 9
2 different methods
Odd-parity Even-parity
P Information Bits
11000011 01000011
Added even parity bit Added odd parity bit