You are on page 1of 47

UNIT IV

CONTROLLERS AND ALGORITHMS


Dr. RM. KUPPAN CHETTY., M.Tech., Ph.D
CONTENTS

 MICROPROCESSORS
 MICROCONTROLLERS
 PROGRAMMABLE LOGIC CONTROLLERS
 ARTIFICIAL NEURAL NETWORKS
 FUZZY LOGIC CONTROLLERS

25-12-2019 HITS-II-BMS-RMKP 2
OUTCOMES
Students are able to
 Describe the basic structure and architecture of the microprocessor and micro
controllers and how they can be applied in mechatronic system design
 Describe the basic structure of the Programmable logic controller (PLC) and
appreciate its uses in mechatronic system design
 Discuss the use of Artificial Neural Networks and Fuzzy logics as control
algorithms in mechatronic systems.

25-12-2019 HITS-II-BMS-RMKP 3
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.

25-12-2019 HITS-II-BMS-RMKP 4
INTRODUCTION

25-12-2019 HITS-II-BMS-RMKP 5
DIAGRAM OF A COMPUTER SYSTEM
A computer is a programmable machine that receives input, stores
and manipulates data/information, and provides output in a useful
format.

25-12-2019 Diagram Of AHITS-II-BMS-RMKP


Computer
6 System
Building Blocks of Processor Systems

MEM ORY
INPUT-OUTPUT

CONTROL

DATAPATH
CPU
Processor System Architecture
The typical processor system consists
of:

 CPU (central processing unit)


 ALU (arithmetic-logic unit)
Interconnections between
 Control Logic
these units:
 Registers, etc…
 Address Bus
 Memory
 Data Bus
 Input / Output interfaces  Control Bus
General-purpose microprocessor

• CPU for Computers


• Commonly no RAM, ROM, I/O on CPU chip itself

Many chips on motherboard


Data Bus
CPU
General-
Serial
Purpose RAM ROM I/O Timer COM
Micro- Port
Port
processor
Address Bus

25-12-2019 HITS-II-BMS-RMKP 9
Bus and CPU

Bus: A shared group of wires used for communicating


signals among devices
• Address bus: the device and the location within the
device that is being accessed
• Data bus: the data value being communicated
• Control bus: describes the action on the address and
data buses

CPU: Core of the processor, where instructions are executed


• High-level language: a = b + c
• Assembly language: add r1 r2 r3
• Machine language: 0001001010111010101

25-12-2019 HITS-II-BMS-RMKP 10
Memory and I/O
Memory: Where instructions (programs) and data are stored
• Organized in arrays of locations (addresses), each storing
one byte (8 bits) in general
• A read operation to a particular location always returns the
last value stored in that location

I/O devices: Enable system to interact with the world


 Device interface (a.k.a. controller or adapter) hardware connects
actual device to bus
 The CPU views the I/O device registers just like memory that
can be accessed over the bus. However, I/O registers are connected
to external wires, device control logic, etc.
 Reads may not return last value written
 Writes may have side effects

25-12-2019 HITS-II-BMS-RMKP 11
8085 Microprocessor Architecture
The 8085 Bus Structure
The 8-bit 8085 CPU (or MPU – Micro Processing Unit) communicates with the
other units using a 16-bit address bus, an 8-bit data bus and a control bus.
The 8085 Bus Structure

Address Bus
 Consists of 16 address lines: A0 – A15

 Operates in unidirectional mode: The address


bits are always sent from the MPU to peripheral
devices, not reverse.

 16 address lines are capable of addressing a


total of 216 = 65,536 (64k) memory locations.

 Address locations: 0000 (hex) – FFFF (hex)


The 8085 Bus Structure
Data Bus
 Consists of 8 data lines: D0 – D7

 Operates in bidirectional mode: The data bits are


sent from the MPU to peripheral devices, as well
as from the peripheral devices to the MPU.

 Data range: 00 (hex) – FF (hex)

Control Bus
 Consists of various lines carrying the control
signals such as read / write enable, flag bits.
The 8085: CPU Internal Structure

The internal architecture of the 8085 CPU is


capable of performing the following operations:

 Store 8-bit data (Registers, Accumulator)

 Perform arithmetic and logic operations (ALU)


 Test for conditions (IF / THEN)

 Sequence the execution of instructions

 Store temporary data in RAM during execution


Microcontroller :
• A single-chip computer
• On-chip RAM, ROM, I/O ports...
• Example:Motorola’s 6811, Intel’s 8051, Zilog’s Z8 and PIC 16X

CPU RAM ROM

Serial
I/O Timer COM
Port
Port

17
25-12-2019 HITS-II-BMS-RMKP
Microcontroller

18
25-12-2019 HITS-II-BMS-RMKP
Microprocessor vs. Microcontroller
Microprocessor Microcontroller
• CPU is stand-alone, RAM, ROM,
I/O, timer are separate • CPU, RAM, ROM, I/O and timer are
all on a single chip
• designer can decide on the
amount of ROM, RAM and I/O • fixed amount of on-chip ROM,
ports. RAM, I/O ports
• expensive • for applications in which cost,
• versatility power and space are critical
• general-purpose • single-purpose (control-oriented)
• High processing power • Low processing power
• High power consumption • Low power consumption
• Instruction sets focus on • Bit-level operations
processing-intensive operations • Instruction sets focus on control
• Typically 32/64 – bit and bit-level operations
• Typically deep pipeline (5-20 • Typically 8/16 bit
stages) • Typically single-cycle/two-stage
19
25-12-2019 HITS-II-BMS-RMKP
pipeline
Intel 8051 Basic Component
• 4K bytes internal ROM
• 128 bytes internal RAM
• Four 8-bit I/O ports (P0 - P3).
• Two 16-bit timers/counters
• One serial interface
CPU RAM ROM
A single chip
I/O Serial Microcontroller
Timer COM
Port
Port

20
25-12-2019 HITS-II-BMS-RMKP
Block Diagram of General Microcontroller

External Interrupts

Interrupt 4k 128 bytes Timer 1


Control ROM RAM Timer 2

CPU

OSC Bus
4 I/O Ports Serial
Control

P0 P2 P1 P3 TXD RXD
21
25-12-2019 Addr/Data
HITS-II-BMS-RMKP
Other 8051 features
• only 1 On chip oscillator (external crystal)
• 6 interrupt sources (2 external , 3 internal, Reset)
• 64K external code (program) memory(only read)PSEN
• 64K external data memory(can be read and write) by RD,WR
• Code memory is selectable by EA (internal or external)
• We may have External memory as data and code

22
25-12-2019 HITS-II-BMS-RMKP
8051 Internal architecure

23
25-12-2019 HITS-II-BMS-RMKP
Selection of Microcontroller
- Factors to be considered

 No of Input / Output Pins. I.e. No. of I/O’s needed for the task
concerned
 Interface required. Ex. PWM is needed for motor control
 Memory requirement – Size of the memory for the task
 No. of Interrupts – based on no. of critical events need to be
serviced
 Processing Speed

24
25-12-2019 HITS-II-BMS-RMKP
Simple Temperature Measurement System using
Microcontroller

Temperature as voltage – ADC – Converted into BCD data – storage


register – 7 Segment Display
25
25-12-2019 HITS-II-BMS-RMKP
Domestic Washing using Microcontroller

26
25-12-2019 HITS-II-BMS-RMKP
Programmable Logic Controllers
(PLC)
Programmable Logic Controllers
• PLC – microprocessor based system used to control
machines and processes
• Stores instructions in a programmable memory
• Implements functions or set of rules
• Logics
• Sequencing
• Timing
• Counting
• Arithmetic etc..

25-12-2019 HITS-II-BMS-RMKP 28
PLC – Basics – Introduction (contd.)

• Defined as miniature industrial computers that contain


hardware and software used to perform control functions
• PLC is a dedicated computer designed to work in an industrial
environment
• Equipped with special Input / Output Interfaces
• Features
• Rugged, withstand industrial environment such as heat,
humidity, shocks and vibrations
• Ease of Programming with dedicated mnemonics
• Capable of implementing both logic and PID control

25-12-2019 HITS-II-BMS-RMKP 29
PLC – Basics – Introduction (contd.)

25-12-2019 HITS-II-BMS-RMKP 30
PLC – Basics – Introduction (contd.)

Control Structure architecture of PLC

25-12-2019 HITS-II-BMS-RMKP 31
PLC – Basic Components

PLC’s consist of a few different


components
• Power supply.
• Input module.
• Output module.
• Processor (CPU)
• Programming device / Teach Pendant
• Monitor / Display
• Rack or mounting assembly.
• Programming unit (software)
25-12-2019 HITS-II-BMS-RMKP 32
PLC – Basic Components (Contd.)
Processor:
• It is the heart of PLC
• He processor processes the signals
from input module and generates
controlling signals for the system
• It also scans and solve the logic of the
user program
• It consists of ALU, microprocessor unit,
memory unit and system power supply
Memory:
• Contains the program stored in it
• Programs were written with control actions to be executed by the microprocessor
for the input given
• RAM is a temporary storage device used to store ladder diagram and for testing
and evaluation
25-12-2019 HITS-II-BMS-RMKP 33
PLC – Basic Components (Contd.)
Power Supply:
• Convert the main A.C voltage into a low - level D.C voltage (5V).
• D.C. voltage is supplied to the processor and the circuits in the input and output
interface modules.
• Should be free from heavy loads, noises and voltage fluctuations.

Input / Output Modules (peripheral devices)


• Input module receives information from extended devices and sends to processor
• Output modules communicates the processed information to the external devices
• Input devices are mechanical switches, photo sensors, temperature sensors, flow
sensors, other type of sensors keypads etc.,
• Output devices may include solenoid valves, Relays, contactors, lights, Horns,
Heating elements, fans, Motor starter, signal Amplifiers. Conveyor belt, lift,
automatic door etc..

25-12-2019 HITS-II-BMS-RMKP 34
PLC Architecture

25-12-2019 HITS-II-BMS-RMKP 35
PLC Architecture
CENTRAL PROCESSING UNIT (CPU)
• It has the following:
• An Arithmetic and Logic Unit (ALU) that is responsible for data manipulation
and carrying out arithmetic operations of addition and subtraction and logic
operations of AND, OR, NOT, and EXCLUSIVE-OR.
• Memory, termed registers, located within the microprocessor and used to
store information involved in program execution.
• A control unit that is used to control the timing of operations.

MEMORY
• System read-only-memory (ROM) gives permanent storage for the operating
system and fixed data used by the CPU.
• Random-access memory (RAM) is used for the user’s program.
• Random-access memory (RAM) is used for data.

25-12-2019 HITS-II-BMS-RMKP 36
PLC Architecture (contd.)
Control Unit / Processor:
• A control unit is used to control the timing of
operations.
• Analyze the data from the sensors through input
modules and make decisions based on the user
defined functions
• The processor functions under a permanent
supervisory operating system that directs the
overall operations from data input and output to
execution of user programs.
• Controller can perform only one operation at a time.
So, it scans each of the inputs sequentially,
evaluates the ladder diagram program, provide each
output(s), and then repeat the whole process.
• Hence, the timing control's necessary for a PLC
system.
25-12-2019 HITS-II-BMS-RMKP 37
PLC Architecture (contd.)
Control Unit / Processor:
Arithmetic and Logic Unit (ALU):
• Performs data manipulation and arithmetic and logical operations on input
variable data and determines the proper state of the output variables.
• Arithmetic operation includes addition, subtraction etc., and logic operations
include AND, OR, AND, EXCLUSIVE - OR.
Memory Unit:
• Registers located within the microprocessor and used to store information
involved in a program execution, which contains control actions to be executed by
the microprocessor for the given input.
• There are several memory elements in a PLC system.
• System Read-only Memory (ROM) gives permanent storage for the operating
system and fixed data wed by the CPU.
• RAM for the user to develop program and acts a temporary memory.
• In addition, temporary buffer stores
25-12-2019
for the I/O channels.
HITS-II-BMS-RMKP 38
PLC Architecture (contd.)
Memory Unit:
• During entering and editing including Debugging, the program is stored in the
temporary storages called RAM (Random Access memory).
• Once the program is completely finished (free & from errors), It may be 'burned'
into ROM
• When the ROM is plugged into the PLC, the device is ready to be placed into
service in the industrial environment.
• Memory may be either volatile type or Non-volatile type.
Volatile Memory:
• Volatile memory will lose all its programmed contents if operating power is
removed or lost.
Non Volatile Memory: It does not lose its content during power failure.
• Permanent memory or system memory is (used) a system memory that stores
the monitor a booting programs, lookup tables etc.,
• This usually programmed and supplied by the manufacturer and controls the
25-12-2019 HITS-II-BMS-RMKP 39
operation of PLC.
PLC Architecture (contd.)
The Different Types of ROMS are

25-12-2019 HITS-II-BMS-RMKP 40
25-12-2019 HITS-II-BMS-RMKP 41
PLC Architecture (contd.)
BUSES:

25-12-2019 HITS-II-BMS-RMKP 42
PLC Architecture (contd.)

25-12-2019 HITS-II-BMS-RMKP 43
PLC Architecture (contd.)
BUSES:

25-12-2019 HITS-II-BMS-RMKP 44
PLC Architecture (contd.)
INPUT & OUTPUT UNIT

25-12-2019 HITS-II-BMS-RMKP 45
Selection of PLC - Factors to be considered
To determine the most suitable PLC to be used in the automation
task there are several basic considerations to be made:
• Necessary input/output capacity
• Types of I/O required
• Size of memory required
• Speed and power required of the CPU and instruction set
• Communication protocols
• Power supply

25-12-2019 HITS-II-BMS-RMKP 46
Self Study:
– Role as control algorithm in Mechatronic System design
• Artificial Neural Networks (ANN)
• Fuzzy Logic – Role as Control algorithm in Mechatronic
System design

25-12-2019 HITS-II-BMS-RMKP 47

You might also like