Programming PLCs Programming PLCs using LADDER Logic using LADDER Logic
Programming PLCs Programming PLCs using LADDER using LADDER
LogicLogic
Presentation OutlinePresentation Outline
Review of Ladder ProgrammingReview of Ladder ProgrammingKeyence PLC Ladder BuilderKeyence PLC Ladder BuilderExample 1: Motor ControlExample 1: Motor ControlExample 2: Drill ControlExample 2: Drill ControlExample 3: Traffic LightExample 3: Traffic Light
Programming the PLCProgramming the PLC
Ladder Logic DiagramsLadder Logic DiagramsFunction Block DiagramsFunction Block DiagramsSequential Function ChartsSequential Function ChartsInstruction ListInstruction ListStructured TextStructured TextHigh-Level LanguageHigh-Level Language
PLC Scan CyclePLC Scan Cycle
ReadReadInputsInputs
ExecuteExecuteProgramProgram
UpdateUpdateOutputsOutputs
Ladder Logic ExecutionLadder Logic Execution Rungs of Ladder diagram are solved from Rungs of Ladder diagram are solved from
Left to right and top to bottomLeft to right and top to bottom Branches within rungs are solved top left Branches within rungs are solved top left
to bottom rightto bottom right
PP SS
RR
AA
BB
DD EE
FF GG HH
II JJ KK
Left Power RailLeft Power Rail
BranchBranch
Right Power RailRight Power Rail
Ladder RungLadder Rung
Basic Ladder Basic Ladder ProgrammingProgramming
Basic Ladder Basic Ladder ProgrammingProgramming
Basic Ladder Basic Ladder ProgrammingProgramming
Basic Ladder Basic Ladder ProgrammingProgramming
TimerTimer
OutputOutput
Input TriggeredInput Triggered
Timer SettingTimer Setting
Keyence Ladder BuilderKeyence Ladder Builder http://www.keyence.com/products/plc.html
-> PLC Library Free evaluation version – up to 50 timesFree evaluation version – up to 50 times KV -> PLC Series from KeyenceKV -> PLC Series from Keyence
Keyence Ladder BuilderKeyence Ladder BuilderStartStart -> -> Programs Programs -> -> Keyence Applications Keyence Applications ->->
Ladder Builder for KV Sample Ver.Ladder Builder for KV Sample Ver.
Keyence Ladder BuilderKeyence Ladder Builder
Create a new file. Select the KV10 Create a new file. Select the KV10 model.model.
Keyence Ladder BuilderKeyence Ladder Builder
ToolbarToolbar
Ladder Ladder EditorEditor
Keyence Ladder BuilderKeyence Ladder BuilderBasic Table of I/OBasic Table of I/O
KV-10KV-10Input Input
RelaysRelaysOutput Output RelaysRelays
Internal Internal RelaysRelaysTimers/Timers/
CountersCountersData Data
MemoryMemory
0000 – 0000 – 00050005 0500 – 0500 – 05030503 1000 – 1000 – 19151915 T/C 000 – T/C 000 – 063063 DM 0 – DM 0 – 09990999
Example 1 – Motor Example 1 – Motor ControlControl
K1K1
~~
StarStartt
StopStop
K1K1~~ ~~ ~~
M1M1
K1K1
* The overload relay has been omitted in order to * The overload relay has been omitted in order to simplify the circuitsimplify the circuit
Example 1 – Motor Example 1 – Motor ControlControl
Stop -> Input Relay 0000 (X000)Stop -> Input Relay 0000 (X000)Normally Closed (NC)Normally Closed (NC)
Start -> Input Relay 0001 (X001)Start -> Input Relay 0001 (X001)Normally Open (NO)Normally Open (NO)
Motor -> Output Relay 0500 (Y050)Motor -> Output Relay 0500 (Y050)
Example 1 – Motor Example 1 – Motor ControlControl
ENDHENDH
ENDEND
Ladder Diagram:Ladder Diagram:
StartStart StopStop MotorMotor
MotorMotor
Example 1 – Motor Example 1 – Motor ControlControl
Add a normally open contactAdd a normally open contact
Select Select relayrelay00010001
Example 1 – Motor Example 1 – Motor ControlControl
Add a normally closed contactAdd a normally closed contact
Select Select relayrelay00000000
Example 1 – Motor Example 1 – Motor ControlControl
Add horizontal connection linesAdd horizontal connection lines
Example 1 – Motor Example 1 – Motor ControlControl
Add an output relayAdd an output relay
Select Select relayrelay05000500
Example 1 – Motor Example 1 – Motor ControlControl
Connect the circuit to the right power lineConnect the circuit to the right power line
Example 1 – Motor Example 1 – Motor ControlControlPlace the cursor below the contact of relay 0001Place the cursor below the contact of relay 0001
Add a Branch with a NO contact (OR Add a Branch with a NO contact (OR logic)logic)
Select Select relayrelay05000500
Example 1 – Motor Example 1 – Motor ControlControlPlace the cursor below the NO contact of relay 0500.Place the cursor below the NO contact of relay 0500.
Type Type ENDEND -> for end of routine . Click -> for end of routine . Click OKOK..
Example 1 – Motor Example 1 – Motor ControlControlPlace the cursor below on line 0004.Place the cursor below on line 0004.
Type Type ENDHENDH -> for end of program . Click -> for end of program . Click OKOK..
Example 1 – Motor Example 1 – Motor ControlControlRun the simulatorRun the simulator
Example 1 – Motor Example 1 – Motor ControlControlExecute the program for continuous scanExecute the program for continuous scan
Example 1 – Motor Example 1 – Motor ControlControlStart the motorStart the motor
(turn on and then off the start button)(turn on and then off the start button)
Change the status here andChange the status here andThen press Then press Write Current ValueWrite Current Value……
……or or double double
click with click with the the
mouse mouse left left
buttonbutton
Example 1 – Motor Example 1 – Motor ControlControlStop the motorStop the motor
(watch the status of the motor – relay 0500)(watch the status of the motor – relay 0500)
Example 1 – Motor Example 1 – Motor ControlControlStop the simulation and return to the editorStop the simulation and return to the editor
Example 1 – Motor Example 1 – Motor ControlControlUsing labelsUsing labels
Example 1 – Motor Example 1 – Motor ControlControlRight click with the mouse button on the deviceRight click with the mouse button on the device
and select and select Change LabelChange Label
Example 1 – Motor Example 1 – Motor ControlControl
Type the label and press OK (or Enter)Type the label and press OK (or Enter)
Example 1 – Motor Example 1 – Motor ControlControlType all labels (save the program – optional)Type all labels (save the program – optional)
If you use labels you can enter the device by its labelIf you use labels you can enter the device by its label(instead of its number)(instead of its number)
Example 2 – Drill ControlExample 2 – Drill Control
M1M1M2M2
L1L1
L2L2
UpperUpperLimit SwitchLimit Switch
LowerLowerLimit SwitchLimit Switch
Drill MotorDrill MotorVerticalVerticalMotorMotor
(up and (up and down)down)
Example 2 – Drill ControlExample 2 – Drill Control
In the beginning of the drilling cycle the Upper Limit In the beginning of the drilling cycle the Upper Limit Switch (0001) is closedSwitch (0001) is closed
The START button (0000) starts the drilling cycleThe START button (0000) starts the drilling cycle The drill motor M1 (0500) must start. At the same The drill motor M1 (0500) must start. At the same
time, the vertical motor M2 must start to descend time, the vertical motor M2 must start to descend the drill (0501)the drill (0501)
The drill will stop at the Lower Limit Switch (0002).The drill will stop at the Lower Limit Switch (0002). At this time, the vertical motor start to ascend the At this time, the vertical motor start to ascend the
drill (0502).drill (0502). The drill motor must stop just at the upper position.The drill motor must stop just at the upper position. Wait for a new drilling cycleWait for a new drilling cycle
Example 2 – Drill ControlExample 2 – Drill Control
Non-retentive contacts:Non-retentive contacts:
Example 2 – Drill ControlExample 2 – Drill ControlGo to Go to Help Help -> -> Instruction WordInstruction Word -> -> Instructions in Alphabetical OrderInstructions in Alphabetical Order -> -> DIFUDIFU
Example 2 – Drill ControlExample 2 – Drill Control
SET – RESET instructionsSET – RESET instructions
Example 2 – Drill ControlExample 2 – Drill ControlGo to Go to Help Help -> -> Instruction WordInstruction Word -> -> Instructions in Alphabetical OrderInstructions in Alphabetical Order -> -> SET SET ((RESRES))
Example 2 – Drill ControlExample 2 – Drill ControlTiming diagram:Timing diagram:
STARTSTART
LIMIT1LIMIT1
MOTORMOTOR11LIMIT2LIMIT2
M2-M2-DOWNDOWNM2-UPM2-UP
Example 2 – Drill ControlExample 2 – Drill Control
Example 3 – Traffic LightExample 3 – Traffic Light
Start the operation with the switch Start the operation with the switch S1 (input 0000)S1 (input 0000)
The red signal must be ON for 5 The red signal must be ON for 5 seconds (output 0500)seconds (output 0500)
The green signal must be ON for 8 The green signal must be ON for 8 seconds (output 0501)seconds (output 0501)
The yellow signal must be ON for 3 The yellow signal must be ON for 3 seconds (output 0502)seconds (output 0502)
The cycle must continues until the The cycle must continues until the switchswitch
S1 is releasedS1 is released
Example 3 – Traffic LightExample 3 – Traffic LightGo to Go to Help Help -> -> Instruction WordInstruction Word -> -> Instructions in Alphabetical OrderInstructions in Alphabetical Order -> -> TMRTMR
Example 3 – Traffic LightExample 3 – Traffic Light
Example 3 – Traffic LightExample 3 – Traffic Light
Place the cursor at the position you want Place the cursor at the position you want to add a Timer. Then, double click with to add a Timer. Then, double click with the mouse left button and select the mouse left button and select Instruction Instruction -> TMR-> TMR
Example 3 – Traffic LightExample 3 – Traffic Light
Define the Timer number and the Preset Define the Timer number and the Preset value.value.
Timer numberTimer number
Preset valuePreset value
Example 3 – Traffic LightExample 3 – Traffic Light