Você está na página 1de 39

Industrial Electronics

DEK 3113

Fundamental of
Programmable Logic
Controller

Chapter 4

Taaruf Session

Engr. Reza Ezuan Samin


B.Eng (Electronics) 2004
M.Eng in Electrical Engineering
(Mechatronics) 2006
Contact info:

Office : 07-4537868
E-mail : reza@uthm.edu.my
HP:016-7585859

What is a PLC Cont..

Programmable Logic Controllers (PLCs), also


referred as programmable controllers, are in
the computer family.

PLC is a digital electronic device, that uses


programmable memory to store instructions.

Can be programmed to implement functions


such as logic, sequencing, timing, counting
and arithmetic.

HARDWARE CONFIGURATION OF PLC

Laboratory Training set

PLC Advantages

PLCs are similar to computer but have certain features


which are specific to their use as controller. These are:
1. They are rugged and designed to withstand vibrations,
temperature, humidity, and noise.
2. The interfacing for inputs and outputs is inside the
controller.
3. Easily programmed and easily understood programming
language.

PLC Operation
1.

A PLC monitors inputs, makes decisions based


on its program, and controls outputs to
automate a process or machine.

2.

The operation of the PLC system is simple and


straightforward. The processor or CPU
completes three processes:
(1) scans, or reads, from the input devices
(2) executes or "solves" the program logic, and
(3) updates, or writes, to the output devices.

Memory map/address

TIMER (TIM)

address is from TIM 000 511

MNEMONIC
FUNCTION

COUNTER (CNT)
The address sharing with
timer
Mnemonic
00004

CP
00002

CNT 007
#10

CNT 007

10010 (siren)

END

LD
00004
LD
00002
CNT 007
#10
LD
CNT 007
OUT
10010
Fun (01)

CNTR (12)

CNTR is a reversible counter where both


up count and down count can be down by
the same counter
up

down

reset

CNTR (12)

DIFU(13) DIFFERENTIATION UP

DIFU turns its output ON when it detects


an OFF to ON transition in its input signal

DIFD(14) DIFFERENTIATION
DOWN
DIFD turns its output ON when it detects
an ON to OFF transition in its input signal
or from HIGH to LOW signal

Car
park
system
A simple
car park
control system allows only a

maximum of 30 cars parking spaces. Every time a car


comes in, an incoming sensor
will add 1 and any car that goes out an outgoing
sensor will deduct 1. If the car park is occupied with 30
cars at one time, a full sign will be lighted up to inform
there is no vacancy. Use instruction
CNTR for counting and DIFU and DIFD for the sensor.

KEEP(11) LATCHING RELAY


To replace normal latching
Has two input-set and reset
Better use HR so the output retain even though
power fails Set =00000
KEEP (11)
Reset=00001

IR/Output
Port/HR

END

Example

An incoming bar for a parking lot will raise up for 20 seconds when sensor 1
detects an incoming car. After passing the bar, sensor 2 will start count up
the number of cars that parks in the parking lot. At the exit sensor 3 will
deduct out going cars from the parking lots. If at one time the number of
cars in the parking lot is 20 then the full sign light will be on.
I/O assignment:
i/p
o/p
Sensor 1
Bar (Motor)
Sensor 2
Timer 1 (TIM 1 = #200)
Sensor 3
CNTR (#20)
Reset button
Full Sign
Tim 1 contact
CNTR contact

Figure for example given


Incoming

Sensor 1
Sensor 3
Sensor 2
Outgoing

Ladder Diagram

MOV(21)

To move a data from one channel to


another channel
Mov(21)
S
D

S : Source Channel

IR,SR,AR,DM,HR,TC,LR,#

D : Destination channel

IR,AR,DM,HR,LR

Example transfer data

eg-transfer data from channel 000 to 100

25313

MOV(21)

000
100

Transfer data diagram


Source input Channel
000

Destination Output Ch 100

Bit

Channel/
Word
15
000

14

13

12

11

10

09

08

07

06

05

04

03

02

01

00

001
002
.
.
.
100
.
999

Example

Display Error Code of Machine To Aid Tracing Source Of


Problem
Using MOV instruction design :
Activation of error input signal 00001 to 00003 will sound an alarm
and at the same time display the error code.
Input 00006 will reset the error code displayed after machine
recovery from error.

Example ladder diagram


00001
RED LIGHT
10000

00002

Alarm

00003

00001

MOV(21)
#0001
101

00002

00003

00006

MOV(21)
#0002
101

Alarm
Code #2

MOV(21)
#0003
101

Alarm Code
#3

MOV(21)
#0000
101

END

Alarm Code
#1

Reset Alarm
Code Display

CMP(20)-compare
Compare is used to compare the data in a specific channel with the
data in another channel or a four-digit hexadecimal constant

CMP(20)

Cp1

Cp2

Cp1: First Compare Word

IR,SR,AR,DM,HR,TC,LR,#

Cp 2: Second Compare Word

IR, AR, DM, HR, LR

Example
25313

TR0
CMP(20)

ADDR

OP CODE

DATA

0000

LD

25313

0001

OUT

TR0

0002

CMP (20)

#0020
#0020
HR1
HR1

25507 ( < )
10001

Green Light

25506(=)
10002

Red Light

0003

AND

25507

0004

OUT

10001

0005

LD

TR 0

0006

AND

25506

0007

OUT

10002

Add(30)

To add data in two different channel


Au: Augend Channel
IR,SR,AR,DM,HR,TC,LR,#
ADD(30)
Au
Ad

Ad: Addend Channel


IR,SR,AR,DM,HR,TC,LR,#
R: Result
IR,AR,DM,HR,LR

ADD(30)

00007

HR000
#1234
HR000

The operation:
ADDR

OP CODE

DATA

0000

LD

00007

0001

ADD(30)

0002

1.

HR000

#1234
HR000

HR000

HR000

0003

END(01)

#1235

2. Add #0001 + #1234 = #1235


3. The result:
HR000

#1234

#0001

#1235

Sub(31)

Opposite of add

Continue..

A simple car park control system allows only a


maximum of 30 cars parking spaces. Every time a car
comes in, an incoming sensor
will add 1 and any car that goes out an outgoing
sensor will deduct 1. If the car park is occupied with 30
cars at one time, a full sign will be lighted up to inform
there is no vacancy. Replace CNTR with ADD and SUB.

Exercise

Using KEEP instruction to solve these problems


instead of normal latching:
A sensor is placed outside yellow line that
enclosed the robot to provide safety cautions to
the user. If the sensor detects someone crossing
the yellow line the robot will automatically stop its
operation and the siren will on until a reset button
is pressed. Then the push button need to be
pressed for robot to run again.

YELOW
LINE
sensor

sensor

ROBOT
sensor

Solution

Exercise 2
An automatic home garage is equipped with sensor 1, S1, that
detects the approaching car and will open the garage until sensor
2, S2,detects the whole car body has safely parks inside the
garage. Use DIFU and DIFD to solve the problem.
S2

S1

Garage Door

Solution

Exercise 3
A conveyor belt is used to transfer red and blue balls for
sorting by initially pressed the start button. A colour sorter
system is designed to sort red balls and blue balls. If
sensor 1 detects red ball, the ball will be pushed into bin 1
by cylinder 1 (CY1) for 2 seconds. If sensor 2 detects blue
ball then the ball will be pushed into bin 2 by cylinder 2
(CY2) for another 2 seconds. If the counter has counted 10
red balls, then red light is on and when counter has
counted 10 blue balls then green light is on. When either
lights is on the conveyor stops the transferring of the balls.
The conveyor will start again when reset button is pressed
to empty the adder of full ball and the system restart. Use
ADD, MOV, CMP instead of CNT.

Assignment
A conveyor belt is used to transfer red and blue balls for sorting by
initially pressed the start button. A color sorter system is designed to
sort red balls and blue balls. If sensor 1 detects red ball, the ball will
be pushed into bin 1 by cylinder 1 (CY1).If sensor 2 detects blue ball
then the ball will be pushed into bin 2 by cylinder 2 (CY2). If the
counter has counted 10 red balls, then red light is on and when
counter has counted 10 blue balls then green light is on. When
either lights is on the conveyor stops the transferring of the balls.
Use CNT instead of ADD and SUB.
Assume traveling time for cylinder from original position to full
extension(vice versa is 0.2 sec) and all cylinder is single acting
cylinder.
All cylinder will go back to its original position after transferring the
ball.

Assignment
Two different item need to be sort out. It is been placed along a
conveyor belt. Conveyor belt will turn on when sensor 1 detect the first
item present on that conveyor belt at its origin. When sensor 2 detect
item A, it will be transferred by single acting cylinder, CY1 to first path.
When LS1 detect the full extension of CY1,it will return to its initial
position. When sensor 3 detect item B,it will be transferred by single
acting cylinder,CY2 to second path.When LS2 detect full extension of
CY2,it will return to its intial position.If the counter has counted 30 item A,
green light will be on.If the counter counted 30 item B,blue light will be
on.When one of the counter has count 30 item no matter item A or item B,
the conveyor belt will be turn off. It will be turn on again when the adder
of full ball is reset to zero then the system will restart again. Use DIFU,
ADD, MOV, and CMP instead of CNT.

BREAK TIME !

Any Questions
So far???

Você também pode gostar