Number System and Logic Gates
Number System and Logic Gates
Number System and Logic Gates
The term digital refers to a process that is achieved by using discrete unit.
In number system there are different symbols and each symbol has an absolute value and also has place
value.
RADIX OR BASE:-
The radix or base of a number system is defined as the number of different digits which can occur in
each position in the number system.
RADIX POINT :-
The generalized form of a decimal point is known as radix point. In any positional number system the
radix point divides the integer and fractional part.
In general,
is given by
dn dn-1 dn-2 …………… d0 . d -1 d -2............................... d - m
(dn x 10n) + (dn-1 x 10n-1) + (dn-2 x 10n-2) + … + ( d0 x 100) + ( d-1 x 10 -1) + (d-2 x 10 -2) +…+(d -m x 10 –m)
For example:-
In general,
is given by
(dn x 2n) + (dn-1 x 2n-1) + (dn-2 x 2n-2) + ….+ ( d0 x 20) + ( d-1 x 2 -1) + (d-2 x 2 -2) +….+(d -k x 2 –k)
0 000 4 100
1 001 5 101
2 010 6 110
3 011 7 111
For example:
Group of 3 bits are 101 111 010 110 . 110 110 011
Convert each group into octal = 5 7 2 6 . 6 6 3
The result is (5726.663)8
(ii) Convert (10101111001.0111)2 into octal.
Solution :
Binary number 10 101 111 001 . 011 1
Group of 3 bits are = 010 101 111 001 . 011 100
Convert each group into octal = 2 5 7 1 . 3 4
The result is (2571.34)8
(c) Binary to Hexadecimal conversion:-
For conversion binary to hexadecimal number the binary numbers starting from the binary point, groups are
made of 4 bits each, on either side of the binary point.
Hexadecimal Binary Hexadecimal Binary
0 0000 8 1000
1 0001 9 1001
2 0010 A 1010
3 0011 B 1011
4 0100 C 1100
5 0101 D 1101
6 0110 E 1110
7 0111 F 1111
For example:
(i) Convert (1011011011)2 into hexadecimal.
Solution:
Given Binary number 10 1101 1011
Group of 4 bits are 0010 1101 1011
Convert each group into hex = 2 D B
The result is (2DB)16
(ii) Convert (01011111011.011111)2 into hexadecimal.
Solution:
Given Binary number 010 1111 1011 . 0111 11
Group of 3 bits are = 0010 1111 1011 . 0111 1100
Convert each group into octal = 2 F B . 7 C
The result is (2FB.7C)16
2. DECIMAL NUMBER SYSTEM:-
2 I 52
2 l 26 ―0
2 l 13 ―0
2l6 ―1
2l3 ―0
2l1 ―1
0 ―1
Result of (52)10 is (110100)2
(ii) Convert (105.15)10 into binary.
Solution:
Integer part Fraction part
2 I 105 0.15 x 2 = 0.30
2l 52 ― 1 0.30 x 2 = 0.60
2l 26 ― 0 0.60 x 2 = 1.20
2l 13 ― 0 0.20 x 2 = 0.40
2l 6 ― 1 0.40 x 2 = 0.80
2l3 ― 0 0.80 x 2 = 1.60
2l1 ― 1
0 ― 1
Result of (105.15)10 is (1101001.001001)2
For example:
(i) Convert (378.93)10 into octal.
Solution:
8 I 378 0.93 x 8 = 7.44
8 l 47 ― 2 0.44 x 8 = 3.52
8l5 ― 7 0.52 x 8 = 4.16
0 ― 5 0.16 x 8 = 1.28
For example:
(i) Convert (2598.675)10 into hexadecimal.
Solution:
Remainder
Decimal Hex Hex
16 I 2598 0.675 x 16 = 10.8 A
16 l 162 ― 6 6 0.800 x 16 = 12.8 C
16 l 10 ― 2 2 0.800 x 16 = 12.8 C
0 ― 10 A 0.800 x 16 = 12.8 C
Result of (2598.675)10 is (A26.ACCC)16
For example:
Convert (367.52)8 into binary.
Solution:
Given Octal number is 3 6 7 . 5 2
Convert each group octal = 011 110 111 . 101 010
to binary
For example: -
Convert (4057.06) 8 to decimal
Solution:
(4057.06) 8 = 4 x 83 + 0 x 82 + 5 x 81 + 7 x 80 + 0 x 8 – 1 + 6 x 8- 2
= 2048 + 0 + 40 + 7 + 0 +0.0937
= (2095. 0937)10
Result is (2095.0937)10
(c) Octal to hexadecimal conversion:-
For conversion of octal to Hexadecimal, first convert the given octal number to binary and then binary
number to hexadecimal.
For example :-
Convert (756.603)8 to hexadecimal.
Solution :-
Given octal no. 7 5 6 . 6 0 3
Convert each octal digit to binary = 111 101 110 . 110 000 011
Group of 4bits are = 0001 1110 1110 . 1100 0001 1000
Convert 4 bits group to hex. = 1 E E . C 1 8
Result is (1EE.C18)16
For example:
Convert (3A9E.B0D)16 into binary.
Solution:
Given Hexadecimal number is 3 A 9 E . B 0 D
Convert each hexadecimal = 0011 1010 1001 1110 . 1011 0000 1101
digit to 4 bit binary
For example: -
Convert (A0F9.0EB)16 to decimal
Solution:
(A0F9.0EB)16 = (10 x 163 )+(0 x 162 )+(15 x 161 ) +( 9 x 160 ) +(0 x 16 – 1) +(14 x 16- 2) +(11 x 16-3)
= 40960 + 0 + 240 + 9 + 0 +0.0546 + 0.0026
= (41209.0572)10
Result is (41209.0572)10
(c) Hexadecimal to Octal conversion:-
For conversion of hexadecimal to octal, first convert the given hexadecimal number to binary and then
binary number to octal.
For example :-
Convert (B9F.AE)16 to octal.
Solution :-
Given hexadecimal no.is B 9 F . A E
Convert each hex. digit to binary = 1011 1001 1111 . 1010 1110
Group of 3 bits are = 101 110 011 111 . 101 011 100
Convert 3 bits group to octal. = 5 6 3 7 . 5 3 4
Result is (5637.534)8
For example :-
100101
+ 1101111
10010100
Result is (10010100)2
2. BINARY SUBTRACTION:-
The binary subtraction rules are as follows
0 - 0 = 0 ; 1 - 1 = 0 ; 1 - 0 = 1 ; 0 - 1 = 1 , with a borrow of 1
For example :-
Substract (111.111)2 from (1010.01)2.
Solution :-
1010.010
- 111 .111
0 0 1 0 .0 1 1
Result is (0010.011)2
3. BINARY MULTIPLICATION:-
The binary multiplication rules are as follows
0x0=0;1x1=1;1x0=0;0x1=0
For example :-
1101
x 110
0000
1101
+ 1101
1001110
Result is (1001110)2
4. BINARY DIVISION:-
The binary division is very simple and similar to decimal number system. The division by ‘0’ is meaningless.
So we have only 2 rules
0÷1=0
1÷1=1
For example :-
Divide (10110)2 by (110)2.
Solution :-
For example :-
Find (1100)2 1’s complement.
Solution :-
Given 1 1 0 0
1’s complement is 0 0 1 1
Result is (0011)2
For example:-
0 1 0 1 0 0 1 = +41
↑
Sign bit
1 1 0 1 0 0 1 = -41
↑
Sign bit
Result is +10
2’s COMPLEMENT:-
In 2’s complement subtraction, add the 2’s complement of subtrahend to the minuend. If there is a carry out,
ignore it. If the MSB is 0, the result is positive. If the MSB is 1, the result is negative and is in its 2‘s
complement form. Then take its 2’s complement to get the magnitude in binary.
For example:-
Subtract (1010100)2 from (1010100)2 using 2’s complement.
Solution:-
1010100 1010100 = 84
- 1010100 => + 0 1 0 1 1 0 0 (2’s complement) = - 84_
1 0 0 0 0 0 0 0 ( Ignore the carry) 0
= 0 (result = 0)
Hence MSB is 0. The answer is positive. So it is +0000000 = 0
LOGIC GATES:- LOGIC GATES
Logic gates are the fundamental building blocks of digital systems.
There are 3 basic types of gates AND, OR and NOT.
Logic gates are electronic circuits because they are made up of a number of electronic devices and
components.
Inputs and outputs of logic gates can occur only in 2 levels. These two levels are termed HIGH and
LOW, or TRUE and FALSE, or ON and OFF or simply 1 and 0.
The table which lists all the possible combinations of input variables and the corresponding outputs is
called a truth table.
LEVEL LOGIC:-
A logic in which the voltage levels represents logic 1 and logic 0. Level logic may be positive or negative logic.
Positive Logic:-
A positive logic system is the one in which the higher of the two voltage levels represents the logic 1 and the
lower of the two voltages level represents the logic 0.
Negative Logic:-
A negative logic system is the one in which the lower of the two voltage levels represents the logic 1 and the
higher of the two voltages level represents the logic 0.
DIFFERENT TYPES OF LOGIC GATES:-
NOT GATE (INVERTER):-
A NOT gate, also called and inverter, has only one input and one output.
It is a device whose output is always the complement of its input.
The output of a NOT gate is the logic 1 state when its input is in logic 0 state and the logic 0 state when
its inputs is in logic 1 state.
IC No. :- 7404
INPUT OUTPUT
A A
0 1
1 0
Timing Diagram
1 0 0 1
0 1 1 0
AND GATE:-
An AND gate has two or more inputs but only one output.
The output is logic 1 state only when each one of its inputs is at logic 1 state.
The output is logic 0 state even if one of its inputs is at logic 0 state.
IC No.:- 7408
Logic Symbol Truth Table
OUTPUT
A B Q=A . B
Timing Diagram 0 0 0
0 0 1 1 0 1 0
1 0 0
A
1 1 1
0 1 0 1
0 0 0 1
OR GATE:-
An OR gate may have two or more inputs but only one output.
The output is logic 1 state, even if one of its input is in logic 1 state.
The output is logic 0 state, only when each one of its inputs is in logic state.
IC No.:- 7432
Logic Symbol Truth Table
INPUT OUTPUT
A B Q=A + B
0 0 0
0 1 1
1 0 1
Timing Diagram 1 1 1
0 0 1 1
0 1 0 1
0 1 1 1
Q
NAND GATE:-
NAND gate is a combination of an AND gate and a NOT gate.
The output is logic 0 when each of the input is logic 1 and for any other combination of inputs, the
output is logic 1.
IC No.:- 7400 two input NAND gate
7410 three input NAND gate
7420 four input NAND gate
7430 eight input NAND gate
INPUT OUTPUT
A B Q= A.B
0 0 1
0 1 1
1 0 1
Timing Diagram
1 1 0
0 0 1 1
0 1 0 1
1 1 1 0
NOR GATE:-
NOR gate is a combination of an OR gate and a NOT gate.
The output is logic 1, only when each one of its input is logic 0 and for any other combination of inputs,
the output is a logic 0 level.
INPUT OUTPUT
A B Q= A + B
0 0 1
0 1 0
1 0 0
1 1 0
Timing Diagram
0 0 1 1
0 1 0 1
1 0 0 0
IC No.:- 7486
INPUT OUTPUT
A B Q=A
B
INPUTS are A and B 0 0 0
OUTPUT is Q = A B 0 1 1
1 0 1
=AB+AB
1 1 0
Timing Diagram
0 0 1 1
0 1 0 1
0 1 1 0
Logic Symbol
INPUT OUTPUT
A B OUT =A XNOR B
0 0 1
0 1 0
1 0 0
OUT =A B + A B
1 1 1
= A XNOR B
Timing Diagram
0 0 1 1
A
0 1 0 1
B
1 0 0 1
OUT
UNIVERSAL GATES:-
There are 3 basic gates AND, OR and NOT, there are two universal gates NAND and NOR, each of which can
realize logic circuits single handedly. The NAND and NOR gates are called universal building blocks. Both
NAND and NOR gates can perform all logic functions i.e. AND, OR, NOT, EXOR and EXNOR.
NAND GATE:-
a) Inverter from NAND gate
Input =A
Output Q = A
NOR GATE:-
a) Inverter from NOR gate
Input =A
Output Q = A
b) AND gate from NOR gate
Input s are A and B
Output Q = A.B
c) OR gate from NOR gate