Anda di halaman 1dari 10

5.

Numbering Systems
Decimal Numbering System (Base 10)
Each position of a whole number contains ten possible digits from 0 to 9.
For a four digit decimal number the least significant position (the right
most digit) has weight 100 and the most significant position (left most)
has weight 103 as
Four digit number
103

102

101

100

X 1000

X 100

X 10

X1

Example 1
4623
3 x 100 = 3 x 1 =
3
2 x 101 = 2 x 10 =
20
6 x 102 = 6 x 100 = 600
4 x 103 = 4 x 1000 = 4000 +
4623

Example 2

257310
= 2 x 103 + 5 x 102 + 7 x 101 + 3 x 100
= 2000 + 500 + 70 + 3
= 2573
x
In 10 , x is the power of 10 and is called the weighting factor
Binary Numbering System (Base 2)
Binary system has only two digits 0 or 1. Weighting factors for binary
positions are powers of 2.
8 bit
system

27
X 128

26
X 64

25
X 32

24
X 16

Page 1 of 10

23

22

21

20

X8

X2

Binary to Decimal Conversion


Example: Convert 010101102 to decimal
= 0x27+1x26+0x25+1x24+0x23+1x22+1x21+0x20
=
64 +
16 +
4 + 2
= 8610
Binary Fractions
Weighting values are less than 1 and fractional powers of 2.

2-1
0.5

2-2
0.25

2-3

2-4

0.125

0.0625 0.03125

2-5

Example 1: Convert 1011.10102 to decimal


= 1x23+0x22+1x21+1x20 . 1x2-1+0x2-2+1x2-3+0x2-5
= 8 +
2 + 1 . 0.5 +
0.125
= 11.62510
Example 2: Convert 0.011012 to decimal
= 0. 0x2-1+1x2-2+1x2-3+0x2-4+1x2-5
= 0.
0.25 + 0.125+
0.03125
= 0.4062510
Decimal to Binary Conversion
Example 1: Convert 13310 to binary
133
-128
27
5
-4
22
1
-1
20
0
Answer: 100001012

Page 2 of 10

Example 2: Convert 12210 to binary


122
-64
26
58
-32
25
26
-16
24
10
-8
23
2
-2
20
0
Answer: 011110102

Example 3: Convert 95.062510 to binary


95
.0625
6
-64
2
-.0625
2-4
31
0
4
-16
2
15
-8
23
7
-4
22
3
-2
21
1
-1
20
0
Answer: 01011111.00012
Example 4: Convert 27.187510 to binary
27
.1875
4
-16
2
-.125
2-3
11
0.0625
3
-8
2
-0.0625
2-4
3
0
1
-2
2
1
-1
20
0
Answer: 00011011.00112
Digital systems generally deal with 4, 8, 16 or 32 Binary Digits or Bits
therefore we try to keep all our answers to conform to that form.
Page 3 of 10

Octal Numbering System (Base 8)


Binary numbers grouped in 3s. The eight allowable digits are from 0 to
7.

87

Decimal
0
1
2
3
4
5
6
7
8
9
10

86

85

84

83

82

81

80

4096

512

64

Binary (Groups of 3)
000
001
010
011
100
101
110
111
001 000
001 001
001 010

Octal
0
1
2
3
4
5
6
7
10
11
12

Binary to Octal Conversion


We group binary numbers in groups of three starting from the Least
Significant Bit (LSB) and write the octal equivalent.
Example 1: Convert 0111012 to octal
= 011 101
= 3 5 = 358
Example 2: Convert 101110012 to octal
= 010 111 001
= 2 7 1 = 2718
Octal to Binary Conversion
Example: Convert 6248 to binary
= 110 010 100 = 1100101002
Page 4 of 10

Octal to Decimal Conversion


Example: Convert 3268 to decimal
3268
6 x 80 = 6 x 1 =
6
2 x 81 = 2 x 8 = 16
3 x 82 = 3 x 64 = 192 +
21410

Decimal to Octal Conversion


Example: Convert 48610 to octal
Method 1:

486
-448
38
-32
6

7 x 82
4 x 81
6 x 80

Answer: 7468

Method 2:
436 / 8 = 60 remainder 6
60 / 8 = 7 remainder 4
7 / 8 = 0 remainder 7
We write the remainders in reverse order to get the answer as 7468
Hexadecimal Numbering System (Base 16)
Hexadecimal system uses 16 different digits and uses 4 bit groupings.
Data in 8-, 16- or 32- bit digital systems can be represented as a 2-, 4- or
8- digit hexadecimal code.
167

166

165
65536

164

163

162

161

160

4096

512

256

16

Page 5 of 10

Decimal
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

Binary
0000 0000
0000 0001
0000 0010
0000 0011
0000 0100
0000 0101
0000 0110
0000 0111
0000 1000
0000 1001
0000 1010
0000 1011
0000 1100
0000 1101
0000 1110
0000 1111
0001 0000
0001 0001
0001 0010
0001 0011
0001 0100

Hexadecimal
00
01
02
03
04
05
06
07
08
09
0A
0B
0C
0D
0E
0F
10
11
12
13
14

To signify a hexagonal number, a subscript 16 or the letter H is used.


Two hexadecimal digits represent 8 bits or 1 byte of information.

Binary to Hexadecimal conversion


Example: Convert 011011012 to hexadecimal
= 0110 11012
= 6

D in hexadecimal = 6D16 or 6DH

Hexadecimal to Binary Conversion


Example: Convert A9H to binary
= 1010 1001 in binary = 101010012
Page 6 of 10

Hexadecimal to Decimal conversion


Example: Convert 2A6H to decimal
Example
2A6H
6 x 160 = 6 x 1 =
6
A x 161 = 10 x 16 = 160
2 x 162 = 2 x 256 = 512 +
67810

Example: Convert 2A6H first to binary and then to decimal


= 0010 1010 01102 = 2+4+32+128+512 = 67810
Decimal to Hexadecimal conversion
Example 1: Convert 15110 to hexadecimal
151 / 16 = 9 remainder 7
9 / 16 = 0 remainder 9
Answer: 97H
Example 2: Convert 49810 to hexadecimal
498 / 16 = 31 remainder 2
31 / 16 = 1 remainder 15 (F)
1 / 16 = 0 remainder 1
Answer: 1F2H

Binary Coded Decimal System (BCD)


BCD is used to represent each ten decimal digits as 4-bit binary code. So
to convert to BCD, we convert each decimal digit to its 4 bit binary code.
Example 1: Convert 49610 to BCD
= 0100 1001 0110BCD
Example 2: Convert 0111 0101 1000BCD to decimal
= 7 5 810

Page 7 of 10

Example 3: Convert 0110 0100 1011BCD to decimal


=64*
* not possible because 1011 is not a valid BCD number as they can have
values from 0 to 9 only.

The ASCII Code


To get information into and out of computers we need more than number
representations, because we need to represent letters and symbols. The
special codes that represent all letters symbols and numbers is called the
alphanumeric code.
The industry standard for the Input /Output code is the American
Standard Code for Information Interchange or ASCII.
ASCII code uses 7 bits to represent all alphanumeric data used for
computer input /output. These 7 bits give 128 different code
combinations for the alphanumeric code as shown in Table 5.
Each time a key is depressed on the keyboard, the key is converted to
ASCII and processed by the computer. After processing the output is sent
to the display or a printer and reconverted from ASCII to English text.

Page 8 of 10

Table 5
American Standard Code for Information Interchange (ASCII)
MSB
LSB
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111

000

001

010

011

100

101

NUL
SOH
STX
ETX
EOT
ENQ
ACK
BEL
BS
HT
LF
VT
FF
CR
SO
SI

DLE
DC1
DC2
DC3
DC4
NAK
SYN
ETB
CAN
EM
SUB
ESC
FS
GS
RS
US

SP
!

#
$
%
&

(
)
*
+
,
.
/

0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
?

@
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O

P
Q
R
S
T
U
V
W
X
Y
Z
[
\
]

Definition of control abbreviations


ACK
Acknowledge
BEL
Bell
BS
Backspace
CAN
Cancel
CR
DC1-DC4
DEL
DLE
EM
ENQ
EOT
ESC
ETB
ETX
FF
FS

GS
HT
LF
NAK

Carriage return
NUL
Direct control
RS
Delete idle
SI
Data link escape
SO
End of medium
SOH
Enquiry
SP
End of transmission
STX
Escape
SUB
End of transmission block
End text
SYN
Form feed
US
Form separator
VT
Page 9 of 10

110

111

a
b
c
d
e
f
g
h
I
j
k
l
m
n
o

p
q
r
s
t
u
v
w
x
y
z
{
|
}
~
DEL

Group Separator
Horizontal tab
Line feed
Negative
acknowledge
Null
Record separator
Shift in
Shift out
Start of heading
Space
Start text
Substitute
Synchronous idle
Unit separator
Vertical tab

Exercises: 5 Numbering Systems


1. Convert the following binary numbers to decimal
(a) 0110 (610), (b) 1100 (1210), (c) 0100 1011 (7510), (d) 1010 0111
(16710)
2. Convert the following decimal numbers to 8-bit binary
(a) 18610 (

), (b) 2710(

), (c) 25110 (

3. Convert the following binary numbers to octal


(a) 011001 (318), (b) 1011100 (1348), (c) 1101101 (1558)
4. Convert the following octal numbers to binary
(a) 748 (

), (b) 328 (

), (c) 618 (

5. Convert the following octal numbers to decimal


(a) 378 (3110), (b) 728 (5810), (c) 518 (4110)
6. Convert the following decimal numbers to octal
(a) 12610(

), (b) 8710 (

), (c) 9410(

7. Convert the following binary numbers to hexadecimal


(a) 1101 1100 (DC16), (b) 1111 1011 (FB16), 0111 0100 (7416)
8. Convert the following hexadecimal numbers to binary
(a) FA16 (

), (b) D616 (

), (c) A9416 (

9. Convert the following hexadecimal numbers to decimal


(a) F416 (24410), (b) AB16 (17110), (c) 3C516 (96510)
10. Convert the following decimal numbers to hexadecimal
(a) 12710 (

), 10710 (

), (c) 2910 (

11. Convert the following BCD numbers to decimal


(a) 1001 1000BCD (9810), (b) 0111 0100BCD (7410), (c) 1000 0001BCD
(8110)
12. Convert the following decimal numbers to BCD
(a) 14210 (

), (b) 9410 (

), (c) 4410 (

13. Use the ASCII Table to convert the following to ASCII


(a) $14 (0100100 0110001 0110100), (b) N-6, (c) CPU, (d) Pg
Page 10 of 10

Anda mungkin juga menyukai