Introduction
:
Early computer systems used electrical switches and when
electrical switches were replaced by less mechanical devices such as vacuum
tubes, than the transistor, the integrated circuit, the concept of switching on
and off remained with computers but a representation of the on/off behavior of computers
had to be made.
The term, digital, in computing and electronics applies to
converting real world information to binary numeric form. The binary (base 2) number system
represents two discreet values using two symbols or digits i.e., 0 and 1. The
binary number system, where a zero symbolizes no electrical current (OFF) and
one represents electrical current exists (ON).
All computer data (alpha-numeric, symbols and characters, audio,
graphics and video) are represented or encoded using sequences of binary digits
that are interpreted according to appropriate software. Computers are made up
of electronic devices and electronic device can exist or either in ON or OFF
state. For our convenience an ON State is represented by the code ‘1’ and OFF state is
represented by the code‘0’.
They are called ‘bits’, an abbreviation for Binary Digit. The numbers
represented by bits are known as binary numbers.
Basically
number systems are classified in two types :
1)
Non – Positional Number System
2)
Positional Number System
Non-Positional
Number System :
In this number system any number can be represented by arranging
symbols in various positions. Each symbol represents a definite value
irrespective of the position in which they appear. For example: Roman Number
System
Positional
Number System :
In a positional number system, a number is represented by a set of
symbols. Each symbol represents a particular value, depending on its position.
The actual number of symbols used in a position system depends on its base.
Base :
The number of digits or basic symbols used in a positional number system is known as the
BASE or Radix of the system.
1.
Decimal
Number System (Base 10) :
It is a positional number system with base 10 and thus it uses 10
symbols i.e., 0 to 9. Any number can be represented by arranging symbols in
various positions. In the decimal system, each position represents a specific
power of 10.
For example : The decimal number 654.52,
written as (654.52)10
or 654.52(10) to specify base 10 is represented as follows :
Increasing
Powers of 10 |
Decreasing
Powers of 10 |
||||
|
Hundreds |
Tens |
Units |
One Tenth |
One
Hundredth |
Weights |
102 |
101 |
100 |
10-1 |
10-2 |
Digits |
6 |
5 |
4 |
5 |
2 |
Thus, the expanded notation of
654.52(10)
= 6 X 102 + 5 X 101
+ 4 X 100 + 5 X 10-1 + 2 X 10-2
= 6 X
100 + 5 X 10 + 4 X 1 + 5 X 0.1 + 2 X 0.01
= 600 + 50 + 4 + 0.5 + 0.02
= 654.52
Note : In a positional number system all bits or digits to the
left of the decimal or binary point have weights that are positive powers of
base and those to the right have weights that are negative powers of base. The
base is also called Radix and fractional
point is called as Radix point.
2. Binary Number System (Base 2) :
The binary system is a positional system to the base 2. It uses
two symbols 0 and 1. Each position represents specific power of 2.
For example
: The binary
number 1 1 0 1 . 1 1 written as 1 1 0 1 . 1
1 (2) or (1 1 0 1
. 1 1)2 to specify base 2, is represented as follows :
Increasing
Powers of 2 |
Decreasing
Powers of 2 |
|||||
Weights |
23 |
22 |
21 |
20 |
2-1 |
2-2 |
Digits |
1 |
1 |
0 |
1 |
1 |
1 |
Thus, the expanded notation of 1 1 0 1 . 1 1 (2)
= 1 X 23 + 1 X 22 + 0 X 21 + 1 X
20 + 1 X 2-1 + 1 X 2-2
3.
Octal Number
System (Base 8) :
The octal number system is a positional number system with base 8.
It uses 8 symbols i.e., 0 to 7. In octal number system, each digit
position corresponding to a power of 8.
For example : The octal number 43.12 written as (43.12)8
or 43.12(8) to specify base 8, is
represented as follows :
Increasing
Powers of 8 |
Decreasing
Powers of 8 |
|||
Weights |
81 |
80 |
8-1 |
8-2 |
Digits |
4 |
3 |
1 |
2 |
Thus, the expanded notation of 43.12(8)
= 4
X 81 + 3 X 80 + 1 X 8-1 + 2 X 8-2
4. Hexadecimal Number System (Base 16) :
The hexadecimal number system is a positional number system to the
base 16. It uses 16 symbols to represent any number. The first 10 symbols are
represented by digits 0 to 9 and the remaining 6 symbols by the letters A to F,
representing the decimal values 10 to 15 respectively. Each position represents
a specific powers of 16.
For example, the hexadecimal number BA85.12
is written as (BA85.12)16 or BA85.12(16), is represented as follows :
Increasing
Powers of 16 |
Decreasing
Powers of 16 |
|||||
Weights |
163 |
162 |
161 |
160 |
16-1 |
16-2 |
Digits |
B |
A |
8 |
5 |
1 |
2 |
Thus, the expanded notation of BA85.12(16)
= B
X 163 + A X 162 + 8 X 161 + 5 X 160
+ 1 X 16-1 + 2 X 16-2
INTER
CONVERSION OF NUMBER FROM ONE SYSTEM TO ANOTHER INTEGER PART
1. Divide the integer part of the
decimal number by the base ‘b’ of the new system. The remainder will give the
right most digit of the integer part of the new number.
2.
Divide the
quotient again by the base ‘b’. The remainder is the next digit from right.
3. Repeat step 2 until a zero
quotient is obtained. Last remainder is the left most digit of the new number.
FRACTIONAL
PART
1. Multiply the fractional part of
the decimal number by the base ‘b’ of
the new system. The integer part of the product gives the left most digit of
the fractional part of the new number.
2. Multiply the fractional part of
the product by the base ‘b’. The
integer part of the resultant product is the next digit from left.
3. Repeat step 2 until a zero
fractional part or a repeated fractional part or a non-terminating fractional
part occurs.
1.
Decimal to
Binary Conversion :
1) 25. 625 (10) = ? (2)
2 |
25 |
|
|
Product |
Integer |
Fractional-Part |
2 |
1 2 |
1 |
0.625 X 2 |
1.250 |
1 |
0.250 |
2 |
6 |
0 |
0.250 X 2 |
0.500 |
0 |
0.500 |
2 |
3 |
0 |
0.500 X 2 |
1.000 |
1 |
0.000 |
2 |
1 |
1 |
|
|
|
|
2 |
0 |
1 |
Therefore,
25(10) = 1 1 0 0 1 Thus, the
result is 25.625(10) |
& = |
0.625(10)
= 1 0 1 1 1 0 0 1
. 1 0 1(2) |
2.
Binary to
Decimal Conversion :
1) 1 1 . 1 0
1 1 (2) = ? (10)
=1X 21 + 1 X 20 + 1 X 2-1 + 0 X 2-2
+ 1 X 2-3 + 1 X 2-4
=1 X 2 + 1 X 1 + 1 X 0.5 + 0 X 0.25 + 1 X 0.125 + 1 X 0.0625
=2 + 1 + 0.5 + 0 + 0.125 + 0.0625
=3.6575(10)
3.
Binary to
Octal Conversion :
1) 0 1 1 1 0 1 (2) = ?(8)
Octal |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
Binary |
000 |
001 |
010 |
011 |
100 |
101 |
110 |
111 |
Note : Place the 3 binary bits into one group from right side and
write equivalent octal digit.
0 1 1 1 0 1
3 5
Thus, the result is 0 1 1 1 0 1 (2) = 3 5 (8)
4.
Binary to
Hexadecimal Conversion :
1) 01101101(2) = ?(16)
Hexa Decimal |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
A |
B |
C |
D |
E |
F |
Binary |
0000 |
0001 |
0010 |
0011 |
0100 |
0101 |
0110 |
0111 |
1000 |
1001 |
1010 |
1011 |
1100 |
1101 |
1110 |
1111 |
Note : Place the 4 binary bits into one group from right side and
write equivalent Hexadecimal digit.
0 1 1 0 1 1 0 1
6 D
Thus, the result
is 0 1 1 0 1 1 0 1 (2)
= 6D (16)
5.
Octal to
Decimal Conversion :
1) 43.12(8) = ? (10)
43.12(8)
= 4 X 81 + 3 X 80 + 1 X
8-1 + 2 X 8-2
= 4 X 8 + 3 X 1 + 1 X 0.125 + 2 X 0.015625
= 32 + 3 + 0.125 + 0.03125
= 35.15625 (10)
6.
Octal to
Binary Conversion :
Octal |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
Binary |
000 |
001 |
010 |
011 |
100 |
101 |
110 |
111 |
Note : Place the 3 bit binary equivalent of each digit below the
number 1) 67.35(8) = ?(2)
6 |
7 . |
3 5 |
110 |
111 |
011 101 |
Thus the result is 67.35(8) = 110111.011101(2)
7.
Octal to
Hexadecimal Conversion :
(a)
First Covert Octal to Decimal 43.12(8) = ? (10)
= 4 X 81
+ 3 X 80 + 1 X 8-1 + 2 X 8-2
= 4 X 8 + 3
X 1 + 1 X 0.125 + 2 X 0.015625
= 32 + 3 +
0.125 + 0.031250
= 35.15625 (10)
(b)
Convert
Decimal to Hexadecimal
35.15625 (10) = ? (16)
16 |
3 5 |
|
|
Product |
Integer |
Fractional-Part |
|
16 |
2 |
3 |
0.15625 X
16 |
2.500 |
2 |
0.500 |
|
|
0 |
2 |
0.50000 X
16 |
8.000 |
0 |
0.000 |
|
Therefore, 35(10) = 2 3
& 0.15625(10) = 2 0
Thus, the result is 35.15625(10) = 2 3 . 2 0
(16)
Representation
of Signed Numbers
In Binary System, we represent the sign of a number using an extra
bit at the extreme right of the number and is called ‘sign’ bit. By convention
the symbol ‘0’ is used to represent the (+) sign and ‘1’ to represent (-) sign.
In the case of binary numbers used in computers, the most
significant bit represents the sign
and the remaining bits the magnitude of the number. For example a
6 bit binary equivalent of a decimal number -15 is represented by ( 1 0 1 1 1 1
)2 and + 15 is represented by ( 0 0 1 1 1 1 )2.
This method of representing is known as sign magnitude
representation.
Representation
of Signed numbers are :
1)
By sign
magnitude representation
2)
By using 1’s complement
3)
By using 2’s complement
Sign and Magnitude
Representation
To represent Positive numbers, the magnitude is represented in the
true binary form, and a sign bit 0 is placed in front of the MSB.
For example + 47 represented as follows :
0 |
1 |
0 |
1 |
1 |
1 |
1 |
Sign bit True Number
To represent negative number, the magnitude is represented into
2’s complement form, and a sign bit of 1 is placed in front of the MSB.
For example + 47 represented as follows :
1 |
0 |
1 |
0 |
0 |
0 |
1 |
Sign
bit True Number
1’s
Complement
The 1’s complement of a binary number is obtained by complementary
all the bits i.e., by changing 1’s to 0’s.
Example : Find the 1’s complement of 1 0
1 1 0 0
Step1 : 1 0 1 1 0 0 given number
Step2 : 0 1 0 0 1 1 complement each bit
to form 1’s complement.
Thus, 1’s
complement of 1 0 1 1 0 0 = 0 1 0 0 1 1
2’s
Complement
The 2’s complement of a binary number is obtained by adding 1 to
1’s complement of a binary number.
Example : Find the 2’s complement of
1 0 1 1 0 0
Step1 : 1 0 1 1 0 0 given number
Step2 : 0 1 0 0 1 1 complement each bit
to form 1’s complement. 0 1 0 0 1 1
+ 1
0 1 0 1 0 0
Step3 : 0 1 0 1 0 0 is 2’s complement
of original number.
Binary
Arithmetic :
Binary Arithmetic is a fundamental code for all digital computers
and most other digital systems. It can perform all arithmetic operations like
addition, subtraction, multiplication and division.
Binary
Addition :
It is
performed in the same manner as decimal addition. The following table shows
that four basic rules for binary addition.
A |
|
B |
Sum |
Carry |
0 |
+ |
0 |
0 |
0 |
0 |
+ |
1 |
1 |
0 |
1 |
+ |
0 |
1 |
0 |
1 |
+ |
1 |
0 |
1 |
Examples :
|
1 0 1 |
|
1 0
1 1 . 1 0 1 |
+ |
0 1 1 |
+ |
1 0 1 0 . 1 0 0 |
|
1 0 0 0 |
|
1 0 1 1 0
. 0 0 1 |
Binary
Substraction :
Binary subtraction rules are as follows :
A |
|
B |
Sum |
Carry |
0 |
- |
0 |
0 |
0 |
1 |
- |
0 |
1 |
0 |
1 |
- |
1 |
0 |
0 |
0 |
- |
1 |
1 |
1 |
Examples :
|
1 0 1 |
|
1 0 0 1 0
1 0 |
- |
0 1 1 |
- |
1 0 1 0 1 |
|
0 1 0 |
|
0 1 1 0 1
0 1 |
Subtraction
of Binary number using 1’s Complement :
Case 1: Substraction of Smaller number from Larger number
1.Determine 1’s Complement of
smaller number
2.Add 1’s compliment to the larger number
3.We get carry. Addition end around
carry to the above gives the result of subtraction.
Example :
Subtract 1001 – 1000 using 1’s Complement
1.
1’s
complement of 1000 is 0111
2.
Add 1’s
complement to the larger number 1 0 0 1
0 1 1 1
1 0 0 0 0
3.
Add carry 1
to the above result 0 0 0 0
+ 1
0
0 0 1
Therefore,
1 0 0 1 – 1 0 0 0 = 0 0 0 1 (
9 – 8 = 1 )
Case 2: Substraction of Larger number from Smaller number
1.
Determine
1’s Complement of larger number
2.
Add 1’s
compliment to the smaller number
3.
There will
be no carry. To get answer take the 1’s complement of the result and put
negative sign.
Example :
Subtract 111 – 101 using 1’s Complement
1.
1’s
complement of larger number 111 is 000
2.
Add 1’s
complement to the smaller number 1 0 1
+ 0 0 0
1 0 1
3.
Find 1’s complement of 101 and
put negative sign i.e., - 0 1 0
Therefore,1 0 1 – 1 1 1 = - 0 1 0(
5 – 7 = -2 )
Subtraction
of Binary number using 2’s Complement :
Case 1: Substraction of Smaller number from Larger number
1.
Determine 2’s
Complement of smaller number
2.
Add 2’s
compliment to the larger number
3.
We get
carry. Neglect the carry and the remaining gives the result of subtraction
Example :
Subtract 1001 – 1000 using 2’s Complement
1.
2’s
complement of 1000 is
0 1 1 1
+ 1
1 0 0 0
Add 2’s complement to the larger
number
1
0 0 1
+ 1 0 0 0
1 0 0 0 1
2.
Neglect the carry i.e., 0 0 0 1
Therefore,1 0 0 1 – 1 0 0 0 = 0 0 0 1(9–8=1 ) Case 2: Substraction of Larger number from Smaller number
1.
Determine
2’s Complement of larger number
2.
Add 2’s
compliment to the smaller number
3.
There will
be no carry. To get answer take the 2’s complement of the result and put
negative sign.
Example :
000 1 001
Subtract 111
– 101 using 1’s Complement
1.
2’s
complement of larger number 111 is i.e.,
2.
Add 2’s
complement to the smaller number 1 0 1
+
0 0 1
1 1 0
3.
Find 2’s complement of 110 and
put negative sign i.e.,0 0 1
+ 1
0 1 0
i.e.,
- 0 1 0
Therefore, 1 0 1 – 1 1 1 = -
0 1
0 ( 5 – 7 = -2 )
Computer
Codes :
Computer understands everything only in binary. Therefore, when we
input numbers, alphabets and other special symbols, they must be represented in
the binary format. There are three such coding standards. There are BCD, ASCII
and EBCDIC.
1.
BCD (Binary Coded Decimal System :
In BCD each digit of a decimal number is independently converted
to 4-bit binary number. For example the decimal number 573 would be represented
in the 4 bit BCD code as
0 1 0 1 0 1 1 1 0 0 1 1
5 7 3
BCD Coding system is used to represent only decimal numbers,
4-bits are insufficient to represent the various characters used by computer.
Therefore 6-bit BCD Code was developed. In this code two more bits called as
‘zero position’ are added. It is possible to represent 64 code groups i.e., 10
decimal digits, 26 alphabets and 28 special characters using 6 bit code.
2.
ASCII (American Standard Code for
Information Interchange :
It is most widely used alphanumeric code for printers, keyboards
and terminals which are interface with computer to represent data. This is 7
bit code and also it has
128 possible code groups
i.e., alphabets, numbers, special characters and control character (Enter
Key, Escape Key, Space bar etc.,). A
is represented in ASCII as 1000001 whose decimal equivalent is 65.
3.
EBCDIC (Extended Binary Coded
Decimal Interchange Code) :
It is also an alphanumeric code
used in IBM computers and mainframe applications. It is an 8 bit code
representing 256 different code group. A is represented in EBCDIC code as 11000001.
Digital
Logic :
The word Logic is used to describe the circuits which can
duplicate specific function of decision making performed by the human mind. In
the logic relevant to computers we know that there can be only two states. This
logic is thus called two state logic or bivalent logic. Such a logical method
was developed by ARISTOTAL for getting at the truth. The method was
subsequently developed by mathematician DE-MORGAN and GEORGE BOOLE into a very powerful
mathematical tool.
A Gate is a simple electronic circuit or device that performs
logical functions. It has one or more inputs and output. Gates are called
binary logic gates 1 and 0 are inputs and outputs.
Truth Table
Truth Table is a table which shows all inputs and outputs
possibilities of a logical circuits or gate.
Types of
Logic Gates
1.
AND Gate
2.
OR Gate
3.
NOT Gate
4.
NAND Gate
5.
NOR Gate
AND Gate
This is an electronic decision making element with one or more
inputs and single outputs. Its function is to implement the AND operation
(i.e., Logical Multiplication). The logical symbol for AND Gate is
A
B
Q
Two inputs
AND Gate truth table
Input A |
Input B |
Output Q=A.B |
0 |
0 |
0 |
0 |
1 |
0 |
1 |
0 |
0 |
1 |
1 |
1 |
Three inputs
AND Gate truth table
Input A |
Input B |
Input C |
Output Q=A.B.C |
0 |
0 |
0 |
0 |
0 |
0 |
1 |
0 |
0 |
1 |
0 |
0 |
0 |
1 |
1 |
0 |
1 |
0 |
0 |
0 |
1 |
0 |
1 |
0 |
1 |
1 |
0 |
0 |
1 |
1 |
1 |
1 |
AND Gate
Rule
1. Logic 1 when all inputs are 1
2.
Logic 0 when
any input is 0
OR Gate
This is an electronic decision
making element with one or more inputs and single output. Its function is to
implement the OR operation (i.e., Logical Addition). The logical symbol for OR
Gate is
Two inputs
OR Gate truth table
Input A |
Input B |
Output Q=A+B |
0 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
1 |
1 |
1 |
1 |
Three inputs
OR Gate truth table
Input A |
Input B |
Input C |
Output Q=A+B+C |
0 |
0 |
0 |
0 |
0 |
0 |
1 |
1 |
0 |
1 |
0 |
1 |
0 |
1 |
1 |
1 |
1 |
0 |
0 |
1 |
1 |
0 |
1 |
1 |
1 |
1 |
0 |
1 |
1 |
1 |
1 |
1 |
OR Gate Rule
1.
Logic 1 when
an inputs is 1
2.
Logic 0 when
all inputs are 0
NOT Gate
This is an electronic decision making element with one input and
one output. Its function is to implement the NOT operation (i.e., Inversion or
Logical Complement) . The logical symbol for NOT Gate is
Truth table of NOT Gate is
Two inputs
OR Gate truth table
Input A |
Output Q (Complement of A) |
0 |
1 |
1 |
0 |
NOT Gate
Rule is
1.
Logic 1 when
input is 0
2.
Logic 0 when
input is 1
NAND Gate
This is combination of NOT and AND Gates. This is like AND Gate
but with the output complimented.
The logical
symbol for NAND Gate is
Two inputs NAND Gate truth table
Input A |
Input B |
A.B |
Output Q=NOT(A.B) |
|
0 |
0 |
0 |
1 |
|
0 |
1 |
0 |
1 |
|
1 |
0 |
0 |
1 |
|
1 |
1 |
1 |
0 |
|
NAND Gate rule is
1.
Logic 1 when
any input is 0
2.
Logic 0 when
all inputs are 1
NOR Gate
This is combination of NOT and OR Gates.
This is like OR Gate but with the output complimented.
The logical symbol for NOR Gate is
Two inputs
NOR Gate truth table
Input A |
Input B |
A+B |
Output Q=NOT(A+B) |
0 |
0 |
0 |
1 |
0 |
1 |
1 |
0 |
1 |
0 |
1 |
0 |
1 |
1 |
1 |
0 |
NOR Gate rule is
1.
Logic 1 when
all inputs are 0
2.
Logic 0 when
any inputs is 1
Universal
Gates
NAND and NOR gates are called universal gates because the other
gates (i.e., AND, OR and NOT) can realized these individual gates.
No comments:
Post a Comment