4.ladder logic programming
TRANSCRIPT
Ladder Logic Fundamentals
•Programming languages
•Electrical Ladder Diagram
•Ladder Logic Diagram
•Ladder Logic Instructions
•Combining Instructions
•Program execution
Programming Languages
• The most Commonly use programming language is “ladder Logic”
• Other control logic languages occasionally used to program PLC include BASIC, C and Boolean.
Electrical Ladder Diagrams
• Ladder logic diagrams evolved from electrical diagrams, which represent how electric current flows through devices to complete an electric circuit.
L1 L2
Power Bus Power Bus
PB1 Stop
PB2 Start
Auxiliary Holding Contact
Motor
• A rung is said to have electrical continuity when current flows uninterrupted from left to right across the rung I.e.all contacts are closed).
• Each electrical circuit in the diagram is considered a rung. Every rung has two key components – the device to be controlled. – and the conditions that affect the device.
Ladder Logic Programs
• PLC Ladder logic programs resembles an electrical ladder diagram.
• Electrical ladder consists of symbls that represent real world devices while PLC ladder logic symbols represent logic instructions.
• In electrical ladder the devices are described as being open or closed(Off or On). In a ladder logic program, instructions are either true or false.
Stop button Start button
Auxiliary Holding Contact
Motor – M1
Condition Instructions Control Instructions
• Each ladder contains at least one control (output) instruction and usually contains one or more condition instructions (Input)
• On the right hand side , a control instruction is the operation or function that is activated/de-activated by rung logic – such as output energize (Valve, solenoid alarms , etc.) bit commands, timers, and counters.
• If logical continuity exists , the PLC energises the control output. IF it does not exist the control instruction will be off or de-energized state.
Ladder logic Instructions
• Normally open Instruction (XIC) – Check if closed
• Normally Closed Instruction (XIO) – Check if open
Input DeviceInput terminal on PLC
Ladder ProgramOutput terminal on PLC
Output Device
PB1
I/3 I/3 - true O/4 - true O/4 On
Input DeviceInput terminal on PLC
Ladder ProgramOutput terminal on PLC
Output Device
PB1
I/3 I/3 False O/4 - False
O/4 Off
Functioning of Normally Open instruction
Input DeviceInput terminal on PLC
Ladder ProgramOutput terminal on PLC
Output Device
PB1
I/4 I/4 - true O/5 - true O/5 On
Input DeviceInput terminal on PLC
Ladder ProgramOutput terminal on PLC
Output Device- off
PB1
I/4 I/4 False O/5 - False
O/5
Functioning of Normally Closed instruction
PB1
N. O. Push button – Not activated
PB1
N. O. Push button – Activated (XIC)
PB1
N. C. Push button – Not Activated (XIC)
PB1
N. C. Push button – Activated (XIC)
Data Table bit
The status of instruction
XIC XIO OTE
Logic 0 false True False
Logic 1 true False True
Operational procedures
• Input address have the form I:e/b
I = Input Data file
: = Element or Slot delimiter
e = Slot no. of the input module
/ = Bit or terminal delimiter
b = terminal no. used with input device
Operational procedures
• Output addresses have the form O:e/b
O = output data file
: = Element or Slot delimiter
e = Slot no. of the output
/ = bit or terminal delimiter
b = terminal number used with output
Output Energize instruction (OTE)
•OTE instruction is used to turn on a bit when rung conditions are evaluated as true.
• OTE instructions are reset when when condition goes false or MCR is activated
L
Output Latch instruction (OTL)
•Retentive output Instruction , turns on a bit.
•The o/p remains on even after the rung condition goes false.
Output Unlatch Instruction ( OUT)
U
•The OUT instruction is a retentive output that can only turn off a bit.
•Traditionally used in pairs with an output latch (OTL)
•It can not turn on a bit.
OSR
One-Shot Rising (OSR)
A retentive input instruction that triggers an event to occur one time.
Example : Push_start/Push_stop operaton