Manual - PLC Application - English PDF
Manual - PLC Application - English PDF
PLC
API160 169 Real Time Calendar ............................................................ 9-39 API170 171 Gray Code Conversion ........................................................ 9-49 API172 175 Floating Point Operation ..................................................... 9-51 API180 190 Matrix................................................................................. 9-59 API191 199 Positioning Instruction ........................................................ 9-76
1.1
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 counterthe 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
X0 X1 Y0 Y1 X4 Y2
Y0 Y1 Y2
X2 X3
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.
1-1
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 1 2 3 4 5 X5 No action Action No action No action No action X6 No action No action No action Action No action Y3 Off On On Off 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
X0
X1 Y0
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.)
Y1
Executing in cycles
Y126 End
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 X4 X2 X5 Y0
1.3
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
1-3
1-4
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 Step 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 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 Timer 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 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 Data register 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.
1-5
E and F index registers are 16-bit data registers as other data registers. They can be read and Index register 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. The structure of a ladder diagram: Structure Explanation Normally open, contact A Normally closed, contact B Normally open in series connection Normally closed in series connection Normally open in parallel connection Normally closed in parallel connection Rising-edge trigger switch Falling-edge trigger switch 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 Instruction LD LDI AND ANI OR ORI LDP LDF ANDP ANDF ORP ORF ANB Devices Used X, Y, M, S, T, C X, Y, M, S, T, C X, Y, M, S, T, C X, Y, M, S, T, C X, Y, M, S, T, C X, Y, M, S, T, C X, Y, M, S, T, C X, Y, M, S, T, C X, Y, M, S, T, C X, Y, M, S, T, C X, Y, M, S, T, C X, Y, M, S, T, C -
ORB
1-6
Multiple output
Y, M, S S See Ch.3 for basic instructions (RST/SET and CNT/TMR) and Ch.5 ~ 10 for application instructions -
Block: A block is a series or parallel operation composed of more than 2 devices. There are series block and parallel block.
Series block
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).
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.
1-7
An independent network
Network 2
An incomplete network
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 M0 X3
X1
Y1 T0
X4 Y1 M3 TMR T0 K10
M1
1-8
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.
Rising edge X0 Time OFF ON OFF OFF ON OFF X0 Time
Falling edge
2. AND (ANI) instruction: A single device connects to another single device or a block in series
AND instruction 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.
1-9
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 given above for the analysis cannot be wrong. However, sometimes the compiling program will ignore the same output status, as shown in the figure.
MRD MPS MPS
MPP
MPP
1-10
8. RET instruction: Placed after the completed step ladder diagram. RET also has be placed after STL instruction. See the example below.
S20 S X1
RET S20 S X1
RET
See step ladder instructions [STL], [RET] in Ch. 4 for the structure of the ladder diagram.
1-11
Ladder Diagram
X0 X1
X2 M0 M1
X1 Y0 C0 SET S0
AND block
Parallel connection block
M2
Y0
S0 S
S10 S
S11 S
S20 S
S12 S
S13 S
X13 S0 RET
ANI X1 The output will continue Y0 following the status of Multiple C0 outputs S0 Step ladder Start S0 X10 Status S0 and X10 operation Status working item and Y10 step point transfer S10 S10 Withdraw S10 status Withdraw X11 status X11 Y11 S11 Status working item and step point transfer S12 S13 Withdraw S11 status S11 Withdraw X12 status X12 Y12 Status working item and S20 step point transfer S20 Bifurcation S12 convergence S13 End of step ladder X13 Status working item and step point transfer S0 Return
X0 C0 K10 C0 X1 M0 X1 M1 M2 M2 C0
Read C0
Multiple outputs
End of program