Chapter 4 - Programming
Chapter 4 - Programming
PROGRAMMING
●
Ladder logic uses a
variety of programming
symbols
●
Power always flows
from left to right
●
Output devices are in
the ON state if power
flows through them
CONT..
The normally open (NO) is true when the input device is 1 (on).
The normally closed (NC) is true when the input device is 0 (off).
SCAN PATTERNS
Horizontal Scanning Order
The processor
examines input and
output instructions
from the first
command, top left
in the program,
horizontally, rung
by rung.
SCAN PATTERNS
Vertical Scanning Order
The processor
examines input and
output instructions
from the first
command,
vertically, column
by column and page
by page. Pages are
executed in
sequence.
Start
End
Example:-
2. INSTRUCTION LIST (IL)
A low level language which has a structure similar to an
assembly language. Since it is simple, it is easy to learn and
ideally for small hand-held programming devices. Each line of
code can be divided into four fields: label, operator,
operand, and comment.
Simple example:-
LD A
AND B
ST C
Basic IL Instructions
Example :
3. STRUCTURED TEXT (ST)
●
Structured Text (ST) is a high level textual language that is a
Pascal like language. It is very flexible and intuitive for
writing control algorithms.
●
used to express the behavior of functions, function blocks
and programs
●
In IEC 1131-3 standard, it has a syntax very similar to
PASCAL
●
strongly typed language
●
Functions:
●assignments
●expressions
●statements
●operators
●function calls
●
flow control
Example:
Cylinder out = (Input A OR Input B) AND Output C
4.SEQUENTIAL FUNCTION CHART (SFC)
A graphics language used for depicting
sequential behavior. The IEC standard grew out
of the French standard Grafcet which in turn is
based on Petri-net.
SFC have been developed to accommodate the
programming of more advanced systems. These
are similar to flowcharts, but much more
powerful. This method is much different from
flowcharts because it does not have to follow a
single path through the flowchart.
SFC
Action Qualifiers:
N non-stored, executes while
the step is active
R resets a store action
S sets an action active
L time limited action,
terminates after a given period
D time delayed action.
P a pulse action, executes
once in a step
SD stored and time delayed
DS time delayed and stored
SL stored and time limited
EXAMPLE FOR SFC
A SFC is depicted as a series of
steps shown as rectangular boxes
connected by vertical lines. Each
step represent a state of the
system being controlled.
The horizontal bar indicates a
condition. It can be a switch
state, a timer, etc. A condition
statement is associated with each
condition bar. Each step can also
have a set of actions. Action
qualifier causes the action to
behave in certain ways. The
indicator variable is optional. It is
for annotation purposes
5.FUNCTION BLOCK DIAGRAM (FBD)
Functional Block Diagram (FB) is a well packaged element
of software that can be re-used in different parts of an
application or even in different projects. Functional blocks
are the basic building blocks of a control system and can
have algorithms written in any of the IEC languages.
block diagram
SP set point
PV sensor feedback
KP proportional error gain
TR integral gain
TD derivative gain control algorithm
AUTO calculate
XOUT output to process
XO manual output adjustment
cycle time between execution
DIFFERENCES BETWEEN
LADDER AND FBD
MNEMONIC CODE
●
One of the earliest techniques involved mnemonic
instructions. These instructions can be derived directly
from the ladder logic diagrams and entered into the PLC
through a simple programming terminal.
EXAMPLE
Ladder diagram and mnemonic code to solve control system
For a process control, it is desired to have the process start (by turning
on a motor) five seconds after a part touched a limit switch. The
process is terminated automatically when the finished part touches a
second limit switch. An emergency switch will stop the process any
time when it is pushed.
BASIC LOGIC INSTRUCTION
●
Load/Load Not
●
And/And Not
●
Or/Or Not
●
AND load
●
OR load
●
Out
●
END
●
No Operation
LOAD
Load: The load (LD) instruction is
a normally open contact
Set
Input
Reset
3. JUMP
●
Instructions JMP (04) is usually used in pairs with the
command JME (05) for the jump.
●
JMP (04) instructions for determining the starting point of
the jump and JME (05) is the direction of the jump.
●
When the instruction JMP (04) is ON, no jump will occur and
the program will be implemented as written.
●
When the instruction JMP (04) is OFF, a jump to the
instruction JME (05) having the same number will be done.
Further instruction after JME (05) will be implemented.
●
Instructions JUMP and JUMP END can use the numbers from
the range of 00 to 99.
●
To set jump instruction for OMRON PLC, the instruction FUN
04 is for the JUMP and instruction FUN 05 is for JUMP END
instruction.
Address Instruction Operand / Data
00000 LD 00000
00001 FUN (04) 01
00002 LD 00001
00003 OUT 10000
00004 FUN (05) 01
00005 FUN (01) -
●
When the input instruction LD 00 000 OFF (there has been a
change from ON to OFF), 01 000-bit operations will ON, the
output will be ON OUT 10,000 within a very short time and
then OFF. We can not see the situation at the output.
●
After the 01 000-bit operations will be OFF regardless of the
status of the input instruction LD 00000.
6. MOVE (21)
●
MOVE instruction copy the from the source
channel to the destination source.
●
For OMRON PLC, FUN 21 is the instruction for
MOVE.
●
Symbol:
SOURCE SOURCE
Masukan Keluaran