CHP 2-Number System
CHP 2-Number System
CHP 2-Number 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
There are only 0 and 1 These two binary digits are commonly referred to as bits
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
Ex. 2:-
Ex.3:-
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
Know the weight of each bit in a binary number Add them together to get its decimal equivalent
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
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
Start from the right and group 4 bits at a time, replacing each 4-bit binary number with its hex equivalent
Ex 2:-
Convert to binary first and then convert to hex Convert directly from decimal to hex by repeated division, keeping track of the remainders
10
Ex. 2:-
Ex.3:-
Convert from hex to binary and then to decimal Convert directly from hex to decimal by summing the weight of all digits
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
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
If the second digit is greater than the first, borrow 16 from the preceding digit
14
Numbers 0 to 9 All the letters of English alphabet, uppercase and lowercase Many control codes and punctuation marks
ASCII Code
15
BINARY ARITHMETIC
16
BINARY ARITHMETIC
17
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
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
Ex.:-
20
Ex.:-
BINARY ARITHMETIC
21
Ex.:-
BINARY ARITHMETIC
22
BINARY ARITHMETIC
Binary Number
256 possible combination of eight bits.
23
BINARY ARITHMETIC
Ex.:-
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.:
25
BINARY ARITHMETIC
Binary division is the repeated process of subtraction, just as in decimal division. Ex.:
26
Ex.:-
BINARY ARITHMETIC
27
Ex.:-
BINARY ARITHMETIC
28
DIGITAL PRIMER
29
DIGITAL PRIMER
30
DIGITAL PRIMER
31
THE END
32