Professional Documents
Culture Documents
Number System and Logic Gates
Number System and Logic Gates
Syllabus of Unit 3
Where,
N = decimal number with 3-digit integer and 3-digit fractional
portion
D = Decimal digits
= 0,1,2,3,4,5,6,7,8,9
R = Radix or base of the number system
For Decimal numbersystemR= 10 4
Decimal Number System
For Example:
N = (356.238)10
= (3 × 10 2 )+ (5 × 10 1 )+ (6 × 10 0 )+ (2 × 10 −1 )+ (3 × 10−2 )+ (8 × 10 −3 )
5
Binary Number System
𝑁 = ⋯ (𝐵 2 × 𝑅 2 )+ (𝐵 1 × 𝑅 1 )+ (𝐵 0 × 𝑅 0 )+ (𝐵 −1 × 𝑅 −1 )+ (𝐵 −2 × 𝑅 −2 )+ (𝐵 −3 × 𝑅 −3 )…
Where,
N = binary number with 3-digit integer and 3-digit fractional
portion
B = Binary digits
= 0,1
7
Octal Number System
𝑁 = ⋯ (𝑂 2 × 𝑅 2 )+ (𝑂 1 × 𝑅 1 )+ (𝑂 0 × 𝑅 0 )+ (𝑂 −1 × 𝑅 −1 )+ (𝑂 −2 × 𝑅 −2 )+ (𝑂 − 3 × 𝑅 −3 )…
Where,
N = Octal number with 3-digit integer and 3-digit fractional portion
O = Octal digits
= 0,1,2,3,4,5,6,7
9
Hexadecimal Number System
𝑁 = ⋯ (𝐻 2 × 𝑅 2 )+ (𝐻 1 × 𝑅 1 )+ (𝐻 0 × 𝑅 0 )+ (𝐻 − 1 × 𝑅 −1 )+ (𝐻 − 2 × 𝑅 −2 )+ (𝐻 − 3 × 𝑅 −3 )…
Where,
N = Hexadecimal number with 3-digit integer and 3-digit
fractional portion
H = Hexadecimal digits
= 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
11
Conversions
1) Decimal Binary
2) Decimal Octal
3) Decimal Hexadecima
4) Binary l Octal
5) Binary Hexadecimal
6) Octal Hexadecimal
12
1. Decimal to Binary
• The most popular way to convert a decimal
number into the binary is the double dabble
method.
• In this method, the given decimal number is
progressively divided by 2 and writing the
remainder after each division.
• When all the remainder is read in reverse
order, the binary number is obtained.
13
1. Decimal to Binary
Steps for Decimal to Binary Conversion
Step – 1 Divide the decimal number which is to be converted by
2 which is the base of the binary number. Step – 2 The
remainder which is obtained from step 1 is the least significant
bit of the new binary number. Step – 3 Divide the quotient
which is obtained from the step 2
and the remainder obtained from thisis the second least
significant bit of the binary number.
Step – 4 Repeat the process until the quotient remains zero. Step
– 5 The last remainder obtained from the division is the most
significant bit of the binary number. Hence arrange the number
from most significant bit to the least significant bit (i.e., from
bottom to top).
14
1. Decimal to Binary
15
1. Decimal to Binary
Conversion of Decimal to Binary for Fraction
Number
• For fractional decimal numbers, multiply it by
2 and record the carry in the integral position.
• The carries when read down produces the
equivalent binary fraction as explained by the
example given below.
16
1. Decimal to Binary
Consider the fractional decimal number 0.35
19
2. Binary to Decimal
The conversion of a fractional binary number
(0.0101)2 into its equivalent decimal number
20
3. Decimal to Octal
Steps for Decimal to Octal Conversion
Step – 1 Divide the decimal number which is to be converted by
8 which is the base of the octal number. Step – 2 The
remainder which is obtained from step 1 is the least significant
bit of the new octal number. Step – 3 Divide the quotient which
is obtained from the step 2
and the obtained from thisis the second least
remainder of the octal
significantbit
Step – 4 Repeat the process until the
number.
quotient remains zero. Step
– 5 The last remainder obtained from the division is the most
significant bit of the octal number. Hence arrange the number
from most significant bit to the least significant bit (i.e., from
bottom to top).
21
3. Decimal to Octal
Consider the conversion of the decimal
number (239.53)10 . The conversion of
integer part is shown below.
(239.53)𝟏𝟎 = (354.4172)𝟖
22
4. Octal to Decimal
In octal number system, each digit
position has the weight eight regarding power
eight shown in the figure below.
(354.42)8= (236.531255)𝟏𝟎 23
5. Decimal to Hexadecimal
Steps for Decimal to Hexadecimal Conversion
Step – 1 Divide the decimal number which is to be converted by
16 which is the base of the hexadecimal number. Step – 2 The
remainder which is obtained from step 1 is the least significant
bit of the new hexadecimal number. Step – 3 Divide the quotient
which is obtained from the step 2 and the remainder obtained
from this is the second least significant bit of the hexadecimal
number. Step – 4 Repeat the process until the quotient remains
zero. Step – 5 The last remainder obtained from the division is
the most significant bit of the hexadecimal number. Hence
arrange the number from most significant bit to the least
significant bit (i.e., from bottom to top).
24
5. Decimal to Hexadecimal
Consider the conversion of the decimal number (3749)10 into its
hexadecimal equivalent number.
(3749)𝟏𝟎 = (D97)𝟏𝟔
25
5. Decimal to Hexadecimal
For fractional decimal numbers, multiply it by 16 and record the carry in the integral
position.
The carries when read down produces the equivalent binary fraction as explained
by the example given below.
26
6. Hexadecimal to Decimal
The base of the hexadecimal number system is 16,
therefore the weights corresponding to various positions
of the digits will be as shown below.
(E8F6.27)𝟏𝟔 = (59638.1523437)𝟏𝟎
27
7. Binary to Octal
The conversion of binary to octal is a reversal of
the above procedure. For example, the binary
number (010100111.100011) can be converted
into an octal number by first written the bits in
the group of three and then awarding the
decimal number of to each of the group of three
bits as shown below.
(010100111.100011) 𝟐 = 𝟖
28
8. Octal to Binary
The base of the octal number system (8) is the third power of
base of a binary system (2), the interconversion of octal and a
binary number is very simple and direct as explained below.
Let converting the octal number 35.346 to its equivalent binary
number
(35.346)𝟖 = 𝟐
29
9. Binary to Hexadecimal
The base of the binary number system is two because it
is represented by two digits, i.e., 0 and 1. It is difficult to
represent the large number in the form of binary digit
and hence the hexadecimal system are used in the
digital electronics. The hexadecimal number systems
are easily converted into a binary system by using the
method explains below.
30
10. Hexadecimal to Binary
For converting any hexadecimal number to binary, the binary
representation as detailed above in Table is to be written for
each hexadecimal digit.
31
11. Octal to Hexadecimal
First convert an octal number to a binary
number, then convert it to a h
exadecimal.
32
12. Hexadecimal to Octal
In this method, each digits of the hexadecimal number is
replaced by its 4 bits equivalent, first we find the binary
equivalent of the digit. If, it is not in 3 bits ,then the zeroes are
placed before the binary equivalent to make it 4 bits
Convert (524.36)16 into its binary equivalent
First of all, convert each of the digits into its binary bits and then
group the subsequent bits into 4 bits .If, they all are not able
form the group of 4 then, zeroe’s (0) are left padded to form the
4 bit pair.
5 2 4 3 6
0101 0010 0011 0110 ( 4 bits
representation ) .
(524.36)16 = (0101 01000010 0100 . 0011 0110)2
33
12. Hexadecimal to Octal
Then convert the binary number (11011.1011) to its octal equivalent
This conversion is simple. In this case ,first the binary bits are grouped into 3
bits .If ,they are not forming then zeros are left padded.
After that each groups are converted into its octal equivalent using the table:
11011.1011
011 011 . 101 100
3 3 5 4
(11011.1011)16 =
(33.54)8
34
Binary Addition
There are four points or steps to remember before
proceeding through the operation.
These are
35
Binary Subtraction
Subtraction and Borrow, these two words will be used very
frequently for the binary subtraction. There are four rules of
binary subtraction.
36
Binary Subtraction by 1’s
Complement Method
What is 1’s compliment of a Binary number?
- Replace all 1 to 0 and 0 to 1
- For example
1 1 0 0 1 Original Binary Number
0 0 1 1 0 1’s
0 0 1 1 1 Compliment
2’s
Compliment of subtrahend
40
Binary Subtraction by 2’s
Complement Method
The operation is carried out by means of the following steps:
(i) At first, 2’s complement of the subtrahend is found.
(ii) Then it is added to the minuend.
(iii)If the final carry over of the sum is 1, it is dropped and the
result is positive.
(iv) If there is no carry over, the two’s complement of the sum
will be the result and it is negative.
41
Binary Subtraction by 2’s
Complement Method
1010.11 – 1001.01
2’s complement of 1001.01 is 0110.11. Hence
Minuend -
10100.01
44
Binary Division
Binary division is similar to decimal division. It is called as
the long division procedure.
45
Questions on G3.1
1. Convert
(10101.1101)2 to Decimal
(432.14)10 to Hexadecimal
(462.27)8 to Hexadecimal
(2BA.0C)16 to Octal
(B89A.03)16 to Decimal
Topic Unit
Group 3 Number System and Logic Gates
3.6 Basic Gates:- Symbol, Truth Table, Boolean Algebra Rules (AND, OR, NOT)
1. AND
3.7 2. OR
3.8 3. NOT
3.9 4. XOR
G3.2
3.10 5. XNOR
◊ NOT (INVERTER)
◊ AND
◊ OR
The NOT function
◊ The NOT function:
◊ If any input is high, the output is
low
◊ If any input is low, the output is
high
Input Output
Output
Input 0 1
Output
Input 1 0
Input Output
0 1
1 0
NOT Function
The AND function
◊ The AND function:
◊ If all the inputs are high is the
output is
high
◊ If any input is low, the output is low
Inputs Output
0
Inputs 0 Output
0
Determine the output
AND Logic Symbol
0
Inputs 0 Output
1
Determine the output
AND Logic Symbol
1
Inputs 1 Output
1
Determine the output
AND Truth Table
◊ To help understand the function of a
digital device, a Truth Table is
used: Input Output
Every possible input
combination 0 0 0
0 1 0
1 0 0
1 1 1
AND Function
AND Gates
◊ It is possible to have AND gates
with more than 2 inputs. The same
logic rules apply – “if any input…”
The OR function
◊ The OR function:
◊ if any input is high, the output is high
◊ if all inputs are low, the output is low
Inputs Output
0
Inputs 0 Output
0
Determine the output
OR Logic Symbol
0
Inputs 1 Output
1
Determine the output
OR Logic Symbol
1
Inputs 1 Output
1
Determine the output
OR Truth Table
◊ Truth Table
Input Output
0 0 0
0 1 1
1 0 1
1 1 1
OR Function
Basic logic Gates
X Y Z X Y Z X Z
0 0 0 0 0 0
0 1 0 0 1 1 0 1
1 0 0 1 0 1 1 0
1 1 1 1 1 1
68
Combinational logic
◊ How would your describe the output
of this combinational logic circuit?
NAND Gate
◊ The NAND gate is the combination
of an NOT gate with an AND gate.
X Y Z X Y Z
0 0 1 0 1
0 1 1 0 0
1 1 0 0
0 0 1 0
1 1 1 0
1
73
1
Derived logic Gates
X Y Z X Y Z
0 0 0 0 0 1
0 1 1 0 1 0
1 0 1 1 0 0
1 1 0 1 1 1
74
Boolean Laws
1. Commutative law
79
Boolean Laws
B . . . . is equivalent to . . . .
A A
A.B
B
B
De-Morgan’s Theorem
Proof of De-Morgan’s
Theorem
Theorem 1: It states that the, complement of a product is equal to sum of the
complements. AB = A + B
A B AB AB A B A+B
0 0 0 1 1 1 1
0 1 0 1 1 0 1
1 0 0 1 0 1 1
1 1 1 0 0 0 0
Proof of De-Morgan’s
Theorem
Theorem 2: It states that the, complement of a sum is equal to product of the
complements. A+B = A B
A B A+B A+B A B AB
0 0 0 1 1 1 1
0 1 1 0 1 0 0
1 0 1 0 0 1 0
1 1 1 0 0 0 0
Examples:
A + AB = A
Solution:
LHS = A + AB
= A (1 + B) …. (1 + B = 1)
=A
= RHS…. Proved
Examples:
Solution:
LHS = A + A’B Since A = A +
AB
= (A+AB) + A’B
AB + A’B
= A + B(A+A’) …….
take
A+ B A’
common
=
=A+ B 1
= RHS ….. Proved
Examples:
(A + B) (A + C) = A +
BC
Solution:
LHS = (A+B) (A+C)
= AA + AC +AB + …. AA =
BC A
= A + AC + AB + BC …. 1 + C = 1
= A (1 +C) + AB + BC
= A + AB + BC …. 1 + B = 1
= A (1 + B) + BC
= A + BC
= RHS ….
Proved
Exercise:
A + A’B + AB = A + B
AB + ABC + AB’ = A
(A + B’ +AB) (A + B) A’B’ = 0
1. With the help of truth table, explain operation of AND, OR, EX-OR,
EX-NOR, NOT gates
Topic Unit
Group 3 Number System and Logic Gates
3.19 Introduction to
1. Microprocessor (Only block diagram and explanation)
3.20 2. Microcontroller (Only block diagram and explanation)
Binary Addition
• The addition of two binary numbers is performed in exactly
the same manner as the addition of decimal numbers.
• Least-significant-digit first.
• “Carry” of 1 into the next position may be needed.
• 4 different cases for binary addition
A B Addition Carry
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
Inputs
H.A Outputs
Carryout (C)
B
98
Truth Table for Adding
Two 1-Bit Numbers
INPUTS OUTPUTS
A B SUM CARRY
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
99
For Sum : For Carry :
Sum = A B + A B Carry = A B
=A + B
100
Logic Diagram for the Half Adder
A
Sum
B =A + B
CarryOut
=A.B
101
DISADVANTAGES OF HALF ADDER
For Ex : A1 A0 Number A
+ B1 B0 Number
+ B
Carry generated from A0 + B0
C0 S0
C1
S1 from this example, for the addition of
A1, B1 & C0 i.e. for three bits, is not possible to
perform by using half adder because it adds
only two bits. Hence we cannot use half adder
in practice.
102
FULL ADDER
• It is a 3 single bit adder circuit .
A Sum (S)
3 Inputs
F. A.
B Carryout (Co)
Cin
104
Truth Table for Full Adder
A B Cin S Co
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
105
Sum = S = A + B + Cin
Carryout = Co = A B + A Cin + B
Cin
106
Logic Diagram For Full Adder
A B Cin 74LS86N
1 3
2 4
6
5 Sum
74LS86N
1
2 3
1
74LS08J 2 3
4
6 74LS32N
5 4
74LS08J
5 6
Carryout
9 74LS32N
10 8
107
Full Adder using Half Adder:
H.A. 1 H.A. 2
A A2 S2 S
A1 S1
B B1 C1 B2 C2
1
Cin
Co
2
3
74LS32
N
108
Flip-Flops
Flip-flop is a bistable logic device i.e. its outputs have two stable
states.
The state of the flip-flop is change only with the inputs and clock
signal.
The clock signal is only edge triggered clock. Either positive edge
negative
or edge triggered clock. High
Negative Edge
110
Flip-Flops
I/P CLK
Flip-Flop O/P
Types: 1. S – R Flip-Flop
2. J – K Flip-Flop
3. D Flip-Flop
4. T Flip-Flop
110
S- R Flip-Flop
S Q
111
SR Flip Flop
S-R Flip-Flop OR S-R Latch
S R Qn+1 Qn+1
No
0 0 Qn Qn Change
0 1 0 1 Reset
1 0 1 0 Set
1 1 1 1
Race
113
S-R Flip-Flops
When S = 0 & R = 0
S R Qn+1 Qn+1
No
0 0 Qn Qn Change
S = 0 & R = 0 : No Change
114
S-R Flip-Flops
When S = 0 & R = 1
S R Qn+1 Qn+1
0 0 Qn Qn No
Change
0 1 0 1
Reset
115
S-R Flip-Flops
When S = 1 & R = 0
S R Qn+1 Qn+1
0 0 Qn Qn No
Change
0 1 0 1
Reset
1 0 1 0 Set
116
S-R Flip-Flops
When S = 1 & R = 1
S R Qn+1 Qn+1
No
0 0 Qn Qn Change
0 1 0 1 Reset
Set
1 0 1 0
1 1 1 1 Race
S = 1 & R = 1 : Race
117
J-K Flip-Flop
J Q
118
J-K Flip-Flop
J K Qn+1 Qn+1
No
0 0 Qn Qn Change
0 1 0 1 Reset
1 0 1 0 Set
1 1 Qn Qn Toggl
119
J-K Flip-Flop
When J = 0 & K = 0
J K Qn+1 Qn+1
No
0 0 Qn Qn Change
J = 0 & K = 0 : No Change
120
J-K Flip-Flops
When J = 0 & K = 1
J K Qn+1 Qn+1
0 0 Qn Qn No
Change
0 1 0 1
Reset
121
J-K Flip-Flops
When J = 1 & K = 0
J K Qn+1 Qn+1
0 0 Qn Qn No
Change
0 1 0 1
Reset
1 0 1 0 Set
122
J-K Flip-Flops
When J = 1 & K = 1
J K Qn+1 Qn+1
No
0 0 Qn Qn Change
0 1 0 1 Reset
Set
1 0 1 0
1 1 Qn Qn Toggl
e
J = 1 & K = 1 : Toggle
123
D Flip-Flop
D
J Q
1
K Q
D Q D Qn Qn’
D
CLK Flip-flop 0 0 1
Q
1 1 0
124
T Flip-Flop
T
J Q
T Q T Qn Qn’
T
CLK Flip-flop 0 1 0
Q
1 0 1
125
Applications of Flip-Flops
Acts as one bit memory
In the timers
126
Why do we need to learn
Microprocessors/controllers?
The microprocessor is the core of
computer systems.
Nowadays many communication, digital
entertainment, portable devices, are
controlled by them.
A designer should know what types of
components he needs, ways to reduce
production costs and product reliable.
127
The necessary tools for a
microprocessor/controller
CPU: Central Processing Unit
I/O: Input /Output
Bus: Address bus & Data bus
Memory: RAM & ROM
Timer
Interrupt
Serial Port
Parallel Port
128
Microprocessor (MPU)
A group of electronic
circuits fabricated on a
semiconductor chip that
can read binary
instructions written in
memory and process
binary data according
to those instructions
CPU and MPU
129
Microprocessors:
General-purpose microprocessor
CPU for Computers
No RAM, ROM, I/O on CPU chip itself
Example : Intel’s x86, Motorola’s
680x0
130
Microcontroller :
A smaller computer
On-chip RAM, ROM, I/O ports...
Example : Motorola’s 6811, Intel’s 8051, Zilog’s Z8 and
PIC 16X
131
Microcontroller
Microcontrollers
⎯ A microcontroller is a simple
computer implemented in a
single VLSI chip.
⎯ In general, microcontrollers
are cheap and have low
performance
It is mainly used in personal computers. It is used mainly in a washing machine, MP3 players,
and embedded systems.
Microprocessor has a smaller number of registers, so Microcontroller has more register. Hence the
more operations are memory-based. programs are easier to write.
It has no RAM, ROM, Input-Output units, timers, and It has a CPU along with RAM, ROM, and other
other peripherals on the chip. peripherals embedded on a single chip.
It's used for general purpose applications that allow It's used for application-specific systems.
you to handle loads of data.
It's complex and expensive, with a large number of It's simple and inexpensive with less number of
instructions to process. instructions to process in130
I
Microprocessor vs. Microcontroller
Microprocessor Microcontroller
CPU is stand-alone, RAM, •
CPU, RAM, ROM, I/O and
ROM, I/O, timer are timer are all on a single chip
separate • fix amount of on-chip ROM,
designer can decide on the
RAM, I/O ports
amount of ROM, RAM and • for applications in which cost,
I/O ports. power and space are critical
expansive
• single-purpose
versatility
general-
purpose
134
Applications of Microprocessor-Based Systems
Computers
⎯ System performance is normally the most important design concern
Other
... ...
Keyboard Monitor Disk
peripherals
Bus
1-135
Questions on G3.3