Chapter 3
Chapter 3
CHAPTER THREE
Bit is the smallest unit of data that can be stored in a computer. It is a single bit
that can be stored in a computer. In other words, it is a single bit that can
represent two values; either 0 or 1.
Nibble
Without question, the most important data structure used by the most
microprocessor is the byte. A byte consists of eight bits and is the smallest
addressable datum (data item) in the microprocessor. It is the most important
data structure & is used by most microcomputer.
The bits in a byte are numbered from bit zero (b0) through seven (b7) as follows:
b7 b6 b5 b4 b3 b2 b1 b0
Byte also contains exactly two nibbles. Since a byte contains eight bits, it can
^
represent 2 8, or A 256, different values. Generally, we'll use a byte to represent:
Eventually, the number systems that can are generally used by the computers
are:
• Decimal system
• Binary system
• Octal system
• Hexadecimal system
Number
Radix value Set of Digits Example
system
Decimal r = 10 (0,1,2,3,4,5,6,7,8,9) (25)10
Binary r=2 (0,1) (11001)2
Octal r=8 (0,1,2,3,4,5,6,7) (31)8
(0,1,2,3,4,5,6,7,8,9,A,
Hexadecimal r = 16 (1A)16
B,C,D,E,F)
1. Decimal Number system
▪ It is the primary number system used. Derived from the Latin word ‘Decimal’,
which means ten.
▪ Starting at the decimal point and moving to the left, each position is represented
by the base value raised to a power. 103 102 101 100
▪ Moving to the right of the decimal is just like moving to the left except that we will
need to place a minus sign in front of each power. . 10-1 10-2 10-3
Eg 9735 = (9x103) + (7x102) + (3x101) + (5x100)
2. Binary Number System
▪ Computers do not use the ten digits of the decimal system for counting and
arithmetic. Their CPU and Memory are made up of millions of tiny switches that
can be either in the ON or OFF states.
▪ The number system with only two digits (0 & 1) is called Binary number system.
The place value of the binary number system is based on the number two. In the
binary number system with base 2, the weight of n th bit of the number from Right
Hand Side (RHS) is nth bit x 2n-1
Binary-Decimal-Octal Comparison
2 36 Remainder
Least Significant Bit (LSB)
2 18 0
2 9 0
2 4 1
2 2 0
2 1 0
0 1 Most Significant Bit (MSB)
8 359 Remainder
8 44 Least Significant Bit (LSB)
7 8 5
4 8 0
5 Most Significant Bit (MSB)
So (359) 10 = (547)8
Octal number 2 3 1
Binary 010 011 001
number
So, (231) 8 = (010011001) 2
16
16 319 8=8
16 19 15=F
16 1 3=3
16 0 1=1 Most Significant Bit (MSB) So, (5112) 10 =
(13F8) 16
11. Conversion of Decimal fractions to Hexadecimal fractions: To
perform this operation we follow the following steps.
1. Multiply the decimal fraction by 16 (the base of the
hexadecimal system).
2. If a whole number is generated, record the whole number
otherwise place 0.
3. Repeat steps 1 and 2 with decimal fraction until it becomes 0.
4. Finally, when no more multiplication can occur, write down the
remainders in the down ward direction.
E.g. determine the hexadecimal equivalent of (0.625) 10
0.625 x 16 = 10.000 10
0.000 x 16 = 0.000 0
So, (0.625) 10 = (0.A0) 16
0 -1 -2
(A.23) 16 = (A x 16 ) + (2 x 16 ) + (3 x 16 )
=10 + 0.125 + 0.01171875
= 10.13671875
14. Conversion of Binary to hexadecimal: Steps
1. Break the binary number into 4-bit sections starting from the LSB to
the MSB.
2. Convert the 4-bit binary number to its hexadecimal equivalent. E.g.
determine the hexadecimal equivalent of (11001011) 2.
Binary 1100 1011
number
Decimal 12 11
number
Hexadecimal C (MSB) B (LSB)
number
So (11001011) 2 = (CB) 16
Que. Determine the hexadecimal equivalent of
(101011110011011001) 2.
15. Conversion of Hexadecimal to Binary: Steps that are followed here
are the following
+ 1 0 1 0
1 1 0 0 1 Thus the binary sum is (11001) 2.
II. Binary Subtraction: Subtraction is generally simple in comparison to
addition since only two numbers are involved. In binary subtraction the
problem ‘borrow’ is similar to that in decimal. If the subtrahend bit is
equal to or smaller than the minuend bit, then perform subtraction,
otherwise borrow one from its left most neighbor. Binary subtractions
follow four rules for the operation.
Inpu Output
t
X Y Difference (D) Borrow (B)
0 0 0 0
0 1 1 1
1 0 1 0
1 1 0 0
E.g. find the binary difference of (1101-1011).
Binary Decimal
1 0 1 1 1 1
- 1 0 0 1 - 9
0 0 1 0 0 2
5 2 7
- 7 5
4 11 2
4 B 2 (Hex form)
Thus the hexadecimal difference is (4B2) .
16