CHP 2-Number System
-
Upload
kecik-qayyum -
Category
Documents
-
view
216 -
download
0
Transcript of CHP 2-Number System
-
8/13/2019 CHP 2-Number System
1/32
LED 30303-
MICROPROCESSOR
BASED SYSTEM
CHAPTER 2:-
NUMBER SYSTEM
1
-
8/13/2019 CHP 2-Number System
2/32
2
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
OB
J
E
CT
I
V
E
S
-
8/13/2019 CHP 2-Number System
3/32
Human beings use base 10 (decimal)
arithmetic
There are 10 distinct symbols, 0, 1, 2, , 9
Computers use base 2 (binary) system
There are only 0 and 1
These two binary digits are commonly
referred to as bits
3
NUMBERING
AND
CODING
SYSTEMS(1)
Decimal andBinary Number
Systems
-
8/13/2019 CHP 2-Number System
4/32
Divide the decimal number by 2 repeatedly
Keep track of the remainders
Continue this process until the quotientbecomes zero
Write the remainders in reverse order to
obtain the binary number
4
NUMBERING
AND
CODING
SYSTEMS(2)
Converting fromDecimal to Binary
(1)
-
8/13/2019 CHP 2-Number System
5/32
5
Ex. 2:- Ex.3:-NUMBERING
AND
CODING
SYSTEMS(2)
Converting fromDecimal to Binary
(2)
RESULT
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
-
8/13/2019 CHP 2-Number System
6/32
Know the weight of each bit in a binary
number
Add them together to get its decimalequivalent
Use the concept of weight to convert a
decimal number to a binary directly
Ex.
6
NUMBERING
AND
CODING
SYSTEMS(3)
Converting fromBinary to Decimal
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
-
8/13/2019 CHP 2-Number System
7/32
7
Base 16, the
hexadecimalsystem, is
used as a convenient
representation of binary
number
Ex.
It is much easier to
represent a string of 0sand 1s such as
100010010110 as its
hexadecimal equivalent
of 896H
NUMBERING
AND
CODING
SYSTEMS(4)
HexadecimalSystem
-
8/13/2019 CHP 2-Number System
8/32
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
To convert from hex to binary
Each hex digit is replaced with its 4-bit binary
equivalent
8
NUMBERING
AND
CODING
SYSTEMS(5)
Convertingbetween Binary
and Hex (1)
-
8/13/2019 CHP 2-Number System
9/32
Ex 2:-
9
NUMBERING
AND
CODING
SYSTEMS(5)
Convertingbetween Binary
and Hex (2)
-
8/13/2019 CHP 2-Number System
10/32
Convert to binary first and then convert to
hex
Convert directly from decimal to hex byrepeated division, keeping track of the
remainders
10
NUMBERING
AND
CODING
SYSTEMS(6)
Converting fromDecimal to Hex
(1)
-
8/13/2019 CHP 2-Number System
11/32
11
Ex. 2:- Ex.3:-NUMBERING
AND
CODING
SYSTEMS(6)
Converting fromDecimal to Hex
(2)
Note:it may not always be possible toobtain an exact equivalent of the
fractional part of a number. The
accuracy depend on the number of
decimal places considered
-
8/13/2019 CHP 2-Number System
12/32
Convert from hex to binary and then to
decimal
Convert directly from hex to decimal bysumming the weight of all digits
Ex:-
12
NUMBERING
AND
CODING
SYSTEMS(7)
Converting fromHex to Decimal
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
-
8/13/2019 CHP 2-Number System
13/32
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
13
NUMBERING
AND
CODING
SYSTEMS(8)
Addition of HexNumbers
-
8/13/2019 CHP 2-Number System
14/32
If the second digit is greater than the first,
borrow 16 from the preceding digit
14
NUMBERING
AND
CODING
SYSTEMS(9)
Subtraction ofHex Numbers
-
8/13/2019 CHP 2-Number System
15/32
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
The ASCII system uses 7 bits to represent
each code
15
NUMBERING
AND
CODING
SYSTEMS(10)
ASCII Code
-
8/13/2019 CHP 2-Number System
16/32
Rules of Binary Addition
Ex.:- (without carry)
16
BINARY
ARITHMETIC
Binary Addition(1)
-
8/13/2019 CHP 2-Number System
17/32
Ex.:- (with carry)
17
BINARY
ARITHMETIC
Binary Addition(2)
-
8/13/2019 CHP 2-Number System
18/32
Rules of Binary subtraction
Ex.:-
18
BINARY
ARITHMETIC
Binary Subtraction
-
8/13/2019 CHP 2-Number System
19/32
BINARY
ARITHMETIC
Binary Subtractionusing Complement
(1)
Most microprocessor do not have a
subtraction circuitry
It is possible to do the subtraction by using
the complements Two types:-
1s complement
2s complement
1s complement or radix-minus-onecomplement is obtain by inverting each bit
of the binary number
e.g.:15510= %1001 1011 0110 0100
2s complement or radix-minus-twocomplement is obtain by inverting each bit
of the binary number and then adding 1 to
the least significant bit 19e.g.:15510= %1001 1011 0110 0100 => 0110 0101+ 1
-
8/13/2019 CHP 2-Number System
20/32
Ex.:-
Ex.:-
20
BINARY
ARITHMETIC
Binary Subtractionusing Complement
(2)
-
8/13/2019 CHP 2-Number System
21/32
BINARY
ARITHMETIC
Binary Subtractionusing Complement
(3)
Ex.:-
21
-
8/13/2019 CHP 2-Number System
22/32
Ex.:-
22
BINARY
ARITHMETIC
Binary Subtractionusing Complement
(4)
-
8/13/2019 CHP 2-Number System
23/32
23
BINARY
ARITHMETIC
Binary Number
256 possible combination of eight bits.
-
8/13/2019 CHP 2-Number System
24/32
Rules of Binary multiplication
Ex.:-
24
BINARY
ARITHMETIC
BinaryMultiplication
(1)
Note:The rules of binary multiplication
are the same as the truths of the AND
gate
-
8/13/2019 CHP 2-Number System
25/32
Another Method: Binary multiplication is
the same as repeated binary addition; add
the multicand to itself the multiplier
number of times.
Ex.:-
25
BINARY
ARITHMETIC
BinaryMultiplication
(2)
-
8/13/2019 CHP 2-Number System
26/32
Binary division is the repeated process of
subtraction, just as in decimal division.
Ex.:-
26
BINARY
ARITHMETIC
Binary Division(1)
-
8/13/2019 CHP 2-Number System
27/32
Ex.:-
27
BINARY
ARITHMETIC
Binary Division(2)
-
8/13/2019 CHP 2-Number System
28/32
Ex.:-
28
BINARY
ARITHMETIC
Binary Division(3)
-
8/13/2019 CHP 2-Number System
29/32
29
DIGITAL
PRIMER
Logic Gates
(1)
-
8/13/2019 CHP 2-Number System
30/32
30
DIGITAL
PRIMER
Logic Gates
(2)
-
8/13/2019 CHP 2-Number System
31/32
31
DIGITAL
PRIMER
Logic Gates
(3)
-
8/13/2019 CHP 2-Number System
32/32
THEEND32