Sie sind auf Seite 1von 32

LED 30303MICROPROCESSOR BASED SYSTEM

CHAPTER 2:-

NUMBER SYSTEM
1

O B J E C T I V E S

Understand the concept of numbering and coding systems Convert numbers in binary and hexadecimal into decimal equivalents and vice versa Represent binary and hex numbers using the complement systems Addition of binary numbers Subtraction of binary numbers using complement systems Perform multiplication and division of binary numbers Logic Gates

NUMBERING AND CODING SYSTEMS (1)

Human beings use base 10 (decimal) arithmetic

There are 10 distinct symbols, 0, 1, 2, , 9

Computers use base 2 (binary) system

Decimal and Binary Number Systems

There are only 0 and 1 These two binary digits are commonly referred to as bits

NUMBERING AND CODING SYSTEMS (2)

Divide the decimal number by 2 repeatedly Keep track of the remainders Continue this process until the quotient becomes zero Write the remainders in reverse order to obtain the binary number

Converting from Decimal to Binary (1)

NUMBERING AND CODING SYSTEMS (2)

Ex. 2:-

Ex.3:-

Converting from Decimal to Binary (2)

Note: it may not always be possible to obtain an exact equivalent of the fractional part of a number. The accuracy depend on the number of decimal places considered

RESULT
5

NUMBERING AND CODING SYSTEMS (3)

Know the weight of each bit in a binary number Add them together to get its decimal equivalent

Converting from Binary to Decimal

Use the concept of weight to convert a decimal number to a binary directly

Ex.
6

Note: it may not always be possible to obtain an exact equivalent of the fractional part of a number. The accuracy depend on the number of decimal places considered

NUMBERING AND CODING SYSTEMS (4)

Base 16, the hexadecimal system, is used as a convenient representation of binary number

Hexadecimal System

Ex. It is much easier to represent a string of 0s and 1s such as 100010010110 as its hexadecimal equivalent of 896H

NUMBERING AND CODING SYSTEMS (5)

To represent a binary number as its equivalent hexadecimal number

Start from the right and group 4 bits at a time, replacing each 4-bit binary number with its hex equivalent

Converting between Binary and Hex (1)

To convert from hex to binary

Each hex digit is replaced with its 4-bit binary equivalent

NUMBERING AND CODING SYSTEMS (5)

Ex 2:-

Converting between Binary and Hex (2)

NUMBERING AND CODING SYSTEMS (6)

Convert to binary first and then convert to hex Convert directly from decimal to hex by repeated division, keeping track of the remainders

Converting from Decimal to Hex (1)

10

NUMBERING AND CODING SYSTEMS (6)

Ex. 2:-

Ex.3:-

Converting from Decimal to Hex (2)


Note: it may not always be possible to obtain an exact equivalent of the fractional part of a number. The accuracy depend on the number of decimal places considered 11

NUMBERING AND CODING SYSTEMS (7)

Convert from hex to binary and then to decimal Convert directly from hex to decimal by summing the weight of all digits

Converting from Hex to Decimal

Ex:-

Note: it may not always be possible to obtain an exact equivalent of the fractional part of a number. The accuracy depend on the number of decimal places considered

12

NUMBERING AND CODING SYSTEMS (8)

Adding the digits together from the least significant digits

If the result is less than 16, write that digit as the sum for that position If it is greater than 16, subtract 16 from it to get the digit and carry 1 to the next digit

Addition of Hex Numbers

13

NUMBERING AND CODING SYSTEMS (9)

If the second digit is greater than the first, borrow 16 from the preceding digit

Subtraction of Hex Numbers

14

NUMBERING AND CODING SYSTEMS (10)

The ASCII (pronounced ask-E) code assigns binary patterns for

Numbers 0 to 9 All the letters of English alphabet, uppercase and lowercase Many control codes and punctuation marks

ASCII Code

The ASCII system uses 7 bits to represent each code

15

Rules of Binary Addition

BINARY ARITHMETIC

Binary Addition (1)

Ex.:- (without carry)

16

Ex.:- (with carry)

BINARY ARITHMETIC

Binary Addition (2)

17

Rules of Binary subtraction

BINARY ARITHMETIC

Ex.:-

Binary Subtraction

18

Most microprocessor do not have a subtraction circuitry It is possible to do the subtraction by using BINARY the complements ARITHMETIC Two types:

1s complement 2s complement

Binary Subtraction using Complement (1)

1s complement or radix-minus-one complement is obtain by inverting each bit of the binary number
e.g.: 15510 = %1001 1011 0110 0100

2s complement or radix-minus-two complement is obtain by inverting each bit of the binary number and then adding 1 to the least significant bit 19
e.g.: 15510 = %1001 1011 0110 0100 + 1 => 0110 0101

Ex.:-

BINARY ARITHMETIC

Binary Subtraction using Complement (2)

Ex.:-

20

Ex.:-

BINARY ARITHMETIC

Binary Subtraction using Complement (3)

21

Ex.:-

BINARY ARITHMETIC

Binary Subtraction using Complement (4)

22

BINARY ARITHMETIC

Binary Number
256 possible combination of eight bits.

23

Rules of Binary multiplication

BINARY ARITHMETIC

Ex.:-

Binary Multiplication (1)

Note: The rules of binary multiplication are the same as the truths of the AND gate

24

Another Method: Binary multiplication is the same as repeated binary addition; add BINARY the multicand to itself the multiplier ARITHMETIC number of times. Ex.:

Binary Multiplication (2)

25

BINARY ARITHMETIC

Binary division is the repeated process of subtraction, just as in decimal division. Ex.:

Binary Division (1)

26

Ex.:-

BINARY ARITHMETIC

Binary Division (2)

27

Ex.:-

BINARY ARITHMETIC

Binary Division (3)

28

DIGITAL PRIMER

Logic Gates (1)

29

DIGITAL PRIMER

Logic Gates (2)

30

DIGITAL PRIMER

Logic Gates (3)

31

THE END
32

Das könnte Ihnen auch gefallen