beautypg.com

Motorola M6800 User Manual

Page 21

background image

MPU-21

1011112 = lx2

0 + 1x21 + lx22 + lx23 + 0x24 + 1x25

= 1x1 + 1x2 + 1x4 + 1x8 + 0x16 + 1x32
= 1 + 2 + 4 + 8 + 0 + 32
= 4710

In general, converting from a number in any base to a number in base

10 is accomplished as follows:

(A0 B

0 + A

1 B

1 + A

2 B

2 + A

3 B

3 + A

4 B

4 -- -- -- -- A

n B

n)


where B is the base of the number system and A is the particular digit in the

original number corresponding to its position to the left of the decimal

point. On the example just completed, (101111). A0 = 1, A1 = 1, A2 = 1, A3 =

1, A4 = 0, & A5 = 1 and B = 2 (base 2).

Another base which is very convenient in digital computers is base

8, since base 8 is really a convenient way of representing base 2. Lets

illustrate by converting a base 10 number to base 8 & base 2. Let's convert

61 in base 10 to a number in base 8 and a number in base 2. By continuous

division:

7

8 61

R=5

0

8 7

R=7

758


30

2 61

R=1

15

2 30

R=0

7

2 15

R=1

3

2 7

R=1

1111012

1

2 3

R=1

0

2 1

R=1