computer number systems this presentation will show conversions between binary, decimal, and...

42
Computer Number Systems This presentation will show conversions between binary, decimal, and hexadecimal numbers

Upload: adam-bridges

Post on 23-Dec-2015

227 views

Category:

Documents


0 download

TRANSCRIPT

Computer Number Systems

This presentation will show conversions between binary, decimal, and

hexadecimal numbers

Let us review the decimal system…

It is called Base 10 and uses 10 characters, the numbers 0

through 9.

Each position has a value, ones, tens, hundreds, etc. Remember, we move to the right to find the

values.Example: 258

The 2 is hundreds, 5 is tens, and 8 is ones.

We find the values by multiplying by 1, 10, 100,

etc.2 X 100 = 200

5 X 10 = 508 X 1 = 8

This totals to 258.

It’s binary time!!!!!

Bi means two. Therefore, binary numbers have only two choices,

either 0 or 1.

Here is an example of a binary number

0 0 1 0 1 0 1 1This would convert to 43 in our

decimal number system.

LOST ????

Think of each 1 or 0 as a light switch being on or off. 1 means

on and 0 means off.

Each position of the 1 or 0 has a decimal value. We start on the right with the value of 1. We

move to the left and double it to find the next value.

128 64 32 16 8 4 2 1 0 0 1 0 1 0 1 1

The decimal numbers increase in value from right to left.

128 64 32 16 8 4 2 1 0 0 1 0 1 0 1 1We add all of the decimal numbers having a binary position value of 1.

128 64 32 16 8 4 2 1 0 0 1 0 1 0 1 1

43 = 32 + 8 + 2 + 1

Practice

128 64 32 16 8 4 2 1 0 1 0 1 1 1 1 0

? = + + + +

Did you find the answer to be 94?

128 64 32 16 8 4 2 1 1 1 1 0 0 0 1 1

Answer: 227

More practice:

Try these:0 1 0 0 1 0 1 11 0 0 0 1 1 0 10 1 0 1 1 0 1 0

Your answers should be:75

14190

Now it’s hexadecimal time!!!3F7A

Hexadecimal is referred to as a Base 16 system. This means we use 16 characters when counting. Our decimal system is Base 10

and uses ten characters(the numbers 0 to 9).

Do you notice a pattern from the chart? It starts over with

multiples of 16(and you thought Math would never be used).

Hexadecimal uses the numbers 0 through 9 and letters A through F as its characters. This makes 16

characters, thus, Base 16.

When counting in hexadecimal, think of the characters as being place holders rather than digits.

The decimal 24 would be hexadecimal one eight. Also, decimal 29 would be one D.

Review the table.

Get a copy of the table from the instructor.

How do I convert decimal to hexadecimal???? Divide by 16

and find the remainder.

Example: 18 16 = 1 with remainder of 2. So, decimal 18

would be hex one two (12).

Ex: 24 16 = 1 remainder 8. So, decimal 24 would be hex one

eight (18h). The small h denotes the number is hexadecimal.

What about 30? Divide by 16 to get 1 remainder 14. Now what?? There are probably 4 or 5 ways to go from here. Most people just count to 14 to find what letter is

needed. This will find the answer to be one E (1Eh).

Try 66?

Was the answer 42h? 66 16 = 4 remainder of 2.

Practice changing decimal to hex: 808592

159160

Answers:50h55h5Ch9FhA0h

How is the answer A0?????What character comes after 9?

A

See a pattern???If the decimal is evenly divisible by 16, then the hexadecimal ends

in zero.

Remember, the sequence repeats every 16 characters.

Continue with the LAP…

0 + 0 = 01 + 0 = 10 + 1 = 1

1 + 1 = 10 (carry of 1 to the next higher column)

0 1 10 0 1--------1 0 0

1 0 1 0 (10)0 0 1 1 (03)---------1 1 0 1 (13)

1 1 1 11 1 1 1 0 (30)0 1 0 1 1 (11)---------------

1 0 1 0 0 1 (41)

1 1 11 0 1 1 1 (23)1 0 1 0 1 (21)----------------

1 0 1 1 0 0 (44)

0 – 0 = 01 – 0 = 11 – 1 = 00 – 1 = 1

(with a borrow from the next higher column)

1 1 0 0 (12)1 0 0 0 (08)-------------0 1 0 0 (04)

1 1 0 1 1 (27)0 1 0 0 1 (09)

-----------------------1 0 0 1 0 (18)

0 11 0 1 0 1 1

-----------0 1 0

1 2 0 2 0 2

1 0 1 0 1 (21)0 1 1 1 0 (14)

-----------0 0 1 1 1 (07)

0* 0 = 01 * 0 = 00 * 1 = 01 * 1 = 1

(Multiplication table)

0 / 0 = 01 / 0 = 01 / 1 = 1

(Division Table)

Convert Binary into Real numberNote: real numbers – the whole number which have

decimal value 1110.01 = ?