Delta DVP-PLC User Manual

PLC
PLC
DVP-PLC Application Manual
Programming
Chapter 1 Basic Principles of PLC Ladder Diagram
Foreword: Background and Functions of PLC.......................................................... 1-1
1.1 The Working Principles of Ladder Diagram........................................................ 1-1
1.2 Differences Between Traditional Ladder Diagram and PLC Ladder Diagram ........ 1-2
1.3 Edition Explanation of Ladder Diagram ............................................................. 1-3
1.4 How to Edit Ladder Diagram ............................................................................. 1-8
1.5 The Conversion of PLC Command and Each Diagram Structure......................... 1-12
1.6 Simplified Ladder Diagram ............................................................................... 1-15
1.7 Basic Program Designing Examples.................................................................. 1-17
Chapter 2 Functions of Devices in DVP-PLC
2.1 All Devices in DVP-PLC....................................................................................2-1
2.2 Values, Constants [K] / [H] ............................................................................... 2-6
2.3 Numbering and Functions of External Input/Output Contacts [X] / [Y].................. 2-8
2.4 Numbering and Functions of Auxiliary Relays [M] .............................................. 2-11
2.5 Numbering and Functions of Step Relays [S] ..................................................... 2-11
2.6 Numbering and Functions of Timers [T]............................................................. 2-12
2.7 Numbering and Functions of Counters [C]......................................................... 2-14
2.8 Numbering and Functions of Registers [D], [E], [F]............................................ 2-28
2.8.1 Data register [D]........................................................................................ 2-28
2.8.2 Index Register [E], [F]................................................................................ 2-29
2.8.3 Functions and Features of File Registers.................................................... 2-30
2.9 Pointer [N], Pointer [P], Interruption Pointer [I].................................................. 2-30
2.10 Special Auxiliary Relays and Special Data Registers........................................ 2-33
2.11 Functions of Special Auxiliary Relays and Special Registers............................. 2-69
2.12 Error Codes................................................................................................... 2-125
Chapter 3 Basic Instructions
3.1 Basic Instructions and Step Ladder Instructions ................................................ 3-1
3.2 Explanations on Basic Instructions ................................................................... 3-3
Chapter 4 Step Ladder Instructions
4.1 Step Ladder Instructions [STL], [RET] ............................................................... 4-1
4.2 Sequential Function Chart (SFC) ...................................................................... 4-2
4.3 How does a Step Ladder Instruction Work? ....................................................... 4-3
4.4 Things to Note for Designing a Step Ladder Program......................................... 4-7
4.5 Types of Sequences......................................................................................... 4-9
4.6 IST Instruction................................................................................................. 4-17
Chapter 5 Categories & Use of Application Instructions
5.1 List of Instructions ........................................................................................... 5-1
5.2 Composition of Application Instruction .............................................................. 5-6
5.3 Handling of Numeric Values.............................................................................. 5-11
5.4 E, F Index Register Modification....................................................................... 5-14
5.5 Instruction Index.............................................................................................. 5-16
Chapter 6 Application Instructions API 00-49
API0009Loop Control .......................................................................... 6-1
API1019Transmission Comparison....................................................... 6-18
API2029Four Arithmetic Operation....................................................... 6-32
API3039Rotation & Displacement......................................................... 6-46
API4049Data Processing..................................................................... 6-57
Chapter 7 Application Instructions API 50-99
API5059High Speed Processing........................................................... 7-1
API6069Handy Instructions.................................................................. 7-39
API7079Display of External Settings .................................................... 7-59
API8088Serial I/O ............................................................................... 7-80
Chapter 8 Application Instructions API 100-149
API100109Communication ................................................................... 8-1
API110119Floating Point Operation...................................................... 8-23
API120129Floating Point Operation ..................................................... 8-31
API130139Floating Point Operatio .......................................................8-43
API140149Others ................................................................................ 8-55
Chapter 9 Application Instructions API 150-199
API150154Others ................................................................................ 9-1
API155159Position Control.................................................................. 9-14
API160169Real Time Calendar ............................................................9-39
API170171Gray Code Conversion........................................................ 9-49
API172175Floating Point Operation ..................................................... 9-51
API180190Matrix................................................................................. 9-59
API191199Positioning Instruction ........................................................ 9-76
Chapter 10 Application Instructions API 215-246
API202203Others. ............................................................................... 10-1
API215223Contact Type Logic Operation Instruction. ............................ 10-7
API224246Contact Type Compare Instruction....................................... 10-10
1 Basic Principles of PLC Ladder Diagram
Foreword: Background and Functions of PLC
PLC (Programmable Logic Controller) is an electronic device, previously called “sequence controller”. In 1978,
NEMA (National Electrical Manufacture Association) in the United States officially named it as “programmable logic
controller”. PLC reads the status of the external input devices, e.g. keypad, sensor, switch and pulses, and execute by
the microprocessor logic, sequential, timing, counting and arithmetic operations according the status of the input
signals as well as the pre-written program stored in the PLC. The generated output signals are sent to output devices
as the switch of a relay, electromagnetic valve, motor drive, control of a machine or operation of a procedure for the
purpose of machine automation or processing procedure. The peripheral devices (e.g. personal computer/handheld
programming panel) can easily edit or modify the program and monitor the device and conduct on-site program
maintenance and adjustment. The widely used language in designing a PLC program is the ladder diagram.
With the development of the electronic technology and wider applications of PLC in the industry, for example in
position control and the network function of PLC, the input/output signals of PLC include DI (digital input), AI (analog
input), PI (pulse input), NI (numeric input), DO (digital output), AO (analog output), and PO (pulse output). Therefore,
PLC will still stand important in the industrial automation field in the future.
1.1 The Working Principles of Ladder Diagram
The ladder diagram was a diagram language for automation developed in the WWII period, which is the oldest
and most widely adopted language in automation. In the initial stage, there were only A (normally open) contact, B
(normally closed) contact, output coil, timer and counter…the sort of basic devices on the ladder diagram (see the
power panel that is still used today). After the invention of PLC, the devices displayable on the ladder diagram are
added with differential contact, latched coil and the application commands which were not in a traditional power panel,
for example the addition, subtraction, multiplication and division operations.
The working principles of the traditional ladder diagram and PLC ladder diagram are basically the same. The
only difference is that the symbols on the traditional ladder diagram are more similar to its original form, and PLC
ladder diagram adopts the symbols that are easy to recognize and shown on computer or data sheets. In terms of the
logic of the ladder diagram, there are combination logic and sequential logic.
1. Combination Logic
Examples of traditional ladder diagram and PLC ladder diagram for combination logic:
Traditional Ladder Diagram PLC Ladder Diagram
X0
X1
X2
X3
X4
Y0
Y1
Y2
X0
Y0
X1
X2
X3
X4
Y1
Y2
Row 1: Using a normally open (NO) switch X0 (“A” switch or “A" contact). When X0 is not pressed, the contact
will be open loop (Off), so Y0 will be Off. When X0 is pressed, the contact will be On, so Y0 will be On.
DVP-PLC Application Manual
1-1
1 Basic Principles of PLC Ladder Diagram
Row 2: Using a normally closed (NC) switch X1 (“B” switch or “B” contact). When X1 is not pressed, the contact
will be On, so Y1 will be On. When X1 is pressed, the contact will be open loop (Off), so Y1 will be Off.
Row 3: The combination logic of more than one input devices. Output Y2 will be On when X2 is not pressed or
X3 and X4 are pressed.
2. Sequential Logic
Sequential logic is a circuit with "draw back” structure, i.e. the output result of the circuit will be drawn back as an
input criterion. Therefore, under the same input criteria, different previous status or action sequence will follow by
different output results.
Examples of traditional ladder diagram and PLC ladder diagram for sequential logic:
Traditional Ladder Diagram PLC Ladder Diagram
X5
Y3
X6
Y3
X5
Y3
X6
Y3
When the circuit is first connected to the power, though X6 is On, X5 is Off, so Y3 will be Off. After X5 is pressed,
Y3 will be On. Once Y3 is On, even X5 is released (Off), Y3 can still keep its action because of the draw back (i.e.
the self-retained circuit). The actions are illustrated in the table below.
Device status Action sequence
X5
X6 Y3
1 No action No action Off
2 Action No action On
3 No action No action On
4 No action Action Off
5 No action No action Off
From the table above, we can see that in different sequence, the same input status can result in different output
results. For example, switch X5 and X6 of action sequence 1 and 3 do not act, but Y3 is Off in sequence 1 and
On in sequence 3. Y3 output status will then be drawn back as input (the so-called “draw back”), making the
circuit being able to perform sequential control, which is the main feature of the ladder diagram circuit. Here we
only explain contact A, contact B and the output coil. Other devices are applicable to the same method. See
Chapter 3 “Basic instructions” for more details.
1.2 Differences Between Traditional Ladder Diagram and PLC Ladder Diagram
Though the principles of traditional ladder diagram and PLC ladder diagram are the same, in fact, PLC adopts
microcomputer to simulate the motions of the traditional ladder diagram, i.e. scan-check status of all the input devices
and output coil and calculate to generate the same output results as those from the traditional ladder diagram based
on the logics of the ladder diagram. Due to that there is only one microcomputer, we can only check the program of
the ladder diagram one by one and calculate the output results according to the program and the I/O status before the
cyclic process of sending the results to the output interface Æ re-reading of the input status Æ calculation Æ output.
The time spent in the cyclic process is called the “scan time” and the time can be longer with the expansion of the
program. The scan time can cause delay from the input detection to output response of the PLC. The longer the delay,
1-2
DVP-PLC Application Manual
1 Basic Principles of PLC Ladder Diagram
the bigger the error is to the control. The control may even be out of control. In this case, you have to choose a PLC
with faster scan speed. Therefore, the scan speed is an important specification requirement in a PLC. Owing to the
advancement in microcomputer and ASIC (IC for special purpose), there has been great improvement in the scan
speed of PLC nowadays. See the figure below for the scan of the PLC ladder diagram program.
Read input status from outside
X0 X1
The output result is calculated
based on the ladder diagram.
(The result has not yet sent to the
external output point, but the
internal device will perform an
immediate output.)
Start
Y0
X3
M100
: :
X100 M505
X10
Y0
Executing in cycles
Y1
Y126
End
Send the result to the output point
Besides the difference in the scan time, PLC ladder and traditional ladder diagram also differ in “reverse current”.
For example, in the traditional ladder diagram illustrated below, when X0, X1, X4 and X6 are On and others are Off,
Y0 output on the circuit will be On as the dotted line goes. However, the PLC ladder diagram program is scanned from
up to down and left to right. Under the same input circumstances, the PLC ladder diagram editing tool WPLSoft will be
able to detect the errors occurring in the ladder diagram.
Reverse current of traditional ladder diagram
X0
X3
a
X6
X1 X2
X4
X5
b
Y0
Error detected in the third row
Reverse current of PLC ladder diagram
X0
X3
a
X6
X1
X4 X5
b
X2
Y0
Y0
1.3 How to Edit Ladder Diagram
Ladder diagram is a diagram language frequently applied in automation. The ladder diagram is composed of the
symbols of electric control circuit. The completion of the ladder diagram by the ladder diagram editor is the completion
of the PLC program design. The control flow illustrated by diagram makes the flow more straightforward and
acceptable for the technicians of who are familiar with the electric control circuit. Many basic symbols and actions in
DVP-PLC Application Manual
1-3
1 Basic Principles of PLC Ladder Diagram
the ladder diagram come from the frequently-seen electromechanical devices, e.g. buttons, switches, relay, timer and
counter, etc. in the traditional power panel for automation control.
Internal devices in the PLC: The types and quantity of the devices in the PLC vary in different brand names.
Though the internal devices in the PLC adopts the names, e.g. transistor, coil, contact and so on, in the traditional
electric control circuit, these physical devices do not actually exist inside the PLC. There are only the corresponding
basic units (1 bit) inside the memory of the PLC. When the bit is “1”, the coil will be On, and when the bit is “0”, the coil
will be Off. The normally open contact (NO or contact A) directly reads the value of the corresponding bit. The
normally close contact (NC or contact B) reads the opposite state of the value of the corresponding bit. Many relays
will occupy many bits. 8 bits equal a “byte”. 2 bytes construct a “word” and 2 words combined is “double word”. Byte,
word or double words are used when many relays are processed (e.g. addition/subtraction, displacement) at the
same time. The other two devices, timer and counter, in the PLC have coil, timer value and counter value and they
have to process some values in byte, word or double word.
All kinds of internal devices in the value storage area in the PLC occupy their fixed amount of storage units.
When you use these devices, you are actually read the contents stored in the form of bit, byte or word.
Introductions on the basic internal devices in the PLC (See Ch 2. Functions of Devices in DVP-PLC for more details.)
Device Functions
The input relay is an internal memory (storage) unit in the PLC corresponding to a external
input point and is used for connecting to the external input switches and receiving external
input signals. The input relay will be driven by the external input signals which make it “0” or
“1". Program designing cannot modify the status of the relay, i.e. it cannot re-write the basic
unit of a relay, nor can it force On/Off of the relay by HPP/WPLSoft. SA/SX/SC/EH/EH2/SV
series MPU can simulate input relay X and force On/Off of the relay. But the status of the
Input relay
external input points will be updated and disabled, i.e. the external input signals will not be read
into their corresponding memories inside PLC, but only the input points on the MPU. The input
points on the extension modules will still operate normally. There are no limitations on the times
of using contact A and contact B of the input relay. The input relays without corresponding input
signals can only be left unused and cannot be used for other purposes.
& Device indication: X0, X1,…X7, X10, X11,… are indicated as X and numbered in octal
form. The No. of input points are marked on MPU and extension modules.
The output relay is an internal memory (storage) unit in the PLC corresponding to a external
Output relay
1-4
output point and is used for connecting to the external load. The output relay will be driven by
the contact of an input relay, contacts of other internal devices and the contacts on itself. A
normally open contact of the output relay is connected to the external load. Same as the input
contacts, there are no limitations on the times of using other contacts of the output relay. The
output relay without corresponding output signals can only be left unused and can be used as
input relay if necessary.
& Device indication: Y0, Y1,…Y7, Y10, Y11,…are indicated as Y and numbered in octal
form. The No. of output points are marked on MPU and extension modules.
DVP-PLC Application Manual
Internal relay
Step
1 Basic Principles of PLC Ladder Diagram
The internal relay does not have connection with the external. It is an auxiliary relay inside the
PLC with the functions same as those of the auxiliary (middle) relay in the electric control
circuit. Every internal relay corresponds to a basic internal storage unit and can be driven by
the contacts of the input relay, contacts of the output relay and the contacts of other internal
devices. There are no limitations on the times of using the contacts of the internal relay and
there will be no output from the internal relay, but from the output point.
& Device indication: M0, M1,…, M4095 are indicated as M and numbered in decimal form.
DVP series PLC offers a step-type control program input method. STL instruction controls the
transfer of step S, which makes it easy for the writing of the control program. If you do not use
any step program in the control program, step S can be used as a internal relay M as well as an
alarm point.
& Device indication: S0, S1,…S1023 are indicated as S and numbered in decimal form.
The timer is used for timing and has coil, contact and register in it. When the coil is On and the
Timer
Counter
Data register
estimated time is reached, its contact will be enabled (contact A closed, contact B open). Every
timer has its fixed timing period (unit: 1ms/10ms/100ms). Once the coil is Off, the contact iwlwl
be disabled (contact A open, contact B closed) and the present value on the timer will become
“0”.
& Device indication: T0, T1,…,T255 are indicated as T and numbered in decimal form.
Different No. refers to different timing period.
The counter is used for counting. Before using the counter, you have to give the counter a set
value (i.e. the number of pulses for counting). There are coil, contact and registers in the
counter. When the coil goes from Off to On, the counter will regard it as an input of 1 pulse and
the present value on the counter will plus “1”. We offer 16-bit and 32-bit high-speed counters
for our users.
& Device indication: C0, C1,…,C255 are indicated as C and numbered in decimal form.
Data processing and value operations always occur when the PLC conducts all kinds of
sequential control, timing and counting. The data register is used for storing the values or all
kinds of parameters. Every register is able to store a word (16-bit binary value). Double words
will occupy 2 adjacent data registers.
& Device indication: D0, D1,…,D9,999 are indicated as D and numbered in decimal form.
DVP-PLC Application Manual
1-5
1 Basic Principles of PLC Ladder Diagram
The file register is used for storing the data or all kinds of parameters when the data registers
required for processing the data and value operations are insufficient. Every file register is able
to store a 16-bit word. Double words will occupy 2 adjacent file registers. In SA/SX/SC series
File register
Index register
The structure of a ladder diagram:
Structure Explanation Instruction Devices Used
MPU, there are 1,600 file registers. In EH/EH2/SV series MPU, there are 10,000 file registers.
There is not an actual device No. for a file register. The reading and writing of file registers
should be executed by instructions API 148 MEMR, API 149 MEMW, or through the peripheral
device HPP02 and WPLSoft.
& Device indication: K0 ~ K9,999, numbered in decimal form.
E and F index registers are 16-bit data registers as other data registers. They can be read and
written and can be used in word devices, bit devices or as a constant for index indication.
& Device indication: E0 ~ E7, F0 ~ F7 are indicated as E and F and numbered in decimal
form.
Normally open, contact A LD X, Y, M, S, T, C
Normally closed, contact B LDI X, Y, M, S, T, C
Normally open in series connection Normally closed in series connection
AND X, Y, M, S, T, C
ANI X, Y, M, S, T, C
Normally open in parallel connection
Normally closed in parallel connection
Rising-edge trigger switch LDP X, Y, M, S, T, C
Falling-edge trigger switch LDF X, Y, M, S, T, C
Rising-edge trigger in series connection Falling-edge trigger in series connection
Rising-edge trigger in parallel connection
Falling-edge trigger in parallel connection
Block in series connection ANB -
Block in parallel connection ORB -
OR X, Y, M, S, T, C
ORI X, Y, M, S, T, C
ANDP X, Y, M, S, T, C
ANDF X, Y, M, S, T, C
ORP X, Y, M, S, T, C
ORF X, Y, M, S, T, C
1-6
DVP-PLC Application Manual
1 Basic Principles of PLC Ladder Diagram
Structure Explanation Instruction Devices Used
MPS
Multiple output
Coil driven output instruction OUT Y, M, S
MRD MPP
-
SS
Block:
A block is a series or parallel operation composed of more than 2 devices. There are series block and parallel block.
Series block
Step ladder STL S
Basic instruction Application instruction
Inverse logic INV -
Application
instructions
See Ch.3 for basic instructions (RST/SET and CNT/TMR) and Ch.5 ~ 10 for application instructions
Parallel block
Separation line and combination line:
The vertical line is used for separating the devices. For the devices on the left, the vertical line is a combination line,
indicating that there are at least 2 rows of circuits on the left connected with the vertical line. For the devices on the
right, the vertical line is a separation line, indicating that there are at least 2 rows of circuits interconnected on the right
side of the vertical line).
1
Combination line for block 1 Separation line for block 2
Network:
A complete block network is composed of devices and all kinds of blocks. The blocks or devices connectable by a
vertical line or continuous line belong to the same network.
2
Combination line for block 2
DVP-PLC Application Manual
1-7
1 Basic Principles of PLC Ladder Diagram
Network 1
An independent network
Network 2
An incomplete network
1.4 How to Edit a PLC Ladder Diagram
The editing of the program should start from the left power line and ends at the right power line, a row after
another. The drawing of the right power line will be omitted if edited from WPLSoft. A row can have maximum 11
contacts on it. If 11 is not enough, you can continuously connect more devices and the continuous number will be
generated automatically. The same input points can be used repeatedly. See the figure below:
X0 X1 X2 X3 X4 X5
X11 X12 X13
00000
Continuous number
X6 X7 X10 C0 C1
00000
Y0
The operation of the ladder diagram program is scanning from top left to bottom right. The coil and the operation
frame of the application instruction belong to the output side in the program and are placed in the right if the ladder
diagram. Take the figure below for example, we will step by step explain the process of a ladder diagram. The
numbers in the black circles indicate the order.
X0 X1 Y1 X4
M0
X3
M1
Y1
T0
M3
TMR T0 K10
The order of the instructions:
1 LD X0 2 OR M0 3 AND X1 4 LD X3 AND M1
1-8
DVP-PLC Application Manual
1 Basic Principles of PLC Ladder Diagram
n
ORB 5 LD Y1 AND X4 6 LD T0 AND M3 ORB 7 ANB 8 OUT Y1 TMR T0 K10
Explanations on the basic structures in the ladder diagram:
1. LD (LDI) instruction: Given in the start of a block.
LD instruction LD instruction
AND block OR block
The structure of LDP and LDF instructions are the same as that of LD instruction, and the two only differ in their
actions. LDP and LDF instructions only act at the rising edge or falling edge when the contact is On, as shown in the
figure below.
X0
Rising edge
OFF
ON
OFF
Time
X0
OFF
Falling edge
ON
OFF
Time
2. AND (ANI) instruction: A single device connects to another single device or a block in series
AND instructio
AND instruction
The structure of ANDP and ANDF instructions are the same. ANDP and ANDF instructions only act at the rising
edge or falling edge.
3. OR (ORI) instruction: A single device connects to another single device or a block
OR instruction OR instruction OR instruction
The structure of ORP and ORF instructions are the same. ORP and ORF instructions only act at the rising edge
or falling edge.
DVP-PLC Application Manual
1-9
1 Basic Principles of PLC Ladder Diagram
4. ANB instruction: A block connects to a device or another block in series
ANB instruction
5. ORB instruction: A block connects to a device or another block in parallel
ORB instruction
If the ANB and ORB operations are with several blocks, the operation should be performed from up to down or
left to right, combining into a block or network.
6. MPS, MRD, MPP instructions: Bifurcation point of multiple outputs, for generating many and diverse outputs.
MPS instruction is the start of the bifurcation point. The bifurcation point is the intersection of the horizontal line
and vertical line. We will have to determine whether to give a contact memory instruction by the contact status of the
same vertical line. Basically, every contact can be given a memory instruction, but considering the convenience of
operating the PLC and the limitation on its capacity, some parts in the ladder diagram will be omitted during the
conversion. We can determine the type of contact memory instruction by the structure of the ladder diagram. MPS is recognized as “” and the instruction can be given continuously for 8 times.
MRD instruction is used for reading the memory of the bifurcation point. Due to that the same vertical line is of
the same logic status, in order to continue analyzing other ladder diagrams, we have to read the status of the original contact again. MRD is recognized as “├”.
MPP instruction is used for reading the start status of the top bifurcation point and popping it out from the stack.
Since MPP is the last item on the vertical line, the vertical line ends at this point.
MPP is recognized as “”. Using the method
MPS
given above for the analysis cannot be wrong.
However, sometimes the compiling program will ignore
MPS
the same output status, as shown in the figure.
1-10
MRD
MPP
MPP
DVP-PLC Application Manual
1 Basic Principles of PLC Ladder Diagram
7. STL instruction: Used for designing the syntax of the sequential function chart (SFC).
STL instruction allows the program designer a clearer and readable picture of the sequence of the program as
when they draw a sequence chart. From the figure below, we can see clearly the sequence to be planned. When the
step S moves to the next step, the original S will be “Off". Such a sequence can then be converted into a PLC ladder
diagram and called “step ladder diagram”.
M1002
M1002
S0
S
S21
S
S22
S
8. RET instruction: Placed after the completed step ladder diagram.
RET also has be placed after STL instruction. See the example below.
S20
S
S20
S
X1
X1
RET
RET
SET
SET
SET
S0
RET
S0
S21
S22
See step ladder instructions [STL], [RET] in Ch. 4 for the structure of the ladder diagram.
DVP-PLC Application Manual
1-11
1 Basic Principles of PLC Ladder Diagram
1.5 The Conversion of PLC Command and Each Diagram Structure
Ladder Diagram
X0 X2 X1
S0
S
S
S
S
M0
M1
Y0
X10
X11
X12
S12SS13
X1
X1
M2
X1
M2
S10
S11
S20
X0
C0
LD X0 OR X1 LD X2 OR M0
Y0
C0
SET S0
OR I M1 ANB LD M2 AND Y0 ORB AN I X1 OU T Y0 AND C0
Y10
SET S0 STL S0
SET S10
LD X10 OU T Y10 SET S10
Y11
STL S10 LD X11
SET S11
SET S12
SET S13
OU T Y11 SET S11 SET S12 SET S13 STL S11 LD X12
Y12
OU T Y12 SET S20
SET S20
STL S20 STL S12
X13
S
S0
RET
STL S13 LD X13 OU T S0 RET LD X0
CNT
C0
K10
CNT C0 K 10 LD C0
M0
MPS AND X1
M1
M2
RST C0
OU T M0 MRD AN I X1 OU T M1 MPP
END
AN I M2 OU T M2
RST C0 END
OR block
OR block
Series connection blcok
AND block
Parallel connection block
ANI
Multiple outputs
Step ladder Start
Status S0 and X10 operation
Status working item and step point transfer
Withdraw S10 status Withdraw X11 status
Status working item and step point transfer
Withdraw S11 status
Withdraw X12 status
Status working item and step point transfer
Bifurcation convergence
Status working item and step point transfer
Return
Read C0
Multiple outputs
End of program
The output will continue following the status of
End of step ladder
Fuzzy Syntax
The correct ladder diagram analysis and combination should be conducted from up to down and left to right.
However, without adopting this principle, some instructions can make the same ladder diagram.
1-12
DVP-PLC Application Manual
1 Basic Principles of PLC Ladder Diagram
Example Program 1
See the ladder diagram below. There are 2 ways to indicate the ladder by instruction programs with the same result.
X0 X2 X4
Ideal way Less ideal way
LD X0 LD X0
X5X3X1
OR X1 OR X1
LD X2 LD X2
OR X3 OR X3
ANB LD X4
LD X4 OR X5
OR X5 ANB
ANB ANB
The two instruction programs will be converted into the same ladder diagram. The difference between the ideal
one and less ideal one is the operation done by the MPU. For the ideal way, the combination is done block by block
whereas the less idea way combines all the blocks combine with one another in the last step. Though the length of
the program codes of the two ways are equal, the combination done in the last step (by ANB instruction, but ANB
cannot be used continuously for more than 8 times) will have to store up the previous calculation results in advance.
In our case, there are only two blocks combined and the MPU allows such kind of combination. However, once the
number of blocks exceed the range that the MPU allows, problems will occur. Therefore, the best way is to execute
the block combination instruction after a block is made, which will also make the logic sequence planned by the
programmer more in order.
Example Program 2
See the ladder diagram below. There are 2 ways to indicate the ladder by instruction programs with the same result.
Ideal way Less ideal way
X0
X1
X2
LD X0 LD X0
OR X1 LD X1
OR X2 LD X2
OR X3 LD X3
X3
ORB
ORB
ORB
In this example, the program codes and the operation memory in the MPU increase in the less ideal way.
Therefore, it is better that you edit the program following the defined sequence.
Incorrect Ladder Diagram
PLC processes the diagram program from up to down and left to right. Though we can use all kinds of ladder
symbols to combine into various ladder diagrams, when we draw a ladder diagram, we will have to start the diagram
from the left power line and end it at the right power line (In WPLSoft ladder diagram editing area, the right power line
is omitted), from left to right horizontally, one row after another from up to down. See bellows for the frequently seen
incorrect diagrams:
DVP-PLC Application Manual
1-13
1 Basic Principles of PLC Ladder Diagram
OR operation upward is not allowed.
“Reverse flow” exists in the signal circuit from the beginning of input to output.
Re verse flow
The up-right corner should output first.
Combining or editing should be done from the up-left to the bottom-right. The dotted-lined area should be moved up.
Parallel operation with empty device is not allowed.
Empty device cannot do operations with other devices.
1-14
No device in the middle block.
Devices and blocks in series should be horizontally aligned.
Label P0 should be in the first row of a complete network.
Blocks connected in series should be aligned with the upmost horizontal line.
DVP-PLC Application Manual
1 Basic Principles of PLC Ladder Diagram
1.6 Simplified Ladder Diagram
When a series block is connected to a parallel block in series, place the block in the front to omit ANB instruction.
X0 X1
Ladder diagram complied into instruction
LD X0
X2
Ø
X0X1
LD X1
OR X2
ANB
Ladder diagram complied into instruction
LD X1
X2
OR X2
AND X0
When a single device is connected to a block in parallel, place the block on top to omit ORB instruction.
T0
Ladder diagram complied into instruction
LD T0
X1
X1
X2
X2
Ø
LD X1
AND X2
ORB
Ladder diagram complied into instruction
LD X1
T0
AND X2
OR T0
In diagram (a), the block on top is shorter than the block in the bottom, we can switch the position of the two
blocks to achieve the same logic. Due to that diagram (a) is illegal, there is a “reverse flow” in it.
Ladder diagram complied into instruction
X0
LD X0
X1
X3
X2
X4
OR X1
AND X2
LD X3
(a)
Ø
AND X4
ORB
Ladder diagram complied into instruction
X3
X1
X4
X2
LD X3
AND X4
LD X1
X0
(b)
OR X0
AND X2
DVP-PLC Application Manual
ORB
1-15
1 Basic Principles of PLC Ladder Diagram
w
MPS and MPP instruction can be omitted when the multiple outputs in the same horizontal line do not need to
operate with other input devices.
X0
Y1
Ladder diagram complied into instruction
MPS
AND X0
Ø
Y0
OUT Y1
MPP
OUT Y0
Ladder diagram complied into instruction
X0
Y0
Y1
OUT Y0
AND X0
OUT Y1
Correct the circuit of reverse flow
In the following two examples, the diagram in the left hand side is the ladder diagram we desire. However, the illegal
“reverse flow” in it is incorrect according to our definition on the ladder diagram. We modify the diagram into the
diagram in the right hand side.
Example 1
Example 2
X0
X3
X6
rever se fl o
X0
X3
X6
Re verse f l ow
X0
X3
X1
X4
X7
X1
X4
X7
re ver se fl ow
X1
X4
X2
X10
X2
X5
X2
X5
X10
X5
LOOP 1
LO OP 1
X0 X1 X2
X3 X4 X5
X10
Ö
X6 X7 X5
X10
LOOP1
X0 X1 X2
X3 X4 X5
X6
X3 X7 X10
Ö
X6
LOOP1
X0 X1 X7 X10
X4
1-16
X6
X7
X10
LOOP2
LOOP
2
DVP-PLC Application Manual
1 Basic Principles of PLC Ladder Diagram
1.7 Basic Program Designing Examples
Start, Stop and Latched
In some application occasions, we need to use the transient close/open buttons for the start and stop of an equipment.
To maintain its continuous action, you have to design latched circuits.
Example 1: Stop first latched circuit
When the normally open contact X1 = On and the
normally closed contact X2 = Off, Y1 will be On. If you make
X2 = On at this time, Y1 will be Off. It is the reason why this is
called “stop first”.
Example 2: Start first latched circuit
When the normally open contact X1 = On and the
normally closed contact X2 = Off, Y1 will be On and latched. If
you make X2 = On at this time, Y1 will continue to be On
because of the latched contact. It is the reason why this is
called “start first”.
Example 3: Latched circuit for SET and RST instructions
See the diagram in the right hand side for the latched
circuit consist of RST and SET instructions.
In the stop first diagram, RST is placed after SET. PLC
executes the program from up to down, so the On/Off of Y1 will
be determined upon its status in the end of the program.
Therefore, when X1 and X2 are enabled at the same time, Y1
will be Off. It is the reason why this is called “stop first”.
In the start first diagram, SET is placed after RST. When
X1 and X2 are enabled at the same time, Y1 will be On. It is
the reason why this is called “start first”.
Y1
X1
X1
Y1
Stop first
X1
X2
Start first
X2
X1
X2
X2
SET
RST
RST
SET
Y1
Y1
Y1
Y1
Y1
Y1
Example 4: Power shutdown latched
The auxiliary relay M512 is latched (see instruction
sheets for DVP series PLC MPU). The circuit can not only be
latched when the power is on, but also keep the continuity of
the original control when the power is shut down and switched
on again.
DVP-PLC Application Manual
X1
X2
M512
SET
M512
RST M512
Y1
1-17
Frequently Used Control Circuit
1 Basic Principles of PLC Ladder Diagram
Example 5: Conditional control
X1
Y1
X2
Y2
X3
X4
Y1
X1
Y1
Y2
X3
X2
X4
Y1
Y2
X1 and X3 enables and disables Y1; X2 and X4 enables and disables Y2, and all are latched. Due to that the
normally open contact of Y1 is connected to the circuit of Y2 in series, Y1 becomes an AND condition for Y2.
Therefore, only when Y1 is enabled can Y2 be enabled.
Example 6: Interlock control
X1
Y1
X3
Y2
Y1
X1
X3
X2
X2
Y2
X4
Y1
Y2
X4
Y1
Y2
Which of the X1 and X2 is first enabled decides either the corresponding output Y1 or Y2 will be enabled first.
Either Y1 or Y2 will be enabled at a time, i.e. Y1 and Y2 will not be enabled at the same time (the interlock). Even X1
and X2 are enabled at the same time, Y1 and Y2 will not be enabled at the same time due to that the ladder diagram
program is scanned from up to down. In this ladder diagram, Y1 will be enabled first.
Example 7: Sequential control
X1
Y1
X2
Y2
X3
X4
Y2
Y1
If we serially connect the normally closed contact
Y1
of Y2 in example 5 to the circuit of Y1 as an AND
condition for Y1 (as the diagram in the left hand side),
the circuit can not only make Y1 as the condition for Y2,
Y2
but also allow the stop of Y1 after Y2 is enabled.
Therefore, we can make Y1 and Y2 execute exactly the
sequential control.
1-18
DVP-PLC Application Manual
1 Basic Principles of PLC Ladder Diagram
Y1
Y1
T T
Example 8: Oscillating circuit
An oscillating circuit with cycle ΔT+ΔT
Y1
The ladder diagram above is a very simple one. When the program starts to scan the normally closed contact
Y1, Y1 will be closed because coil Y1 is Off. When the program then scan to coil Y1 and make it On, the output will be
1. When the program scans to the normally closed contact Y1 again in the next scan cycle, because coil Y1 is On, Y1
will be open and make coil Y1 Off and output 0. The repeated scans will result in coil Y1 outputs oscillating pulses by
the cycle ΔT(On)+ΔT(Off).
An oscillating circuit with cycle nT+ΔT
X0
T0
Y1
TMR
Y1
T0
Kn
X0
Y1
TTn
The ladder diagram program controls the On time of coil Y1 by timer T0 and disable timer T0 in the next scan
cycle, resulting in the oscillating pulses in the output of Y1. n refers to the decimal set value in the timer and T is the
cycle of the clock.
Example 9: Flashing circuit
X0
T1
X0 T1
T2
TMR
Y1
T1
T2TMR Kn2
Kn1
X0
Tn2
*
Y1
T
n1
*
The ladder diagram is an oscillating circuit which makes the indicator flash or enables the buzzer alarms. It
uses two timer to control the On/Off time of coil Y1. n1 and n2 refer to the set values in T1 and T2 and T is the cycle
of the clock.
Example 10: Trigger circuit
X0
M0
M0
M0
Y1
Y1
Y1
DVP-PLC Application Manual
X0
T
M0
Y1
1-19
1 Basic Principles of PLC Ladder Diagram
The rising-edge differential instruction of X0 makes coil M0 generate a single pulse of ΔT (one scan cycle).
Coil Y1 will be On during this scan period. In the next scan period, coil M0 will be Off and the normally closed contact
M0 and Y1 will all be closed, making coil Y1 continue to be On until another rising-edge arrives in input X0, making
coil M0 On for another scan period and Y1 Off. Such kind of circuit relies on an input to make two actions execute
interchangeably. Also from the timing diagram on the last page, we can see that input X0 are square pulse signals of
the cycle T and coil Y1 output are square pulse signals of the cycle 2T.
Example 11: Delay circuit
X0
T10
TMR
Y1
T10
K1000
X0
Y1
Time base: T = 0.1 sec
100 seconds
When input X0 is On, due to that its corresponding normally closed contact is Off, time T10 will be Off and the
output coil Y1 will be On. T10 will be On and start to count until input X0 is Off. Output coil Y1 will be delayed for
100 seconds (K1,000 × 0.1 sec = 100 secs) and be Off. See the timing diagram above.
Example 12: Output delay circuit
The output delay circuit is the circuit composed of two timers. When input X0 is On and Off, output Y4 will be
delayed.
X0
T5
K50
5 secs
T5
T5
Y4
TMR
T6
Y4
Y4
X0
TMR
T6
K30
Example13: Timing extension circuit
X0
Y1
T11
T12TMR Kn2
Kn1
TMR
T11
T12
Timer = T11, T12
Clock cycle: T
1-20
T
T6
3 secs
The total delay time from input X0 is closed to output
Y1 is On = (n1+n2)* T. T refers to the clock cycle.
X0
T11
T12
Y1
n1*
T
(n1+n2)*
n2*
T
T
DVP-PLC Application Manual
1 Basic Principles of PLC Ladder Diagram
Kn1
The counting range of a 16-bit counter is 0 ~ 32,767. As
the circuit in the left hand side, using two counters can
increase the counting range to n1*n2. When the counting
of counter C5 reaches n1, C6 will start to count for one
time and reset for counting the pulses from X13. When
the counting of counter C6 reaches n2, the pulses from
input X13 will be n1*n2.
Example 14: How to enlarge the counting range
X13
CNT
C5
C5
C6CNT Kn2
C5RST
X14
RST
C6
C6
Y1
Example 15: Traffic light control (by using step ladder instruction)
Traffic light control
Vertical Light
Vertical
light
Horizontal
Horizontal Light
light
On time 35 secs 5 secs 25 secs 5 secs
Red light
Y0 Y1 Y2 Y2
Y10 Y11 Y12 Y12
Yellow
light
Green
light
Green
light
flashes
Timing Diagram:
Vertical Light
Red
Y0
Yel l ow
Y1
Green
Y2
Horizontal Light
Red
Y10
Ye ll o w
Y11
Green
Y12
25 secs
5 secs 5 secs
25 secs
5 secs
5 secs
DVP-PLC Application Manual
1-21
1 Basic Principles of PLC Ladder Diagram
SFC Figure:
M1002
S0
S20
T0
S21
T1
S22
T2
S23
T13
S0
TMR T0 K350
TMR T1 K250
TMR T2 K50
M1013
Y0
Y2
Y2
Y1
T10
T11
T12
S30
S31
S32
S33
Y12
TMR T10 K250
TMR T11 K50
M1013
Y11
TMR T12 K50
TMR T13 K350
Y12
Y10
Ladder Diagram:
M1002
S0
S
S20
S
S21
S
S22
S
S23
S
S30
S
T0
T1
M1013
T2
ZRST S0 S127
SET S0
SET S20
SET S30
Y0
TMR T0
K350
SET S21
Y2
TMR T1
K250
SET S22
TMR T2
K50
Y2
SET S23
Y1
Y12
TMR T10
T10
K250
SET S31
S31
S
M1013
TMR T11
K50
Y12
T11
SET S32
S32
S
T12
Y11
TMR T12
K50
SET S33
S33
S
Y10
TMR T13 K350
S23SS33
T13
S
S0
RET
END
1-22
DVP-PLC Application Manual
Drawing by SFC Editor (WPLSoft )
Drawn by SFC Internal Ladder Diagram
1 Basic Principles of PLC Ladder Diagram
LAD-0
M1002
S0ZRST S127
LAD-0
S0
0
S20
1
S21
2
S22
3
S23
S30
S31
S32
S33
S0SET
Transferring Condition 1
T0
TRANS*
5
6
7
S22
T2TMR K50
M1013
Y2
Transferring Condition 4
S0
T13
T13
T13
T13
T13
T13
T13
TRANS*
TRANS*
TRANS*
TRANS*
TRANS*
TRANS*
TRANS*
4
Transferring Condition 7
T12
T12
T12
T12
T12
T12
T12
TRANS*
TRANS*
TRANS*
TRANS*
TRANS*
TRANS*
TRANS*
DVP-PLC Application Manual
1-23
1 Basic Principles of PLC Ladder Diagram
MEMO
1-24
DVP-PLC Application Manual
2.1 All Devices in DVP-PLC
ES/EX/SS series MPU:
Device
Type
X External input relay X0 ~ X177, 128 points, octal
Y External output relay Y0 ~ Y177, 128 points, octal
General purpose
Auxiliary
M
relay
T Timer
Relay (bit)
C Counter
S Step
T Present value of timer T0 ~ T127, 128 points
C Present value of counter
Register (word data)
Pointer
Constant
* The latched area is fixed and cannot be changed.
Data
D
register
N For master control nested loop N0 ~ N7, 8 points
P For CJ, CALL instructions P0 ~ P63, 64 points
I Interruption
K Decimal form
H Hexadecimal form
Latched* M512 ~ M767, 256 points
Special purpose
100ms timer T0 ~ T63, 64 points
10ms timer (M1028 = On)
1ms timer T127, 1 points
16-bit counting up (general purpose) 16-bit counting up (latched*) C112 ~ C127, 16 points
32-bit counting up/down high-speed counter (latched*)
Initial step (latched*) S0 ~ S9, 10 points
Zero return (latched*)
Latched* S20 ~ S127, 108 points
Item Range Function
1-phase 1 input
1-phase 2 inputs C246, C247, C249, 3 points
2-phase 2 inputs C251, C252, C254, 3 points
General purpose D0 ~ D407, 408 points
Latched* D408 ~ D599, 192 points
Special purpose D1000 ~ D1311, 312 points Index indication E, F, 2 points
External interruption I001, I101, I201, I301, 4 points
Timed interruption
Communication interruption I150, 1 point
2 Functions of Devices in DVP-PLC
Corresponds to external
To ta l
256 points
M0 ~ M511, M768 ~ M999, 744 points
M1000 ~ M1279, 280 points (some are latched)
T64 ~ T126, 63 points (M1028 = Off: 100ms)
C0 ~ C111, 112 points
C235 ~ C238, C241, C242, C244, 7 points
S10 ~ S19, 10 points (used with IST instruction)
C0 ~ C127, 16-bit counter, 128 points C235 ~ C254, 32-bit counter, 13 points
I6□□, 1 point (□□=10 ~ 99, time base = 1ms ) (for V5.7 and above)
K-32,768 ~ K32,767 (16-bit operation) K-2,147,483,648 ~ K2,147,483,647 (32-bit operation)
H0000 ~ HFFFF (16-bit operation) H00000000 ~ HFFFFFFFF (32-bit operation)
To ta l
1,280 points
Tota l
128 points
Tota l
128 points
Tota l
13 points
Tota l
128 points
To ta l
600 points
To ta l
312 points
input points Corresponds to external output points
The contact can be On/Off in the program.
Timer indicated by TMR instruction. If timing reaches its target, the T contact of the same No. will be On.
Counter indicated by CNT (DCNT) instruction. If counting reaches its target, the C contact of the same No. will be On.
Used for SFC.
When the timing reaches the target, the contact of the timer will be On. When the counting reaches the target, the contact of the counter will be On.
Memory area for data storage; E, F can be used for index indication.
Control point for main control loop Position index for CJ and CALL
Position index for interruption subroutine.
DVP-PLC Application Manual
2-1
SA/SX/SC series MPU:
Device
Type
X External input relay X0 ~ X177, 128 points, octal
Y External output relay Y0 ~ Y177, 128 points, octal
Auxiliary
M
Relay
T Timer
Relay (bit)
C Counter
S Step point
T Present value of timer T0 ~ T255, 256 points
C Present value of counter
Data
D
Register (word data)
register
N/A File register K0 ~ K1,599 (1,600 points) (*4)
2 Functions of Devices in DVP-PLC
Item Range Function
Corresponds to external input points Corresponds to external output points
The contact can be On/Off in the program.
Timer indicated by TMR instruction. If timing reaches its target, the T contact of the same No. will be On.
Counter indicated by CNT (DCNT) instruction. If counting reaches its target, the C contact of the same No. will be On.
Used for SFC.
When the timing reaches the target, the contact of the timer will be On. When the counting reaches the target, the contact of the counter will be On.
Memory area for data storage; E, F can be used for index indication.
Expanded register for data storage.
General purpose M0 ~ M511, 512 points (*1)
Latched*
Special purpose
100ms
10ms
1ms
16-bit counting up
32-bit counting up/down
For SA/SX, 32-bit high-speed counter
For SC, 32-bit high-speed counter
Initial step S0 ~ S9, 10 points (*1)
Zero return
General purpose S20 ~ S511, 492 points (*1)
Latched* S512 ~ S895, 384 points (*3)
Alarm S896 ~ S1023, 128 points (*3)
General purpose D0 ~ D199, 200 points (*1)
Latched*
Special purpose D1000 ~ D1999, 1,000 points Index indication E0 ~ E3, F0 ~ F3, 8 points (*1)
M512 ~ M999, 488 points (*3) M2000 ~ M4095, 2,096 points (*3) M1000 ~ M1999, 1,000 points (some are latched)
T0 ~ T199, 200 points (*1) T192 ~ T199 for subroutine T250 ~ T255, 6 accumulative points (*4)
T200 ~ T239, 40 points (*1) T240 ~ T245, 6 accumulative points (*4)
T246 ~ T249, 4 accumulative points (*4) C0 ~ C95, 96 points (*1) C96 ~ C199, 104 points (*3) C200 ~ C215, 16 points (*1) C216 ~ C234, 19 points (*3) C235 ~ C244, 1-phase 1 input, 9 points (*3) C246 ~ C249, 1-phase 2 inputs, 3 points (*3) C251 ~ C254, 2-phase 2 inputs, 4 points (*3) C235 ~ C245, 1-phase 1 input, 11 points (*3) C246 ~ C250, 1-phase 2 inputs, 4 points (*3) C251 ~ C255, 2-phase 2 inputs, 4 points (*3)
S10 ~ S19, 10 points (used with IST instruction) (*1)
C0 ~ C199, 16-bit counter, 200 points C200 ~ C254, 32-bit counter, 50 points (SC: 53 points)
D200 ~ D999, 800 points (*3) D2000 ~ D4999, 3,000 points (*3)
To ta l
256
points
To ta l 4,096 points
To ta l
256
points
To ta l
235
points
Tota l
16
points
To ta l
19
points
To ta l 1,024 points
To ta l 5,000 points
2-2
DVP-PLC Application Manual
Loading...
+ 556 hidden pages