company logo dkt 122/3 digital system 1 week #2 number systems, operation & codes (part 1)

40
Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Upload: ella-cummings

Post on 18-Jan-2016

226 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Company

LOGODKT 122/3

DIGITAL SYSTEM 1

WEEK #2 NUMBER SYSTEMS, OPERATION & CODES

(PART 1)

Page 2: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Numbers & Codes

Numbering Systems Decimal numbering system (Base 10) Binary numbering system (Base 2) Hexadecimal numbering system (Base 16) Octal numbering system (Base 8)

Number Conversion Binary Arithmetic 1’s and 2’s Complements of Binary

Numbers

Page 3: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Numbers & Codes (cont..)

Signed Numbers Arithmetic Operations with Signed Numbers

Other Number Codes Binary-Coded-Decimal (BCD) ASCII codes Gray codes

Digital Codes & Parity

Page 4: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Numbering Systems

0 ~ 9

0 ~ 1

0 ~ 7

0 ~ F

Decimal(base 10)

Binary(base 2)

Octal(base 8)

Hexadecimal(base 16)

Page 5: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Num. Systems (Characteristics)

The digits are consecutive (berturutan).

The number of digits is equal to the size of the base.

Zero is always the first digit.

When 1 is added to the largest digit, a sum of zero and a carry of one results.

Numeric values determined by the implicit positional values of the digits.

Page 6: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

00000000000000010000001000000011000001000000010100000110000001110000100000001001000010100000101100001100000011010000111000001111

000001002003004005006007010011012013014015016017

0123456789ABCDEF

0123456789

101112131415

BinaryOctalHexDec

Numbering Systems (Cont.)

Page 7: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Numbering System (Decimal)

Also called the Base 10 system Have 10 digits : 0 9 The position for each digit in the decimal

number indicates the magnitude of the quantity represented and can be assigned a weight

Page 8: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Numbering System (Decimal)

The weight for whole numbers are positive powers of ten that increase from right to left

105 104 103 102 101 100

For fractional numbers, the weights are negative powers of ten that decrease from left to right

102 101 100 . 10-1 10-2 10-3….

Decimal point

Page 9: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Numbering System (Binary)

Also called the Base 2 system The binary number system is used to

model the series of electrical signals computers use to represent information

0 represents the no voltage or an off state

1 represents the presence of voltage or an on state

Page 10: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Just think for a while..

“There are 10 kinds of mathematicians.

Those who can think binarily and those who can't...”

So, what is the meaning of this?

YOU FALL IN WHICH

CATEGORY?

Page 11: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Significant Digits

Binary: 11101101

Hexadecimal: 1D63A72A

Most significant digit (MSB) Least significant digit (LSB)

Question: How many bits does the numbers represent?

Page 12: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Number Conversion

Any Radix (base) to Decimal Conversion

Page 13: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Binary to Decimal Conversion

Decimal value of any binary number can be found by adding weights of all bits that are 1 and discarding the weights of all bits that are 0

Page 14: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Solve this..

(a) 10102

(b) 101112

Answer : ?

Answer : ?

(c) 10101102

Answer : ?

Convert the following binary numbers to decimal

Page 15: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Decimal to Binary Conversion

For whole number conversion, use the repeated division-by-2 process and record the remainder

For fractional number conversion, use repeated multiplication by 2 until the fractional product is 0 or until the desired number of decimal places is reached

Page 16: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

2 5 = 12 + 1 2

1 2 = 6 + 0 2

6 = 3 + 0 2

3 = 1 + 1 2

1 = 0 + 1 2 MSB LSB 2510 = 1 1 0 0 1 2

Remainder

Decimal to Binary Conversion

Whole number

Page 17: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Decimal to Binary Conversion

Carry . 0 1 0 10.3125 x 2 = 0.625 0 0.625 x 2 = 1.25 1

0.25 x 2 = 0.50 0

0.5 x 2 = 1.00 1

The Answer: 1 1 0 0 1.0 1 0 1

MSB LSB

Fractional number

Page 18: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Solve this..

(a) 3910

(b) 5810

Answer : ?

Answer : ?

(c) 0.37510

Answer : ?

Convert the following decimal numbers to binary

Page 19: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Binary Arithmetics

Binary Addition Binary Subtraction Binary Multiplication Binary Division

Page 20: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Binary Addition

Four basic rules for adding binary digits (bits) are:

0 + 0 = 0 (Sum of 0 with a carry of 0)

0 + 1 = 1 (Sum of 1 with a carry of 0)

1 + 0 = 1 (Sum of 1 with a carry of 0)

1 + 1 = 1 0 (Sum of 0 with a carry of 1)

Page 21: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Examples

Perform the following binary additions:

(a) 100 + 10

1 0 0

1 0+

1 1 0 (Answer)

(b) 111 + 11

1 1 1

1 1+

1 0 1 0 (Answer)

Page 22: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Solve this..

(a) 11 + 01

(b) 111 + 110

Answer : ?

Answer : ?

(c) 1001 + 101:Answer : ?

Perform the following binary additions:

Page 23: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Binary Arithmetics

Binary Addition Binary Subtraction Binary Multiplication Binary Division

Page 24: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Binary Subtraction

Four basic rules for subtracting binary digits (bits) are:

0 - 0 = 0

1 - 1 = 0

1 - 0 = 1

1 0 - 1 = 1 (0 – 1 with a borrow of 1)

Page 25: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Examples

Perform the following binary subtractions:

(a) 101 – 011

1 0 1

0 1 1-

0 1 0 (Answer)

(b) 110 – 101

1 1 0

1 0 1-

0 0 1 (Answer)

Page 26: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Solve this..

(a) 101 – 100

(b) 1110 - 11

Answer : ?

Answer : ?

(c) 1100 - 1001:Answer : ?

Perform the following binary subtractions

Page 27: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Binary Arithmetics

Binary Addition Binary Subtraction Binary Multiplication Binary Division

Page 28: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Binary Multiplication

Four basic rules for muliplying binary digits (bits) are:

0 x 0 = 0

0 x 1 = 0

1 x 0 = 0

1 x 1 = 1

Page 29: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Examples

Multiply 111 and 101:

1 1 1

1 0 1x

1 1 10 0 0

1 1 1

1 0 0 0 1 1 (Answer)

Page 30: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Solve this..

(b) 110 x 111:

(c) 1101 x 1010:

Answer : ?

Answer : ?

(a) 11 x 11:Answer : ?

Page 31: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Binary Arithmetics

Binary Addition Binary Subtraction Binary Multiplication Binary Division

Page 32: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Binary Division

Division in binary follows the same procedure as division in decimal

Example: Perform the binary divisions of 110 11

1 1 01 1

1 0

1 1

0 0 0

(Answer)

Page 33: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Solve this..

(a) 100 10Answer : ?

(b) 1100 100:

Answer : ?

Divide the binary numbers as indicated:

Page 34: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Changing all the 1s to 0s and all the 0s to 1s

Example:

1 1 0 1 0 0 1 0 1 Binary number

0 0 1 0 1 1 0 1 0 1’s complement

1’s Complement

Page 35: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

2’s Complements

Find the 1’s complements of the numbers

1 1 1 0 1 0 1 0 1 Binary number 0 0 0 1 0 1 0 1 0 1’s complement

Step 1: Step 1:

Step 2: Step 2: Add ‘1’ to the 1’s complements

0 0 0 1 0 1 0 1 0 1’s complement + 1 Add 1 0 0 0 1 0 1 0 1 1 2’s complement

Page 36: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Solve this..

(a) 00010110

Answer : ?

(b) 10010001

Answer : ?

Determine the 2’s complement of each binary number:

Page 37: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Left most is the sign bit 0 is for positive, 1 is for negative

Sign & magnitude

00011001 = +25

sign bit magnitude bits

Signed Numbers

Page 38: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Sign-Magnitude Numbers

Sign bit

0 = positive

1 = negative

31 bits for magnitude

0110010.. …00101110010101

The left-most is the sign bit and the remaining bits are the magnitude bits

Page 39: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

1’s complement

The negative number is the 1’s complement of the corresponding positive number

Example

+25 is 00011001 So, -25 is 11100110

2’s complement

The positive number – same as sign magnitude and 1’s complement

The negative number is the 2’s complement of the corresponding positive number.

Example

+25 is 00011001 So, -25 is 11100111

Signed Numbers (Cont.)

Page 40: Company LOGO DKT 122/3 DIGITAL SYSTEM 1 WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)

Solve this..

Express +19 and -19 (as an 8-bit number) ini. sign magnitude

ii. 1’s complement

iii. 2’s complement

Answer : ?

Answer : ?

Answer : ?

END