chapter 4 plc
DESCRIPTION
TRANSCRIPT
Chapter 4
Fundamental of Programmable Logic Controller
Industrial Electronics
DEK 3113
Ta’aruf SessionTa’aruf Session Engr. Reza Ezuan Samin Engr. Reza Ezuan Samin B.Eng (Electronics) 2004B.Eng (Electronics) 2004 M.Eng in Electrical Engineering M.Eng in Electrical Engineering
(Mechatronics) 2006(Mechatronics) 2006 Contact info:Contact info:
Office : 07-4537868Office : 07-4537868 E-mail : E-mail : [email protected] HP:016-7585859HP: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 Operation1. 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 timerCP
CNT 007
#10
00004
00002
CNT 00710010 (siren)
END
Mnemonic 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
CNTR (12)
up
down
reset
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 systemA 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 latchingHas two input-set and resetBetter use HR so the output retain even though power fails Set =00000
Reset=00001
KEEP (11)
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
Sensor 1
Sensor 2
Sensor 3
Incoming
Outgoing
Ladder Diagram
Figure for example given
MOV(21) To move a data from one channel to
another channel
Mov(21)
S
D
S
S : Source Channel
IR,SR,AR,DM,HR,TC,LR,#
D : Destination channel
IR,AR,DM,HR,LR
Example transfer dataeg-transfer data from channel 000 to 100
25313MOV(21)
000
100
Transfer data diagramSource input Channel 000
Destination Output Ch 100
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
000 0 0 0 1 0 0 0 1 1 0 1 0 0 1 1 1
001
002
.
.
.
100 0 0 0 1 0 0 0 1 1 0 1 0 0 1 1 1
.
999
BitChannel/Word
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
00002
00003
RED LIGHT 10000
Alarm
Alarm Code #1
00001 MOV(21)#0001
101
MOV(21)#0002
101
00002
MOV(21)#0003
101
00003
MOV(21)#0000
101
00006
END
Alarm Code #2
Alarm Code #3
Reset Alarm Code Display
CMP(20)-compareCompare is used to compare the data in a specific channel with thedata 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
25313 TR0
CMP(20)
#0020
HR1
25507 ( < )
25506(=)
10001
10002
Green Light
Red Light
ExampleADDR OP CODE DATA
0000 LD 25313
0001 OUT TR0
0002 CMP (20)
#0020
HR1
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
ADD(30)
Au
Ad
R
Au: Augend Channel
IR,SR,AR,DM,HR,TC,LR,#
Ad: Addend Channel
IR,SR,AR,DM,HR,TC,LR,#
R: Result
IR,AR,DM,HR,LR
ADD(30)
HR000
#1234
HR000
00007
ADDR OP CODE DATA
0000 LD 00007
0001 ADD(30)
0002 HR000
#1234
HR000
0003 END(01)
The operation:
HR000 #00011.#1234
2. Add #0001 + #1234 = #12353. The result:
HR000 #1235
HR000 #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.
ExerciseUsing KEEP instruction to solve these problemsinstead 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
ROBOT
sensor
sensorsensor
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.
S1
S2
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.
AssignmentTwo 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???