UNIT 4 Controllers PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 71

Controllers

There are several types of controllers :


• Mechanical
• Electrical
• Electromechanical
• Hydraulic & Pneumatic
• Digital Controllers
Here, we discuss in brief some of digital controllers
such as :microprocessor,
microcontroller,
programmable logic controller(PLC)
© Oxford University Press 2015. All rights
reserved.
Controllers: Basics of number system,
binary, octal and hexadecimal systems with
their conversion from one system to other.
Boolean algebra, logic gates, ICs, flip-flops
& counters.
Microprocessor, Microcontroller, PLC &
their Architectures, Working Principle,
Software Programs (Assembly/High Level),
Interfacing Aspects

© Oxford University Press 2015. All rights


reserved.
Topics to be thought through Flipped Learning
(NPTEL MOOCs) -
https://nptel.ac.in/courses/112107298)

• Basics of number, binary, octal and


hexadecimal systems with their conversion
from one system to other. Boolean algebra,
logic gates, ICs, flip-flops. (Unit 5 Lecture
21&22)
• PLC Controller (Unit 7 Lecture 33)
© Oxford University Press 2015. All rights
reserved.
Learning Objectives
• Demonstrate proficiency in the various number
systems
• Apply Boolean algebra principles to simplify logical
expressions.
• Identify and analyze the function of basic logic gates
(AND, OR, NOT, NAND, NOR, XOR).
• Explain the operation of various types of flip-flops (SR,
JK, D, T).
• Describe the architecture, working principles and
various interfacing techniques of microprocessors,
microcontrollers and PLC.
• Write and debug simple assembly language programs.
© Oxford University Press 2015. All rights
reserved.
Microprocessors

© Oxford University Press 2016. All rights reserved.


Microprocessor
• A single-chip programmable logic
device designed and developed
with VLSI technology.
• Performs mathematical, logical,
and decision-making operations
through input–output (I/O) ports
and memory.
Components of MPU
• Input port devices
• Brain or central processing unit
(CPU)
• Memory
• Output Port devices
• Bus (data, address, control)
Block Diagram MPU
Microcontroller Microprocessor

•The microcontroller is the heart of an •The microprocessor is the heart of a Computer


embedded system. system.
•The microcontroller has internal memory and •It is just a processor. Memory and I/O
i/O components components have to be connected externally
•Since memory and I/0 are present internally, •Since memory and I/O have to be connected
the circuit is small. externally, the circuit becomes large.
•Can be used in compact systems and hence it is •Cannot be used in compact systems and hence
an efficient technique inefficient
•The cost of the entire system is low •Cost of the entire system increases
•Due to external components, the entire power
•Since external components are low, total
consumption is high. Hence it is not suitable to
power consumption is less and can be used with
use with devices running on stored power like
devices running on stored power like batteries.
batteries.
•Most microcontrollers have power-saving
modes like idle mode and power-saving •Most microprocessors do not have power-
mode. This helps to reduce power saving features.
consumption even further.
•Since memory and I/O components are all
•Since components are internal, most of the
external, each instruction will need an
operations are internal instruction, hence
external operation, hence it is relatively
speed is fast.
slower.
•Microprocessors have less number of
•Microcontrollers have more registers, hence
registers, hence more operations are memory
the programs are easier to write.
based
•Microprocessors are based on the von
•Microcontrollers are based on Harvard
Neumann model/architecture where
architecture where program memory and
programs and data are stored in the same
Data memory are separate
memory module
•Used mainly in washing machines, MP3 •Mainly used in personal computers (general
players (dedicated systems) purpose systems)

•CPU , RAM, ROM, I/O and timers are all on a •CPU is stand-alone, RAM, ROM, I/O, timer
single chip are separate

•8051, PIC, ARM •8085, 8086


8085 Pin Diagram

RD
WR
ALE

© Oxford University Press 2015. All rights ALE - Address latch enable
reserved.
Direct Memory Access

RD
WR
ALE
Machines Cycle Status

© Oxford University Press 2015. All rights


reserved.
Mnemonic- MVI A, 32H
Opcode- MVI
Operand- A, 32H
Hex Code- 3E
32
Binary code- 0011 1110
0011 0010

© Oxford University Press 2015. All rights


reserved.
Flow Chart of Working
An MPU performs three
steps execution:
• fetch to read,

• interpret (decode)

• and perform (execute).


Architecture of 8085

© Oxford University Press 2015. All rights


reserved.
Flags

© Oxford University Press 2015. All rights


reserved.
© Oxford University Press 2015. All rights
reserved.
•8-bit data bus
•16-bit address bus, which can address upto 64KB
•A 16-bit program counter
•A 16-bit stack pointer
•Six 8-bit registers arranged in pairs: BC, DE, HL
• Requires +5V supply to operate at 3.2 MHZ single
phase clock
General purpose register
There are 6 general purpose registers in 8085 processor, i.e. B, C, D, E, H &
L. Each register can hold 8-bit data.
These registers can work in pair to hold 16-bit data and their pairing
combination is like B-C, D-E & H-L.
Program counter
It is a 16-bit register used to store the memory address location of the next
instruction to be executed. Microprocessor increments the program
whenever an instruction is being executed, points to the memory address of
the next instruction that is going to be executed.
Stack pointer
16-bit register works like stack, which is always incremented/decremented
by 2 during push & pop operations.
Instruction register and decoder
• It is an 8-bit register. When an instruction (Op-
code) is fetched from memory then it is stored
in the Instruction register. Instruction decoder
decodes the information present in the
Instruction register.

© Oxford University Press 2015. All rights


reserved.
© Oxford University Press 2015. All rights
reserved.
© Oxford University Press 2015. All rights
reserved.
© Oxford University Press 2015. All rights
reserved.
Programing Languages

© Oxford University Press 2015. All rights


reserved.
Instruction Format
One-byte instructions
In 1-byte instruction, the opcode and the operand of
an instruction are represented in one byte. Op-code (1
byte) operand (0byte)

Mnemonic- ADD B
Mnemonic- MOV B, A
Opcode- ADD
Opcode- MOV
Operand- B
Operand- B, A
Hex Code- 80H
Hex Code- 47H
Binary code- 1000 0000
Binary code- 0100 0111
Instruction Format
Two-byte instructions –
Two-byte instruction is the type of instruction in
which the first 8 bits indicates the opcode and
the next 8 bits indicates the operand.
Mnemonic- MVI A, 32H Mnemonic- MVI B, F2H
Opcode- MVI Opcode- MVI
Operand- A, 32H Operand- B, F2H
Hex Code- 3E Hex Code- 06
32 F2
Binary code- 0011 1110 Binary code- 0000 0110
0011 0010 1111 0010
Three-byte instructions –

Three-byte instruction is the type of instruction in


which the first 8 bits indicates the opcode and the next
two bytes specify the 16-bit address. The low-order
address is represented in second byte and the high-
order address is represented in the third byte.
Mnemonic- LDA 2050H Mnemonic- JMP 2085H
Opcode- LDA Opcode- JMP
Operand- 2050H Operand- 2085H
Hex Code- 3A Hex Code- C3
50 85
20 20
Binary code- 0011 1010 Binary code- 1100 0011
0101 0000 1000 0101
0010 0000 0010 0000
Instructions Set
8085 - 74 Operation Code
Types of instructions
• Data transfer - MOV, MVI, LXI, LDA, STA
• Arithmetic - : ADD, SUB, INR, DCR
• Logical - ANA, XRA, ORA, CMP, RAL
• Branch (change the sequence of instruction
execution) - JMP, JC, JZ, CALL
• Machine/device control - IN, OUT, PUSH, POP,
HLT
Addressing Modes
• Direct
• Register
• Indirect
• Immediate
• Implicit
• Inherent/Implied
Subroutine

Group of
instruction
separate from
main program.
Avoids
repetition of
instruction in
the main
program and
thus saves
time.

© Oxford University Press 2015. All rights


reserved.
Memory Interfacing

© Oxford University Press 2015. All rights


reserved.
Input Device Interfacing

© Oxford University Press 2015. All rights


reserved.
Microcontrollers

© Oxford University Press 2015. All rights


reserved.
Introduction
Microprocessor Vs Microcontroller

A microprocessor system :As a general-purpose digital computer


system with a microprocessor such as a CPU. It is featured with
a CPU, an ALU, and general-purpose and flag registers.

A microcontroller: As a computer on a single chip. A


microcontroller has a microprocessor with memory I/O device
ports and a timer counter on a single chip

© Oxford University Press 2015. All rights


reserved.
Block Diagram of a Microcontroller

(Register

© Oxford University Press 2015. All rights


reserved.
ALE 𝐸𝐴
𝑃𝑆𝐸𝑁

In 8051-based system, the crystal oscillator has a frequency of 11.0592 MHz. Each machine
cycle is made up of 12 clock cycles. Hence for a single machine cycle, the frequency becomes
1/12 × 11.0529 MHz = 921.6 KHz.
8051 PIN Diagram

TxD/

[𝑃𝑆𝐸𝑁]= 0, then
external program
memory becomes
enabled and micro
controller read
content of external
memory location.

© Oxford University Press 2015. All rights


reserved.
Architecture of a Microcontroller

© Oxford University Press 2015. All rights


reserved.
SFR Functions

© Oxford University Press 2015. All rights


reserved.
Features of 8051

© Oxford University Press 2015. All rights


reserved.
© Oxford University Press 2015. All rights
reserved.
Microcontroller Programming
Four classes of operation:
• Operations for data transfer functions
• Operations to handle arithmetic functions
• Operations to handle logical functions
• Operations for branch/loop functions
Data Movement Operations

© Oxford University Press 2015. All rights


reserved.
Arithmetic Operation

© Oxford University Press 2015. All rights


reserved.
Logical Operation

© Oxford University Press 2015. All rights


reserved.
Bit Rotation Operation

© Oxford University Press 2015. All rights


reserved.
Bit Rotation with Carry

© Oxford University Press 2015. All rights


reserved.
Interfacing Concept of 8051

• Integration of Hardware and Software:


• Analog Interfacing
Input Device Interfacing

© Oxford University Press 2015. All rights


reserved.
Output Device Interfacing

© Oxford University Press 2015. All rights


reserved.
Memory Interfacing

© Oxford University Press 2015. All rights


reserved.
Programmable Logic
Controllers
(PLC)
PLC Vs microprocessor
Vs microcontroller
© Oxford University Press 2015. All rights
reserved.
Basic Structure of PLCS

PLC – use µC or µ P

Modular Type interfacing.


Used in environment with noise,
dust and vibration.
Rugged design & optically isolated.
© Oxford University Press 2015. All rights
Automation or Supervisory control. reserved.
Hardware Components of PLCS

© Oxford University Press 2015. All rights


reserved.
Circuit for Input Module

© Oxford University Press 2015. All rights


reserved.
© Oxford University Press 2015. All rights
reserved.
Circuit for Output Modules

© Oxford University Press 2015. All rights


reserved.
© Oxford University Press 2015. All rights
reserved.
PLC Configuration

© Oxford University Press 2015. All rights


reserved.
PLC Operation

Check status of sensor ON or OFF


& stores the information in
memory location
Issue control signal , action
implemented and status stored
in specified memory location

Output status check and changes


as per requirement to correct it
© Oxford University Press 2015. All rights
reserved.
Software Concept
The five PLC programming languages are as
follows:
• Instruction list (IL): assembly language, Low
level Programming language
• Structured text (ST) : High level Programming
• Ladder diagram (LD): Electrical Wiring type
• Functional block diagram (FBD): Graphical
representation, structure analysis using
logical blocks.
• Sequential function chart (SFC): Graphical
language Petri nets and SDL
Ladder Program Symbols

© Oxford University Press 2015. All rights


reserved.
© Oxford University Press 2015. All rights
reserved.
Implementation of PLC Logical Functions

AND Function:

LD or LDI indicates to
the PLC that a new
rung is starting
© Oxford University Press 2015. All rights
reserved.
OR Function

© Oxford University Press 2015. All rights


reserved.
NAND Function

© Oxford University Press 2015. All rights


reserved.
NOR Function

© Oxford University Press 2015. All rights


reserved.
EX-OR Function

© Oxford University Press 2015. All rights


reserved.
PLC Timer (Time delay using timer)

© Oxford University Press 2015. All rights


reserved.
Thanks

© Oxford University Press 2015. All rights


reserved.

You might also like