number system

25
Number Systems

Upload: renie

Post on 22-Jul-2016

6 views

Category:

Documents


0 download

DESCRIPTION

Logic Circuits

TRANSCRIPT

Page 1: Number System

Number Systems

Page 2: Number System

Objective

Page 3: Number System

Introduction

Page 4: Number System

Decimal Numbering System• Uses ten (10) as a base, also called base-

10 system.• It uses ten digit symbols: 0, 1, 2, 3, 4, 5,

6, 7, 8, and 9.• Each number position represents a

weighting factor (positional value system) which is a power of the base ten. (1, 10, 100, 1000, etc.)

Page 5: Number System

Why do we use 10 digits, anyway?• Digit is derived from the Latin word for

“finger”

Page 6: Number System

Decimal: Example• 4175.8610 can be computed as:

=(4 x 103) + (1 * 102) + (7 * 101) + (5 * 100) + (8 * 10-1) + (6 * 10-2)

• 7,392.42 is equal to: = (7 * 103) + (3 * 102) + (9 * 101) + (2 * 100) + (4

* 10-1) + (2 * 10-2)

Page 7: Number System

Octal Numbering System• A base-eight numbering system with eight

digits of 0,1,2,3,4,5,6,7.

Decimal Octal -------- ------

0 0 1 1 7 7 8 10 9 11

Page 8: Number System

Octal (cont.)• For example to count in octal the digits

combine after reaching a count of 7 1,..7,10,11,12,…,17,20,21,…,75,76,77,100

• For two octal digits the largest number is 77 so the two octal digits end after at 77.

Page 9: Number System

Octal (cont.)• To find the decimal number equal to an

octal number:

• (127.4)8

= (1* 82) +(2 * 81) + (7 * 80) + (4 * 8-1 )

= (87.5)10

• (4536)8 = (4x83) + (5x82) + (3x81) + (6x80)= (1362)10

Page 10: Number System

Summary: Octal• In the octal system, a number with digits XYZ

can be written as:• XYZ8

= (X x 82) + (Y x 81) + ( Z x 80)Sixty fours Eights Ones

32768 4096 512 64 8 1

…. 85 84 83 82 81 80

Page 11: Number System

Hexadecimal Numbering System• Has a base-16 • There are 16 digits in this system: 0, 1..9, and A,

B, C, D, E, F)Hexadecimal Decimal

----------- ------- 0 0 1 1 …….. ……

9 9 A 10

B 11 …….. ……

E 14 F 15

Page 12: Number System

Hexadecimal (cont.)• To count in hexadecimal: 0..F,10,11,…

19,1A,1B,..,1E,1F,20, 21,….99,9A,…,9F,A0,A1…..,FE,FF,100

• For two hexadecimal digits the largest number is FF so the two hexadecimal digits end after at FF.

Page 13: Number System

Hexadecimal (cont.)• To find the decimal number equal to a

hexadecimal number:• (B65F)16

= (11 * 163)+ (6 * 162)+ (5 * 161)+ (5 * 160)= (46,687)10

• Try this…—(BCF) 16

—(FA.CE) 16

Page 14: Number System

Hexadecimal (cont.)• XYZ16 = X x 162 + Y x 161 + Z x 160

256s 16s 1s

1048576 65536 4096 256 16 1 …. 165 164 163 162 161 160

Page 15: Number System

Binary Numbering System• Uses two (2) as a base, made of binary

digits (bits): 0 and 1; useful to represent switch positions (open or closed).

• Leftmost bit position is called Most Significant Bit (MSB).

• Right most bit position is called Least Significant Bit (LSB).

Page 16: Number System

Binary Numbering System• Groups of eight bits are called a byte

—(11001001) 2

• Groups of four bits are called a nibble.— (1101) 2

21 20 Base 10 Equivalent

0 0 00 1 11 0 21 1 3

Page 17: Number System

Conversion of Integer from Decimal to other Bases• For each digit position:

1. Divide decimal number by the base.2. The remainder is the lowest-order digit3. Repeat first two steps until no divisor

remains.

• Example: (13)10 = _____ 2IntegerQuotient

13/2 = 6 + ½ a0 = 1 6/2 = 3 + 0 a1 = 0 3/2 = 1 + ½ a2 = 1 1/2 = 0 + ½ a3 = 1

Remainder Coefficient

Answer (13)10 = (a3 a2 a1 a0)2 = (1101)2

Page 18: Number System

Integer Conversion:• Try This:

—(53)10 = _____ 2

—(255)10 = _____ 8

—(2008)10 = _____ 16

—(100)10 = _____ 4

—(1024)10 = _____ 12

Page 19: Number System

Conversion of Fractions from Decimal to other Bases• For each digit position:

1. Multiply decimal number by the base.2. The integer is the highest-order digit3. Repeat first two steps until fraction

becomes zero (or repeated/continuous).

• Example: (0.625)10 = ____2

Integer

0.625 x 2 = 1 + 0.25 a-1 = 10.250 x 2 = 0 + 0.50 a-2 = 00.500 x 2 = 1 + 0 a-3 = 1

Fraction Coefficient

Answer (0.625)10 = (0.a-1 a-2 a-3 )2 = (0.101)2

Page 20: Number System

Conversion• Try This…

—(0.8125)10= ______2

—(0.3125)10 = ______8

Page 21: Number System

Hexadecimal to Binary Conversion• Converting from Hex to Binary is easy:

• Every hex digit becomes 4 binary digits

• Example #1: (1AF5) 16

=(0001 1010 1111 0101) 2

• Example #2: (306.D)16

= ( 0011 0000 0110. 1101 )2

Page 22: Number System

Binary to Hexadecimal Conversion• Just as simple, reverse to process

• Example: (11100101010101.1101) 2

=(0011 1001 0101 0101 . 1101) 2 =(3955.D) 16

Page 23: Number System

Octal to Binary• Converting from Octal to Binary is trivial:

• Every octal digit becomes 3 binary digits

• Example: (17.5 ) 8

=(001 111 . 101) 2

Page 24: Number System

Binary to Octal• Just as simple, reverse to process

• Example: (11001010101.011101) 2

=(011 001 010 101 . 011 101) 2 =(3125.35) 8

• Note: Using the hex and octal equivalent instead of binary numbers are more convenient and less prone to errors.

Page 25: Number System

Exercises: