Dvp-Plc-Program o en 20101119
Dvp-Plc-Program o en 20101119
Dvp-Plc-Program o en 20101119
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
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
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
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
API00 ~ 09 Loop Control.......................................................................... 6-1 API10 ~ 19 Transmission Comparison ...................................................... 6-18 API20 ~ 29 Four Arithmetic Operation ...................................................... 6-32 API30 ~ 39 Rotation & Displacement ........................................................ 6-46 API40 ~ 49 Data Processing .................................................................... 6-57
Chapter 7
API50 ~ 59 High Speed Processing .......................................................... 7-1 API60 ~ 69 Handy Instructions ................................................................. 7-39 API70 ~ 79 Display of External Settings ................................................... 7-59 API80 ~ 88 Serial I/O............................................................................... 7-80
Chapter 8
API100 ~ 109 Communication .................................................................. 8-1 API110 ~ 119 Floating Point Operation ..................................................... 8-21 API120 ~ 129 Floating Point Operation ..................................................... 8-29 API130 ~ 139 Floating Point Operatio....................................................... 8-41 API140 ~ 149 Others ............................................................................... 8-53
Chapter 9
API150 ~ 154 Others ............................................................................... 9-1 API155 ~ 159 Position Control ................................................................. 9-23
API160 ~ 169 Real Time Calendar............................................................ 9-52 API170 ~ 171 Gray Code Conversion ....................................................... 9-62 API172 ~ 175 Floating Point Operation ..................................................... 9-64 API180 ~ 190 Matrix ................................................................................ 9-69 API191 ~ 199 Positioning Instruction ........................................................ 9-86
Chapter 10
API202 ~ 203 Others. .............................................................................. 10-1 API215 ~ 223 Contact Type Logic Operation Instruction. ........................... 10-7 API224 ~ 246 Contact Type Compare Instruction ...................................... 10-10
Chapter 11
11.1 11.2 11.3 11.4
Appendix
Appendix A: Self Detection Table for Abnormality .......................................... 11-1 Appendix B: MPU Terminal Layout ............................................................... 11-2 Appendix C: Terminal Layout for Digital I/O Modules ..................................... 11-6 Appendix D: Revision History ....................................................................... 11-9
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
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
1-5
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
1.4
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 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 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
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
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
X0 X1 X2 X3
LD OR OR OR
X0 X1 X2 X3
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:
1-13
Reverse flow exists in the signal circuit from the beginning of input to output.
Re ver se fl ow
Combining or editing should be done from the up-left to the bottom-right. The dotted-lined area should be moved up.
Blocks connected in series should be aligned with the upmost horizontal line.
1-14
X1 X2
X0
When a single device is connected to a block in parallel, place the block on top to omit ORB instruction.
T0 X1 X2
X1 T0
X2
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 LD
X2 X4
X0 X1 X3
X0 X1 X2 X3 X4
X3 X4 X1 X0 X2
1-15
X0 Y1 Y0
Ladder diagram complied into instruction MPS AND OUT MPP OUT Y0 Y0 X0 Y1 Ladder diagram complied into instruction X0 Y1
Y0 X0 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
X0
X1
X2
X0 X3 X6
X1 X4 X7
X2 X5 X1 0 LO OP 1
X3
X4
X5
X10
X6
X7
X5
re ver se fl ow
X10
LOOP1
Example 2
X0 X3 X6 X1 X4 X7 X2
X0
X5
X1 X4
X2 X5
X3
X1 0 LO OP 1
X6
re ver se fl ow
Re ver se fl ow
X3 X6
X7
X10
X0 X3 X6
X1 X4 X7
X2 X5 X 10 L OO P2
1-16
Y1 X1
X2 Y1
X1 Y1
X2 Y1
1-17
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 X4 Y1 Y2 X3 Y2 Y1
If we serially connect the normally closed contact 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, 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
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 Y1 TMR T0 Kn
Y1 nT T X0
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 TMR X0 T1 Y1 T2 Kn2
Y1 n1 * T
T2 TMR T1 Kn1
X0 n2 *T
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
M0 Y1
X0
T
1-19
X0 Y1
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 TMR T5 Y4 Y4 X0 TMR T6 K30
T6 3 secs T
T5
K50
5 secs T5
T6 Y4
T11
Kn1
The total delay time from input X0 is closed to output Y1 is On = (n1+n2)* T. T refers to the clock cycle.
n2* T
(n1+n2)* T
1-20
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 15: Traffic light control (by using step ladder instruction) Traffic light control
Vertical Light
Vertical light Horizontal light On time
Horizontal Light
Timing Diagram:
Vertical Light Red Y0 Yellow Y1 Green Y2 Horizontal Light Red Y10 Yellow Y11 Green Y12 25 secs 5 secs 5 secs
1-21
Ladder Diagram:
M1002
ZRST SET
S0 S0 S20 S30
S127
S30 T0 K350 T10 S31 T1 T2 Y2 Y1 K250 K50 T11 S32 T12 S33
S0 S
T10 T11 Y12 K250 K50
SET SET
S20 S
T0
SET
S21 S
Y2 TMR
T1
T13 S0
T1 S22 T2
K250
SET
S22 S M1013
TMR Y2
T2
K50
SET
S23 S S30 S
S23
Y1 Y12 TMR
T10
K250
SET
S31 S M1013
TMR Y12
T11
K50
SET
S32 S
S32
Y11 TMR
T12
T12 S33
K50
SET
S33 S
S23 S33 S S
T13
S0 RET END
1-22
LAD-0 S0
Transferring Condition 1
0
SET
T0 TRANS*
S20
1
S30
5
S22
S21
2
S31
6
TMR M1013 Y2
T2
K50
S22
3
S32
7
S23
S33
Transferring Condition 4
T13 TRANS*
4
S0
Transferring Condition 7
T12 TRANS*
1-23
1-24
Timer indicated by TMR instruction. If timing reaches its target, the T contact of the same No. will be On.
Total 13 points
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
C0 ~ C127, 16-bit counter, 128 points C235 ~ C254, 32-bit counter, 13 points D0 ~ D407, 408 points D408 ~ D599, 192 points D1000 ~ D1311, 312 points E, F, 2 points N0 ~ N7, 8 points P0 ~ P63, 64 points I001, I101, I201, I301, 4 points Total 600 points Total 312 points
Data register
N Pointer P
For master control nested loop For CJ, CALL instructions External interruption
Interruption
I6, 1 point (10 ~ 99, time base = Position index for interruption subroutine. 1ms ) (for V5.7 and versions above) I150, 1 point 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)
Constant
K H
2-1
Range X0 ~ X177, 128 points, octal Y0 ~ Y177, 128 points, octal M0 ~ M511, 512 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) S0 ~ S9, 10 points (*1) S10 ~ S19, 10 points (used with IST instruction) (*1) S20 ~ S511, 492 points (*1) S512 ~ S895, 384 points (*3) S896 ~ S1023, 128 points (*3) Total 256 points Total 4,096 points
Function Corresponds to external input points Corresponds to external output points The contact can be On/Off in the program.
X Y
Auxiliary Relay
100ms T Timer 10ms 1ms Relay (bit) 16-bit counting up 32-bit counting up/down
Timer indicated by TMR instruction. If timing reaches its target, the T contact of the same No. will be On.
Total 235 points Total 16 points Counter indicated by CNT (DCNT) instruction. If counting reaches its target, the C contact of the same No. will be On.
Counter
Total 19 points
Initial step Zero return S Step point General purpose Latched* Alarm T Register (word data) Present value of timer
When the timing reaches the target, the T0 ~ T255, 256 points contact of the timer will be On. When the counting C0 ~ C199, 16-bit counter, 200 points reaches the target, the C200 ~ C254, 32-bit counter, 50 points (SC: 53 contact of the counter points) will be On. D0 ~ D199, 200 points (*1) D200 ~ D999, 800 points (*3) D2000 ~ D4999, 3,000 points (*3) D1000 ~ D1999, 1,000 points E0 ~ E3, F0 ~ F3, 8 points (*1) K0 ~ K1,599 (1,600 points) (*4) Total 5,000 points Memory area for data storage; E, F can be used for index indication. Expanded register for data storage.
Data register
N/A
File register
2-2
N0 ~ N7, 8 points P0 ~ P255, 256 points I001, I101, I201, I301, I401, I501, total 6 points I6, I7, 2 points ( = 1 ~ 99, time base = 1ms) I010, I020, I030, I040, I050, I060, total 6 points
Control point for main control loop Position index for CJ and CALL
Communication interruption I150, 1 point K-32,768 ~ K32,767 (16-bit operation) K Decimal form K-2,147,483,648 ~ K2,147,483,647 (32-bit operation) H0000 ~ HFFFF (16-bit operation) H Hexadecimal form H00000000 ~ HFFFFFFFF (32-bit operation) *1. Non-latched area cannot be modified. *2. The preset non-latched area can be modified into latched area by setting up parameters. *3. The preset latched area can be modified into non-latched area by setting up parameters. *4. The fixed latched area cannot be modified
It is fixed to be non-latched It is fixed to be non-latched 16-bit counting up C (Counter) C0 ~ C95 It is fixed to be non-latched Initial S0 ~ S9 C96 ~ C199 Default: latched Start: D1208 (K96) End: D1209 (K199) Zero return S10 ~ S19
32-bit counting up/down C200 ~ C215 It is fixed to be non-latched C216 ~ C234 Default: latched Start: D1210 (K216) End: D1211 (K234) Latched S512 ~ S895 Default: latched Start: D1214 (K512) End: D1215 (K895) Special register D1000 ~ D1999 Some are latched and cannot be modified.
S (Step relay)
It is fixed to be non-latched General purpose D0 ~ D199 It is fixed to be non-latched Latched D200 ~ D999 Default: latched Start: D1216 (K200) End: D1217 (K999)
D (Register)
File Register
2-3
Item External input relay External output relay General purpose Auxiliary relay Latched Special purpose 100ms
Function Corresponds to external Total input points 512 Corresponds to external points output points
X Y M
M0 ~ M499, 500 points (*2) Total The contact can be M500 ~ M999, 500 points (*3) 4,096 On/Off in the program. M2000 ~ M4095, 2,096 points (*3) points M1000 ~ M1999, 1,000 points (some are latched) T0 ~ T199, 200 points (*2) T192 ~ T199 is for subroutine T250~T255, 6 accumulative points (*4) Timer indicated by TMR Total instruction. If timing 256 reaches its target, the T points contact of the same No. will be On. Counter indicated by CNT (DCNT) Total instruction. If counting 253 reaches its target, the C points contact of the same No. will be On.
T Relay (bit)
Timer
Counter
Step
T200 ~ T239, 40 points (*2) T240 ~ T245, 6 accumulative points (*4) 1ms T246 ~ T249, 4 accumulative points (*4) 16-bit counting C0 ~ C99, 100 points (*2) up C100 ~ C199, 100 points (*3) 32-bit counting C200 ~ C219, 20 points (*2) up/down C220 ~ C234, 15 points (*3) C235 ~ C244, 1-phase 1 input, 10 points (*3) 32-bit high-speed C246 ~ C249, 1-phase 2 inputs, 4 points(*3) counter C251 ~ C254, 2-phases 2 inputs, 4 points (*3) Initial step point S0 ~ S9, 10 points (*2) S10 ~ S19, 10 points (used with IST instruction) Zero return (*2) General purpose S20 ~ S499, 480 points (*2) 10ms Latched Alarm S500 ~ S899, 400 points (*3) S900 ~ S1023, 124 points (*3) T0 ~ T255, 256 points
C0 ~ C199, 16-bit counter, 200 points C200 ~ C254, 32-bit counter, 53 points D0 ~ D199, 200 points, (*2) D200 ~ D999, 800 points (*3) D2000 ~ D9999, 8,000 points (*3) D1000 ~ D1999, 1,000 points E0 ~ E7, F0 ~ F7, 16 points (*1) K0 ~ K9,999 (10,000 points) (*4) N0 ~ N7, 8 points P0~P255, 256 points I00(X0), I10(X1), I20(X2), I30(X3), I40(X4), , = I50(X5), 6 points ( = 1, rising-edge trigger 0, falling-edge trigger )
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 Total storage; E, F can be 10,000 used for index points indication. Expanded register for data storage. Control point for main control loop Position index for CJ and CALL
Data register
N/A N P
File register For master control loop For CJ, CALL instructions
I Pointer Interruption
External interruption
Timed interruption Interruption inserted when high-speed counter reaches target Pulse interruption Communication interrruption
I6, I7, 2 points( = 1~99ms) time base = 1ms I8, 1 point ( = 1~99, time base = 0.1ms) Position index for interruption subroutine. I010, I020, I030, I040, I050, I060, 6 points I110, I120, I130, I140, 4 points I150, I160, I170, 3 points
2-4
Range
Function
Constant
K H
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)
*1. Non-latched area cannot be modified. *2. The preset non-latched area can be modified into latched area by setting up parameters. *3. The preset latched area can be modified into non-latched area by setting up parameters. *4. The fixed latched area cannot be modified
T (Timer)
C (Counter)
S (Step relay)
100 ms 10 ms T0 ~ T199 T200 ~ T239 Default: non-latched Default: non-latched Accumulative type Start: D1204 (K-1)*1 Start: D1206 (K-1)*1 It is fixed to be latched. End: D1205 (K-1)*1 End: D1207 (K-1)*1 16-bit counting up 32-bit counting up/down 32-bit high-speed counting up/down C0 ~ C99 C100 ~ C199 C200 ~ C219 C220 ~ C234 C235 ~ C245 C246 ~ C255 Default: Default: Default: latched Default: latched Default: latched non-latched non-latched Start: D1208 (K100) Start: D1210 (K220) Start: D1212 (K235) End: D1209 (K199) End: D1211 (K234) End: D1213 (K255) General Initial Zero return Latched Step alarm purpose S0 ~ S9 S10 ~ S19 S20 ~ S499 S500 ~ S899 S900 ~ S1023 Non-latched (default) Latched (default) It is fixed to be latched. Start: D1214 (K500) End: D1215 (K899) General purpose Latched D200 ~ D999 Default: latched Special register D1000 ~ D1999 Some is latched and cannot be modified. Latched D2000 ~ D9999 Default: latched Start: D1218 (K2,000) End: D1219 (K9,999) D0 ~ D199 Default: non-latched
Some are latched and Start: D1202 (K2,000) cannot be modified. End: D1203 (K4,095) 10 ms 1 ms 100 ms T240 ~ T245 T246 ~ T249 T250 ~ T255
D (Register)
Start: D1216 (K200) End: D1217 (K999) File register *1: K-1 refers to the default setting is non-latched.
Power On/Off or the MPU switches between RUN/STOP: Memory of ES/EX/SS V5.5 (and versions above)
Memory type Non-latched Latched Special M, Special D, index register Initial Power OffOn Clear STOPRUN RUNSTOP Clear all non-latched areas (M1031) Clear Unchanged Unchanged Clear all latched areas (M1032) Unchanged Clear Default setting 0 Unchanged Initial setting
Clear when M1033 = Off Remain unchanged when M1033 = On Unchanged Unchanged
2-5
Unchanged Unchanged
2.2
For different control purposes, there are five types of values inside DVP-PLC for executing the operations. See the explanations bellows for the functions and works of every type of value. 1. Binary value (BIN) All the operations and storage of values in PLC are conducted in BIN. Belows are the terms for BIN values. Bit: Nibble: The basic unit for a BIN value, either 1 or 0. Composed of 4 continuous bits (e.g. b3 ~ b0). Presented as the decimal value 0 ~ 9 of a digit or 0 ~ F in hex. Byte: Word: Composed of 2 continuous nibble (i.e. 8 bits, b7 ~ b0). Presented as 00 ~ FF in hex. Composed of 2 continuous bytes (i.e. 16 bits, b15 ~ b0). Presented as 4-digit 0000 ~ FFFF in hex. Double word: Composed of 2 continuous words (i.e. 32 bits, b31 ~ b0). Presented as 8 digit 00000000 ~ FFFFFFFF. Bit, nibble, byte, word, and double word in a binary system:
DW W1 BY3 NB7 NB6 NB5 BY2 NB4 NB3 BY1 NB2 NB1 W0 BY0 NB0 Double Word Word Byte Nibble Bit
2. Octal value (OCT) The No. of external input and output terminals in DVP-PLC is numbered in octal system. For example: External input: X0 ~ X7, X10 ~ X17(device No.) 2-6 DVP-PLC Application Manual
Constant H: H is normally placed before a hexadecimal value in the PLC. For example, H100 refers to a hexadecimal value, 100. Reference table:
Binary (BIN) For PLC internal operation 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Octal (OCT) No. of device X, Y 0 1 2 3 4 5 6 7 10 11 12 13 14 15 16 17 Decimal (DEC) Constant K, No. of device M, S, T, C, D, E, F, P, I 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Binary Code Decimal (BCD) For DIP switch and 7-section display 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 0 1 1 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Hexadecimal (HEX) Constant H 0 1 2 3 4 5 6 7 8 9 A B C D E F
2-7
2.3
No. of input/output contacts (in octal): The No. of input and output contacts on the PLC MPU starts from X0 and Y0. The range of the No. varies upon the number of points on the MPU. For I/O extension units, the No. of input and output contacts is calculated according to its connection sequence with the MPU. ES/EX/SS series MPU:
Model Input X Output Y DVP-14ES X0 ~ X7 (8 points) Y0 ~ Y5 (6 points) DVP-14SS DVP-20EX DVP-24ES X0 ~ X7 (8 points) Y0 ~ Y5 (6 points) X0 ~ X7 (8 points) Y0 ~ Y5 (6 points) X0 ~ X17 (16 points) Y0 ~ Y7 (8 points) DVP-32ES X0 ~ X17 (16 points) Y0 ~ Y17 (16 points) DVP-40ES X0 ~ X27 (24 points) Y0 ~ Y17 (16 points) DVP-60ES X0 ~ X43 (36 points) Y0 ~ Y27 (24 points) I/O Extension Unit X20/30/50 ~ X177 (Note) Y20/30 ~ Y177 (Note)
Note: The input points on I/O extension units start from X20 and output points from Y20, except input points on DVP-40ES start from X30 and output from Y20; input points on DVP-60ES start from X50 and output from Y30. The No. of input/output points on the I/O extension units increases by 8s multiple. If the number of points is less than 8, it will be counted as 8.
Note 1: Besides 4DI and 2DO, SX series MPU has also 2AI (12-bit) and 2AO (12-bit) of analog input/output. Note 2: SX/SA/SC series MPU share the extension units with SS series MPU. The input points on I/O extension units start from X20 and output points start from Y20. The calculation on the No. of I/O points is the same as that in SS series.
EH series MPU:
Model DVP-16EH X0 ~ X7 (8 points) Y0 ~ Y7 (8 points) DVP-20EH (Note 1) X0 ~ X13 (12 points) Y0 ~ Y7 (8 points) DVP-32EH (Note1, 2) X0 ~ X17 (16 points) Y0 ~ Y17 (16 points) DVP-40EH X0 ~ X27 (24 points) Y0 ~ Y17 (16 points) DVP-48EH X0 ~ X27 (24 points) Y0 ~ Y27 (24 points) DVP-64EH X0 ~ X37 (32 points) Y0 ~ Y37 (32 points) DVP-80EH X0 ~ X47 (40 points) Y0 ~ Y47 (40 points) I/O Extension Unit (Note 3) X~X377
Input X
Output Y
Y~Y377
Note 1: The output type of 20EH00T and 32EH00T is transistor, among which Y0 and Y2 are high-speed transistor output (200kHz) and other outputs are normal transistor output (10kHz). The output type of other MPUs with 16/48/64/80 points is transistor and all outputs are normal transistor output (10kHz). Note 2: The terminal layouts of 32EH00T, 32EH00R and 32EH00M are different. See the instruction sheets of EH series MPU. In 32EH00M, CH0 (Y0, Y1) and CH1 (Y2, Y3) are high-speed differential output (200kHz). Note 3: The start No. of the input and output points on the I/O extension unit resumes from the last No. in the MPU. The start No. of input points on the I/O extension unit of DVP-16EH and DVP-20EH start from X20 and output points start from Y20. The No. on the I/O extension unit are in sequence, with max. input point No. X377 and max. output point No. Y377.
2-8
Output Y
Y~Y377
Note 1: The output type of 20EH00T2 and 32EH00T2 is transistor, among which Y0 and Y2 are high-speed transistor output (200kHz) and other outputs are normal transistor output (10kHz). The output type of other MPUs with 16/48/64/80 points is transistor and all outputs are normal transistor output (10kHz). Note 2: The output type of 40EH00T2 is transistor, among which CH0 (Y0, Y1), CH1 (Y2, Y3), CH2 (Y4) and CH3 (Y6) are high-speed transistor output (200kHz). The output type of other output points is normal transistor output (10kHz). The high-speed inputs CH0 (X0, X1), CH1 (X4, X5), CH2 (X10, X11) and CH3 (X14, X15) are able to achieve max. frequency 200kHz. Note 3: The numbering of the I/O points on EH2 series MPU is the same as that of EH series MPU.
SV series MPU:
Model Input X Output Y DVP-28SV (Note 1) X0 ~ X17 (16 points) Y0 ~ Y13 (12 points) I/O Extension Unit (Note 2) X20 ~ X377 Y20 ~ Y377
Note 1: The output type of 28SV11T is transistor output, among which CH0 (Y0, Y1), CH1 (Y2, Y3), CH2 (Y4) and CH3 (Y6) are high-speed transistor output (200kHz); others are normal transistor output (10kHz). Note 2: The input points on I/O extension units start from X20 and output points start from Y20. The calculation on the No. of I/O points is the same as that in SS series.
Input relay X0 ~ X377 The numbering of input relays (or input terminals) is in octal form. EH series MPU can have up to 256 points and the range is: X0 ~ X7, X10 ~ X17, , X370 ~ X377. Output relay Y0 ~ Y377 The numbering of output relays (or output terminals) is also in octal form. EH series MPU can have up to 256 points and the range is: Y0 ~ Y7, Y10 ~ Y17, , Y370 ~ Y377. Functions of input contact X The input contact X is connected to the input device and reads the input signals into the PLC. There is no limitation on the times of using contact A or B of input contact X in the program. On/Off of the input contact X only changes with On/Off of the input device. You cannot use the peripheral devices (HPP or WPLSoft) to force On/Off of the input contact X. The special relay M1304 in SS/ES/EX/SA/SX/SC/EH/EH2/SV series MPU allows the peripheral devices HPP or WPLSoft to set up On/Off of the MPU input contact X, but the PLC will not be able to receive external input signals at this time. Functions of output contact Y Output contact Y sends out On/Off signals to drive the load connected to output contact Y. There are two types of output contacts, relay and transistor. Thereis no limitation on the times of using contact A or B of output contact Y in the program, but the No. of output coil Y can only be used once in the program; otherwise according to the scan principle of the PLC program, the output status will be determined by the circuit of the last output Y in the program.
2-9
The output of Y0 will be determined by circuit 2, i.e. On/Off of X10 will determine the output status of Y0.
Y0 is repeated X10 Y0 2
Regenerate input signal 1. Before the execution of the program, PLC reads the On/Off status of the external input signals into the input signal memory at a time. 2. The On/Off status of the input signal during the execution of the program will not change the signal status in the input signal memory. The new On/Off status will be read in in the next scan. 3. There will be approximately a 10ms delay from the OnOff or OffOn changes to the status being recognized by the contact in the program. The delay time may be affected by the scan time in the program. Program processing
Output terminal Device Memory
Input terminal Read into memory Input signal memory Program processing X0 Y0 Y0 Read Y0 status from memory M0 Write in M0 status Regenerate output Output Output latched memory Read X0 status from memory Write in Y0 status
After the PLC reads the On/Off status of every input signal in the input signal memory, it will start to execute every instruction in the program in order starting from address 0. The execution result (On/Off of every output coil) will be stored in order into the device memory. Regenerate output 1. When the program executes to END instruction, it will send the On/Off status of Y in the device memory to the output latched memory. The output latched memory is the coil of the output relay. 2. There will be a 10ms delay from On Off or Off On of the relay coil to the On/Off status of the contact. 3. There will be a 10 ~ 20us delay from On Off or Off On of the transistor module to the On/Off status of the contact.
Y output
2-10
Functions of auxiliary relays: Both auxiliary relay M and output relay Y have output coils and contact A, B, and there is no limitation on the times of using the contact. You can use auxiliary relay M to assemble a control loop, but it cannot directly drive the external load. There are three types of auxiliary relays: 1. General purpose auxiliary relay: If the relay encouters power cut during the operation of the PLC, its status will be reset to Off and stay Off when the power is on again. 2. Latched auxiliary relay: If the relay encounters power cut during the operation of the PLC, its status will be retained and stay at the status before the power cut when the power is on again. 3. Special purpose auxiliary relay: Every relay of this kind has its specific function. Do not use undefined special purpose auxiliary relay. See 2.10 for special puspose auxiliary relay of all series MPU and 2.11 for its functions.
2.5
2-11
Functions of step relays: The step relay S can easily set up the procedure in the industrial automation, which is the most basic device in the the sequential function chart (SFC) and has to be used with STL, RET instructions. The device No. of S is S0 ~ S1023 (total 1,024 points) and both step relay S and output relay Y have output coils and contact A, B, and there is no limitation on the times of using the contact. S cannot directly drive the external load. When the step relay is not used in SFC, it can be used as a normal auxiliary relay. There are four types of step relays: 1. Initial step relay: S0 ~ S9, total 10 points, used for initial steps. 2. Zero return step relay: S10 ~ S19, total 10 points. S10 ~ S19 are planned for zero return when used with API 60 IST instruction in the program. If they are not used with IST, they will become normal step relays. 3. General purpose step relay: S20 ~ S511, total 492 points (for SA/SX/SC series MPU); S20 ~ S499, total 480 points (for EH/EH2/SV series MPU). Used for general purposes in SFC and their status will all be cleared when the operation of the PLC encounters power cut. 4. Latched step relay: S512 ~ S895, total 384 points (for SA/SX/SC series MPU); S20 ~ S127, total 108 points (for ES/EX/SS series MPU); S500 ~ S899, total 400 points (for EH/EH2/SV series MPU). Used for latched function in SFC and their status will all be retained when the operation of the PLC encounters power cut. They will remain at the status before the power cut when the PLC is powered again. 5. Alarm step relay: S896 ~ S1023, total 128 points (for SA/SX/SC series MPU); S900 ~ S1023, total 124 points (for EH/EH2/SV series MPU). Used with alarm driving instruction API 46 ANS as an alarm contact for recording the alarm messages or eliminating external malfunctions.
2-12
Functions of timers: The units of the timer are 1ms, 10ms and 100ms and the counting method is counting up. When the present value in the timer equals the set value, the output coil will be On. The set value should be a K value in decimal and the data register D can also be a set value. The actual set time in the timer = timing unit set value There are three types of timers: 1. General purpose timer: For ES/SA series MPU: The timer executes once when the program reaches END instruction. When TMR instruction is executed, the output coil will be On when the timing reaches its target. For EH/EH2/SV series MPU: The timer executes once when the program reaches TMR instruction. When TMR instruction is executed, the output coil will be On when the timing reaches its target.
X0 TMR T0 Y0 T0 K100
When X0 = On, The PV in timer T0 will count up by 100ms. When the PV = SV K100, the output coil T0 will be On.
2-13
When X0 = Off or the power is off, the PV in timer T0 will be cleared as 0, and the output coil T0 will be Off.
2. Accumulative type timer: For ES/SA series MPU: The timer executes once when the program reaches END instruction. When TMR instruction is executed, the output coil will be On when the timing reaches its target. For EH/EH2/SV series MPU: The timer executes once when the program reaches TMR instruction. When TMR instruction is executed, the output coil will be On when the timing reaches its target.
X0 T MR T 250 Y0 T1 X0 SV K100 T 250 Y0 PV T2 T 1+ T2=10sec T 250 K100
When X0 = On, The PV in timer T250 will count up by 100ms. When the PV = SV K100, the output coil T0 will be On. When X0 = Off or the power is off, timer T250 will temporarily stop the timing and the PV remain unchanged. When X0 is On again, the timing will resume and the PV will count up and when the PV = SV K100, the output coil T0 will be On.
3. Subrountine timer: Timer T192 ~ T199 are used in subrountines or interruption subroutines. For SA series MPU: The timer executes once when the program reaches END instruction. When END instruction is executed, the output coil will be On when the timing reaches its target. For EH/EH2/SV series MPU: The timer executes once when the program reaches TMR or END instruction. When TMR or END instruction is executed, the output coil will be On when the PV equals SV. If the general purpose timer is used in a subroutine or interruption subroutine but the subroutine is not being executed, the timer will not be able to time correctly. How to designate SV: The actual set time in the timer = timing unit set value a) Designating constant K: SV is a constant K b) Indirectly designating D: SV is data register D
2-14
2-15
Counting up, counting down -2,147,483,648 ~ +2,147,483,647 Constant K or data register D (designating 2 values) Counter will continue when the SV is reached. On and keeps being On when counting up reaches SV. Reset to Off when counting down reaches SV. Acts immediately when the counting reaches its target, has nothing to do with the scan period.
PV will be return to 0 when RST instruction is executed and the contact will be reset to Off. Acts when the scanning is completed. Acts when the scanning is completed.
Functions of counters: When the pulse input signals of the counter go from Off to On and the present value in the counter equals the set value, the output coil will be On. The set value should be a K value in decimal and the data register D can also be a set value. 16-bit counters C0 ~ C199: 1. The setup range of 16-bit counter: K0 ~ K32,767. K0 is the same as K1. The output contact will be On immediately when the first counting starts. 2. PV in the general purpose counter will be cleared when the power of the PLC is switched off. If the counter is a latched type, the counter will retain the PV and contact status before the power is off and resume the counting after the power is on again. 3. If you use MOV instruction, WPLSoft or HPP to send a value bigger than the SV to the present value register of C0, next time when X1 goes from Off to On, the contact of counter C0 will be On and its PV will equal SV. 4. The SV in the counter can be constant K (set up directly) or the values in register D (set up indirectly, excluding special data registers D1000~ D1999). 5. If you set up a constant K as the SV, it should be a positive value. Data register D as SV can be positive or negative. When the PV reaches up to 32,767, the next PV will turn to -32,768. Example: LD RST LD CNT LD OUT X0 C0 X1 C0 K5 C0 Y0
C0 Y0 X0 RST X1 CNT C0 K5 C0
2-16
2-17
Accumulatively increasing
Progressively decreasing
Accumulatively increasing
5 4 3 4 3 2 1 0 -1 -2 -3 -4 -5 -5 -6 -7 -8 -7 -6 -4 -3 0
2-18
1. Input points X0 and X1 can be planned as counters of higher speed with 1-phase 1 input reaching 20kHz. But the two counting frequencies added together has to be smaller or equal 20kHz. If the input is a 2-phase 2 input signal, the counting frequency will be approximately 4kHz. The 1-phase input of high-speed counters X2 and X3 and reach 10kHz. 2. The use of DHSCS instruction together with DHSCR instruction in ES series MPU cannot exceed 4 times. High-speed counters for SA/SX series MPU, total bandwidth: 40kHz
Type 1-phase input 1-phase 2 inputs 2-phase 2 inputs Input C235 C236 C237 C238 C239 C240 C241 C242 C244 C246 C247 C249 C251 C252 C253 C254 X0 X1 X2 X3 X4 X5 U: Progressively increasing input D: Progressively decreasing input U/D U/D U/D U/D U/D U/D A: A phase input B: B phase input S: Input started R: Input cleared U/D R U/D R S U/D R U D U D R U D R S A B A B R B A A B R S
1. The frequency of input points X0 and X1 of 1-phase input can reach up to 20kHz, X2 ~ X5 can reach 10kHz. The frequency of C251, C252 and C254 of 2-phase input (X0, X1) can reach up to 4kHz. The maximum frequency of C253 is 25kHz (only supports 4 times frequency counting). 2. Input point X5 has two functions: a) When M1260 = Off, C240 will be normal U/D high-speed counter. b) When M1260 = On and DCNT instruction enables C240, X5 will be the shared reset signal for C235 ~ C239. Counter C240 will continue to receive the input signals from X5. High-speed counters for SC series MPU, total bandwidth: 130kHz
Type 1-phase input 1-phase 2 inputs 2-phase 2 inputs Input C235 C236 C237 C238 C239 C240 C241 C242 C243 C244 C245 C246 C247 C249 C250 C251 C252 C254 C255 X0 X1 X2 X3 X4 X5 X10 X11 U: Progressively increasing input D: Progressively decreasing input A: A phase input B: B phase input U/D U/D U/D U/D U/D U/D U/D U/D S: Input started R: Input cleared U D A B U/D R U/D R S U/D R U D U D R U D R S A B A B R A B R S
2-19
C243 C245
C250
C255
f)
Explanations on high-speed counter and high-speed comparator: (i) When DHSCS and DHSCR instructions use new added high-speed counters, they can only use two groups of SVs in high speed comparison instruction. Assume you have used the comparison instruction DHSCS D0 C243 Y10, you can only set another group of instruction DHSCR D2 C243 Y10 or DHSCS D4 C245 Y10. (ii) When DHSZ instruction uses new added high-speed counters, it can only use one group of SV in the comparator. (iii) The number of SVs in high speed comparison instructions offered by SA/SX series MPU will not decrease owing to the increasing of high-speed counters. (iv) If the output device of the high-speed comparison instruction DHSCS requires high-speed output, it is recommended you use Y10 or Y11 for the output. If you use other general devices, the output will delay for 1 scan period for its setup or clearing. For example, if I0x0 interruption is set, C243 will correspond to I020, C245 to I040, and C250 and C255 to I060.
2-20
Function Setting up the multiplied frequency of the counter Normal frequency mode selected Double frequency mode selected (default) 4 times frequency mode selected indicates the occurrence of counting) Counting wave pattern
Counting up
Counting down
2-phase 2 inputs
A-phase
2 (Double frequency)
B-phase
Counting up
Counting down
A-phase
4 (4 times frequency)
B-phase
Counting up
Counting down
EH/EH2/SV series MPU supports high speed counters. C235 ~ C240 are program-interruption 1-phase high speed counter with a total bandwidth of 20kHz, can be used alone with a counting frequency of up to 10kHz. C241 ~ C254 are hardware high speed counter (HHSC). There are four HHSC in EH/EH2/SV series MPU, HHSC0 ~ 3. The pulse input frequency of HHSC0 and HHSC1 can reach 200kHz, and that of HHSC2 and HHSC3 can reach 20kHz (1 phase) or 5kHz (A-B phase). The pulse input frequency of HHSC0 ~ 3 of 40EH2 series MPU can reach 200kHz, among which: C241, C246 and C251 share HHSC0 C242, C247 and C252 share HHSC1 C243, C248 and C253 share HHSC2 DVP-PLC Application Manual 2-21
C235 C236 C237 C238 C239 C240 C241 C242 C243 C244 C246 C247 C248 C249 C251 C252 C253 C254
A B R S A B R S A B R S A B R S
3. System structure of the hardware high speed counters: a) HHSC0 ~ 3 have reset signals and start signals from external inputs. Settings in M1272, M1274, M1276 and M1278 are reset signals of HHSC0, HHSC1, HHSC2 and HHSC3. Settings in M1273, M1275, M1277 and M1279 are start signals of HHSC0, HHSC1, HHSC2 and HHSC3. b) If the external control signal inputs of R and S are not in use, you can set M1264/M1266/M1268/M1270 and M1265/M1267/M1269/M1271 as True and disable the input signals. The corresponding external inputs can be used again as general input points (see the figure below). c) When special M is used as a high speed counter, the inputs controlled by START and RESET will be affected by the scan time.
2-22
Comparator
8 set values
HHSC0 HHSC1 HHSC2 HHSC3 D1225 D1226 D1227 D1228 Select counting m odes Counting up/down monitoring flag Set values 1 ~ 4 indicate Mode 1 ~ 4 (1 ~ 4 times frequency) HHSC0 HHSC1 HHSC2 HHSC3 U/D mode setup flag C241 M1241 C242 M1242 C243 M1243 C244 M1244 HHSC0 M1246 HHSC1 M1247 HHSC2 M1248 HHSC3 M1249
AND OR
HHSC0 HHSC1 HHSC2 HHSC3 X2 M1264 X6 M1266 X12 M1268 X16 M1270 Reset signal R
Interruption forbidden flag I 010 M1289 I 020 M1290 I 030 M1291 I 040 M1292 I 050 M1293 I 060 M1294
M1272
M1274
M1276
M1278
HHSC0 HHSC1 HHSC2 HHSC3 X3 M1265 X7 M1267 X13 M1269 X17 M1271
AND OR
Start signal S
M1273
M1275
M1277
M1279
4. Counting modes: The counting modes of the hardware high-speed counters in EH/EH2/SV series MPU can be set in D1225 ~ D1228. Counting modes
Type Set value in special D 1 (Normal frequency) 2 (Double frequency) 1 (Normal frequency) 2 (Double frequency) 1 (Normal frequency) 2 (Double frequency) 3 (Triple frequency) 4 (4 times frequency) Counting up(+1)
U/D U/D FLAG
U/D U/D FLAG
Wave pattern
Counting down(-1)
1-phase 1 input
U D U D A B A B A B A B
1-phase 2 inputs
2-phase 2 inputs
2-23
D1152 (low word) In frequency control mode, DHSZ reads the upper and lower limits in the table D1153 (high word) counting register D1153 and D1152. D1166 Switching between rising/falling edge counting modes of X10 (for SC_V1.4 series MPU only) Switching between rising/falling edge counting modes of X11 (for SC_V1.4 series MPU only) The counting mode of the 1st group counters (C241, C246, C251) The counting mode of the 2nd group counters (C242, C247, C252) The counting mode of the 3rd group counters (C243, C248, C253) The counting mode of the 4th group counters (C244, C249, C254) Counting modes of HHSC0 ~ HHSC3 in EH/EH2/SV series MPU (default = 2) 1: Normal frequency counting mode D1225 ~ D1228 2: Double frequency counting mode 3: Triple frequency counting mode 4: 4 times frequency counting mode
2-25
1. X11 drives M1241 to determine whether C241 is an addition or subtraction counter. 2. When X10 is On, RST instsruction will be executed and the PV in C241 will be cleared to 0 and the contact will be Off. 3. In C241, when X12 is On and C241 receives the signals from X0, the PV in the counter will count up (plus 1) or count down (minus 1). 4. When the counting of C241 reaches SV K5, the contact of C241 will be On. If there are still input signals from X0, the counting will continue. 5. C241 in ES/EX/SS and SA/SX/SC series MPU has external input signals to reset X1. 6. C241 in EH/EH2/SV series MPU has external input signals to reset X2 and start X3. 7. The external input contact of reset signal of C241 (HHSC0) in EH/EH2/SV series MPU is disabled by M1264. The external input contact of start signal is disabled by M1265. 8. The internal input contact of reset signal of C241 (HHSC0) in EH/EH2/SV series MPU is disabled by M1272. The internal input contact of start signal is disabled by M1273. 9. The counting modes (normal frequency or double frequency) of C246 (HHSC0) in EH/EH2/SV series MPU can be set up by D1225. The default setting is double frequency mode.
Counting down Contact X11, M1241 X10 X12 X0 PV in C241 5 4 3 2 1 0 Contact Y0, C241 3 0 6 7 6 5 4 Counting up
1. When X10 is On, RST instsruction will be executed. The PV in C246 will be cleared to 0 and the output contact will be reset to be Off. 2. In C246, when X11 is On and C246 receives the signals from X0, the PV in the counter will count up (plus 1) or count down (minus 1). 3. When the counting of C246 reaches SV K5, the contact of C246 will be On. If there are still input signals from X0, the counting will continue. 4. C246 in EH/EH2/SV series MPU has external input signals to reset X2 and start X3.
5. The counting modes (normal frequency or double frequency) of C246 (HHSC0) in EH/EH2/SV series MPU can be set up by D1225. The default setting is double frequency mode. 6. The external input contact of reset signal of C246 (HHSC0) in EH/EH2/SV series MPU is disabled by M1264. The external input contact of start signal is disabled by M1265. 7. The internal input contact of reset signal of C246 (HHSC0) in EH/EH2/SV series MPU is disabled by M1272. The internal input contact of start signal is disabled by M1273. 2-phase AB input high-speed counter Example: LD RST LD DCNT LD OUT 1. 2. X10 C251 X11 C251 K5 C251 Y0
X11 DCNT C251 Y0 C251 K5 X10 RST C251
When X10 is On, RST instsruction will be executed. The PV in C251 will be cleared to 0 and the output contact will be reset to be Off. In C251, when X11 is On and C251 receives the A-phase signals from X0 and B-phase signals from X1, the PV in the counter will count up (plus 1) or count down (minus 1). You can select different counting modes if you use EH/EH2/SV series MPU.
3. 4.
When the counting of C251 reaches SV K5, the contact of C251 will be On. If there are still input signals coming in, the counting will continue. The counting modes (normal frequency, double frequency or 4 times frequency) of C251 (HHSC0) in ES/SA series MPU can be set up by D1022. The default setting is double frequency mode.
2-27
Counting up
Counting down
1 0
Counting up
Counting down
1 0
2.8
2.8.1 Data register [D] A data register is for storing a 16-bit datum of values between -32,768 to +32,767. The highest bit is + or -" sign. Two 16-bit registers can be combined into a 32-bit register (D + 1; D of smaller No. is for lower 16 bits). The highest b it is + or - sign and it can store a 32-bit datum of values between -2,147,483,648 to +2,147,483,647.
2-28
Data register D
There are five types of registers: 1. General purpose register: When PLC goes from RUN to STOP or the power of the PLC is switched off, the data in the register will be cleared to 0. When M1033 = On and PLC goes from RUN to STOP, the data will not be cleared, but will still be cleared to 0 when the power is off. 2. Latched register: When the power of PLC is switched off, the data in the register will not be cleared but will retain at the value before the power is off. You can use RST or ZRST instruction to clear the data in the latched register. 3. Special purpose register: Every register of this kind has its special definition and purpose, mainly for storing the system status, error messages and monitored status. See 2.10 and 2.11 for more details. 4. Index register E, F: The index register is a 16-bit register. There are 2 points of E, F in ES/EX/SS series MPU; 8 points (E0 ~ E3, F0 ~ F3) in SA/SX/SC series MPU; 16 points (E0 ~ E7, F0 ~ F7) in EH/EH2/SV series MPU. If the index register is to be used as a 32-bit register, please designate E. When E is already designated in a 32-bit instruction, using also F will not be allowed. 5. File register: There are 1,600 file registers (K0 ~ K1,599) in SA/SX/SC series MPU and 10,000 file registers (K0 ~ K9,999) in EH/EH2/SV series MPU. The file register does not have an exact device No.; therefore the read/write function of file registers has to be executed by instruction API 148 MEMR, API 149 MEMW or through peripheral devices HPP and WPLSoft.
2-29
read. If you need to use a 32-bit register, you have to designate E. In this case, F will be covered by E and cannot be used anymore; otherwise, the content in E (32-bit) will be incorrect. We suggest you use DMOVP K0 E instruction, the content in E (including F) will be cleared to 0 when the power of PLC is switched on. The combination of E, F when you use a 32-bit index register: (F0, E0), (F1, E1), (F2, E2), (F7, E7)
When X0 = On, E0 = 8, F0 = 14, D5E0 = D (5 + 8) = D13, D10F0 = D (10 + 14) = D24. At this moment, the content in D13 will be moved to D24.
The index register is the same as normal operands, can be used for moving or comparison on word devicies (KnX, KnY, KnM, KnS, T, C, D) and bit devices (X, Y, M, S). ES/SA series MPU does not support constant (K, H) index register, but EH/EH2/SV series MPU supports constant (K, H) index register. ES/EX/SS series MPU has 2 points of index registers E0, F0 SA/SX/SC series MPU has 8 points of index registers E0 ~ E3, F0 ~ F3 EH/EH2/SV series MPU has 16 points of index registers E0 ~ E7, F0 ~ F7 Some instructions do not support index registers. For how to use index register E, F to modify the operands, see Chapter 5.4 for more details. When you use the instruction mode in WPLSoft to generate constant (K, H) index register function, please use symbol @. For example, MOV K10@E0 D0F0 When you use index register E, F to modify the operands, the modification range CANNOT exceed the range of special purpose registers D1000 ~ D1999 and special auxiliary registers M1000 ~ M1999 in case errors may occur. 2.8.3 Functions and Features of File Registers When the power of PLC is switched on, SA/SX/SC and EH/EH2/SV series MPU will check the following devices: 1. M1101 (whether the file register is enabled) 2. D1101 (No. of file registers in SA/SX/SC series MPU: K0 ~ K1,599; No. of file registers in EH/EH2/SV series MPU: K0 ~ K9,999) 3. D1102 (Number of file registers to be read in SA/SX/SC series MPU: K0 ~ K1,600; number of file registers to be read in EH/EH2/SV series MPU: K0 ~ K8,000) 4. D1103 (devices for storing the data read from file registers; the No. of designated data register D starts from K2,000 ~ K9,999; determining whether to automatically send the content in the file register to the designated data register.) 2-30 DVP-PLC Application Manual
2.9
Note: Among the 6 pairs of interruption No. (I001, I010), (I101, I020), (I201, I030), (I301, I040), (I401, I050), (I501, I060), only 1 No. in the pair is allowed to be used in the program. If you use both No. in the pair and write them into the program, there may be syntax errors occurring.
2-31
External interruption
Pointer
I6, I7, 2 points ( = 1 ~ 99, time base = 1ms) I8, 1 point ( = 1 ~ 99, time base = 0.1ms) I010, I020, I030, I040, I050, I060, 6 points I110, I120, I130, I140, 4 points I150, I160, I170, 3 points
Frequency measurement card I180, 1 point triggered interruption Note: Input point X as a high-speed counter cannot be used as an external interruption signal. For example, if C251 occupies X0, X1, X2 and X3, the external input interruption No. I00(X0), I10(X1), I20(X2), and I30(X3) cannot be used.
Pointer N: Used with MC and MCR instructions. MC is the master control start instruction. When MC instruction is executer, the instructions between MC and MCR will still be executed normally. See Chapter 3 explanations on MC and MCR instructions for more details. Pointer P: Used with API 00 CJ, API 01 CALL and API 02 SRET. See Chapter 6 explanations on CJ, CALL and SRET instructions for more details. CJ Conditional Jump:
X0 0 X1 Y1 X2 P1 N Y2 CJ P** P1
When X0 = On, the program will jump from address 0 to N (designated label P1) and keep on the execution. The addresses in the middle will be ignored. When X0 = Off, the program will execute from address 0 and keep on executing. At this time, CJ instruction will not be executed.
2-32
When X0 = On, CALL instruction will be executed and the program will jump to P2 and executed the designated subroutine. When SRET instruction is executed, the program will return to address 24 and keep on the execution.
Interruption Pointer I: Used with API 04 EI, API 05 DI, API 03 IRET. See Chapter 5.5 for more details. There are 6 types of interruption pointer. To insert an interruption, you have to combine the action with EI (enable interruption), DI (disable interruption), IRET (interruption return) instructions. 1. External interruption: Due to the special hardware design inside the MPU, the input signals coming in at input terminals X0 ~ X5 when rising-edge or falling-edge triggers will not be affected by the scan cycle. The currently executed program will be interrupted immediately and the execution will jump to the designated interruption subroutine pointer I00(X0), I10(X1), I20(X2), I30(X3), I40(X4), I50(X5). Till the execution reaches IRET instruction, the program will return to the original position and keep on its execution. In SA/SX series MPU, X0 (pulse input point) works with X4 (external interruption point), corresponding to C235, C251 and C253 work with I401, which will be able to interrupt and intercept the present value in the high-speed counter. D1181 is the device to store the 32-bit value. X1 (pulse input point) works with X5 (external interruption point), corresponding to C236 works with I501, which will be able to interrupt and intercept the present value in the high-speed counter. D1198 and D1199 are the devices to store the 32-bit value. In SC series MPU, X10 (pulse input point) works with X4 (external interruption point), corresponding to C243 and C255 work with I401, which will be able to interrupt and intercept the present value in the high-speed counter. D1180 and D1181 are the devices to store the 32-bit value. X11 works with X5, corresponding to C245 works with I501, which will be able to interrupt and intercept the present value in the high-speed counter. D1198 and D1199 are the devices to store the 32-bit value. 2. Timed interruption: PLC automatically interrupts the currently executed program every a fixed period of time and jumps to the execution of a designated interruption subroutine. 3. Interruption when the counting reaches the target: The high-speed counter comparison instruction API 53 DHSCS can designates that when the comparison reaches the target, the currently executed program will be interrupted and jump to the designated interruption subrountine executing the interruption pointers I010, I020, I030, I040, I050 and I060. 4. Pulse interruption: The pulse output instruction API 57 PLSY can be set up that the interruption signal is sent out synchronously when the first pulse is sent out by enabling flags M1342 and M1343. The corresponding DVP-PLC Application Manual 2-33
2.10
The types and functions of special auxiliary relays (special M) and special data registers (special D) are listed in the table below. Please be noted that some devices of the same No. may bear different meanings in different series MPUs. Special M and special D marked with * will be further illustrated in the 2.11. Columns marked with R regers to read only, R/W refers to read and write, - refers to the status remains unchanged and # refers to the system will set it up according to the status of the PLC.
ES SA EH Function EX SX EH2 SS SC SV Monitoring normally open contact (A) Monitoring normally closed contact (B) Enabling positive pulses (On when RUN) Enabling negative pulses (Off when RUN) On when syntax errors occur Password of data backup memory card and password of MPU do not match Data backup memory card has not been initialized Data do not exist in the program area of data backup memory card Scanning watchdog timer (WDT) On Insufficient 24V DC supply, LV signal has been occurred.
Special M M1000* M1001* M1002* M1003* M1004* M1005* M1006* M1007* M1008* M1009
Off STOP RUN Attribute Latched Default On Off On Off On Off Off Off Off Off Off RUN STOP On Off On Off Off Off Off On Off On R R R R R R R R R R NO NO NO NO NO NO NO NO NO NO Off On Off On Off Off Off Off Off Off
2-34
M1010
Off
R/W
NO
Off
M1011* M1012* M1013* M1014* M1015* M1016* M1017* M1018 M1019 M1020 M1021 M1022 M1023 M1024 M1025* M1026 M1027
Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off
Off -
NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO
Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off
Off
R/W
NO
Off
M1029*
Off
NO
Off
M1030*
Off
NO
Off
M1031*
Off
R/W
NO
Off
2-35
M1035*
R/W
YES
Off
Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off
Off -
R R/W R R/W R/W R/W R/W R/W R/W R/W R R/W R R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R R
NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO
Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off
M1036*
2-36
Off STOP RUN Attribute Latched Default On Off Off Off Off Off Off Off RUN STOP Off Off Off Off R R R R R R R NO NO NO NO NO NO NO Off Off Off Off Off Off Off
Off
R/W
NO
Off
M1071
Off
R/W
NO
Off
M1072 M1075 M1076* M1077 M1078 M1079 M1080 M1081 M1082 M1083
Off Off Off Off Off Off Off Off Off Off
On -
Off -
NO NO NO NO NO NO NO NO NO NO
Off Off Off Off Off Off Off Off Off Off
Off Off
Off -
NO NO NO NO NO
2-37
Off STOP RUN Attribute Latched Default On Off Off RUN STOP Off Off R R NO NO Off Off
M1089 M1090
M1091
Off
Off
NO
Off
M1092 M1093 M1094 M1095 M1096 M1097 M1098 M1099 M1100 M1101* M1102* M1103* M1104* M1105* M1106* M1107* M1108* M1109* M1110* M1111* M1112* M1113* M1115*
Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off
Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off
R R/W R/W R R/W R/W R/W R/W R/W R/W R/W R/W R R R R R R R R R/W R/W R/W
NO NO NO NO NO NO NO NO NO Yes NO NO NO NO NO NO NO NO NO NO NO NO NO
Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off
2-38
Off STOP RUN Attribute Latched Default On Off Off Off Off RUN STOP Off Off Off Off Off Off Off Off R/W R/W R/W R/W NO NO NO NO Off Off Off Off
Accelerating/decelerating pulse output reaches its target (not available in SC_V1.4 and versions above) Pulse output is decelerating (not available in SC_V1.4 and versions above) Accelerating/decelerating pulse output is completed (not available in SC_V1.4 and versions above) Retaining the communication setting of COM2 (RS-485), modifying D1120 will be invalid when M1120 is set. Waiting for the sending of RS-485 communication data Sending request Receiving is completed Waiting for receiving Communication reset Selecting STX/ETX user defined or system defined Sending/receiving data of communication instruction is completed (RS instruction not included) Sending/receiving... indication Receiving time-out Selectin STX/ETX user defined or system defined On during MODRD/RDST/MODRW data are converted to hex data On when there are no communication related instructions in the program Enabling special high-speed pulse output Y0 (50kHz) SC_V1.4 and versions above: 2-axis synchronous control, enabling Y10 output Special high-speed pulse output Y0 (50kHz)
M1120*
Off
Off
R/W
NO
Off
M1121 M1122 M1123 M1124 M1125 M1126 M1127 M1128 M1129 M1130 M1131 M1132
Off Off Off Off Off Off Off Off Off Off Off Off
On Off Off Off Off Off Off Off Off Off Off -
NO NO NO NO NO NO NO NO NO NO NO NO
Off Off Off Off Off Off Off Off Off Off Off On
M1133*
Off
Off
Off
R/W
NO
Off
M1134*
On: continuous output (Not available in SC_V1.4 and versions above) Special high-speed pulse output Y0 (50kHz) reaches the target number of pulses. SC_V1.4 and versions above: 2-axis synchronous control, enabling Y11 output Retaining the communication setting of COM3 DNET mapping data are retained in STOP status.
Off
Off
R/W
NO
Off
M1135*
Off
Off
Off
R/W
NO
Off
M1136* M1137
Off -
R/W R/W
NO NO
Off Off
2-39
Off STOP RUN Attribute Latched Default On Off RUN STOP R/W NO Off
M1138*
M1139*
R/W R R R
NO NO NO NO
Off
R/W
NO
Off
Off Off Off Off Off Off Off Off Off Off Off Off
Off Off -
NO NO NO NO NO NO NO NO NO NO NO NO
Off Off Off Off Off Off Off Off Off Off Off Off
M1154*
M1156*
Enabling X0 interruption, immediate deceleration and stopping CH0 high-speed output (When M1156 is enabled and M1538 = On, clear M1156 to send the remaining output pulses.) Enabling X1 interruption, immediate deceleration and stopping CH1 high-speed output Enabling X2 interruption, immediate deceleration and stopping CH2 high-speed output
Off
Off
R/W
NO
Off
M1157* M1158*
Off Off
Off Off
R/W R/W
NO NO
Off Off
2-40
M1162
Off
R/W
NO
Off
M1164
Off
R/W
NO
Off
M1165
When On, the program and password on flash will be copied to the PLC when PLC is powered. (Not available in EH) When On, the recipe on flash will be copied to the PLC when PLC is powered. (Not available in EH) 16-bit mode for HKY input Designating work mode of SMOV Selecting PWD modes Enabling single step execution Single step execution Switch for 2-phase pulse output On: switch on On: continuous output The number of output pulses reaches the target Losing PLC parameter data (not available in EH)
R/W
YES
Off
M1166 M1167 M1168 M1169 M1170* M1171* M1172* M1173* M1174* M1175 M1176 M1178* M1179*
Off Off Off Off Off Off Off Off Off Off
Off Off -
Off -
R/W R/W R/W R/W R/W R/W R/W R/W R/W R R R/W R/W
Off Off Off Off Off Off Off Off Off Off Off Off Off
Losing the data in PLC program (not available in EH) Enabling VR0 rotary switch Enabling VR1 rotary switch Enabling X2 interruption (I201) followed by immediately clearing X0 high-speed counting input value.
M1181
PS1: Only supports SA/SX_V1.8 and versions above. PS2: After the high-speed counting value is obtained, the high-speed counting present value will be cleared immediately. Enabling X3 interruption (I301) followed by immediately clearing X1 high-speed counting input value. PS1: Only supports SA/SX_V1.8 and versions above.
Off
Off
R/W
NO
Off
M1182
Off
Off
R/W
NO
Off
2-41
Off STOP RUN Attribute Latched Default On Off Off Off Off Off Off RUN STOP Off R/W R/W R/W R/W R/W R/W NO NO NO NO NO NO Off Off Off Off Off Off
M1189
Off
R/W
NO
Off
M1190 M1191
Off Off
Off Off
R/W R/W
NO NO
Off Off
M1194
Off
Off
R/W
NO
Off
M1195
Off
Off
R/W
NO
Off
Off Off Off Off Off Off Off Off Off Off Off Off Off Off
R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
NO NO NO NO NO NO NO NO NO NO NO NO NO NO
Off Off Off Off Off Off Off Off Off Off Off Off Off Off
2-42
Off STOP RUN Attribute Latched Default On Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off RUN STOP R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off
2-43
Off STOP RUN Attribute Latched Default On Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off RUN STOP R/W R R R R R R R R R R R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off
2-44
ES SA EH Function EX SX EH2 SS SC SV
Off STOP RUN Attribute Latched Default On Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off RUN STOP R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off
M1306
Off
NO
Off
M1308
Off
Off
Off
R/W
NO
Off
M1309
On->Off: Completing remaining numbe of output pulses Immediately disabling Y10 pulse output (for SC_V1.4 and versions above)
Off
Off
Off
R/W
NO
Off
M1310*
Off
Off
R/W
NO
Off
2-45
M1310*
Off
Off
Off
R/W
NO
Off
Off
Off
R/W
NO
Off
On->Off: Completing remaining numbe of output pulses M1312 M1313 M1314 M1315 M1316 M1317 M1320 M1321 M1322 M1323 M1324 M1325 M1328 M1329 M1330 M1331 M1332 M1333 Controlling start input point of C235 Controlling start input point of C236 Controlling start input point of C237 Controlling start input point of C238 Controlling start input point of C239 Controlling start input point of C240 Controlling reset input point of C235 Controlling reset input point of C236 Controlling reset input point of C237 Controlling reset input point of C238 Controlling reset input point of C239 Controlling reset input point of C240 Enabling start/reset of C235 Enabling start/reset of C236 Enabling start/reset of C237 Enabling start/reset of C238 Enabling start/reset of C239 Enabling start/reset of C240 EH/EH2/SV: stopping the 1st group pulse output CH0 (Y0, Y1) SC_V1.4 and versions above: selecting Y10 pulse output stop modes EH/EH2/SV: stopping the 2 CH1 (Y2, Y3)
nd
Off
Off
Off
R/W
NO
Off
Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off
R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO
Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off
M1334*
Off
R/W
NO
Off
M1335*
SC_V1.4 and versions above: selecting Y11 pulse output stop modes Sending out the 1 group pulse output CH0 (Y0, Y1) Sending out the 2nd group pulse output CH1 (Y2, Y3)
st
Off
R/W
NO
Off
M1336 M1337
Off Off
Off Off
Off Off
R R
NO NO
Off Off
2-46
Off STOP RUN Attribute Latched Default On Off Off Off Off Off Off Off Off Off RUN STOP R/W R/W R/W R/W R/W R/W R/W R/W R/W NO NO NO NO NO NO NO NO NO Off Off Off Off Off Off Off Off Off
M1347
Off
R/W
NO
Off
M1348
Off
R/W
NO
Off
NO NO NO NO NO
M1355
Off
R/W
NO
Off
R R R R R
NO NO NO NO NO
2-47
Off STOP RUN Attribute Latched Default On Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off RUN STOP R R R R R R R R R R R R R R R R R R R R R R R R R NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off
Indicating Slave ID#1 data transaction status on PLC LINK Indicating Slave ID#2 data transaction status on PLC LINK Indicating Slave ID#3 data transaction status on PLC LINK Indicating Slave ID#4 data transaction status on PLC LINK Indicating Slave ID#5 data transaction status on PLC LINK Indicating Slave ID#6 data transaction status on PLC LINK Indicating Slave ID#7 data transaction status on PLC LINK Indicating Slave ID#8 data transaction status on PLC LINK Indicating Slave ID#9 data transaction status on PLC LINK Indicating Slave ID#10 data transaction status on PLC LINK Indicating Slave ID#11 data transaction status on PLC LINK Indicating Slave ID#12 data transaction status on PLC LINK Indicating Slave ID#13 data transaction status on PLC LINK Indicating Slave ID#14 data transaction status on PLC LINK
2-48
Off STOP RUN Attribute Latched Default On Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off RUN STOP R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off
M1390* M1391* M1392* M1393* M1394* M1395* M1396* M1397* M1398* M1399* M1400* M1401* M1402* M1403* M1404* M1405* M1406* M1407* M1408* M1409* M1410* M1411* M1412* M1413* M1414* M1415* M1416* M1417* M1418* M1419* M1420* M1421* M1422*
2-49
Off STOP RUN Attribute Latched Default On Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off RUN STOP R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off
2-50
ES SA EH Function EX SX EH2 SS SC SV
Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off
R R R R R R R R R R R R R R R R R R R R R R R R R
NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO
Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off
2-51
Off STOP RUN Attribute Latched Default On Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off RUN STOP R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off Off
2-52
Off STOP RUN Attribute Latched Default On Off Off Off Off Off Off Off Off RUN STOP Off Off R R R R R/W R/W R R NO NO NO NO NO NO NO NO Off Off Off Off Off Off Off Off
EH2/SV: sending out the 3rd group pulse output CH2 (Y4, Y5) (Not available in EH) EH2/SV: sending out the 4th group pulse output CH3 (Y6, Y7) (Not available in EH)
rd EH2/SV: reset after the 3 group pulse output CH2 (Y4, Y5) is completed (Not available in EH)
M1524
SC: reset after Y10 high-speed pulse output is completed EH2/SV: reset after the 4th group pulse output CH3 (Y6, Y7) is completed (Not available in EH) SC: reset after Y11 high-speed pulse output is completed EH2/SV: reversing Y4 pulse output signal for PWM instruction (Not available in EH) EH2/SV: reversing Y6 pulse output signal for PWM instruction (Not available in EH) EH2/SV: switching time base unit of Y4 output for PWM instruction On: 100us; Off: 1ms (Not available in EH) EH2/SV: switching time base unit of Y6 output for PWM instruction On: 100us; Off: 1ms (Not available in EH)
Off
R/W
NO
Off
M1525
Off
R/W
NO
Off
M1526 M1527
Off Off
R/W R/W
NO NO
Off Off
M1530
Off
R/W
NO
Off
M1531
Off
R/W
NO
Off
M1532
rd EH2/SV: reverse operation of the 3 group pulse CH2 (Y4, Y5) for PLSV/DPLSV/DRVI/DDRVI/DRVA /DDRVA instruction (Not available in EH) th EH2/SV: reverse operation of the 4 group pulse CH3 (Y6, Y7) for PLSV/DPLSV/DRVI/DDRVI/DRVA /DDRVA instruction
Off
R/W
NO
Off
M1533
Off
R/W
NO
EH2/SV: CH0 being able to designate deceleration time. Has to be used with D1348. EH2/SV: CH1 being able to designate deceleration time. Has to be used with D1349. EH2/SV: CH2 being able to designate deceleration time. Has to be used with D1350.
NO NO NO
2-53
Off STOP RUN Attribute Latched Default On Off Off Off Off Off RUN STOP Off Off Off Off R/W R/W R/W R/W R/W NO NO NO NO NO Off Off Off Off Off
2-54
Off On 200 # -
STOP
RUN
RUN STOP # # -
EH ES/SA
D1002*
NO
0 0
0 -
R R R
YES NO NO
# 0 0
D1009
YES
0 0 0 0
H0FDB H4049
NO NO NO NO NO NO NO
0 0 0 0 H0FDB H4049 10
10
10
R/W
NO
10
D1022
R/W
NO
R/W
NO
0 0 0 0 0 0 0 0 0
0 0 -
---
NO NO NO NO NO NO NO NO NO
0 0 0 0 0 0 0 0 0
2-55
Off On -
STOP
RUN
RUN STOP -
H86 -
D1038*
R/W
YES
D1039* D1040 D1041 D1042 D1043 D1044 D1045 D1046 D1047 D1049 D1050 D1055 D1056* D1057* D1058* D1059* D1061 D1062
0 0 0 0 0 0 0 0 0 0
R/W R R R R R R R R R
NO NO NO NO NO NO NO NO NO NO
0 0 0 0 0 0 0 0 0 0
NO
Present value at analog input channel CH0 in SX/EX or at CH0 on AD card in EH/EH2 Present value at analog input channel CH1 in SX/EX or at CH1 on AD card in EH/EH2 Present value at analog input channel CH2 in EX Present value at analog input channel CH3 in EX
0 0 0 0 2
R R R R R R/W
NO NO NO NO YES NO
0 0 0 0 0 2
System error message: number of errors recorded in latched area Average times of AD0, AD1 in SX (2 ~ 4 times) PLC reads/writes all programs (and password) and all latched data in the memory card. PLC reads all programs (and password) in the memory card: H55AA
D1063
PLC writes all programs (and password) in the memory card: HAA55 PLC reads all latched data in the memory card: H55A9 PLC writes all latched data in the memory card: HA955
R/W
NO
2-56
D1064
R/W
NO
D1067* D1068*
0 0
0 -
R R
NO NO
0 0
D1070 D1085
NO
D1086
R/W
NO
D1087
R/W
NO
D1089 D1099
NO
0 -
0 0 1,600 2,000
0 H86 0 0 0 0 0
NO NO NO NO NO NO NO
0 H86 0 0 0 0 0
Average value at analog input channel CH0 in SX/EX or at CH0 on AD card in EH/EH2 Average value at analog input channel CH1 in SX/EX or at CH1 on AD card in EH/EH2 Average value at analog input channel CH2 in EX Average value at analog input channel CH3 in EX CH0 of analog output in SX/EX CH0 of DA card in EH/EH2 CH1 of analog output in SX/EX CH1 of DA card in EH/EH2
D1117*
R/W
NO
2-57
Off On 5
STOP
RUN
RUN STOP 0 0 -
R/W R/W R/W R R R/W R/W R/W R/W R/W R R R/W R R/W
NO NO YES NO NO NO NO NO NO NO NO NO NO NO NO
H86 0 0
Interruption request for receiving specific word in RS instruction (I150) Abnormal communication time-out (time: ms) Error code returning from Modbus Low 16 bytes of high-speed counter value extracted by interruption I501
0 0 0 0 100 0 100
D1131*
High 16 bytes of high-speed counter value extracted by interruption I501 D1132* Output/input ratio of CH1 close-loop control (for in EH2/SV) SA/SX: start No. of register D for Y0 special high-speed pulse output (50kHz) SC_V1.4 and versions above: start No. of register D for Y10 2-axis synchronous control output Number of sections in Y10 output for 2-axis synchronous control (available in SC_V1.4 and versions above) SC_V1.4 and versions above: start No. of register D for Y11 2-axis synchronous control output Number of sections in Y11 output for 2-axis synchronous control (available in SC_V1.4 and versions above) Address where incorrect use of operand occurs Number of right-side special extension modules (max. 8) Number of points X in digital extension unit Number of points Y in digital extension unit Start No. of register D for Y0 adjustable acceleration/deceleration pulse output
D1133*
R/W
NO
D1134*
R/W
NO
D1135*
R/W
NO
0 0 0 0 0 0 0
0 -
R/W R R R R R/W R
NO NO NO NO NO NO NO
0 0 0 0 0 0 0
2-58
Off On
STOP
RUN
RUN STOP
NO
NO
0 0 0 0 200
0 0 0 0 -
0 0 0 0 -
R R R R R/W
NO NO NO NO NO
0 0 0 0 200
Suggested deceleration frequency (-1 ~ -32,700Hz) for adjustable acceleration/deceleration pulse output Y0
-1,000
R/W
NO
-1,000
R/W
NO
Switching rising-/falling-edge counting mode of X10 (available in SC_V1.4 and versions above) Switching rising-/falling-edge counting mode of X11 (available in SC_V1.4 and versions above)
0 0 0 0 0 0
0 -
0 -
NO NO NO NO NO NO
0 0 0 0 0 0
Interruption request for receiving specific word in RS instruction (I150) Interruption request for receiving specific word in RS instruction (I160) PC value when executing single step Frequency of 2-phase pulse output (12Hz ~ 20kHz)
2-59
Off On 0 0 0 0 0 0 0
STOP
RUN
RUN STOP -
D1180*
R/W
NO
D1181*
R/W
NO
D1182 D1183 D1184 D1185 D1186 D1187 D1188 D1189 D1190 D1191 D1192 D1193 D1194 D1195 D1196
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2-60
Off On
STOP
RUN
RUN STOP
D1198*
NO
D1199*
NO
R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
YES YES YES YES YES YES YES YES YES YES
D1210*
R/W
YES
D1214*
R/W
YES
D1215* D1216*
R/W R/W
YES YES
# 200
2-61
Off On 0 0 0
STOP
RUN
RUN STOP -
Attribu Latched Default te R/W R/W R/W R/W R/W R/W YES YES YES NO NO NO 999 2,000 # 0 0 0
D1223 D1225 D1226 D1227 D1228 D1229 D1230 D1232* D1233* D1234* D1235* D1236* D1237* D1238* D1239*
Time difference between direction signal and pulse nd output for the 2 group pulse CH1 (Y2, Y3) in DRVI, DDRVI, DRVA, DDRVA, PLSV, DPLSV Counting mode of the counter HHSC0 Counting mode of the counter HHSC1 Counting mode of the counter HHSC2 Counting mode of the counter HHSC3 Phase of the 3rd group pulse output CH2 (Y4, Y5) (available in EH2/SV) Phase of the 4th group pulse output CH3 (Y6, Y7) (available in EH2/SV) Designating number of output pulses for CH0 deceleration and stop (low 16 bits) Designating number of output pulses for CH0 deceleration and stop (high 16 bits) Designating number of output pulses for CH1 deceleration and stop (low 16 bits) Designating number of output pulses for CH1 deceleration and stop (high 16 bits) Designating number of output pusles for CH2 deceleration and stop (low 16 bits) Designating number of output pulses for CH2 deceleration and stop (high 16 bits) Designating number of output pulses for CH3 deceleration and stop (low 16 bits) Designating number of output pulses for CH3 deceleration and stop (high 16 bits) When the RS-485 communication instruction MODRW built-in the PLC is executed, the words of sent out by the instruction will be stored in D1256 ~ D1259. You can check whether the instruction is correct by the contents in these registers.
0 2 2 2 2 0 0 0 0 0 0 0 0 0 0
R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO
0 2 2 2 2 0 0 0 0 0 0 0 0 0 0
NO
The RS-485 communication instruction MODRW built in the PLC automatically converts the ASCII data received in the designated register into hex and store the hex data into D1296 ~ D1311.
NO
2-62
Off On #
STOP
RUN
RUN STOP -
R/W
NO
D1314*
R/W
NO
D1315*
R/W
NO
D1316*
R/W
NO
D1317*
R/W
NO
D1318*
R/W
NO
D1319*
R/W
NO
D1320*
NO
D1321*
NO
D1322*
NO
D1323*
NO
D1324*
NO
D1325*
NO
D1326*
NO
0 0 0 0 0 0 0
NO NO NO NO NO NO NO
0 0 0 0 0 0 0
2-63
Off On 0 0
STOP
RUN
RUN STOP -
R R
NO NO
0 0
D1336
YES
YES
(EH2/SV are latached above EH_V1.2) D1338 Low word of the present value of the 2 pulses CH1 (Y2, Y3)
nd
group
YES
(EH2/SV are latached above EH_V1.2) D1339 High word of the present value of the 2 pulses CH1 (Y2, Y3)
nd
group
YES
(EH_V1.2 and versions above are latached) EH/EH2/SV: start/end frequency of the 1st group pulse output CH0 (Y0, Y1) SC: start/end frequency of Y10 output D1341 D1342 Low word of max. output frequency High word of max. output frequency Fixed as 200kHz
YES R/W NO R R YES YES YES R/W NO R/W R/W R/W R/W R R/W R R/W R R/W YES YES YES YES NO YES NO YES NO YES 200 0 0 0 0 0 100 0 100 0 100 H04D0 3 100 200
D1340
200 -
D1343*
EH: acceleration/deceleration time for the 1st group pulse output CH0 (Y0, Y1) SC: acceleration/deceleration time of Y10 output
200
Low word of the number of compensation pulses of the 1st group pulses CH0 (Y0, Y1) High word of the number of compensation pulses of the 1st group pulses CH0 (Y0, Y1) Low word of the number of compensation pulses of the 2nd group pulses CH1 (Y2, Y3) High word of the number of compensation pulses of the 2nd group pulses CH1 (Y2, Y3) SC: low word of present value of Y10 pulse output
0 0 0 -
D1348
EH2/SV: CH0 pulse output. When M1534 = On, it refers to the deceleration time SC: high word of present value of Y10 pulse output
D1349
EH2/SV: CH1 pulse output. When M1535 = On, it refers to the deceleration time SC: low word of present value of Y11 pulse output
D1350
EH2/SV: CH2 pulse output. When M1536 = On, it refers to the deceleration time
2-64
Off On 0 200
STOP
RUN
RUN STOP -
group
200
R/W YES NO
200
SC: acceleration/deceleration time of Y11 output D1353* EH/EH2/SV: acceleration/deceleration time of the 2nd group pulse output CH1 (Y2, Y3) Starting reference for Master to read from Salve ID#1 Starting reference for Master to read from Salve ID#2 Starting reference for Master to read from Salve ID#3 Starting reference for Master to read from Salve ID#4 Starting reference for Master to read from Salve ID#5 Starting reference for Master to read from Salve ID#6 Starting reference for Master to read from Salve ID#7 Starting reference for Master to read from Salve ID#8 Starting reference for Master to read from Salve ID#9 Starting reference for Master to read from Salve ID#10 Starting reference for Master to read from Salve ID#11 Starting reference for Master to read from Salve ID#12 Starting reference for Master to read from Salve ID#13 Starting reference for Master to read from Salve ID#14 Starting reference for Master to read from Salve ID#15 Starting reference for Master to read from Salve ID#16
200 100 H1064 H1064 H1064 H1064 H1064 H1064 H1064 H1064 H1064 H1064 H1064 H1064 H1064 H1064 H1064 H1064
R/W YES
D1355* D1356* D1357* D1358* D1359* D1360* D1361* D1362* D1363* D1364* D1365* D1366* D1367* D1368* D1369* D1370*
R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES
2-65
Off On 1 1 1
STOP
RUN
RUN STOP -
D1374
R/W
NO
0 0 0 0
D1379
st Start frequency of the 1 section and end frequency of the last section for the 3rd group pulse output CH2 (Y4, Y5) (available in EH2/SV) st Start frequency of the 1 section and end frequency of the last section for the 4th group pulse output CH3 (Y6, Y7) (available in EH2/SV)
R/W
YES
200
D1380
R/W
YES
200
D1381 D1382
Acceleration/deceleration time for the 3rd pulse output CH2 (Y4, Y5) (available in EH2/SV) Acceleration/deceleration time for the 4th pulse output CH3 (Y6, Y7) (available in EH2/SV)
R/W R/W
YES YES
100 100
D1383*
Setting up the time difference between direction signal and pulse output point for the 1st set of pulses CH2 (Y4, Y5) for DRVI, DDRVI, DRVA, DDRVA, PLSV, DPLSV instructions. (for EH2/SV) Setting up the time difference between direction signal and pulse output point for the 1st set of pulses CH3 (Y6, Y7) for DRVI, DDRVI, DRVA, DDRVA, PLSV, DPLSV instructions. (for EH2/SV) ID of the 1st left-side extension module (available in SV) ID of the 2nd left-side extension module (available in SV) ID of the 3rd left-side extension module (available in SV) ID of the 4th left-side extension module (available in SV) ID of the 5th left-side extension module (available in SV)
R/W
NO
D1384*
R/W
NO
D1386*
NO
D1387*
NO
D1388*
NO
D1389*
NO
D1390*
NO
2-66
Off On 0
STOP
RUN
RUN STOP -
NO
D1392*
NO
D1393* D1399* D1415* D1416* D1417* D1418* D1419* D1420* D1421* D1422* D1423* D1424* D1425* D1426* D1427* D1428* D1429* D1430* D1431* D1432* D1433* D1434* D1435* D1436* D1437* D1438* D1439* D1440* D1441* D1442*
0 0 0 0 -
R R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
NO YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES NO NO NO YES YES YES YES YES YES YES YES YES
0 1 H10C8 H10C8 H10C8 H10C8 H10C8 H10C8 H10C8 H10C8 H10C8 H10C8 H10C8 H10C8 H10C8 H10C8 H10C8 H10C8 0 0 0 16 16 16 16 16 16 16 16 16
2-67
Off On -
STOP
RUN
RUN STOP -
Attribu Latched Default te R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R R R R R R R YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 2,000 0 2,000 0 1,000 0 1,000
Number of pulses required per revolution of motor at CH0 (low word) Number of pulses required per revolution of motor at CH0 (high word) Number of pulses required per revolution of motor at CH1 (low word) Number of pulses required per revolution of motor at CH1 (high word) Distance created for 1 revolution of motor at CH0 (low word) Distance created for 1 revolution of motor at CH0 (high word) Distance created for 1 revolution of motor at CH1 (low word)
2-68
Off On 100
STOP
RUN
RUN STOP -
R R R R R R/W
0 0 0 0 0 100
D1479
100
R/W
NO
100
D1480* D1495*
YES
D1496* D1511*
Data buffer to store the data written on Slave ID#1 when M1353 = Off. When M1353 = On, the starting D register No. to store data written on ID#1~16 by Master (available in EH/EH2/SV). Data buffer to store the data read from Slave ID#2 when M1353 = Off. When M1353 = On, the starting D register No. to store data read from ID#17~32 by Master (available in EH/EH2/SV). Data buffer to store the data written on Slave ID#2 when M1353 = Off. When M1353 = On, the starting D register No. to store data written on ID#17~32 by Master (available in EH/EH2/SV). Data buffer to store the data read from Slave ID#3 when M1353 = Off. When M1353 = On, the length of data read from ID#17~32 by Master (available in EH/EH2/SV). Data buffer to store the data written on Slave ID#2 when M1353 = Off. When M1353 = On, the length of data written on ID#17~32 by Master (available in EH/EH2/SV). Data buffer to store the data read from Slave ID#4 when M1353 = Off. When M1353=On, the starting D register No. to store data read from ID#17~32 by EH Master (available in EH/EH2/SV).
R/W
YES
D1512* D1527*
YES
D1528* D1543*
R/W
YES
YES
R/W
YES
D1576* D1591*
YES
2-69
Off On
STOP
RUN
RUN STOP
Data buffer to store the data to be written on Slave ID#4 when M1353 = Off. When M1353=On, the starting D register No. to store data to be written on ID#17~32 by EH Master (available in EH/EH2/SV).
R/W
YES
YES
R/W
YES
YES
R/W
YES
YES
R/W
YES
YES
R/W
YES
YES
R/W
YES
YES
R/W
YES
2-70
Off On
STOP
RUN
RUN STOP
YES
R/W
YES
YES
R/W
YES
YES
R/W
YES
YES
R/W
YES
YES
R/W
YES
YES
R/W
YES
0 0
R/W R/W
NO NO
0 0
2-71
Off On 0 0 0
STOP
RUN
RUN STOP -
NO NO NO
0 0 0
2-72
M1000 (A contact) is constantly On during operation and detection. When PLC is in RUN status, M1000 remains On.
M1000 Y0 Normally On contact in PLC RUN PLC is running Keeps being On
M1001: M1001 (B contact) is constantly On during operation and detection. When PLC is in RUN status, M1001 remains On. M1002: M1002 is On during the first scan when PLC starts to RUN and remains Off afterward. The pulse width = 1 scan time. Use this contact for all kinds of initial settings. M1003: M1003 is Off during the first scan when PLC starts to RUN and remains On afterward. M1003 enables negative-direction (Off immediately when RUN) pulses.
PLC RUN M1000 M1001 M1002 M1003 scan time
Monitor timer is used for moitoring PLC scan time. When the scan time exceeds the set time in the moitor timer, the red ERROR LED indicator remains beaconing and all outputs will be Off.
2.
The initial set value of the time in the monitor timer is 200ms. If the program is long or the operation is too complicated, MOV instruction can be used for changing the set value. See the example below for SV = 300ms.
2-73
3.
The maximum set value in the monitor timer is 32,767ms. Please be noted that if the SV is too big, the timing of detecting operational errors will be delayed. Therefore, it is suggested that you remain the scan time of shorter than 200ms.
4.
Complicated instruction operations or too many extension modules being connected to the MPU will result in the scan time being too long. Check D1010 ~ D1012 to see if the scan time exceeds the SV in D1000. In this case, besides modifying the SV in D1000, you can also add WDT instruction (API 07) into the PLC program. When the CPU execution progresses to WDT instruction, the internal monitor timer will be cleared as 0 and the scan time will not exceed the set value in the monitor timer. Program Capacity D1002
Contents: The program capacity differs in different series of MPUs. 1. 2. 3. ES/EX/SS series MPU: 3,792 Steps SA/SX/SC series MPU: 7,920 Steps EH/EH2/SV series MPU: 15,872 Steps Syntax Check M1004, D1004, D1137
When errors occur in syntax check, ERROR LED indicator will flash and special relay M1004 = On. Timings for PLC syntax check: a) When the power goes from Off to On. b) c) When the program is written into PLC. When on-line editing is being conducted.
3.
The syntax check may start due to illegal use of instruction operands (devices) or incorrect program syntax loop. The error can be detected by the error code in D1004 and error table. The address where the error exists will be stored in D1137. (The address value in D1137 will be invalid if the error is a general loop error.)
4.
2-74
M1008 = On: Scan time-out occurs during the execution of the program, and PLC ERROR LED indicator remains beaconing.
2.
Users can use WPLSoft or HPP to monitor the content (STEP address when WDT timer is On). Checking Lost PLC SRAM Data D1009, M1175, M1176
1. bit0 ~ bit7 record the types of data lost. bit = 1 refers to losing data; bit = 0 refers to correct data. 2. What are lost
bit8 ~ 15 Reserved bit 7 PLC program bit 6 D register bit 5 T register bit 4 C register bit 3 File register bit 2 M relay bit 1 S step bit 0 password
3. After the PLC is powered, the data in SRAM will be verified. If the SRAM data are lost, the PLC will record the error in D1009 and set on M1175 or M1176 according to the content of the data. Scan Time Monitor D1010 ~ D1012
The present value, minimum value and maximum value of scan time are stored in D1010 ~ D1012. 1. D1010: Present scan time value 2. D1011: Minimum scan time value 3. D1012: Maximum scan time value
2-75
2.
The clock pulses also start when PLC is in STOP status. The activation timing of clock pulses and that of RUN will not happen synchronously. High-Speed Timer M1015, D1015
The steps for using special M and special D directly: a) b) c) High-speed counter is valid only when PLC is in RUN status for EH/EH2/SV, but is valid when PLC is in RUN or STOP stauts for SA/SX/SC. M1015 = On: High-speed counter D1015 is enabled only whtn PLC scans to END instruction. (Min. timing unit of D1015: 100us) Timing range of D1015: 0~32,767. When the timing reaches 32,767, the next timing restarts from 0. d) M1015 = Off: D1015 stops timing immediately.
2. 3.
EH/EH2/SV series MPU offers high-speed timer instruction HST. See API 196 HST for more details. Example: a) When X10 = On, M1015 will be On. The high-speed timer will start to time and record the present value in D1015. b) When X10 = Off, M1015 will be Off. The high-speed timer will be disabled.
X10 M1015
2-76
M1017 M1076 M1082 D1313 D1314 D1315 D1316 D1317 D1318 D1319 2.
Flag change on RTC On: Modification on RTC Second Minute Hour Day Month Week Year 0 ~ 59 0 ~ 59 0 ~ 23 1 ~ 31 1 ~ 12 1~7 0 ~ 99 (last 2 digits of Year in A.D.)
If the set value in RTC is incorrect, the time will be recovered as Saturday, 00:00 Jan. 1, 2000 when PLC is powered and restarted.
3. 4.
D1313 ~ D1319 will immediately update the RTC only when in TRD instruction or WPLSoft monitoring mode. How to make corrections on RTC: a) Use TWR instruction fir SA/SX/SX/EH/EH2/SV series MPU. See API 167 TWR for more details. b) Use WPLSoft or digital display panel DU-01.
D1018 and D1019 are combined as 32-bit data register for storing the floating point value of(PI) loating point value = H 40490FDB Adjustment on Input Terminal Response Time D1020, D1021
D1020 can be used for setting up the response time of receiving pulses at X0 ~X7 for SS/ES/EX/SA/SX/SC series MPU. (Setup range: 0 ~ 20; Unit: ms)
2.
D1021 can be used for setting up the response time of receiving pulses at X10 ~X17 for ES series MPU. (Setup range: 0 ~ 20; Unit: ms)
2-77
7.
If the following programs are executed during the program, the response time of X0 ~ X7 will be set to 0ms. The fastest response time of input terminals is 50s due to that all terminals are connected with RC filter loop.
M1000 MOV normally ON contact K0 D1020
8.
There is no need to make adjustment on response time when using high-speed counters and interruptions during the program.
9.
Using API 51 REFF instruction has the same effect as modifying D1020 and D1021. Execution Completed Flag M1029, M1030, M1036, M1037, M1102, M1103
Using execution completed flag: 1. API 52 MTR, API 71 HKY, API 72 DSW, API 74 SEGL, API 77 PR: M1029 = On whenever the instruction completes one scan period. 2. API 57 PLSY, API 59 PLSR: a) M1029 will be On after Y0 pulse output of SA/SX/SC/ES/EX/SS is completed. M1030 will be On after Y1 pulse output is compeleted. When PLSY and PLSR instruction is Off, M1029 and M1030 turn Off. You have to reset M1029 and M1030 after the action is completed. b) M1029 will be On after Y0 and Y1 pulse output of EH/EH2/SV is completed. M1030 will be On after Y2 and Y3 pulse output is compeleted. M1036 will be On after Y4 and Y5 pulse output of EH2/SV is completed. M1037 will be On after Y6 and Y7 pulse output is completed.When PLSY and PLSR instruction is Off, M1029, M1030, M1036 and M1037 turn Off. When the instruction is re-executed for the 2-78 DVP-PLC Application Manual
API 155 DABSR, API 156 ZRN, API 158 DRVI, API 159 DRVA for EH/EH2/SV series MPU: a) b) c) M1029 = On when the 1st output group Y0 and Y1 is completed. M1030 = On when the 2nd output group Y2 and Y3 is completed. M1036 = On when the 3rd output group Y4 and Y5 of EH2/SV is completed. M1037 = On when the 4th output group Y6 and Y7 is completed. When the instruction is re-executed for the next time, M1029 or M1030 will turn Off and On again when the execution is completed.
6.
In API 57 PLSY, API 156 DZRN, API 158 DDRVI and API 159 DDRVA for SC series MPU: M1102 will be set On when Y10 pulse output is completed. M1103 will be set On when Y11 pulse output is completed. After PLSY instruction is disabled,M1102 and M1103 will be set Off. In DDRVA, DDRVI and DZRN, M1102 and M1103 will be set Off when next time these instructions are enabled.
When HPP, PC or HMI is connected to the PLC and the PLC receives illegal communication request during the transmission of data, M1025 will be On and the error code will be written in D1025. See the error codes below. 01: Illegal instruction code 02: Illegal device address 03: Requested data exceed the range 07: Checksum error Clear Instruction M1031, M1032
M1031 (clearing non-latched area) , M1032 (clearing latched area) Device No. Cleared Device Contact status of Y, general-purpose M and general-purpose S M1031 General-purpose contact and timing coil of T General-purpose contact, counting coil reset coil of C General-purpose present value register of D
2-79
When M1033 = On and PLC goes from RUN to STOP, the On/Off status of output will be ratained. Assume the output contact load of the PLC is a heater, when PLC switches from RUN to STOP, the status of the heater will be retained. After the PLC program is modified, the PLC will RUN again. All Output Y Inhibited M1034
When M1035 = On, EH/EH2/SV series MPU will determine the content (K0 ~ K15) in D1035 to enable input points X0 ~ X17 as the RUN/STOP switch.
2.
When M1035 = On, SA/SX/SC series MPU will enable the input point X7 (in SA), X3 (in SX) and X5 (in SC) as the RUN/STOP switch. Detecting Speed of X0 ~ X5 M1036
1. For SC_V1.4 and versions above, SPD can detect the speed of X0 ~ X5 at the same time. The total bandwidth is 40kHz. 2. Program example: 2-80 DVP-PLC Application Manual
SPD
X1
K1000
D0
3. Parameter D0 when X7 = On Start No. of D0 + index value +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 Functions Low 16 bits of the 32-bit speed detected at input point X0. High 16 bits of the 32-bit speed detected at input point X0. Low 16 bits of the 32-bit speed detected at input point X1. High 16 bits of the 32-bit speed detected at input point X1. Low 16 bits of the 32-bit speed detected at input point X2. High 16 bits of the 32-bit speed detected at input point X2. Low 16 bits of the 32-bit speed detected at input point X3. High 16 bits of the 32-bit speed detected at input point X3. Low 16 bits of the 32-bit speed detected at input point X4. High 16 bits of the 32-bit speed detected at input point X4. Low 16 bits of the 32-bit speed detected at input point X5. High 16 bits of the 32-bit speed detected at input point X5. Remaining time for speed detection (unit: ms)
When M1084 = On, X0 of ES/EX/SS_V6.4/SA/SX_V1.6/SC_V1.4 can detect pulse width. Whenever X0 turns from On to Off, the value is updated once and stored in D1023 (unit: 0.1ms). The minimum detectable width is 0.1ms and maximum 1,000ms. Communication Port Function M1120, M1136, M1138, M1139, M1143, D1036, D1109, D1120
1. Supports ES/EX/SS_V6.0/SA/SX_V1.2/SC_V1.0/EH_V1.1/SV_V1.0 and versions above. 2. COM ports (COM1: RS-232; COM2: RS-485) in SA/SX/SC series MPU and COM ports (COM1: RS-232; COM2: RS-232/RS-485/RS-422) in EH/EH2 series MPU support Modbus ASCII/RTU communication format with speed of up to 115,200bps. COM1 and COM2 can be used at the same time. COM3: RS-232/RS-485 in EH/EH2 series MPU supports Modbus ASCII communication format with speed of up to 38,400bps. COM1: For slave stations only. Supports ASCII/RTU communication format, adjustable baud rate with speed of up to 115,200bps, and modification on data length (data bits, parity bits, stop bits).
2-81
0 b0 = 0:7 b2, b1 = 00 : b2, b1 = 01 : b2, b1 = 11 : b3 = 0:1 bit (H1) (H2) (H3) (H4) (H5) (H6) (H7) (H8) (H9) : : : : : : : : : 110 150 300 600 1,200 2,400 4,800 9,600 19,200 38,400 57,600 115,200 b8 = 0:None b9 = 0:None b10 = 0:None
1 b0 = 1:8 None Odd Even b3 = 1:2 bit bps bps bps bps bps bps bps bps bps bps bps bps b8 = 1:D1124 b9 = 1:D1125 b10 = 1:D1126
Notes: 1. If COM2 is to be used as a Slave terminal, make sure there is no communication instruction existing in the program. 2. After the communication format is modified, the format will stay intact when PLC switches from RUN to STOP. 3. If you shut down the power of the PLC and repower it again, the modified communication format will return to default setting. Example 2: Modifying the communication format of COM1 1. Add the program code below on top of the program to modify the communication format of COM1. When PLC switches from STOP to TUN, the program will detect whether M1138 is On in the first scan time. If M1138 is On, the program will modify the relevant settings of COM1 according to the value set in D1036. 2. Modify the communication format of COM1 into ASCII mode, 115,200bps, 7 data bits, even parity, 1 stop bit (115,200, 7, E, 1)
M1002 MOV SET H86 M1138 D1036
Notes: 1. 2. After the communication format is modified, the format will stay intact when PLC switches from RUN to STOP. If you shut down the power of the PLC and repower it again, the modified communication format will return to default setting. Example 3: Modifying the communication format of COM3 1. The communication format of COM3 is fixed as 7 data bits, even parity, 1 stop bit. Add the program code below on top of the program to modify the baud rate of COM3 into 38,400bps. When PLC switches from STOP to TUN, DVP-PLC Application Manual 2-83
Notes: 1. 2. After the communication format is modified, the format will stay intact when PLC switches from RUN to STOP. If you shut down the power of the PLC and repower it again, the modified communication format will return to default setting. Example 4: Setting up RTU mode of COM1 and COM2 1. COM1 and COM2 support ASCII/RTU mode. COM1 is set by M1139 and COM2 is set by M1143. When the flags are On, they are in RTU mode; when the flags are Off, they are in ASCII mode. 2. How to set up RTU mode COM1: (9,600, 8, E, 1, RTU)
M1002 MOV SET SET H86 M1138 M1139 D1036
3. COM2 of EH/EH2/SV series MPU supports the generation of interruption I170 when the data receiving is completed in Slave mode. 4. Normally when the communication terminal of the PLC is in Slave mode, PLC will not immediately process the communication data entered but process it after the END is executed. Therefore, when the scan time is very long and you need the communication data to be processed immediately, you can use interruption I170 for this matter. 5. Example of interruption I170 (after the data receiving is completed in Slave mode) 2-84 DVP-PLC Application Manual
With I170 in the program, when COM2 is in Slave mode and there are communication data coming in, PLC will process the data and respond immediately. Notes: 1. DO NOT updat program on-line when using I170. 2. The scan time of PLC will be slightly longer. Function Group Number Contents: 1. When PLC is used as slave station, in RS-485 communication interface, users can set up communication response delay time ranging from 0 to 10,000 (0 ~ 1 second). If the time is without the range, D1038 = O (time unit: 0.1ms). The set value of time must be less than that in D1000(scan time-out timer WDT). 2. In PLC LINK, you can set up delayed transmission of the next communication data (unit: 1 scan period for SA/SX/SC; 0.1ms for EH/EH2/SV). Fixed Scan Time M1039, D1039 Communication Response Delay D1038
When M1039 = On, the scan time of program is determined by the content in D1039. When the execution of the program is completed, the next scan will take place when the fixed scan time is reached. If the content in D1039 is less than the actual scan time of the program, the scan time will follow the actual scan time of the program.
M1000 M1039 Normally On contact MOV P Fixed scan time K20 D1039
2.
Instructions related to scan time, RAMP (API 67), HKY (API 71), SEGL (API 74), ARWS (API 75) and PR (API 77) should be used together with fixed scan time or constant interruption.
2-85
Resolution of analog input channel: 10 bits for EX, corresponding to 0 ~ 10 V (-512 ~ +511) or 0 ~ 20 mA (-512 ~ +511); 12 bits for SX, corresponding to 0 ~ 10 V (-2,000 ~ +2,000) or 0 ~ 20 mA (-1,000 ~ +1,000).
2.
Resolution of analog output channel: 8 bits for EX, corresponding to 0 ~ 10 V (0 ~ 255) or 0 ~ 20 mA (0 ~ 255); 12 bits for SX, corresponding to 0 ~ 10 V (-2,000 ~ +2,000) or 0 ~ 20 mA (-2,000 ~ +2,000).
3. 4.
Sampling time of analog/digital conversion. Default setting = 5; unit: ms. If D1118 5, it will be regarded as 5ms. Resolution of EH/EH2 analog input AD card (DVP-F2AD): 12 bits 0 ~ 10 V (0 ~ +4,000) or 11 bits 0 ~ 20 mA (0~+2,000)
5.
Resolution of EH/EH2 analog input DA card (DVP-F2DA): 12 bits 0 ~ 10 V (0 ~ +4,000) or 0 ~ 20 mA (0 ~ +4,000) Device No. D1056 D1057 D1058 D1059 D1062 D1110 D1111 D1112 D1113 D1116 D1117 D1118 Function Present value of EX/SX analog input channel CH0 and EH/EH2 AD card channel CH0 Present value of EX/SX analog input channel CH1 and EH/EH2 AD card channel CH1 Present value of EX analog input channel CH 2 Present value of EX analog input channel CH 3 Average times (2 ~ 4) of SX AD0 and AD1 Average value of EX/SX analog input channel CH0 and EH/EH2 AD card channel CH0 Average value of EX/SX analog input channel CH1 and EH/EH2 AD card channel CH1 Average value of EX analog input channel CH2 Average value of EX analog input channel CH3 EX/SX analog output channel CH0 and EH/EH2 DA card channel CH0 EX/SX analog output channel CH1 and EH/EH2 DA card channel CH1 Sampling time (ms) of EX/SX/EH/EH2 analog/digital conversion
Operational error flag: Device M1067 M1068 Description Operational error flag Operational error locked flag Latched None None STOP RUN Cleared Latched RUN STOP Latched Latched
2-86
Error code explanation: D1067 error code H 0E18 H 0E19 H 0E1A H 0E1B H 0E1C BCD conversion error Divisor is 0 Use of device exceeds the range (including E, F index register modification) Square root value is negative FROM/TO instruction communication error Cause
When PLC detects LV (Low Voltage) signal, it will check if M1087 is On or not. If M1087 is On, the content in D1100 will be stored in Y0 ~ Y17.
2.
bit0 (LSB) of D1100 corresponds to Y0, bit1 corresponds to Y1, bit8 corresponds to Y10 and so on. File Register M1101, D1101 ~ D1103
When the power of PLC turns from Off to On, PLC determines whether to automatically send the content in the file register to the assigned data register by checking M1101, D1101 ~ D1103 (for SA/SX/SC/EH/EH2/SV). M1101: D1101: D1102: D1103: Whether to automatically downland data from file register Start No. of file register K0 ~ K1,599 (for SA/SX/SC) Start No. of file register K0 ~ K9,999 (for EH/EH2/SV) Number of data read from file register K0 ~ K1,600 (for SA/SX/SC) Number of data read from file register K0 ~ K8,000 (for EH/EH2/SV) Location for storing data read from file register Start No. of assigned data register D K2,000 ~ K4,999 (for SA/SX/SC) Start No. of assigned data register D K2,000 ~ K9,999 (for EH/EH2/SV)
2.
See API 148 MEMR and API 149 MEMW for more details. DIP Switch Function Card M1104 ~ M1111
When PLC is in RUN status with digital switch function card inserted, the 8 DIP switches amd their status orrespond respectively to M1104 ~ M1111.
2.
When PLC is in RUN status with 2DO function card inserted, M1112 and M1113 will correspond respectively to 2 transistors output points, AY0 and AY1. Pulse Output With Speed Acceleration/Deceleration M1115 ~ M1119, D1104
Special D and special M for acceleration/ deceleration of speed pulse output for ES/EX/SS/SA/SX/SC (not applicable to SC_V1.4 and versions above): Device No. M1115 M1116 M1117 M1118 M1119 D1104 Activation switch Accelerating flag Target frequency reached flag Decelerating flag Function completed flag Start No. of control register (D) Function
2.
Parameters for D1104 (frequency range: 25Hz ~ 10kHz) Index +0 +1 +2 +3 +4 +5 Start frequency (SF) Gap frequency (GF) Target frequency (TF) The lower 16 bits of the 32 bits for the total number of output pulses The higher 16 bits of the 32 bits for the total number of output pulses The lower 16 bits of the 32 bits for the total number of output pulses in accelerating/decelerating section The higher 16 bits of the 32 bits for the total number of output pulses in accelerating/decelerating section (AP) (TP) Function
+6 3.
No instruction is needed, users need only to fill out the parameter table and enable M1115 (in RUN mode). This functio only supports Y0 output and the timing chart is as below.
2-88
Number of accel/decel sections = (TF-SF)/GF GF Frequency GP TF Number of output pulses in every section: GP = AP/Number of accel/decel sections
4.
Note: this function is applicable only when all the conditions below are met. a) Start frequency < target frequency. b) Gap frequency (target frequency start frequency) c) Total number of pulses > (accel/decel number of pulses 2) d) For start frequency and target frequency: Min. 25Hz; Max. 10kHz e) Number of accel/decel pulses > number of accel/decel sections
When M1115 turns from On to Off, M1119 will be reset and M1116, M1117 and M1118 remain unchanged. When PLC goes from STOP to RUN, M1115 ~ M1119 will be reset as Off. D1104 will only be cleared as 0 when it turns from Off to On. Either accel/decel pulse output function or PLSY Y0 output can be executed at a time when PLC is operating. 5. How to calculate the action time of each section Assume the start frequency is set as 1kHz, gap frequency as 1kHz, target frequency as 5kHz, total number of pulses as 100 and number of acceleration pulses as 40, the timing diagram of the acceleration sections is as the figure below.
Frequency (Hz)
From the conditions above, we can obtain the number of acceleration/deceleration sections is (5K 1K)/1K = 4 and the number of output pulses in each section is 40/4 = 10. Therefore, in the diagram, t1 = (1/1K) 10 = 10ms, t2 = (1/2K) 10 = 5ms, t3 = (1/3K) 10 = 3.33ms, t4 = (1/4K) 10 = 2.5ms. 6. Program example: Forward/reverse acceleration/deceleration step motor control
2-89
a) When PLC is in RUN status, store all parameter settings into the registers designated in D1104. b) When M1115 = On, the acceleration/deceleration pulse output will start. c) M1116 = On in the acceleration process. When the speed reaches its target, M1117 will be On. M1118 = On in the deceleration process. When the speed reaches its target, M1119 will be On. d) M1115 will not be reset automatically. You have to check the conditions during the process and reset it. e) Pulse output curves:
Frequency (Hz) 10K
1K 10,000
Frequency (Hz) 10K
70,000
80,000
Number of pulses
Time (ms)
Special D and special M for special high-speed pulse Y0 (50kHz)for SA/SX/SC (not applicable to SC_V1.4 and versions above):
2-90
Parameters for D1133: Index +0 +1 +2 +3 +4 +5 Function The lower 16 bits of the 32 bits for output frequency of special high-speed pulse Y0 The higher 16 bits of the 32 bits for output frequency of special high-speed pulse Y0 The lower 16 bits of the 32 bits for number of output pulses of special high-speed pulse Y0 The higher 16 bits of the 32 bits for number of output pulses of special high-speed pulse Y0 The lower 16 bits of the 32 bits of the present number of special high-speed pulses Y0 The higher 16 bits of the 32 bits of the present number of special high-speed pulses Y0
3.
The function: All output frequency and number of pulses stated in the table above can be modified when M1133 = On and M1135 = On. The modification will not affect the present output pulses. The present number of output pulses is updated in every scan time. When M1133 turns from Off to on, the number will be cleared as 0. When 1133 turns from On to Off, the last numner of output pulses will be shown.
Note: The special high-speed pulse output function can only be used on specific Y0 output point when PLC is in RUN status. It can coexist with PLSY (Y0) in the program and PLSY (Y1) will not be affected. If PLSY (Y0) instruction is executed prior to this function, the function cannot be used and vice versa. When the function is executed, the general function, general Y0 output will be invalid but Y1 ~ Y7 can be used. The output frequency of this function is higher (max. 50kHz) than that of PLSY instruction. 2-axis Synchronous Control (PH) M1133, M1135, D1133 ~ D1136
Special D and special M for 2-axis synchronous drawing oblique and arc for SC_V1.4 and versions above: Device No. M1133 M1135 D1133 D1134 D1135 D1136 Function Start flag for Y10 output for two-axis synchronous control Start flag for Y11 output for two-axis synchronous control Start No. of control register (D) for Y10 output for two-axis synchronous control Number of sections for Y10 output for two-axis synchronous control Start No. of control register (D) for Y11 output for two-axis synchronous control Number of sections for Y11 output for two-axis synchronous control
2-91
Function Y10, Y11 2-axis synchronous control; output frequency of 1st section = low 16 bits of 32 bits Y10, Y11 2-axis synchronous control; output frequency of 1st section = high 16 bits of 32 bits Y10, Y11 2-axis synchronous control; output pulse number of 1st section = low 16 bits of 32 bits Y10, Y11 2-axis synchronous control; output pulse number of 1st section = high 16 bits of 32 bits
b)
Note: The frequency and number of output pulses are all in 32-bit. Thus, the 3 sections will continuously occupy 12 D devices (3 2 2 = 12). 4. Note: a) b) c) d) e) f) g) 5. Make sure that the output frequency and the number of pulses have been set before using this function. The output frequency and the number of pulses cannot be modified during the execution of the function. When PLC program scans to END instruction, it will auto-check whether this function needs to be enabled. When M1133 and M1135 are set in the same scan period, the two axes will output pulses synchronously. When the output frequency < 100Hz, the output will be executed in 100Hz. When the output frequency > 100kHz, the output will be executed by 100kHz. Only device D (D0 ~ D999 and D2000 ~ D4999) can be used for this function. DO NOT use other devices or exceed the range of device D. The maximum number of segments for this function is 50. When the number of segments < 1 or > 50, this function will be disabled. After this function is enabled, M1102 = On indicates Y10 output is completed and M1103 = On indicates Y11 output is completed. Examples: a) Draw oblique lines in 2 axes Destination: Draw 2 oblique lines (as figure 1) Program explanation: Y0 and Y10 belong to X axis, and Y1 and Y11 belong to Y axis (as figure 2) Output frequency and number of pulses: see table 1
2-92
(5,000, 4,000)
(1,000, 3,000)
(Figure 1)
M1002 MOV MOV MOV MOV M0 Y0 M1133 Y1 M1135 K200 K2 K300 K2 D1133 D1134 D1135 D1136
(Figure 2)
Axis X
Section 1 2 1 2
b)
Draw an arc in 2 axes Destination: Draw a 90 arc (see Figure 3) Program explanation: Same as the the example of draw oblique lines, except that D1134 and D1136 are modified as K10 (output 10 sections) Output frequency and number of pulses: see table 2
2-93
(0,0)
X
10 sections
(Figure 3)
Axis
Section 1 2 3 4
Device D D201, D200 D205, D204 D209, D208 D213, D212 D217, D216 D221, D220 D225, D224 D229, D228 D233, D232 D237, D236 D301, D300 D305, D304 D309, D308 D313, D312 D317, D316 D321, D320 D325, D324 D329, D328 D333, D332 D337,D336
Output frequency K1,230 K3,664 K6,004 K8,200 K10,190 K11,932 K13,380 K14,498 K15,258 K15,644 K15,644 K15,258 K14,498 K13,380 K11,932 K10,190 K8,200 K6,004 K3,664 K1,230 (Table 2)
Device D D203, D202 D207, D206 D211, D210 D215, D214 D219, D218 D223, D222 D227, D226 D231, D230 D235, D234 D239, D238 D303, D302 D307, D306 D311, D310 D315, D314 D319, D318 D323, D322 D327, D326 D331, D330 D335, D334 D339, D338
Number of output pulses K615 K1,832 K3,002 K4,100 K5,095 K5,966 K6,690 K7,249 K7,629 K7,822 K7,822 K7,629 K7,249 K6,690 K5,966 K5,095 K4,100 K3,002 K1,832 K615
5 6 7 8 9 10 1 2 3 4
5 6 7 8 9 10
c)
Draw arcs in the four quadrants Destination: Draw four 90 arcs (see Figure 4) Program explanation: When the direction signal is On, the direction will be a positive one; when the direction signal is Off, the direction will be a negative one (see Figure 5) Output frequency and number of pulses: see Table 2
2-94
Y0=On Y1=On
X
Y0=On Y1=Off
Y0=Off Y1=Off
(-50,000, -50,000)
(Figure 4)
M1002 MOV MOV MOV MOV M1 SET SET M2 RST SET M3 RST RST M4 SET RST M0 M1133 M1135 Y0 Y1 Y0 Y1 Y0 Y1 Y0 Y1 K200 K10 K300 K10 D1133 D1134 D1135 D1136
(Figure 5)
M0, M1 = On refers to drawing a 90 arc in Quadrant I; M0, M2 = On refers to drawing a 90 arc in Quadrant II; M0, M3 = On refers to drawing a 90 arc in Quadrant III; M0, M4 = On refers to drawing a 90 arc in Quadrant IV. The four 90 arcs are drawn when acceleration in X and deceleration in Y. To draw the arcs when deceleration in X and acceleration in X, modify the program into Figure 6, i.e. D1333 = K300 and D1335 = K200.
2-95
(Figure 6)
M0, M1 = On refers to drawing a 90 arc in Quadrant I; M0, M2 = On refers to drawing a 90 arc in Quadrant II; M0, M3 = On refers to drawing a 90 arc in Quadrant III; M0, M4 = On refers to drawing a 90 arc in Quadrant IV. (See Figure 7)
Y
(-50,000, 50,000)
Quadrant II
(50,000, 50,000)
Y0=Off Y1=On
Quadrant I
Y0=On Y1=On
X
Y0=On Y1=Off
(-50,000, -50,000)
(50,000, -50,000)
(Figure 7)
d)
Draw a circle Destination: Extract four 90 arcs from Ffigure 4 and Figure 7 and combine them into a circle (see Figure 8).
2-96
Y
(50,000, 50,000) D0=K1 D0=K2
(0,0)
(10,000, 0)
D0=K3
(Figure 8)
M1002 MOV MOV MOV X0 INC = D0 K1 SET SET MOV MOV = D0 K2 SET RST MOV MOV D0 Y0 Y1 K200 K300 Y0 Y1 K300 K200 D1133 D1135 D1133 D1135 K10 K10 K0 D1134 D1136 D0
2-97
(Figure 9)
e)
Calculate the frequency and number of output pulses in each section Destination: Draw 10 sections of arcs clockwise until they reach (50,000, 50,000) (see Figure 10) Rx = target value in X; Ry = target value in Y; N = number of sections; = 3.1416
Y
(0,Ry) (x7,y7) (x9,y9) (x10,y10)
X
(Figure 10)
Step 1: Calculate the position for each section x1 = Rx Rx sin [(N-1) (2 N)] x2 = Rx Rx sin [(N-2) (2 N)] . See Table 3 y1 = Ry sin [1 (2 N)] y2 = Ry sin [2 (2 N)]. See Table 4 Position With decimal point Without decimal point 2-98 x1 615.55 615 x2 2,447.12 2,447 x3 5,449.61 5,449 x4 9,549.08 9,549 x5 14,464.59 14,464
(Table 5) Step 3: Decide the execution time of every section and obtain the frequency of every section by Table 5 Assume every section executes for 500ms, the equation for frequency (Hz) of each section is: fx1 = 10.5
Step 4: Fill Device D into table 2 and complete all steps. Reminder 1: When Rx=Ry, you can calculate X axis, and copy X axis to Y axis (as fy1 = fx10, fy2 = fx9, fy10 = fx1,and y1 = x10, y2 = x9,y10 = x1 ) Reminder 2: When drawing a counterclockwise arc, switch the index value of X axis with that of Y axis. Detecting Extension D1140, D1142, D1143, D1145
1. D1140: Number of special right-side extension modules (AD, DA, XA, PT, TC); Max. 8 2. D1142: Number of X input points on digital extension device 3. D1143: Number of Y output points on digital extension device DVP-PLC Application Manual 2-99
1. Special D and special M of Y0 adjustable pulse speed acceleration/deceleration for SA/SX/SC: Device No. M1144 M1145 M1146 M1147 M1148 M1149 M1154 D1030 D1031 D1144 D1154 D1155 Function Activation switch for Y0 adjustable pulse speed acceleration/deceleration Accerlerating flag for Y0 adjustable pulse speed acceleration/deceleration Target frequency reached flag for Y0 adjustable pulse speed acceleration/deceleration Decerlerating flag for Y0 adjustable pulse speed acceleration/deceleration Function completed flag for Y0 adjustable pulse speed acceleration/deceleration Counting temporarily stops flag for Y0 adjustable pulse speed acceleration/deceleration Enabling deceleration flag for Y0 adjustable pulse speed acceleration/deceleration The lower 16 bits in the 32-bit data register for accumulative Y0 output pulses The higher 16 bits in the 32-bit data register for accumulative Y0 output pulses Starting No. of the register (D) for Y0 adjustable pulse speed acceleration/deceleration Recommended value for indicated gap time of deceleration(10 ~ 32,767 ms) Recommended value for indicated gap frequency of deceleration (-1 ~ -32,700 Hz)
2. Parameters for D1144: Index +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 + 10 + 11 + 12 + 13 : + n*6 + 2 + n*6 + 3 2-100 Total number of sections (n) (max. 10) Currently executed section (read only) Start frequency of the 1st section (SF1) Gap time of the 1st section (GT1) Gap frequency of the 1st section (GF1) Target frequency of the 1st section (TF1) The lower 16 bits of the 32 bits for the target number of output pulses in the 1st section (SE1) The higher 16 bits of the 32 bits for the target number of output pulses in the 1st section (SE1) Start frequency of the 2nd section (SF2); Cannot be the same as TF1 Gap time of the 2nd section (GT2) Gap frequency of the 2nd section (GF2) Target frequency of the 2nd section (TF2) The lower 16 bits of the 32 bits for the target number of output pulses in the 2nd section (SE2) The higher 16 bits of the 32 bits for the target number of output pulses in the 2nd section (SE2) : Start frequency of the nth section (SFn); Cannot be the same as the start frequency of the n-1th section (TFn-1) Gap time of the nth section (GTn) Function
Function
Frequency(Hz)
SF1 Time(ms)
3rd section 4th section number of number of pulses pulses (SE4) (SE3)
4. How to use and the restrictions: a) The start frequency and target frequency have to be 200Hz; otherwise, the function will not be executed or complete execution. b) The start frequency and target frequency have to be < 32,700Hz. Frequency > 32,700Hz will be executed in 32,700Hz. c) Range of gap time: 1 ~ 32,767ms (Min. unit: ms) d) The range of gap frequency within acceleration section: 1Hz ~ 32,700Hz; within deceleration section: -1 ~ -32,700Hz. If the gap frequency is set as 0Hz, it will fail to reach target frequency in the executed section but in the next section when the target number of pulses is reached. e) The target number of pulses in a section has to be > (GF GT/1,000) [(TF - SF)/GF]; otherwise the target may not be reached. To correct it, the user may extend gap time or increase the target number of pulses. f) When PLC is in RUN status and there is a high-speed instruction assigning Y0 input, the instruction will be executed prior to other instructions. g) After M1144 = On, if M1148 has not be reached and M1144 is Off, deceleration will be enabled. And if M1154 = Off at the moment, the deceleration rule will be decelerating 200Hz every 200ms and M1147 will be set. The pulse output will stop when the frequency falls under 200Hz. If M1154 = On at the moment, the output will be executed following the gap time and frequency as set by the user. The time shall not be 0 (if
2-101
2-102
MOV K250 D202 MOV K500 D203 MOV K250 D204 MOV D205 D206 MOV K750 D208 MOV K500 D209 MOV K-250 D210 MOV K250 D211 K200 D212 M0
END
7. Example 3: Acceleration and deceleration in 1 section and the pulse output program with direction switch
Y7=OFF TF1 SF2 TF2 X0=ON SF1 Position Zero point TF2 SF2 TF1 Y7=On SF1
Explanation: a) See example 2 for the settings for acceleration and deceleration. The acceleration/deceleration frequency is stored in the latched area; therefore, you do not have to write it in in the program. b) The figure above is the example of the motion. When X0 = On, it will start the motion back and forth; when X0 = Off, the motion will stop. Y7 is a direction switch. c) The program:
2-103
M0 M1 M0 M1
ALT
8. Example 4: Program of zero return for 1 acceleration section and 1 deceleration section The timing diagram of relevant flags:
2-104
Program explanations: a) When X7 is triggered, M1144 will enable an acceleration. Set M1149 (counting temporarily stops) and 10 pulses will be sent out before the deceleration switch X0 is triggered and the program will enter the deceleration section. b) When X0 is disabled (i.e. zero return is completed), set M1148 to disable this function. Note: The example offered here is one of the applications. Please adjust the settings of the parameters according to the features of and restrictions on your machines. PWD Pulse Width Detection Duty-Off/Duty-On M1154
1. PWD pulse width detection function of M1154 is only available in EH2/SV series V1.5 and later versions. 2. M1154 = Off: Detecting the width time when duty-off. M1154 = On: Detecting the width time when duty-on.
2-105
Pulse Output Pause, Mask, Mark M1156 ~ M1159, M1538 ~ M1541, D1026, D1027
I001 interruption does not occur. Start/end frequency Number of output pulses
D1343: Acc eleration time D1348: Dec eleration time or D1233/1232: N umber of deceleration puls es
D1340
) -> Action when I001 interruption does not occur. ) -> A ction when I001 interruption occur s in unmasked area.
Note #1: A fter M1538 = ON and the user reset M1156 = OFF, PLC will com plete the r emaining number of output pulses automatically.
Applicable instructions: DRVI/DDRVI/PLSR/DPLSR Usage restriction: Has to work with external interruptions, special M and special D. Other explanations: a) When this function is enabled, PLC will start to decelerate according to the set deceleration time. Even if the user does not set up the number of deceleration pulses (i.e. special D = 0), or the set number of pulses is less than the number planned for the deceleration time, PLC will still decelerate within the deceleration time. On the contrary, if the number of deceleration pulses is more than the planned number for the deceleration time, PLC will decelerate according to the number set in the special D. b) Range for deceleration time: 10 ~ 10,000ms c) There is mask interruption in CH0 high-speed output. When D1027/D1026 (32-bit) 0, the mask function will be enabled, i.e. X0 external interruption will not be activated when the number of output pulses is within the mask area. High-speed output CH0 ~ CH3 v.s. pause function of external input points X0 ~ X3: Parameter Channel CH0 (Y0,Y1) CH1 (Y2,Y3) 2-106 Interruption paused flag M1156 M1157 External input point X0 X1 Deceleration time Special D D1348 D1349 Deceleration paulses Special D D1232~D1233 D1234~D1235 Mask interruption function D1026, D1027 No Pause status flag M1538 M1539
b) Program explanation: When M0 turns from Off to On, Y0 will start to output pulses and wait for the external input interruption X0 to take place. When interruption signals occur in the acceleration section or the highest speed section during the output, Y0 will immediately decelerate and stop the output after 100ms, and M1538 = On. When M1538 = On, the user can reset (RST) M1156, and PLC will start to output the remaining pulses. When all the target pulses are completed, M1029 will be On. If the external interruption occurs in the planned deceleration area, the output will not decelerate or set M1538 to On. c) Example 2: Immediately decelerate and pause within the number of deceleration pulses Application: When external interruptions occur, the high-speed output has to achieve deceleration and pause within the designated number of deceleration pulses. It is generally applied in the searching mark function in single-axis motion control. The program:
2-107
M0 DDRVI K100000 K100000 Y0 Y1 FEND I001 M1000 INCP D100 IRET END
d) Program explanation: When M0 turns from Off to On, Y0 will start to output pulses. After the external input interruption X0 occurs during the output, Y0 will immediately decelerate and output 50,000 pulses before it stops and set M1538 (pause status flag) to On. When M1538 = On, the user can reset (RST) M1156, and PLC will start to output the remaining pulses. When all the target pulses are completed, M1029 will be On. If the external interruption occurs in the planned deceleration area, the output will not decelerate or set M1538 to On. e) Example 3: Mask interruption and immediate deceleration and pause within the number of deceleration pulses. Application: The mask interruption can be set up when the interruption-inoperable area is eliminating in the mask process. The function is generally applicable in objects with patterns on it and requiring mark function. The program:
2-108
f)
Program explanation: When M0 turns from Off to On, Y0 will start to output pulses. After Y0 outputs more than 40,000 pulses and external input interruption X0 occurs, Y0 will decelerate, output 50,000 pulses and stop and set M1538 (pause status flag) to On. If external input interruption X0 occurs before Y0 outputs 40,000 pulses, Y0 will not start to decelerate. When M1538 = On, the user can reset (RST) M1156, and PLC will start to output the remaining pulses. When the output of target number of pulses is completed, M1029 will be On. If the external interruption occurs in the planned deceleration area, the output will not decelerate or set M1538 to On.
M1308=ON
Start/end frequency
M1308=OFF
Number of pulses
Deceleration time
Acceleration time
Applicable instructions: DRVI/DDRVI/DRVA/DDRVA/PLSR/DPLSR Applicable model/firmware version: EH2 v1.4, SV v1.5 (and their later versions)
2-109
3. Special M and special D registers for SV V1.4 and later versions when conducting deceleration to pausing output (for the ongoing high-speed pulse output encountering interruption signals), mask and mark. Device No. M1308 M1309 M1310 M1311 Function Off -> On: 1st group of CH0 (Y0, Y1) high-speed pulse output immediately pauses. On -> Off: Complete the remaining number of output pulses Off -> On: 1st group of CH1 (Y2, Y3) high-speed pulse output immediately pauses. On -> Off: Complete the remaining number of output pulses Off -> On: 1st group of CH2 (Y4, Y5) high-speed pulse output immediately pauses. On -> Off: Complete the remaining number of output pulses Off -> On: 1st group of CH3 (Y6, Y7) high-speed pulse output immediately pauses. On -> Off: Complete the remaining number of output pulses Enable X0 interruption to trigger immediate decelerating and pausing CH0 high-speed output. (When M1156 is enabled and M1538 = On, simply clear M1156 to finish sending out the remaining output pulses.) Enable X1 interruption to trigger immediate decelerating and pausing CH1 high-speed output Enable X2 interruption to trigger immediate decelerating and pausing CH2 high-speed output Enable X3 interruption to trigger immediate decelerating and pausing CH3 high-speed output CH0 pause status CH1 pause status CH2 pause status CH3 pause status When 0, enabling DRVI and PLSR instructions to work with X0 (mask) interruption. Number of CH0 output pulses after mark Low word High word Low word High word Low word High word
M1156
M1157 M1158 M1159 M1538 M1539 M1540 M1541 D1026 D1027 D1232 D1233 D1234 D1235
2-110
Start/end frequency
Time
Acceleration time Deceleration time Acceleration time Deceleration time
Number
Set M1156 ~ M1159 to enable CH0 ~ CH3 corresponding to the pause of external input points X0 ~ X3. When the pause flag is enabled, the user can set up the desired deceleration time (allowed range: 1 ~ 10,000ms).
Parameter
2-111
Number
Deceleration time Deceleration time
Set M1156 ~ M1159 to enable CH0 ~ CH3 corresponding to the mark function of external input points X0 ~ X3. When the mark function is enabled, the acceleration time and deceleration time will separate from each other automatically. The user can then set up desired acceleration/deceleration time (allowed range: 1 ~ 10,000ms). After the user set up the deceleration time, and when the instruction is enabled, the PLC will automatically calculate the minimum number of output pulses after the mark and place them in the special register. The number of output pulses after the mark shall be more than the calculated number of pulses within the set decelerationi time; otherwise the PLC will fill the minimum number of output pulses back to the register after the mark. After the mark is completed, the pause status flag will be On.
Parameter
2-112
DMOV K50000 D1232 DMOV M0 DDRVI K100000 K100000 Y0 Y1 FEND I001 M1000 INCP D100 IRET END K0 D1026
When M0 turns from Off to On, Y0 will start to output pulses and wait for the external interruption input X0 to come. After that, it will output 50,000 pulses and stop, and M1538 will be On. 8. How to use mask function:
Frequency Invalid X0 interruption Waiting for X0 interruption X0 external interruption generated Target frequency X0 interruption has not occurred Start/end frequency D1340 Time Number D1026, D1027 Designating mask number (32 bits)
D1348: Deceleration time D1232 ~ D1233: Number of pulses moved after mark
When D1026 and D1027 are not 0, the mask function will be enable, and only CH0 corresponding to external input point X0 are supported. When D1026 and D1027 are 0, the mask function will be disabled. 9. Program example for mask function:
2-113
When M0 turns from Off to On, Y0 will start to output pulses and wait for the external interruption input X0 tocome after the number of output pulses exceeds 40,000. 50,000 pulses will then start to output and stop. M1538 = On. If the number of pulse output does not reach 50,000 and the external interruption input X0 comes in, no deceleration will occur. Single Step Execution M1170, M1171, D1170
1. Special D and special M for single step execution for EH/EH2/SV: Device No. M1170 M1171 D1170 2. The function: a) Execution timing: The flag is valid only when PLC is in RUN status. b) Action steps: i) When M1170 is enabled, PLC enters the single step execution mode. PLC stays at a specific instruction, stores the location of STEP in D1170 and executes the instsruction once. ii) When M1171 is forced On, PLC executes the next instruction and stops. At the same time, PLC auto-force O ff M1171 and stops at the next instruction. D1170 stores the present STEP value. 2-114 DVP-PLC Application Manual Start flag Action flag STEP No. of the currently executed instruction Function
1. Special D and special M for two-phase pulse output for SA/SX/SC: Device No. M1172 M1173 M1174 D1172 D1173 D1174 D1175 D1176 D1177 Function Switch for two-phase pulse output (On = enabled) On = Continuous output switch Number of pulses reached flag Output frequency (12Hz ~ 20kHz) Output mode (K1 and K2) The lower 16 bits of the 32 bits for the target number of pulses The higher 16 bits of the 32 bits for the target number of pulses The lower 16 bits of the 32 bits for the present number of pulses The higher 16 bits of the 32 bits for the present number of pulses
2. The function: Output frequency = 1/1 pulse cycle period (i.e. 1/T; as the figure below) There are two output modes. K1 refers to A-phase ahead of B-phase and K2 refers to B-phase ahead of A-phase. The number of pulses accumulates once whenever a phase gap occurs. For example, the number of pulses in the figure below = 8, and when the number is reached, M1174 turns On. To clear the number, simply turn Off M1172.
T
Y0(A)
Y1(B)
The output frequency, target number of pulses and selection of modes can be modified when M1172 = On and M1174 = Off. Modification on output frequency and target number of pulses will not affect the present number of DVP-PLC Application Manual 2-115
1. Special D and special M for built-in 2-point VR volume for EH/EH2/SV/SA/SC: Device No. M1178 M1179 D1178 D1179 2. The function: This function should be used when PLC is in RUN status. When M1178 = On, VR0 value will be converted into a value of 0 ~ 255 and stored in D1178. When M1179 = On, VR1 value will be converted into a value of 0 ~ 255 and stored in D1179. 3. See API 85 VRRD for more details. Enable VR0 volume Enable VR1 volume VR0 value VR1 value Function
Interruption Instruction for Reading the Number of Pulses D1180 ~ D1181D1198 ~ D1199
1. SA/SX/SC can use external interruption to store the present value in the middle-high-speed counter into D1180 ~ D1181, D1198 ~ D1199 2. The function: a) For SA/SX, X0 (pulse input point) has to work with X4 (external interruption point), C235/C251/C253 (high-speed counter) and I401 (interruption No.). D1180 and D1181 are the registers to store the 32-bit values. X1 (pulse input point) has to work with X5 (external interruption point), C236 and I501. D1198 and D1199 are the registers to store the 32-bit values. Condition: When the program enables X2 to be the external interruption input, and X0 is for C235, C251, C253 high-speed counting input, the VR volume function will be enabled. When the program enables X3 to be the external interruption input, and X1 is for C236 high-speed counting input, the function will also be enabled. b) For SC, X10 (pulse input point) has to work with X4 (external interruption point), C243/C255 (high-speed counter) and I401 (interruption No.). D1180 and D1181 are the registers to store the 32-bit values. X11 (pulse input point) 2-116 DVP-PLC Application Manual
MODEM
MODEM
DVP-F232 interface
2.
Special M for MODEM connection for EH/EH2: Device No. M1184 M1185 M1186 M1187 M1188 Function Enable MODEM Initialize MODEM Fail to initialize MODEM MODEM initialization is completed Shows if MODEM is connected Note On: The following actions are valid Off: Initialization is completed Off: M1185 = On Off: M1185 = On On: Connecting
Note: The special Ms are both applicable when PLC is in RUN or STOP status. 3. How to conntect (Please follow the steps below): a) Set On M1184 (Enable PLC MODEM connection). b) Set On M1185 (Enable initialization of MODEM from PLC). c) Check if the initialization of MODEM is successful from M1186, M1187. d) Wait for the connection. 4. Note: a) When PLC is to be connected with MODEM, a RS-232 extension card is required. If there is no RS-232 extension card, all special M above will be invalid. b) After enabling MODEM (M1184 = On), PLC has to initialize MODEM first (M1185 = On). If PLC fails to initialize MODEM, the auto-answering function of the MODEM will not be enabled. DVP-PLC Application Manual 2-117
The latched area for EH/EH2/SV/SA/SX/SC is from the start address No. to the end address No. See the tables in Chapter 2.1 for more details. Set On/Off of Input Point X on MPU M1304
For SS/ES/EX, when M1304 = On, the X input points (X0 ~ X17) on MPU can be set On/Off by peripheral devices, e.g. WPLSoft or DVP-HPP. However, the LED indicators will not respond to the setup.
2.
For SA/SX/SC, when M1304 = On, peripheral devices, e.g. WPLSoft or DVP-HPP, can set On/Off of X0 ~ X17 on the MPU, but the LED indicators will not respond to it.
3.
For EH/EH2/SV, when M1304 = On, peripheral devices, e.g. WPLSoft or DVP-HPP, can set On/Off of X input points on the MPU, but the LED indicators will not respond to it. High-speed Output Pulse Stop Mode M1310 ~ M1311, M1334 ~ M1335, D1166 ~ D1167, D1343 ~ D1353
1. Special D and special M for high-speed pulse output stop mode: (SC_V1.4 and versions above are with an additional mode 3) Device No. M1334 M1335 M1310 M1311 D1166 D1167 D1343 D1353 Function Select stop mode for Y10 pulse Select stop mode for Y11 pulse Immediately stop Y10 pulse output Immediately stop Y11 pulse output X10 rising-edge/falling-edge counting mode switch X11 rising-edge/falling-edge counting mode switch Acceleration/deceleration time for Y10 pulse output Acceleration/deceleration time for Y11 pulse output
2-118
Mode 2 Output shutdown Applicable to: DDRVI, DDRVA, PLSY instructions Criteria for executing output shutdown: Shut down the criteria contact for pulse output instruction and turn On M1334.(Because PLSY does not have acceleration/deceleration setting, M1334 does not need to be set in PLSY) The time from executing output shutdown to the end of pulse output: Max. 1 scan cycle. The solid lines in the figure below are the originally planned routes and the dotted lines refer to the routes after output shutdown is executed.
Frequency Instruction shut down and M1334 = On Target frequency
Mode 3 Immediate output shutdown Applicable to: DDRVI, DDRVA, PLSY instructions Criteria for executing immediate output shutdown: M1310 = On (set before executing the instruction) and the criteria triggers set in X10 (D1166 = K0 refers to rising-edge; D1166 = K1 refers to falling-edge) The time from executing immediate output shutdown to the end of pulse output: Max. 1 pulse time. The solid lines in the figure below are the originally planned routes and the dotted lines refer to the routes after X10 is triggered. DVP-PLC Application Manual 2-119
b) Using Y11 pulse output Mode 1 Planned deceleration Applicable to: DDRVI and DDRVA instructions Criteria for executing planned deceleration: Shut down the criteria contact for pulse output instruction and turn Off M1335. The time from executing planned deceleration to the end of pulse output: The time set in D1353 (for acceleration/deceleration) Mode 2 Output shutdown Applicable to: DDRVI, DDRVA, PLSY instructions Criteria for executing output shutdown: Shut down the criteria contact for pulse output instruction and turn On M1335. (Because PLSY does not have acceleration/deceleration setting, M1335 does not need to be set in PLSY) The time from executing output shutdown to the end of pulse output: Max. 1 scan cycle. Mode 3 Immediate output shutdown Applicable to: DDRVI, DDRVA, PLSY instructions Criteria for executing immediate output shutdown: M1311 = On (set before executing the instruction) and the criteria triggers set in X11 (D1167 = K0 refers to rising-edge; D1167 = K1 refers to falling-edge) The time from executing immediate output shutdown to the end of pulse output: Max. 1 pulse time. 3. Note: a) The execution criteria M1334 and M1335 for mode 1 and 2 have to be set before executing pulse output shutdown instruction. The execution criteria M1310, M1311 and trigger criteria D1166, D1167 for mode 3 have to be set before the pulse output instruction is executed. b) In mode 3 (immediate output shutdown), Y10 can only be used with X10 and Y11 with X11. c) When using X10 or X11 in mode 3, DO NOT use X10 or X11 as the input high-speed counter. Right-Side Special Extension Module ID D1320 ~ D1327
The ID of right-side special extension module, if any, connected to EH/EH2 are stored in D1320 ~ D1327 in sequence.
2.
2-120
The ID of left-side special extension module, if any, connected to SV/EH2-L are stored in D1386 ~ D1393 in sequence.
2.
Left-side special extension module ID for SV/EH2-L: Module Name DVP04AD-SL DVP04DA-SL DVP04PT-SL DVP04TC-SL DVP06XA-SL DVP01PU-SL Module ID (hex) H4400 H4401 H4402 H4403 H6404 H4110 Module Name DVP01HC-SL DVP02HC-SL DVPDNET-SL DVPEN01-SL DVPMDM-SL DVPCOPM-SL Module ID (hex) H4120 H4220 H4131 H'4050 H4040 H4133
2-121
MASTER PLC SLAVE ID 1 SLAVE ID 2 SLAVE ID 3 SLAVE ID 4 SLAVE ID 5 SLAVE ID 6 SLAVE ID 7 SLAVE ID 8 Read Write Read Write Read Write Read Write Read Write Read Write Read Write Read Write out in out in out in out in out in out in out in out in M1353 = Off: Disable 32 stations in the Link and the function of reading/writing more than 16 data (RST M1353); the No. of special D for storing the 16 read/written data.
D1480 D1496 D1512 D1528 D1544 D1560 D1576 D1592 D1608 D1624 D1640 D1656 D1672 D1688 D1704 D1720 D1495 D1511 D1527 D1543 D1559 D1575 D1591 D1607 D1623 D1639 D1655 D1671 D1687 D1703 D1719 D1735
Number Number Number Number Number Number Number Number Number Number Number Number Number Number Number Number of data of data of data of data of data of data of data of data of data of data of data of data of data of data of data of data
D1434 D1450 D1435 D1451 D1436 D1452 D1437 D1453 D1438 D1454 D1439 D1455 D1440 D1456 D1441 D1457
LINK in SLAVE PLC? M1363 M1364 M1379 M1395 M1411 M1427 M1380 M1396 M1412 M1428
Action flag for SLAVE PLC from MASTER PLC Read/write error flag Reading completed flag (turns Off whenever read/write a station is completed) Writing completed flag (turns Off whenever read/write a station is completed)
SLAVE ID 1 SLAVE ID 2 SLAVE ID 3 SLAVE ID 4 SLAVE ID 5 SLAVE ID 6 SLAVE ID 7 SLAVE ID 8 Read Write Read Write Read Write Read Write Read Write Read Write Read Write Read Write out in out in out in out in out in out in out in out in D100 D200 D100 D200 D100 D200 D100 D200 D100 D200 D100 D200 D100 D200 D100 D200 D115 D215 D115 D215 D115 D215 D115 D215 D115 D215 D115 D215 D115 D215 D115 D215 Default start communication address D1355 ~ D1362 to be read = H1064 (D100) Default start communication address D1415 ~ D1422 to be written = H10C8 (D200)
2-122
MASTER PLC SLAVE ID 9 SLAVE ID 10 SLAVE ID 11 SLAVE ID 12 SLAVE ID 13 SLAVE ID 14 SLAVE ID 15 SLAVE ID 16 Read Write Read Write Read Write Read Write Read Write Read Write Read Write Read Write out in out in out in out in out in out in out in out in M1353 = Off: Disable 32 stations in the Link and the function of reading/writing more than 16 data (RST M1353); the No. of special D for storing the 16 read/written data.
D1736 D1752 D1768 D1784 D1800 D1816 D1832 D1848 D1864 D1880 D1896 D1912 D1928 D1944 D1960 D1976 D1751 D1767 D1783 D1799 D1815 D1831 D1847 D1863 D1879 D1895 D1911 D1927 D1943 D1959 D1975 D1991
Number Number Number Number Number Number Number Number Number Number Number Number Number Number Number Number of data of data of data of data of data of data of data of data of data of data of data of data of data of data of data of data
D144 D145 D1443 D1459 D1444 D1460 D1445 D1461 D1446 D1462 D1447 D1463 D1448 D1464 D1449 D1465 2 8 Start Communication Address D1363 D1423 D1364 D1424 D1365 D1425 D1366 D1426 D1367 D1427 D1368 D1428 D1369 D1429 D1370 D1430 M1368 M1384 M1400 M1416 M1432 SLAVE ID 9 Read Write out in D100 D200 D115 D215 M1369 M1385 M1401 M1417 M1433 SLAVE ID 10 Read Write out in D100 D200 D115 D215 M1370 M1386 M1402 M1418 M1434 SLAVE ID 11 Read Write out in D100 D200 D115 D215 LINK in SLAVE PLC? M1371 M1372 M1387 M1403 M1419 M1435 SLAVE ID 12 Read Write out in D100 D200 D115 D215 M1388 M1404 M1420 M1436 SLAVE ID 13 Read Write out in D100 D200 D115 D215 M1373 M1389 M1405 M1421 M1437 SLAVE ID 14 Read Write out in D100 D200 D115 D215 M1374 M1390 M1406 M1422 M1438 SLAVE ID 15 Read Write out in D100 D200 D115 D215 M1375 M1391 M1407 M1423 M1439 SLAVE ID 16 Read Write out in D100 D200 D115 D215
Action flag for SLAVE PLC from MASTER PLC Read/write error flag Reading completed flag (turns Off whenever read/write a station is completed) Writing completed flag (turns Off whenever read/write a station is completed)
Default start communication address D1363 ~ D1370 to be read = H1064 (D100) Default start communication address D1423 ~ D1430 to be written = H10C8 (D200)
2-123
MASTER PLC SLAVE ID 1 SLAVE ID 2 SLAVE ID 3 SLAVE ID 4 SLAVE ID 5 SLAVE ID 6 SLAVE ID 7 SLAVE ID 8 Read Write Read Write Read Write Read Write Read Write Read Write Read Write Read Write out in out in out in out in out in out in out in out in M1353 = On: Enable 32 stations in the Link and the function of reading/writing more than 16 data (SET M1353); the No. of D registers for storing the read/written data.
D1480 D1496 D1481 D1497 D1482 D1498 D1483 D1499 D1484 D1500 D1485 D1501 D1486 D1502 D1487 D1503
Number Number Number Number Number Number Number Number Number Number Number Number Number Number Number Number of data of data of data of data of data of data of data of data of data of data of data of data of data of data of data of data
D1434 D1450 D1435 D1451 D1436 D1452 D1437 D1453 D1438 D1454 D1439 D1455 D1440 D1456 D1441 D1457
LINK in SLAVE PLC? M1363 M1364 M1379 M1395 M1411 M1427 M1380 M1396 M1412 M1428
Action flag for SLAVE PLC from MASTER PLC Read/write error flag Reading completed flag (turns Off whenever read/write a station is completed) Writing completed flag (turns Off whenever read/write a station is completed)
SLAVE ID 1 SLAVE ID 2 SLAVE ID 3 SLAVE ID 4 SLAVE ID 5 SLAVE ID 6 SLAVE ID 7 SLAVE ID 8 Read Write Read Write Read Write Read Write Read Write Read Write Read Write Read Write out in out in out in out in out in out in out in out in D100 D200 D100 D200 D100 D200 D100 D200 D100 D200 D100 D200 D100 D200 D100 D200 D115 D215 D115 D215 D115 D215 D115 D215 D115 D215 D115 D215 D115 D215 D115 D215 Default start communication address D1355 ~ D1362 to be read = H1064 (D100) Default start communication address D1415 ~ D1422 to be written = H10C8 (D200)
2-124
MASTER PLC SLAVE ID 9 SLAVE ID 10 SLAVE ID 11 SLAVE ID 12 SLAVE ID 13 SLAVE ID 14 SLAVE ID 15 SLAVE ID 16 Read Write Read Write Read Write Read Write Read Write Read Write Read Write Read Write out in out in out in out in out in Out in out in out in M1353 = On: Enable 32 stations in the Link and the function of reading/writing more than 16 data (SET M1353); the No. of D registers for storing the read/written data.
D1488 D1504 D1489 D1505 D1490 D1506 D1491 D1507 D1492 D1508 D1493 D1509 D1494 D1510 D1495 D1511
Number Number Number Number Number Number Number Number Number Number Number Number Number Number Number Number of data of data of data of data of data of data of data of data of data of data of data of data of data of data of data of data
D1442 D1458 D1443 D1459 D1444 D1460 D1445 D1461 D1446 D1462 D1447 D1463 D1448 D1464 D1449 D1465
LINK in SLAVE PLC? M1371 M1372 M1387 M1403 M1419 M1435 M1388 M1404 M1420 M1436
Action flag for SLAVE PLC from MASTER PLC Read/write error flag Reading completed flag (turns Off whenever read/write a station is completed) Writing completed flag (turns Off whenever read/write a station is completed)
Default start communication address D1363 ~ D1370 to be read = H1064 (D100) Default start communication address D1423 ~ D1430 to be written = H10C8 (D200)
2-125
MASTER PLC SLAVE ID 17 SLAVE ID 18 SLAVE ID 19 SLAVE ID 20 SLAVE ID 21 SLAVE ID 22 SLAVE ID 23 SLAVE ID 24 Read Write Read Write Read Write Read Write Read Write Read Write Read Write Read Write out in out in out in out in out in out in out in out in M1353 = On: Enable 32 stations in the Link and the function of reading/writing more than 16 data (SET M1353); the No. of D registers for storing the read/written data.
D1576 D1592 D1577 D1593 D1578 D1594 D1579 D1595 D1580 D1596 D1581 D1597 D1582 D1598 D1583 D1599
Number Number Number Number Number Number Number Number Number Number Number Number Number Number Number Number of data of data of data of data of data of data of data of data of data of data of data of data of data of data of data of data
D1544 D1560 D1545 D1561 D1546 D1562 D1547 D1563 D1548 D1564 D1549 D1565 D1550 D1566 D1551 D1567
LINK in SLAVE PLC? M1443 M1444 M1459 M1475 M1491 M1507 M1460 M1476 M1492 M1508
Action flag for SLAVE PLC from MASTER PLC Read/write error flag Reading completed flag (turns Off whenever read/write a station is completed) Writing completed flag (turns Off whenever read/write a station is completed)
Default start communication address D1512 ~ D1519 to be read = H1064 (D100) Default start communication address D1528 ~ D1535 to be written = H10C8 (D200)
2-126
MASTER PLC SLAVE ID 25 SLAVE ID 26 SLAVE ID 27 SLAVE ID 28 SLAVE ID 29 SLAVE ID 30 SLAVE ID 31 SLAVE ID 32 Read Write Read Write Read Write Read Write Read Write Read Write Read Write Read Write out in out in out in out in out in out in out in out in M1353 = On: Enable 32 stations in the Link and the function of reading/writing more than 16 data (SET M1353); the No. of D registers for storing the read/written data.
D1584 D1600 D1585 D1601 D1586 D1602 D1587 D1603 D1588 D1604 D1589 D1605 D1590 D1606 D1591 D1607
Number Number Number Number Number Number Number Number Number Number Number Number Number Number Number Number of data of data of data of data of data of data of data of data of data of data of data of data of data of data of data of data
D1552 D1568 D1553 D1569 D1554 D1570 D1555 D1571 D1556 D1572 D1557 D1573 D1558 D1574 D1559 D1575
LINK in SLAVE PLC? M1451 M1452 M1467 M1483 M1499 M1515 M1468 M1484 M1500 M1516
Action flag for SLAVE PLC from MASTER PLC Read/write error flag Reading completed flag (turns Off whenever read/write a station is completed) Writing completed flag (turns Off whenever read/write a station is completed)
Default start communication address D1520 ~ D1527 to be read = H1064 (D100) Default start communication address D1536 ~ D1543 to be written = H10C8 (D200)
2-127
2-129
2-130
Enable
Disable
1. Enable 32 slaves linkage and up to 100 data for exchange (set M1353). 2. Set up the register D for storing the read data. 3. Set up the register D for storing the written data.
Disable 32 slaves linkage and up to 100 data for exchange. (Reset M1353)
Enable
Disable
Set M1351
Set M1352 Set times of communication (D1431) Set M1350 Start to execute EASY PLC LINK
2-131
M1353 has to be set On before PLC LINK is enabled. When PLC LINK is executed, On/Off of M1353 will not affect the execution. Registers designated in D1480 ~ D1495, D1576~D1591 (starting register for data read from Slave ID#1 ~ 16) and D1496 ~ D1511, D1592 ~ D1607 (starting register for data written into Slave ID#1 ~ 16) can only be register D, and every special D will correspond to one Slave ID#, e.g. D1480 corresponds to ID1, D1481 to ID2, and so on. D1480 ~ D1495, D1576 ~ D1591, D1496 ~ D1511 and D1592 ~ D1607 have to be set before PLC LINK is enabled. In the execution of PLC LINK, you can modify the contents in these special Ds, but the modified results will take effect in the next PLC LINK polling. If the ID# designated by D1480 ~ D1495, D1576 ~ D1591, D1496 ~ D1511 and D1592 ~ D1607 is smaller than 0 or bigger than 9,900, PLC will automatically correct the ID# into 9,900. If M1353 is not enabled during the execution of PLC LINK, the range for D1434 ~ D1449, D1544 ~ D1559 (number of data read from Slave ID#) and D1450 ~ D1465, D1560 ~ D1575 (numbere of data written into Slave ID#) will be 0 ~ 16. If the setting in the special D exceeds the range, PLC will correct it to 16. When M1353 is enabled, the range will be 0 ~ 100. If the setting in the special D exceeds the range, PLC will correct it to 100. You can modify the settings in D1434 ~ D1449, D1544 ~ D1559, D1450 ~ D1465 and D1560 ~ D1575 during the execution of PLC LINK, but the modified results will take effect in the next PLC LINK polling. b) Example 2: PLC LINK with M1353 and I170 2-132 DVP-PLC Application Manual
With I170, the processing of data in PLC LINK will not be done at END, but at the enabling of I170 immediately after the receiving of data is completed If the reaction speed of the RS-485 IC direction control signal pin of the Slave is slow, it is suggested that you do not enable I170. You can set up D1399 (starting Slave ID designated by PLC LINK), and the ID# of the next 15 Slaves have to be in sequence. For example, when D1399 is set as K20, the Master PLC will detect Slave ID# 20 ~ 35. c) Example 3: Connection of 1 Master and 2 Slaves by RS-485 and exchange of 16 data between Master and Slaves through PLC LINK (M1353 = Off, linkage of 16 stations, 16 data read/write mode) Write the ladder diagram program into Master PLC (ID#17)
2-133
Retain communication protocol D1434 D1450 D1435 D1451 Number of data read from Slave ID#1 Number of data written into Slave ID#1 Number of data read from Slave ID#2 Number of data written into Slave ID#2
When X1 = On, the data exchange between Master and the two Slaves will be automatically done in PLC LINK, i.e. the data in D100 ~ D115 in the two Slaves will be read into D1480 ~ D1495 and D1512 ~ D1527 of the Master, and the data in D1496 ~ D1511 and D1528 ~ D1543 will be written into D200 ~ D215 of the two Slaves. Master PLC *1 Read D1480 ~ D1495 D1496 ~ D1511 D1512 ~ D1527 D1528 ~ D1543 Write Read Write D100 ~ D115 of Slave ID#1 D200 ~ D215 of Slave ID#1 D100 ~ D115 of Slave ID#2 D200 ~ D215 of Slave ID#2 Slave PLC*2
Assume the data in D for data exchange between Master and Slave before PLC LINK is enabled (M1350 = Off) are as the follow: Master PLC D1480 ~ D1495 D1496 ~ D1511 D1512 ~ D1527 D1528 ~ D1543 Preset value K0 K1,000 K0 K2,000 Slave PLC D100 ~ D115 of Slave ID#1 D200 ~ D215 of Slave ID#1 D100 ~ D115 of Slave ID#2 D200 ~ D215 of Slave ID#2 Preset value K5,000 K0 K6,000 K0
2-134
The Master PLC has to be SA/SX/SC/EH/EH2/SV series MPU, and the Slave PLC can be any MPU of DVP series. There can be maximum 16 Slave PLCs in PLC LINK. See the special Ds in the Master PLC corresponding to D100 ~ D115 and D200 ~ D215 in every Slave PLC in the tables of special M and special D. d) Example 4: Connection between Delta PLC and Delta VFD-M AC motor drive through PLC LINK for STOP, forward/reverser revolution and writing/reading of frequency. Write the ladder diagram program into Master PLC (ID#17)
M1002 MOV MOV SET MOV MOV MOV MOV X1 M1351 M1350 END Auto mode Enable PLC LINK K17 H86 M1120 K6 K2 H2100 H2000 D1121 D1120 Master ID# COM2 communication protocol
Retain communication protocol D1434 D1450 D1355 D1415 Number of data read Number of data written Starting reference for Master to read from Slave Starting reference for Master to write in Slave
D1480 ~ D1485 correspond to parameters H2100 ~ H2105 in VFD-M. When X1 = On, PLC LINK will be enabled, and the data in H2100 ~ H2105 will be displayed in D1480 ~ D1485. D1496 ~ D1497 correspond to parameters H2000 ~ H2001 in VFD-M. When X1 = On, PLC LINK will be enabled, and the data in H2000 ~ H2001 will be displayed in D1496 ~ D1497. Modify D1496 to give command to VFD, e.g. D1496 = H12: enabling forward revolution of VFD-M; D1496 = H11: enabling reverse revolution of VFD. Modify D1497 to change the frequency of VFD, e.g. D1497 = K5,000: changing the frequency to 50kHz. The Master PLC has to be SA/SX/SC/EH/EH2/SV series MPU, and the Slave AC motor drive can be any VFD series models except VFD-A. DVP-PLC Application Manual 2-135
2-137
0D02
Continuously using STL for more than 9 times Using MC/MCR in STL, using I/P in STL Using STL/RET in subroutine Using STL/RET in interruption subroutine Using MC/MCR in subroutine Using MC/MCR in interruption subroutine MC/MCR does not start from N0, or is not continuous DVP-PLC Application Manual
2-138
C40C Corresponding N of MC and MCR are different C40D Improper use of I/P C40E C40F C41B IRET does not appear after the last FEND SRET does not appear after the last FEND PLC program and data in parameters have not been initialized Invalid RUN/STOP instruction to extension module
C41C Points of extension module exceed the range C41D C41E C41F C420 C430 C440 C441 C442 C443 Number of extension modules exceeds the range Incorrect hardware setting for extension module Failing to write data into memory Read/write function card error Initializing parallel interface error Hardware error in high-speed counter Hardware error in high-speed comparator Hardware error in MCU pulse output No response from extension unit
C4EE No END instruction in the program C4FF Invalid instruction (no such instruction existing)
2-139
2-140
3 Basic Instructions
3.1 Basic Instructions and Step Ladder Instructions
Basic Instructions
Instruction Code LD LDI AND ANI OR ORI ANB ORB MPS MRD MPP Function Loading in A contact Loading in B contact Series connection- A contact Series connection- B contact Parallel connection- A contact Parallel connection- B contact Series connection- loop blocks Parallel connection- loop blocks Operands 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 N/A N/A Execution speed (us) ES 3.8 3.88 2.32 2.4 2.32 2.4 1.76 1.76 1.68 1.6 1.6 SA 3.8 3.88 2.32 2.4 2.32 2.4 1.76 1.76 1.68 1.6 1.6 EH STEP Page 3-3 3-3 3-3 3-4 3-4 3-5 3-5 3-6 3-6 3-6 3-6
0.24 (0.56) 1~3 0.24 (0.56) 1~3 0.24 (0.56) 1~3 0.24 (0.56) 1~3 0.24 (0.56) 1~3 0.24 (0.56) 1~3 0.24 0.24 0.24 0.24 0.24 1~3 1~3 1~3 1 1
Store the current result of the internal N/A PLC operations Reads the current result of the N/A internal PLC operations Pops (recalls and removes) the N/A currently stored result
Output instructions
Instruction Code OUT SET RST Output coil LatchedOn Clear the contacts or the registers Function Operands Y, M, S Y, M, S Y, M, S, T, C, D, E, F Execution speed (us) ES 5.04 3.8 7.8 SA 5.04 3.8 7.8 EH STEP Page 3-7 3-7 3-8
Timers, Counters
API 96 97 97 Instruction Code TMR CNT DCNT Function 16-bit timer 16-bit counter 32-bit counter Operands T-K or T-D C-K or C-D (16 bits) C-K or C-D (32 bits) Execution speed (us) ES 10.6 9.7 10.3 SA 10.6 9.7 10.3 EH 9.6 12.8 14.3 STEP Page 4 4 6 3-8 3-9 3-9
3-1
3 Basic Instructions
Instructions for detecting the contacts of rising-/falling-edge
API 90 91 92 93 94 95 Instruction Code LDP LDF ANDP ANDF ORP ORF Function Rising-edge detection operation Falling-edge detection operation Rising-edge series connection Falling-edge series connection Rising-edge parallel connection Falling-edge parallel connection Operands 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 Execution speed (us) ES 5.1 5.1 4.9 4.9 4.9 4.9 SA 5.1 5.1 4.9 4.9 4.9 4.9 EH 0.56 (0.88) 0.56 (0.88) 0.56 (0.88) 0.56 (0.88) 0.56 (0.88) 0.56 (0.88) 3 3 3 3 3 3 3-11 3-12 3-12 3-12 3-13 3-13 STEP Page
End instruction
Instruction Code END Program ends Function Operands N/A Execution speed (us) ES 5 SA 5 EH 0.24 1 3-14 STEP Page
Other instructions
API Instruction Code NOP 98 INV P I No operation Inverting operation Pointer Interruption program marker Function Operands N/A N/A P0 ~ P255 I Execution speed (us) ES 0.88 1.6 0.88 0.88 SA 0.88 1.6 0.88 0.88 EH 0.16 0.24 STEP Page 1 1 1 1 3-15 3-15 3-15 3-16
Note 1: ES includes ES/EX/SS; SA includes SA/SX/SC; EH includes EH/EH2/SV. Note 2: For EH series MPU, the execution speed in the brackets ( ) refers to the execution speed of designated operand M1536 ~ M4095.
3-2
3 Basic Instructions
3.2 Explanations on Basic Instructions
Function Loading in A contact X0 ~ X377 Operand Y0 ~ Y377 Program steps 1 M0 ~ M4095 S0 ~ S1023
ES EX SS
Mnemonic LD
Controllers
SA SX SC EH SV
T0 ~ T255
C0 ~ C255
D0 ~ D9999 -
Explanations: The LD instruction is used on the A contact that has its start from the left BUS or the A contact that is the start of a contact circuit. The functions are to save the present contents and store the acquired contact status into the accumulative register. Program Example: Ladder diagram: Instruction code: LD X0 X1 Y1 Operation: Loading in contact A of X0 Connecting to contact A of X1 in series Driving Y1 coil
X0
X1 Y1
AND OUT
Mnemonic LDI
Controllers
SA SX SC EH SV
T0 ~ T255
C0 ~ C255
D0 ~ D9999 -
Operand Explanations:
The LDI instruction is used on the B contact that has its start from the left BUS or the B contact that is the start of a contact circuit. The functions are to save the present contents and store the acquired contact status into the accumulative register. Program Example: Ladder diagram: Instruction code: LDI X0 X1 Y1 Operation: Loading in contact B of X0 Connecting to contact A of X1 in series Driving Y1 coil
X0
X1 Y1
AND OUT
Mnemonic AND
Program steps 1
ES EX SS
Controllers
SA SX SC EH SV
Operand Explanations:
M0 ~ M4095 S0 ~ S1023
T0 ~ T255
C0 ~ C255
D0 ~ D9999 -
The AND instruction is used in the series connection of A contact. The functions are to read out the status of present d
3-3
3 Basic Instructions
series connection contacts and perform the AND operation with the logical operation result obtained. The final result will be store in the accumulative register. Program Example: Ladder diagram: Instruction code: LDI X1 X0 Y1 Operation: Loading in contact B of X1 Connecting to contact A of X0 in series Driving Y1 coil
X1
X0 Y1
AND OUT
Mnemonic ANI
Program steps 1
ES EX SS
Controllers
SA SX SC EH SV
Operand Explanations:
M0 ~ M4095 S0 ~ S1023
T0 ~ T255
C0 ~ C255
D0 ~ D9999 -
The ANI instruction is used in the series connection of B contact. The functions are to read out the status of present designated series connection contacts and perform the AND operation with the logical operation result obtained. The final result will be store in the accumulative register. Program Example: Ladder diagram: Instruction code: LD X1 X0 Y1 Operation: Loading in contact A of X1 Connecting to contact B of X0 in series Driving Y1 coil
X1
X0 Y1
ANI OUT
Mnemonic OR
Program steps 1
ES EX SS
Controllers
SA SX SC EH SV
Operand Explanations:
M0 ~ M4095 S0 ~ S1023
T0 ~ T255
C0 ~ C255
D0 ~ D9999 -
The OR instruction is used in the parallel connection of A contact. The functions are to read out the status of present designated parallel connection contacts and perform the OR operation with the logical operation result obtained. The final result will be store in the accumulative register. Program Example: Ladder diagram: Instruction code: LD X0 X1 Y1 Operation: Loading in contact A of X0 Connecting to contact A of X1 in parallel Driving Y1 coil
X0 Y1 X1
OR OUT
3-4
3 Basic Instructions
Mnemonic ORI Function Parallel connection- B contact X0 ~ X377 Program steps 1
ES EX SS
Controllers
SA SX SC EH SV
Operand Explanations:
C0 ~ C255
D0 ~ D9999 -
The OR instruction is used in the parallel connection of B contact. The functions are to read out the status of present designated parallel connection contacts and perform the OR operation with the logical operation result obtained. The final result will be store in the accumulative register. Program Example: Ladder diagram: Instruction code: LD X0 X1 Y1 Operation: Loading in contact A of X0 Connecting to contact B of X1 in parallel Driving Y1 coil
X0 Y1 X1
ORI OUT
Controllers
SA SX SC EH SV
To perform the AND operation of the preserved logic results and content in the accumulative register. Program Example: Ladder diagram: Instruction code: Operation: Loading in contact A of X0 Connecting to contact B of X2 in parallel Loading in contact B of X1 Connecting to contact A of X3 in parallel Connecting circuit block in series Y1 Driving Y1 coil
X0 ANB X1 X2 X3
Y1
X0 X2 X1 X3
Block A Block B
3-5
3 Basic Instructions
Mnemonic ORB Operand Explanations: To perform the OR operation of the preserved logic results and content in the accumulative register. Program Example: Ladder diagram: Instruction code: LD X0 X1 X2 X3 Y1 Operation: Loading in contact A of X0 Connecting to contact B of X1 in series Loading in contact B of X2 Connecting to contact A of X3 in series Connecting circuit block in parallel Driving Y1 coil Function Parallel connection- loop blocks Program steps 1 N/A
ES EX SS
Controllers
SA SX SC EH SV
X0 X2
Controllers
SA SX SC EH SV
To save the content in the accumulative register into the operational result (the pointer of operational result will plus 1).
Controllers
SA SX SC EH SV
To read the operational result and store it into the accumulative register (the pointer of operational result stays intact).
Controllers
SA SX SC EH SV
To retrieve the previous preserved logical operation result and store it into the accumulative register (the pointer of operational result will minus 1).
3-6
3 Basic Instructions
Program Example: Ladder diagram: Instruction code: LD X0 X1 Y1 X2 M0 Y2 Operation: Loading in contact A of X0 Saving into stack Connecting to contact A of X1 in series Driving Y1 coil Reading from stack Connecting to contact A of X2 in series Driving M0 coil Reading from stack and pop pointer Driving Y2 coil Program ends
X0
MPS
X1 Y1 X2
MRD
M0 Y2
MPP
END
Mnemonic OUT
Controllers
SA SX SC EH SV
Operand
T0 ~ T255 -
C0 ~ C255 -
D0 ~ D9999 -
Explanations: 1. To output the logical operation result before OUT instruction into a designated device. 2. Actions of coil contact: OUT instruction Operational result Coil Off On Contact A contact (normally open) Off On B contact (normally closed) On Off
X0
X1 Y1
AND OUT
Mnemonic SET
Controllers
SA SX SC EH SV
Operand
T0 ~ T255 -
C0 ~ C255 -
D0 ~ D9999 -
Explanations:
3-7
3 Basic Instructions
When the SET instruction is driven, its designated device will be On and keep being On both when SET instruction is still being driven or not driven. Use RST instruction to set Off the device. Program Example: Ladder diagram: Instruction code: LD
X0 Y0 SET Y1
X0 Y0 Y1
ANI SET
Mnemonic RST
Program steps 1
ES EX SS
Controllers
SA SX SC EH SV
Operand
E0 ~ E7 F0 ~ F7
Explanations: 1. When the RST instruction is driven, the actions of the designated devices are: Device Y, M, S, T, C D, E, F Coil and contact will be set to Off Present values of the timer or counter will be set to 0, and the coil and contact will be set to Off The content will be set to 0. Status
2. If RST instruction is not being executed, the status of the designated device will stay intact. Program Example: Ladder diagram: Instruction code: LD X0 Y5 Operation: Loading in contact A of X0 Resetting contact Y5
X0 RST Y5
RST
Function
Program steps 1
ES EX SS
Controllers
SA SX SC EH SV
When TMR instruction is executed, the designated coil of the timer will be On and the timer will start to time. When the set value in the timer is reached (present set value), the contact will be: NO (Normally Open) contact NC (Normally Closed) contact Open collector Close collector
3-8
3 Basic Instructions
Program Example: Ladder diagram: Instruction code: LD X0 T5 K1000 Operation: Loading in contact A of X0 T5 timer Set value in timer T5 as K1,000
X0 TMR T5 K1000
TMR
Remarks: See the specification of each model for the range of operand T.
Mnemonic CNT
Program steps 1
ES EX SS
Controllers
SA SX SC EH SV
Operand C-D Explanations: 1. When the CNT instruction goes from Off to On, the designated counter coil will be driven, and the present value in the counter will plus 1. When the counting reaches the set value (present value = set value), the contact will be: NO (Normally Open) contact NC (Normally Closed) contact 2. Open collector Close collector
If there are other counting pulse input after the counting reaches its target, the contact and present value will stay intact. Use RST instruction to restart or reset the counting.
CNT
Mnemonic DCNT
Program steps 1
ES EX SS
Controllers
SA SX SC EH SV
Operand C-D Explanations: 1. 2. DCNT is the instruction for enabling the 32-bit high-speed counters C200 ~ C255. For general purpose addition/subtraction counters C200 ~ C234, when DCNT goes from Off to On, the present value in the counter will pulse 1 (counting up) or minus 1 (counting down) according to the modes set in special M1200 ~ M1235. 3. For high-speed addition/subtraction counters C235 ~ C255, when the high-speed counting pulse input goes from Off to On, the counting will start its execution. For the input terminals (X0 ~ X17) and counting methods
3-9
3 Basic Instructions
(counting up/down) of the high-speed counter, see Chapter 2.7 Numbering and Function of Counter [C] for more details. 4. When DCNT is Off, the counting will stop, but the existing present value in the counter will not be cleared. To clear the present value and the contact, you have to use the instruction RST C2XX. Use externally designated input points to clear the present values and contacts of high-speed addition/subtraction counters C235 ~ C255. Program Example: Ladder diagram: Instruction code: LD M0 Operation: Loading in contact A of M0
DCNT
Program steps 1
ES EX SS
Controllers
SA SX SC EH SV
MC is the main-control start instruction. When MC instruction is executed, the execution of instructions between MC and MCR will not be interrupted. When MC instruction is Off, the actions of the instructions between MC and MCR are: Instruction type General purpose timer Accumulative timer Subroutine timer Counter Coils driven by OUT instruction Devices driven by SET and RST instructions Application instructions Explanation Present value = 0 Coil is Off, No action for the contact Coil is Off, present value and contact stay intact Present value = 0 Coil is Off, No action for the contact Coil is Off, present value and contact stay intact All Off Stay intact All disabled. The FOR-NEXT nested loop will still execute back and forth for N times. Instructions between FOR-NEXT will act as the instructions between MC and MCR.
2. 3.
MCR is the main-control end instruction that is placed in the end of the main-control program. There should not be any contact instructions prior to MCR instruction. MC-MCR main-control program instructions support the nested program structure (max. 8 layers) and please use the instruction in the order N0 ~ N7.
3-10
3 Basic Instructions
Program Example: Ladder diagram: X0 Instruction code: Operation: Loading in A contact of X0 Enabling N0 common series connection contact Loading in A contact of X1 Driving Y0 coil Loading in A contact of X2 Enabling N1 common series connection contact Loading in A contact of X3 Driving Y1 coil Disabling N1 common series connection contact Disabling N0 common series connection contact Loading in A contact of X10 Enabling N0 common series connection contact Loading in A contact of X11 Driving Y10 coil Disabling N0 common series connection contact LD MC LD OUT : LD MC LD OUT : MCR : MCR : LD MC LD OUT : MCR X0 N0 X1 Y0 X2 N1 X3 Y1 N1 N0 X10 N0 X11 Y10 N0
N0
N1
N1 N0 N0
N0
Mnemonic LDP
Controllers
SA SX SC EH SV
Operand
T0 ~ T255
C0 ~ C255
D0 ~ D9999 -
Explanations: The method of using LDP is the same as using LD, but the actions of the two instructions differ. LDP saves the current content and store the detected status of rising-edge to the accumulative register. Program Example: Ladder diagram: Instruction code: LDP X0 X1 Y1 Operation: Starting X0 rising-edge detection Series connecting A contact of X1 Driving Y1 coil
X0
X1 Y1
AND OUT
Remarks: 1. 2. See the specification of each model for the range of operands. If the status of a designated rising-edge is On before the PLC is powered, the contact of the rising-edge will be TRUE after PLC is powered.
3-11
3 Basic Instructions
Mnemonic LDF Function Falling-edge detection operation X0 ~ X377 Y0 ~ Y377 Program steps 1
ES EX SS
Controllers
SA SX SC EH SV
Operand
M0 ~ M4095 S0 ~ S1023
T0 ~ T255
C0 ~ C255
D0 ~ D9999 -
Explanations: The method of using LDF is the same as using LD, but the actions of the two instructions differ. LDF saves the current content and store the detected status of falling-edge to the accumulative register. Program Example: Ladder diagram: Instruction code: LDF X0 X1 Y1 Operation: Starting X0 falling-edge detection Series connecting A contact of X1 Driving Y1 coil
X0
X1 Y1
AND OUT
Mnemonic ANDP
Program steps 1
ES EX SS
Controllers
SA SX SC EH SV
Operand
M0 ~ M4095 S0 ~ S1023
T0 ~ T255
C0 ~ C255
D0 ~ D9999 -
Explanations: ANDP instruction is used in the series connection of the contacts rising-edge detection. Program Example: Ladder diagram: Instruction code: LD X0 X1 Y1 Operation: Loading in A contact of X0 X1 rising-edge detection in series connection Driving Y1 coil
X0
X1 Y1
ANDP OUT
Mnemonic ANDF
Program steps 1
ES EX SS
Controllers
SA SX SC EH SV
Operand
M0 ~ M4095 S0 ~ S1023
T0 ~ T255
C0 ~ C255
D0 ~ D9999 -
Explanations: ANDF instruction is used in the series connection of the contacts falling-edge detection. [Program Example: Ladder diagram: Instruction code: LD X0 X1 Y1 Operation: Loading in A contact of X0 X1 falling-edge detection in series connection Drive Y1 coil
X0
X1 Y1
ANDF OUT
3-12
3 Basic Instructions
Mnemonic ORP Function Rising-edge parallel connection X0 ~ X377 Y0 ~ Y377 Program steps 1
ES EX SS
Controllers
SA SX SC EH SV
Operand
M0 ~ M4095 S0 ~ S1023
T0 ~ T255
C0 ~ C255
D0 ~ D9999 -
Explanations: The ORP instructions are used in the parallel connection of the contacts rising-edge detection. Program Example: Ladder diagram: Instruction code: LD X0 X1 Y1 Operation: Loading in A contact of X0 X1 rising-edge detection in parallel connection Driving Y1 coil
X0 Y1 X1
ORP OUT
Mnemonic ORF
Program steps 1
ES EX SS
Controllers
SA SX SC EH SV
Operand
M0 ~ M4095 S0 ~ S1023
T0 ~ T255
C0 ~ C255
D0 ~ D9999 -
Explanations: The ORP instructions are used in the parallel connection of the contacts falling-edge detection. Program Example: Ladder diagram: Instruction code: LD X0 X1 Y1 Operation: Loading in A contact of X0 X1 falling-edge detection in parallel connection Driving Y1 coil
X0 Y1 X1
ORF OUT
Mnemonic PLS
Controllers
SA SX SC EH SV
Operand
T0 ~ T255 -
C0 ~ C255 -
D0 ~ D9999 -
Explanations: When X0 goes from Off to On (rising-edge trigger), PLS instruction will be executed and S will send out pulses for once of 1 scan time.
3-13
3 Basic Instructions
Program Example: Ladder diagram: Instruction code: LD X0 Operation: Loading in A contact of X0 M0 rising-edge output Loading in contact A of M0 Y0 latched (On)
X0 PLS M0 SET
Timing Diagram:
M0 Y0
PLS LD SET
M0 M0 Y0
X0 M0 Y0
1 scan time
Mnemonic PLF
Controllers
SA SX SC EH SV
Operand
T0 ~ T255 -
C0 ~ C255 -
D0 ~ D9999 -
Explanations: When X0 goes from On to Off (falling-edge trigger), PLF instruction will be executed and S will send out pulses for once of 1 scan time. Program Example: Ladder diagram: Instruction code: LD X0 M0 M0 Y0 Operation: Loading in A contact of X0 M0 falling-edge output Loading in contact A of M0 Y0 latched (On)
X0 PLF M0 SET
Timing Diagram:
M0 Y0
PLF LD SET
X0 M0 Y0
1 scan time
Controllers
SA SX SC EH SV
3-14
3 Basic Instructions
END instruction has to be placed in the end of a ladder diagram or instruction program. PLC will start to scan from address 0 to END instruction and return to address 0 to restart the scan.
Function
Controllers
SA SX SC EH SV
NOP instruction does not conduct any operations in the program; therefore, after the execution of NOP, the existing logical operation result will be kept. If you want to delete a certain instruction without altering the length of the program, you can use NOP instruction. Program Example: Ladder diagram: Instruction code: LD NOP OUT
NOP
X0 Y1
Mnemonic INV
Program steps 1
ES EX SS
Controllers
SA SX SC EH SV
Operand Explanations:
N/A
The logical operation result before INV instruction will be inverted and stored in the accumulative register. Program Example: Ladder diagram: Instruction code: LD X0 Y1 Operation: Loading in A contact of X0 Inverting the operation result Driving Y1 coil
X0 Y1
INV OUT
Function
Program steps 1
ES EX SS
Controllers
SA SX SC EH SV
Pointer P is used in API 00 CJ and API 01 CALL instructions. The use of P does not need to start from No. 0, and the No. of P cannot be repeated; otherwise, unexpected errors may occur.
3-15
3 Basic Instructions
Program Example: Ladder diagram: Instruction code: LD X0 P10 Operation: Loading in A contact of X0 From instruction CJ to P10 Pointer P10 X1 Y1 Loading in A contact of X1 Driving Y1 coil
X0 CJ X1 P10 Y1 P10
CJ : P10 LD OUT
Mnemonic I
Program steps 1
ES EX SS
Controllers
SA SX SC EH SV
I00, I10, I20, I30, I40, I50, I6, I7, I8 Operand Explanations: A interruption program has to start with a interruption pointer (I) and ends with API 03 IRET. I instruction has to be used with API 03 IRET, API 04 EI, and API 05 DI. See Chapter 2.9 for pointers of all DVP series PLCs. Program Example: Ladder diagram:
EI X1 Y1 DI FEND X2 I 001 Y2 IRET Interruption subroutine Allowable range for interruption
I010, I020, I030, I040, I050, I060, I110, I120, I130, I140, I150, I160, I170, I180
Instruction code: Operation: EI LD OUT : DI : FEND I001 LD OUT : IRET Interruption return X2 Y2 Main program ends Interruption pointer Loading in A contact of X2 Driving Y2 coil X1 Y1 Enabling interruption Loading A contact of X1 Driving Y1 coil Disabling interruption
3-16
Controllers
SA SX SC EH SV
STL Sn constructs a step. When STL instruction appears in the program, the program will enter a step ladder diagram status controlled by steps. The initial status has to start from S0 ~ S9. RET instruction indicates the end of a step ladder diagram starting from S0 ~ S9 and the bus returns to a normal ladder diagram instruction. SFC uses the step ladder diagram composed of STL/RET to complete the action of a circuit. The No. of S cannot be repeated.
Mnemonic RET
Program steps 1
ES EX SS
Controllers
SA SX SC EH SV
Operand Explanations:
N/A
RET indicates the end of a step. There has to be a RET instruction in the end of a series of steps. One PLC program can be written in maximum 10 steps (S0 ~ S9) and every step should end with a RET. Program Example: Ladder diagram:
M1002
SFC:
ZRST SET
S0 S S20 S X1 X0
S0 S0 S20
S127
SET Y0 SET
S30
S30 S X2
X2 S40 Y2
Y1 SET S40
X3 S0
S40 S X3
Y2 S0 RET END
4-1
In automation, we always need electric control to work with mechanical control for an automation control. The sequential control can be divided into several orderly steps (or stages). Each step has its actions that should be completed and the transition from one step to another normally requires some criteria. The action of the last step finishes when all criteria is true and the beginning of the next step will clear the actions of the last step. This is the concept of designing a sequential function chart (SFC). Features: 1. No sequential design is required for constant step actions, and PLC will automatically execute the interlocking and dual outputs among all status. An easy sequential design is the only thing required to make the machine work normally. 2. The actions in SFC are easy to understand, adjust for a trial operation, detect the errors and maintain. 3. SFC is a type of diagram editing. The structure of a SFC looks like a flow chart. Every No. of the step relay S inside the PLC represents a step, equal to every processing procedure in a flow chart. When the current procedure is completed, the program will move to the next step according to the set transition criteria. Therefore, you can repeat the cycle and obtain the result you desire. 4. See the SFC chart in the right hand side: The initial step S0 transfers to a general purpose step S21 by making the status transition condition X0 condition true. S21 transfer to S22 or jumps to S24 by making X1 or X2 true. In step S25, X6 will be true and the chart will return to S0 to complete a cycle. The cycle and be repeated to reach a cyclic control. SFC:
X4 S24 X5 S25 X6 S0
5. Next are some basic icons for drawing SFC in WPLSoft SFC editor. Ladder diagram mode. The icon indicates that the internal editing program is a general ladder diagram, not a step ladder program. Initial step in SFC. Applicable for S0 ~ S9. General step. Applicable for S10 ~ S1023. Step jumps. Used for a step to jump to another non-adjacent step. (Jumping up/down to non-adjacent steps in the same sequence, returning to initial step, or jumping among different sequences.) Transition condition between steps. Alternative divergence. The same step transfers to a corresponding step by different transition condition. Alternative convergence. More than 2 steps transfer to the same step by transition condition. Simultaneous divergence. The same step transfers to more than 2 steps by the same transition condition. Simultaneous convergence. More than 2 steps transfer to the same step by a single transition condition.
4-2
M1002
SET
S0 S S21 S S22 S S23 S
S21
S22
S23
1. Actions of Step Ladder: A step ladder is composed of many steps and every step controls an action in the sequence. The step ladder has to: a) Drive the output coil b) Designate the transition condition c) Designate which step will take over the control from the current step Example:
S10 S
Y0 SET
X0
S10 S
Y0 SET Y1 S20
Y1 S20
SET
S20 S X1
X0
SET
S20 S X1
Explanation: When S10 = On, Y0 and Y1 will be On. When X0 = On, S20 will be On and Y10 will be On. When S10 = Off, Y0 will be Off and Y1 will be On. 2. Timing Diagram of Step Ladder:
4-3
Executing the timing diagram below. After the status of S10 and S12 are transferred (taking place simultaneously), and after a delay of 1 scan time, Y10 will be Off and Y11 will be On. There will not be
S14
STL S10
Pro gram execution Pro gram execution
S12 S X1
Y11 SET
overlapping outputs.
3. Repeated Use of Output Coil: a) b) You can use output coils of the same No. in different steps. See the diagram in the right. There can be the same output device (Y0) among different statuses. Y0 will be On when S10 or S20 is On. Such as right diagram, there is the same output device Y0 in the different state. No matter S10 or S20 is On, Y0 will be On. c) Y0 will be Off when S10 is transferring to S20. After S20 is On, Y0 will output again. Therefore in this case, Y0 will be On when S10 or S20 is On. d) Normally in a ladder diagram, avoid repeated use of an output coil. The No. of output coil used by a step should also avoid being used when the step ladder diagram returns to a general ladder diagram.
S20 S X1 S10 S
Y0 SET
X0
Y1 S20
SET Y0 SET
S30
4-4
TMR
T1
K10
TMR
T2
K20
TMR
T1
K30
S10
S
S12
S
SFC:
OUT S0
Ladder diagram:
S0 S S21 S X2 S24 Driving the jumping of step
Using OUT S24
X7 S0 RET
4-5
SFC:
S0
OUT
Ladder diagram:
S1
S0 S S21 S S23 S
sequences.
S21
X2 OUT
S41
S42 RET
S42
S1 S
S23
S43
S42 S S43 S
Two different step sequence: S0 and S1 S23 returns to initial step S0 by using OUT. S43 returns to initial step S1 by using OUT.
6. Cautions for Driving Output Point: See the figure below. After the step point and once LD or LDI instructions are written into the second line, the bus will not be able to connect directly to the output coil, and errors will occur in the compilation of the ladder diagram. You have to correct the diagram into the diagram in the right hand side for a correct compilation.
BUS Sn S M0 Y1 M0 Y2 Modifying the position of M0. Y1 Normally open contact in RUN mode Y2 or M1000 Y2 Y0 Sn S Y0 Sn S M0 Y1 Y0
7. Restrictions on Using Some Instructions: The program of every step is the same as a general ladder diagram, in which you can use all kinds of series/parallel circuits or instructions. However, there are restrictions on some of the instructions. Basic instructions applicable in a step Instruction LD/LDI/LDP/LDF AND/ANI/ANDP/ANDF OR/ORI/ORP/ORF INV/OUT/SET/RST Yes Yes Yes
ANB/ORB MPS/MRD/MPP
MC/MCR
Yes Yes No
No No No
convergence step Step transfer DO NOT use MC/MCR instruction in the step.
DO NOT use STL instruction in a general subroutine or interruption subroutine. You can still use CJ instruction in STL instruction, but this will make the actions more complicated. We do not recommend you do so.
4-6
Instruction code: STL LD MPS AND OUT MRD AND OUT MPP AND OUT Sn X0 X1 Y1 X2 M0 X3 Y2
Explanation: MPS/MRD/MPP instruction cannot be used directly on the new bus. You have to execute LD or LDI instruction first before applying MPS/MRD/MPP.
8. Other Points to Note: The instruction used for transferring the step (SET S or OUT S) can only be executed after all the relevant outputs and actions in the current status are completed. See the figure below. The executed results by the PLC are the same, but if there are many conditions or actions in S10, it is recommended that you modify the diagram in the left hand side into the diagram in the right hand side. SET S20 is only executed after all relevant outputs and actions are completed, which is a more explicit sequence.
S10 S
Y0 SET Y1 S20
S10 S
Y0 Y1 SET S20
S20 S
Y2
S20 S
Y2
S20 S
X1
S0 RET
Make sure to add RET instruction after STL at the end of the step ladder diagram.
S20 S X1
S0 RET
4.4
1. The first step in the SFC is called the initial step", S0 ~ S9. Use the initial step as the start of a sequence and end a complete sequence with RET instruction. 2. If STL instruction is not in use, step S can be a general-purpose auxiliary relay. 3. When STL instruction is in use, the No. of step S cannot be repeated. 4. Types of sequences:
4-7
S0
OUT
S1
S21
S41
S42
4-8
4.5
Types of Sequences
SFC:
ZRST SET S0 S0 S20 S127
M1002 S0 X0 S20 X1 Y0
S0 S S20 S
X0
SET Y0
X1
SET
S30 S X2
S30
S30
Y1 SET S40
Y1
X2 S40 X3
S50
Y2
S40 S X3
Y2 SET
S50 X4 S60
Y3
S50 S X4
Y3 SET S60
Y4
S60 S X5
X5 S0
Y4 S0 RET END
4-9
2. The control power over the step is transferred to the step in another sequence.
S0
OUT
OUT
S0
OUT
S1
S21
S21
OUT
S41
S42
S42
S41
S43
S43
c) Reset Sequence See the diagram in the right hand side. When the condition at S50 is true, S50 will be reset and the sequence will be completed at this time.
S21 S0
RST
S50
4-10
SFC:
SET SET SET SET S21
S20
S22 S23
S21 S22 S23 S24
S24
b) Structure of alternative divergence When the individual condition at the current status is true, the step will be transferred to another individual step. See the diagrams below. When X0 = On, S20 will be transferred to S30; when X1 = On, S20 will be transferred to S31; when X2 = On, S20 will be transferred to S32. Ladder diagram:
S20 S X0
SFC:
SET S30 S31 S32
S20
X0 X1 X2
X1
SET
X2
S30
SET
S31
S32
c) Structure of the simultaneous convergence See the ladder diagram below. A continuous STL instruction represents a simultaneous convergence. When the condition is true after a continuous output, the step will be transferred to the next step. In the simultaneous convergence, only when several conditions are true will the transfer be allowed. Ladder diagram:
S40 S S41 S S42 S X2
SFC:
SET S50
S40 S41 S42
X2
S50
d) Structure of alternative convergence See the diagrams below. Depending on the condition of the input signal of which of S30, S40 and S50 becomes true first, the first one will be first transferred to S60.
4-11
SFC:
SET S60 S60 S60
S30
X0
S40
X1
S50
X2
X1
SET
X2
SET
S60
SFC:
ZRST SET S0 S1
X0
S127
M1002 S1
S1 S S20 S
X0
SET Y0
X1
S20
S20 X1
SET
X4
S30 X2 S40
SET
X7
SET
S30 S X2
X3 S50
Y1 SET S40
T1 S60 X12 Y7
S40 S X3
Y2 SET S50
S31 S X5
Y3 SET S41
S1
S41 S X6
Y4 SET S50
S32 S X10
Y5 SET S42
S42 S X11
S50 S T1
TMR SET
S60 S X12
Y7 S1 RET END
4-12
SFC:
ZRST SET S0 S3 S20 S127
M1002 S3 X0 S20 X1 Y0
S3 S S20 S
X0
SET Y0
X1
S30
Y1
S31 X3
Y3 X4 Y4
S32
Y5
S41
S42
Y6
T1
K10
Y1 SET S40
T1 S60 X6 Y7
S40 S S31 S X3
Y2
S3
Y3 SET S41
S41 S S32 S X4
Y4 Y5 SET S42
Y6
X5
S50 K10
S60 S X6
Y7 S3 RET END
4-13
SFC:
ZRST SET S0 S4 S20 S127
M1002 S4 X0 S20 X1 S30 Y1 S31 X4 Y2 S41 X5 TMR T1 K10 Y4 X7 Y3 X6 S42 Y6 S32 Y5 Y0
S4 S S20 S
X0
SET Y0
X1
X2 S40 X3 S50
Y1 SET S40
T1 S60 Y7
S40 S X3
Y2
S4
SET
S31 S X4
S50
Y3 SET S41
S41 S X5
Y4 SET S50
S32 S X6
Y5 SET S42
S42 S X7
S50 S T1
TMR SET
S60 S X6
Y7 S4 RET END
4-14
ZRST SET
S0 S X0
S0 S0
S127
S51 S X12
Y0 SET S20
Y14
S61 X15 S
SET Y17
S70
S20 S X1
Y1 SET
X2
X17
SET
X3
SET
S30 S X4
Y2 SET S40
S31 S X5
Y3 SET S40
S52 S X13
S40 S X7
S50 S X11
Y7 SET S60
S60 S
Y13
S63 S S62 S
Y16
S63 X16 S
S0 RET END
SFC:
M1002 S0 X0 S20 X1 S30 X4 S40 X7 S50 X11 S60 X15 S70 X17 S0 Y17 Y13 Y7 S51 X12 S61 Y14 Y10 Y5 Y2 Y1 X2 S31 X5 Y3 X3 S32 X6 S41 X10 S52 X13 S62 X16 S0 Y15 Y11 S53 X14 S63 Y16 Y12 Y6 Y4 Y0
4-15
SFC:
M1002
ZRST SET
S0 S S30 S X1 X0
S0 S0 S30
S127
X0
S0
SET Y0
S30 X1 S31
Y0 X1 Y1 S32 X3 Y3 Y2
SET
X1
S31 S32
X2 S33 X4
SET
S31 S X2
Y1 SET S33
S34 X5
Y4 X6 Y5
S36
Y6
S32 S X3
Y2 SET S33
S35 X7
S37
Y7
S33 S X4
Y3
S0
SET SET
S34 S X5
S34 S36
Y4 SET S35
S35 S S36 S X6
Y5 Y6 SET S37
Y7 S0 RET END
4-16
S36
4.6
API 60
IST Instruction
Mnemonic IST Type Bit Devices X * Y * M * S * *
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Function
Controllers
ES/EX/SS SA/SX/SC EH/SV
OP S D1 D2
Operands: S: Start device in the designated operation mode D1: The smallest No. of designated step in auto mode
D2: The biggest No. of designated step in auto mode Explanations: 1. S will occupy 8 consecutive points. 2. Range of D1 and D2: for SA/SX/SC/EH/EH2/SV S20 ~ S899; for ES/EX/SS S20 ~ S127; D2 > D1. 3. See the specifications of each model for their range of use. 4. IST instruction can only be used once in the program. 5. Flags: M1040 ~ M1047. See remarks for more details. 6. IST instruction is a handy instruction specifically for the initial status of step ladder control procedure to accommodate special auxiliary relay.
4-17
X10: Individual operation X11: Zero return X12: Step operation X13: One cycle operation M1040: Operation forbidden M1041: Operation starts M1042: Pulse output enabled M1047: STL monitor enabled
X14: Continuous operation X15: Zero return enabled switch X16: Start switch X17: Stop switch S0: Initiates manual operation S1: Initiates zero return S2: Initiates auto operation
2. When IST instruction is being executed, the following special auxiliary relays will switch automatically.
3. S10 ~ S19 are for zero return and cannot be used as general steps. When S0 ~ S9 are in use, S0 ~ S2 represent manual operation mode, zero return mode and auto operation mode. Therefore, in the program, you have to write the circuit of the three steps in advance. 4. When switched to S1 (zero return) mode, any On in S10 ~ S19 will result in no zero return. 5. When switched to S2 (auto operation) mode, any On of the S in D1 ~ D2 or M1043 = On will result in no auto operation. Program Example 2: 1. Robot arm control (by IST instruction): a) Motion request: Separate the big ball and small ball and move them to different boxes. Configure the control panel for the control. b) Motions of the robot arm: descending, clipping ball, ascending, right shifting, releasing ball, ascending, left shifting. c) I/O devices:
Left-limit X1 Upper-limit X4 Lower-limit X5 Ball size sensor X0
Big Small
Y0 Y1
Right-limit X2 (big)
Right-limit X3 (small)
Y3
Y2
2. Operation modes: Manual operation: Turn On/Off of the load by a single button. Zero return: Press the zero return button to automatically zero-return the machine. Auto operation: a) Single step operation: Press auto start button for every one step forward. b) One cycle operation: Press auto start button at the zero point. After a cycle of auto operation, the operation will stops at the zero point. Press auto stop button in the middle of the operation to stop the operation and press auto start to restart the operation. The operation will resume until it meets the zero point. c) Continuous operation: Press auto start button at the zero point to resume the operation. Press auto stop to operate until it meets the zero point. 3. The control panel:
4-18
Step X12 Zero Return X11 One cycle Operation X13 Continuous Operation X14
X20
X22
X24
Left Shift
X21
X23
X25
a) Ball size sensor X0. b) Robot arm: left limit X1, big ball right limit X2, small ball right limit X3, upper limit X4, lower limit X5. c) Robot arm: ascending Y0, descending Y1, right shifting Y2, left shifting Y3, clipping Y4. Start Circuit
X0 X1 Y4 M1044 M1000 IST X10 S20 S80
SET
X21
Y4 Y4
RST
X22 Y1
Y0
X23 Y0
Ascending Interlocked Descending Right shifting Left shifting Interlocked Robot arm ascends to upper limit (X4 On)
Y1
X24 X4 Y3
Y2
X25 X4 Y2
Y3
4-19
S10 Y4 Y1
Enter zero return mode Clipping released Descending stops Robot arm ascends to upper limit (X4 On)
X4
SET
S11 S
S11 Y2
Right shifting stops Robot arm left shifting to left limit (X1 On)
RST Y3
X1
SET
S12 S
SET RST
4-20
SET Y1 SET
S20
X5 X0
SET
S30 S
SET TMR
T0
K30
SET
S31 S X4
Y0
X4
SET
S32 S X2
S32
Right shifting
Y2
X2
SET
S40 S
S50 Y4 T1 S41
Robot arm ascending to upper limit (X4 On) Clipping tightly
SET TMR
T1
K30
SET
S41 S X4
Y0
X4
SET
S42 S X3
S42
Right shifting
Y2
X3
SET
S50 S X5
S50
Robot arm descending
Y1
X5
SET
S60 S
S60 Y4 T2 S70
Robot arm ascending to upper limit (X4 On) Clipping released
RST TMR
T2
K30
SET
S70 S X4
Y0
X4
SET
S80 S X1
S80
Robot arm left shifting to left limit (X1 On)
Y3
X1
S2 RET END
4-21
4-22
Category
Function
Applicable to ES SA EH
Page
Loop Control
CJ CALL SRET IRET EI DI FEND WDT FOR NEXT CMP ZCP MOV SMOV CML BMOV FMOV XCH BCD BIN ADD SUB MUL DIV INC DEC WAND WOR WXOR NEG ROR ROL RCR RCL SFTR SFTL WSFR WSFL SFWR SFRD ZRST DECO ENCO SUM BON MEAN ANS ANR SQR FLT REF REFF MTR -
DCMP DZCP DMOV DCML DFMOV DXCH DBCD DBIN DADD DSUB DMUL DDIV DINC DDEC DAND DOR DXOR DNEG DROR DROL DRCR DRCL
Conditional Jump Call Subroutine Subroutine Return Interrupt Return Enable Interrupts Disable Interrupts The End of The Main Program (First End) Watchdog Timer Refresh Start of a FOR-NEXT loop End of a FOR-NEXT loop Compare Zone Compare Move Shift Move Compliment Block Move Fill Move Exchange Binary Coded Decimal Binary Addition Subtraction Multiplication Division Increment Decrement Logical Word AND Logical Word OR Logical Exclusive OR 2s Complement (Negative) Rotation Right Rotation Left Rotation Right with Carry Rotation Left with Carry Bit Shift Right Bit Shift Left Word Shift Right Word Shift Left Shift Register Write Shift Register Read Zero Reset Decode Encode Sum of Active Bits Check Specified Bit Status Mean Timed Annunciator Set Annunciator Reset Square Root Floating Point Refresh Refresh and Filter Adjust Input Matrix High Speed Counter Set High Speed Counter Reset
3 3 1 1 1 1 1 1 3 1 7 9 5 11 5 7 7 5 5 5 7 7 7 7 3 3 7 7 7 3 5 5 5 5 9 9 9 9 7 7 5 7 7 5 7 7 7 1 5 5 5 3 9 -
13 17 9 9 13 9 9 9 13 13 13 13 5 5 13 13 13 5 9 9 9 9
6-1 6-5 6-5 6-8 6-8 6-8 6-12 6-14 6-15 6-15 6-18 6-19 6-20 6-21 6-23 6-24 6-26 6-27 6-29 6-30 6-32 6-34 6-35 6-37 6-39 6-40 6-41 6-42 6-43 6-44 6-46 6-47 6-48 6-49 6-50 6-51 6-52 6-54 6-55 6-56 6-57 6-59 6-61 6-63 6-64 6-65 6-66 6-66 6-72 6-70 7-1 7-2 7-3 7-5 7-15
Transmission Comparison
9 13 13 9 9 13 13
Data Processing
5-1
API 55 56 57 58 59 60 61 62 63 64 65 66 67 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
P instruction
Function
Applicable to ES SA EH
Page
SPD PLSY PWM PLSR IST SER ABSD INCD TTMR STMR ALT RAMP SORT TKY HKY DSW SEGD SEGL ARWS ASC PR FROM TO RS PRUN ASCI HEX CCD VRRD VRSC ABS PID PLS LDP LDF ANDP ANDF ORP ORF TMR CNT INV PLF MODRD MODWR FWD REV STOP RDST RSTEF LRC CRC SWRD
Handy Instructions
DTKY DHKY
DABS DPID
DCNT
High Speed Zone Compare Speed Detection Pulse Y Output Pulse Width Modulation Pulse Ramp Initial State Search a Data Stack Absolute Drum Sequencer Incremental Drum Sequencer Teaching Timer Special Timer Alternate State Ramp Variable Value Sort Tabulated Data Ten Key Input Hexadecimal Key Input Digital Switch Seven Segment Decoder Seven Segment with Latch Arrow Switch ASCII Code Conversion Print (ASCII Code Output) Read CR Data in Special Modules Write CR Data into Special Modules Serial Communication Instruction Parallel Run Converts Hex to ASCII Converts ASCII to Hex Check Code Volume Read Volume Scale Absolute Value PID Control Loop Rising-edge Output Rising-edge Detection Operation Falling-edge Detection Operation Rising-edge Series Connection Falling-edge Series Connection Rising-edge Parallel Connection Falling-edge Parallel Connection 16-bit Timer 16-bit / 32-bit Counter Inverting Operation Falling-edge Output Read Modbus Data Write Modbus Data Forward Running of VFD-A Reverse Running of VFD-A Stop VFD-A Read VFD-A Status Reset Abnormal VFD-A Checksum LRC Mode Checksum CRC Mode Read Digital Switch
7 7 7 9 7 9 9 9 5 7 3 9 11 7 9 9 5 7 9 11 5 9 9 9 5 7 7 7 5 5 3 9 3 3 3 3 3 3 3 4 4 1 3 7 7 7 7 7 5 5 7 7 3
17 13 17 17 17
13 17
17 17 9
7-17 7-24 7-26 7-32 7-35 7-39 7-45 7-46 7-48 7-50 7-52 7-54 7-55 7-57 7-59 7-61 7-64 7-66 7-67 7-70 7-72 7-73 7-75 7-76 7-80 7-93 7-94 7-98 7-101 7-103 7-105 7-106 7-107 3-13 3-11 3-12 3-12 3-12 3-13 3-13 3-8 3-9 3-15 3-14 8-1 8-5 8-10 8-10 8-10 8-13 8-15 8-16 8-18 8-20
Serial I/O
17
-
Basic Instructions
Communication
5-2
API 110 111 112 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 143 144 145 146 147 148 149 150 151
P instruction
Function
Applicable to ES SA EH
Page
DECMP DEZCP DMOVR DRAD DDEG DEBCD DEBIN DEADD DESUB DEMUL DEDIV DEXP DLN DLOG DESQR DPOW DINT DSIN DCOS DTAN DASIN DACOS DATAN DSINH DCOSH DTANH
INT
DELAY GPWM FTC CVM SWAP DSWAP MEMR DMEMR MEMW DMEMW MODRW PWD -
Position Control
ZRN PLSV DRVI DRVA TCMP TZCP TADD TSUB TRD TWR HOUR GRY GBIN
156 157 158 159 160 161 162 163 166 167 169 170 171
Floating Point Compare Floating Point Zone Compare Move Floating Point Data Angle Radian Radian Angle Float to Scientific Conversion Scientific to Float Conversion Floating Point Addition Floating Point Subtraction Floating Point Multiplication Floating Point Division Exponent of Binary Floating Point Natural Logarithm of Binary Floating Point Logarithm of Binary Floating Point Floating Point Square Root Floating Point Power Operation Float to Integer Sine Cosine Tangent Arc Sine Arc Cosine Arc Tangent Hyperbolic Sine Hyperbolic Cosine Hyperbolic Tangent Delay Instruction General PWM Output Fuzzy Temperature Control Valve Control (*) Byte Swap Read File Register Write File Register Read/Write MODBUS Data Detection of Input Pulse Width Start of the Measurement of Execution Time of I Interruption End of the Measurement of the Execution Time of I Interruption Random Number Read the Absolute Position from a Servo Motor Zero Return Adjustable Speed Pulse Output Drive to Increment Drive to Absolute Time Compare Time Zone Compare Time Addition Time Subtraction Time Read Time Write Hour Meter BIN Gray Code Gray Code BIN
13 17 9 9 9 9 9 13 13 13 13 9 9 13 9 13 9 9 9 9 9 9 9 9 9 9
8-21 8-22 8-23 8-24 8-25 8-26 8-27 8-29 8-30 8-31 8-32 8-33 8-34 8-35 8-36 8-37 8-38 8-39 8-41 8-43 8-45 8-46 8-47 8-48 8-49 8-50 8-51 8-52 8-53 8-58 8-61 8-62 8-63 9-1 9-19 9-20 9-20 9-22 9-23 9-28 9-32 9-33 9-40 9-52 9-53 9-54 9-55 9-56 9-58 9-60 9-62 9-63
3 7 9 7 3 7 7 11 5 5 3 7 7
5 13 13
Others
13 17 13 17 17
9 7 9 9 11 9 7 7 3 3 7 5 5
13 9 9
5-3
API 172 173 174 175 176 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
P instruction
Function
Applicable to ES SA EH
Page
MMOV MAND MOR MXOR MXNR MINV MCMP MBRD MBWR MBS MBR MBC -
DADDR DSUBR DMULR DDIVR DPPMR DPPMA DCIMR DCIMA DPTPO DCLLM DLD& DLD| DLD^ DAND& DAND| DAND^ DOR& DOR| DOR^ DLD= DLD> DLD< DLD<> DLD<= DLD>= DAND= DAND> DAND< DAND<> DAND<= DAND>= DOR= DOR> DOR< DOR<> DOR<= DOR>= -
Positioning Instruction
196 HST 197 202 SCAL 203 SCLP 215 216 217 218 219 220 221 222 223 224 225 226 228 229 230 232 233 234 236 237 238 240 241 242 244 245 246 LD& LD| LD^ AND& AND| AND^ OR& OR| OR^ LD= LD> LD< LD<> LD<= LD>= AND= AND> AND< AND<> AND<= AND>= OR= OR> OR< OR<> OR<= OR>=
Floating Point Addition Floating Point Subtraction Floating Point Multiplication Floating Point Division Magnify Move Matrix AND Operation Matrix OR Operation Matrix XOR Operation Matrix XNR Operation Matrix Inverse Operation Matrix Compare Read Matrix Bit Write Matrix Bit Matrix Bit Displacement Matrix Bit Rotation Matrix Bit Status Counting 2-Axis Relative Point to Point Motion (*) 2-Axis Absolute Point to Point Motion (*) 2-Axis Relative Position Arc Interpolation (*) 2-Axis Absolute Position Arc Interpolation (*) Single-Axis Pulse Output by Table (*) High Speed Timer Close Loop Position Control (*) Proportional Value Calculation Parameter Proportional Value Calculation S1 & S2 S1 | S2 S1 ^ S2 S1 & S2 S1 | S2 S1 ^ S2 S1 & S2 S1 | S2 S1 ^ S2 S1 = S2 S1 > S2 S1 < S2 S1 S2 S1 S2 S1 S2 S1 = S2 S1 > S2 S1 < S2 S1 S2 S1 S2 S1 S2 S1 = S2 S1 > S2 S1 < S2 S1 S2 S1 S2 S1 S2
5 9 9 9 9 7 9 7 7 7 7 7 -
13 13 13 13 17 17 17 17 13 17 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9
9-64 9-65 9-66 9-67 9-68 9-69 9-71 9-72 9-73 9-74 9-75 9-77 9-79 9-81 9-83 9-85 9-86 9-89 9-91 9-96 9-101 9-103 9-105 10-1 10-3 10-7 10-7 10-7 10-8 10-8 10-8 10-9 10-9 10-9 10-10 10-10 10-10 10-10 10-10 10-10 10-11 10-11 10-11 10-11 10-11 10-11 10-12 10-12 10-12 10-12 10-12 10-12
Matrix
3 9 9 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
5-4
5-5
An application instruction has two parts: the instruction and operands. Instruction: The function of the instruction Operands: Devices for processing the operations of the instruction The instruction part of an application instruction usually occupies 1 step, and one operand occupies 2 or 4 steps depending on the instruction is a 16-bit or 32-bit one. Format of an application instruction:
1
API
3
Mn emo nic DECO
5
Operan ds
6
F un cti on
n
7
Co ntrol lers
ES /EX /SS SA /SX /SC EH /S V
41
13 12
OP S D n Typ e
Decode
Bi t Devic es X Y M S K
Word De vices H Kn X Kn Y Kn M Kn S T C D E F
* *
* *
* *
11
* *
* *
10
PUL SE
* *
* *
* *
* *
* *
16 -b it 32 -b it
ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
API No. Indication of if there is a 16-bit or 32-bit instruction. If there is a 32-bit instruction, the column will be marked with D. Mnemonic of the application instruction Indication of if there is a pulse execution type instruction. If there is a pulse instruction, the column will be marked with P. Operands Function of the application instruction DVP-PLC applicable to the application instruction. ES includes ES/EX/SS, SA includes SA/SX/SC, EH includes EH/EH2/SV. Steps occupied by the 16-bit/32-bit/pulse execution instruction DVP-PLC applicable to the pulse/16-bit/32-bit instruction Column marked with * and in grey refers to E, F index register modification is applicable. Column marked with * is the device applicable for the operand Device name Device type Input of application instruction: Some application instructions are only composed of the instruction part (mnemonic), e.g. EI, DI, WDT. Most application instructions are composed of the instruction part and many operands.
5-6
K10
D10
Operands
MOV instruction is to move the operand designated in S to the operand designated in D. S D Source operand: If there are more than 1 source operands, they will be represented as S1, S2, . Destination operand: If there are more than 1 destination operands, they will be represented as D1, D2, .
If the operand can only be constant K/H or a register, it will be represented as m, m1, m2, n, n1, n2, . Length of operand (16-bit instruction or 32-bit instruction) Depending on the contents in the operand, the length of an operand can be 16-bit or 32-bit. Therefore, a 16-bit instruction is for processing 16-bit operands, and 32-bit instruction is for processing 32-bit operands. The 32-bit instruction is indicated by adding a D before the 16-bit instruction. 16-bit MOV instruction
X0
DMOV
to (D21, D20).
Continuous execution instruction and pulse execution instruction Continuous execution and pulse execution are the two types of execution for an application instruction. Due to that the execution time required will be shorter when the instruction is not executer, the pulse execution instructions are used more to shorten the scan period. Instructions marked with a P" following the mnemonic are pulse execution instruction. Some instructions are mostly used as pulse execution type, e.g. INC, DEC, the kind of displacement instructions.
5-7
MOVP
Continuous execution instruction
X1
D10
D12
executed once and the instruction will not be executed again in the scan period. In every scan period when X1 = On, MOV instruction will
MOV
D10
D12
be executed once.
In the two figures, when X0, X1 = Off, the instruction will not be executed, and the content in operand D will remain unchanged. Designation of operands 1. Bit devices X, Y, M, and S can be combined into word device, storing values and data for operaions in the form of KnX, KnY, KnM and KnS in an application instruction. 2. Data register D, timer T, counter C and index register E, F are designated by general operands. 3. A data register is usually in 16 bits, i.e. of the length of 1 register D. A designated 32-bit data register refers to 2 consecutive register Ds. 4. If an operand of a 32-bit instruction designates D0, the 32-bit data register composed of (D1, D0) will be occupied. D1 is the higher 16 bits; D0 is the lower 16 bits. The same rule also apply to timer T, 16-bit timers and C0 ~ C199. 5. When the 32-bit counters C200 ~ C255 are used as data registers, they can only be designataed by the operands of 32-bit instructions. Format of operand 1. X, Y, M, and S can only On/Off a single point and are defined as bit devices. 2. 16-bit (or 32-bit) devices T, C, D, and registers E, F are defined as word devices. 3. You can place Kn (n = 1 refers to 4 bits. For 16-bit instruction, n = K1 ~ K4; for 32-bit instruction, n = K1 ~ K8) before bit devices X, Y, M and S to make it a word device for performing word-device operations. For example, K1M0 refers to 8 bits, M0 ~ M7.
X0
MOV
K2M0
D10
5-8
All flags will turn On or Off according to the operational result of an instruction. For example, the execution result of operation instructions ADD/SUB/MUL/DVI will affect the status of M1020 ~ M1022. When the instruction is not executed, the On/Off status of the flag will be held. The status of the four flags relates to many instructions. See relevant instructions for more details. b) Example of M1029 When the contact of DSW (Digital Switch) instruction is On, 4 output points will automatically act in cycle at the frequency of 0.1 second in order to read the set value of the digital switch. If the contact goes Off during the execution, the action will be disable. When it is On again, the disabled action will be re-executed. If you do not wish the action to be disabled, you can take the circuit below as a reference.
X0
SET
M0
M0 Y10 D0 K0
When X0 = On, DSW will be enabled. When X0 = Off, M0 will be Off only when DSW completes a cycle and M1029 = On.
DSW X10
M1029
RST
2. Error Operation Flags
M0
Errors occur during the execution of the instruction when the combination of application instructions is incorrect or the devices designated by the operand exceed their range. Other than errors, the flags listed in the table below will be On, and error codes will also appear.
5-9
3. Flags for expanding functions Some application instructions can use some special flags to expand their functions or complete special functions. For example, the communication instruction RS can use M1161 to switch between 8-bit and 16-bit transmission mode. Times of using instructions There are limitation on the times of using some instructions in the program. However, you can use index register modification in the operands to expand the functions of the instruction. 1. Can be used only once in the program: API 58 PWM (ES series MPU) API 74 SEGL (ES series MPU) 2. Can be used only twice in the program: API 57 PLSY (ES series MPU) API 74 SEGL (EH series MPU) 3. Can be used only 4 times in the program: API 169 HOUR (SA series MPU) 4. Can be used only 8 times in the program: API 64 TTMR (SA series MPU) 5. API 53 DHSCS and API 54 DHSCR together can be used only maximum 4 times in the program (ES series MPU). 6. API 53 DHSCS, API 54 DHSCR, and API 55 DHSZ together can be used only maximum 6 times in the program (SA series MPU). There is no limitation on the times of using the instructions listed below, but there are limitations on the times of executing the same instruction at the same time. 1. Instructions which can be executed only once: API 52 MTR (SA/EH), API 56 SPD (ES/SA/EH), API 69 SORT (SA/EH), API 70 TKY (SA/EH), API 71 HKY (SA/EH), API 72 DSW (SA), API 74 SEGL (SA), API 75 ARWS, API 80 RS (ES/SA/EH), API 100 MODRD (ES/SA/EH), API 101 MODWR (ES/SA/EH), API 102 FWD (ES/SA/EH), API 59 PLSR (ES series MPU) API 77 PR (SA/EH series MPU) API 60 IST (ES/SA/EH series MPU) API 155 DABSR (SC/EH series MPU)
5-10
5.3
Devices only with On/Off status are called bit devices, e.g. X, Y, M and S. Devices used exclusively for storing numeric values are called word devices, e.g. T, C, D, E and F. Bit device plus a specific bit device (place a digit before the bit device in Kn) can be used in the operand of an application instruction in the form of numeric value. n = K1 ~ K4 for a 16-bit value; n = K1 ~ K8 for a 32-bit value. For example, K2M0 refers to a 8-bit value composed of M0 ~ M7.
Valid data
M15 M14 M13 M12 M11 M10 M9 M8 M7 M6 M5 M4 M3 M2 M1 M0
0 1 Low byte
Transmit to Reset to 0 D1 0
b15
0
b14
0
b13
0
b12
0
b11
0
b10
0
b9
0
b8
0
b7
1
b6
0
b5
1
b4
0
b3
1
b2
0
b1
1
b0
K1M0, K2M0, and K3M0 are transmitted to 16-bit registers and the vacant high bits will be filled in 0. The same rule applied to when K1M0, K2M0, K3M0, K4M0, K5M0, K6M0, and K7M0 are transmitted to 32-bit registers and the vacant high bits will be filled in 0. In the 16-bit (or 32-bit) operation, if the contents of the operand are designated as bit devices K1 ~ K3 (or K4 ~ K7), the vacant high bits will be regarded as 0. Therefore, the operation is a positive-value one.
5-11
BIN K2X4
D0
The BCD value composed of X4 ~ X13 will be converted to BIN value and sent to D0.
You can choose any No. for bit devices, but please make the 1s digit of X and Y 0, e.g. X0, X10, X20, Y0, Y10, and the 1s digit of M and S 8s multiple (0 is still the best choice), e.g. M0, M10, M20. Designating continuous device No. Take data register D for example, continuous D refers to D0, D1, D2, D3, D4. For bit devices with specifically designated digit, continuous No. refers to: K1X0 K2Y0 K3M0 K4S0 K1X4 K2Y10 K3M12 K4S16 K1X10 K2Y20 K3M24 K4S32 K1X14 Y2X30 K3M36 K4S48
Please follow the No. in the table and do not skip No. in case confusion may occur. In addition, if you use K4Y0 in the 32-bit operation, the higher 16 bits will be regarded as 0. For 32-bit data, please use K8Y0. The operations in DVP-PLC are conducted in BIN integers. When the integer performs division, e.g. 40 3 = 13 and the remainder is 1. When the integer performs square root operations, the decimal point will be left out. Use decimal point operation instructions to obtain the decimal point. Application instructions revelant to decimal point: API 49 (FLT) API 116 (D RAD) API 120 (D EADD) API 124 (D EXP) API 128 (D POW) API 132 (D TAN) API 136 (D SINH) API 173 (D SUBR) Binary Floating Point DVP-PLC represents floating points in 32 bits, following the IEEE754 standard:
8 bits 23 bits mantissa
API 110 (D ECMP) API 117 (D DEG) API 121 (D ESUB) API 125 (D LN) API 129 (INT) API 133 (D ASIN) API 137 (D COSH) API 174 (D MULR)
API 111 (D EZCP) API 118 (D EBCD) API 122 (D EMUL) API 126 (D LOG) API 130 (D SIN) API 134 (D ACOS) API 138 (D TANH) API 175 (D DIVR)
API 112 (D MOVR) API 119 (D EBIN) API 123 (D EDIV) API 127 (D ESQR) API 131 (D COS) API 135 (D ATAN) API 172 (D ADDR)
S b 31
exponent
b0
Sign bit 0: positive 1: negative
5-12
Step 4: Combine the sign bit, exponent and mantissa into a floating point
Example 2: Representing -23.0 in 32-bit floating point The steps required are the same as those in Example 1. The only difference is you have to alter the sign bit into 1.
DVP-PLC uses registers of 2 continuous No. to combine into a 32-bit floating point. For example, we use registers (D1, D0) for storing a binary floating point as below:
D1(b15~b0)
2 E7
7
D0(b15~b0)
0 -1 -2 -3
2 E6
2 E5
2 E1
2 A6
-17
2 A5
-18
2 A4
-19
2 A3
-20
2 A2
-21
2 A1
-22
2 A0
-23
b6
b5
b4
b3
b2
b1
b0
8 bits of exponent
Decimal Floating Point Since the binary floating point are not very user-friendly, we can convert it into a decimal floating point for use. Please be noted that the decimal point operation in DVP-PLC is still in binary floating point. The decimal floating point is represented by 2 continuous registers. The register of smaller No. is for the constant while the register of bigger No. is for the exponent. Example: Storing a decimal floating point in registers (D1, D0) Decimal floating point = [constant D0] 10 [exponent D1 ] Constant D0 = 1,000 ~ 9,999
5-13
5.4
SA/SX/SC, and 16 points E0 ~ E7 and F0 ~ F7 in EH/EH2/SV series MPU. E and F index registers are 16-bit data registers, can be read and written.
16-bit F0 32-bit F0
High byte
16-bit E0
If you need a 32-bit register, you have to designate E. In this case, F will be covered up by E and cannot be used; otherwise, the contents in E may become incorrect. (We recommend you use MOVP instruction to reset the contents in D to 0 when the PLC is switched on.) Combination of E and F when you designate a 32-bit index register: (E0, F0), (E1, F1), (E2, F2), ... (E7, F7)
E0
Low byte
modification refers to the content in the operand changes with the contents in E and F. For example, E0 = 8 and K20E0 represents constant K28 (20 + 8). When the condition is true, constant K28 will be transmitted to register D24.
20 + 8 = 28 10 + 14 = 24 Transmission
Devices modifiable in ES/EX/SS series MPU: P, X, Y, M, S, KnX, KnY, KnM, KnS, T, C, D. Devices modifiable in SA/SX/SC series MPU: P, X, Y, M, S, KnX, KnY, KnM, KnS, T, C, D Devices modifiable in EH/EH2/SV series MPU: P, I, X, Y, M, S, K, H, KnX, KnY, KnM, KnS, T, C, D E and F can modify the devices listed above but cannot modify themselves and Kn. K4M0E0 is valid and K0E0M0 is invalid. Grey columns in the table of operand at the beginning page of each application instruction indicate the operands modifiable by E and F.
5-14
5-15
API 20 46 47 62 66 75 76 82 87 133 134 135 155 172 218 219 220 232 233 234 236 237 238 15 18 19 44 00 01 10 14 84 108 131 137 146 193 194 197 05 23 25 41 72 117 143
P Instruction
Function Addition Timed Annunciator Set Annunciator Reset Absolute Drum Sequencer Alternate State Arrow Switch ASCII Code Conversion Converts Hex to ASCII Absolute Value Arc Sine Arc Cosine Arc Tangent Read the Absolute Position from a Servo Motor Floating Point Addition S1 & S2 S1 | S2 S1 ^ S2 S1 = S2 S1 > S2 S1 < S2 S1 S2 S1 S2 S1 S2 Block Move Binary Coded Decimal Binary Check Specified Bit Status Conditional Jump Call Subroutine Compare Compliment Check Code Checksum CRC Mode Cosine Hyperbolic Cosine Valve Control (*) 2-Axis Relative Position Arc Interpolation (*) 2-Axis Absolute Position Arc Interpolation (*) Close Loop Position Control (*) Disable Interrupts Division Decrement Decode Digital Switch Radian Angle Delay Instruction
Applicable to
ES
SA
EH
Page
ADD ANS ANR ABSD ALT ARWS ASC ASCI ABS AND& AND| AND^ AND= AND> AND< AND<> AND<= AND>= BMOV BCD BIN BON CJ CALL CMP CML CCD CRC CVM DI DIV DEC DECO DSW DELAY
DADD DABSD DABS DASIN DACOS DATAN DABSR DADDR DAND& DAND| DAND^ DAND= DAND> DAND< DAND<> DAND<= DAND>= DBCD DBIN DBON DCMP DCML DCOS DCOSH DCIMR DCIMA DCLLM DDIV DDEC DDEG -
6-32 6-66 6-66 7-46 7-54 7-70 7-72 7-94 7-106 8-45 8-46 8-47 9-23 9-64 10-8 10-8 10-8 10-11 10-11 10-11 10-11 10-11 10-11 6-24 6-29 6-30 6-64 6-1 6-5 6-18 6-23 7-101 8-18 8-41 8-49 8-58 9-91 9-96 9-105 6-8 6-37 6-40 6-59 7-64 8-25 8-51
5-16
API
P Instruction
Function Drive to Increment Drive to Absolute Floating Point Division Enable Interrupts Encode Floating Point Compare Floating Point Zone Compare Float to Scientific Conversion Scientific to Float Conversion Floating Point Addition Floating Point Subtraction Floating Point Multiplication Floating Point Division Exponent of Binary Floating Point Floating Point Square Root
Applicable to
ES
SA
EH
Page
158 DRVI 159 DRVA 175 04 42 110 111 118 EI ENCO FEND FOR FMOV FLT FROM FTC GPWM GRY GBIN HKY HEX HOUR HST IRET INC IST INCD -
DDRVI DDRVA DDIVR DECMP DEZCP DEBCD DEBIN DEADD DESUB DEMUL DEDIV DEXP DESQR DFMOV DFLT DFROM DGRY DGBIN DHSCS DHSCR DHSZ DHKY DHOUR DINC DINT DLN DLOG DLD& DLD| DLD^ DLD= DLD> DLD< DLD<>
9-33 9-40 9-67 6-8 6-61 8-21 8-22 8-26 8-27 8-29 8-30 8-31 8-32 8-33 8-36 6-12 6-15 6-26 6-70 7-75 8-10
The End of the Main Program (First End) Start of a FOR-NEXT Loop Fill Move Floating Point Read CR Data in Special Modules
102 FWD
Forward Running of VFD-A Fuzzy Temperature Control General PWM Output BIN Gray Code Gray Code BIN High Speed Counter Set High Speed Counter Reset High Speed Zone Compare Hexadecimal Key Input Converts ASCII to Hex Hour Meter High Speed Timer Interrupt Return Increment Initial State Increment Drum Sequencer Float to Integer Checksum LRC Mode Natural Logarithm of Binary Floating Point Logarithm of Binary Floating Point
8-53 8-52 9-62 9-63 7-5 7-15 7-17 7-61 7-98 9-60 9-103 6-8 6-39 7-39 7-48 8-38 8-16 8-34 8-35
215 LD&
216 LD| 217 224 225 226 LD^ LD= LD> LD<
228 LD<>
5-17
API
P Instruction
Function S1 S2 S1 S2 Move Multiplication Mean Input Matrix Read Modbus Data Write Modbus Data Move Floating Point Data Read File Register Write File Register Read/Write MODBUS Data Floating Point Multiplication Matrix AND Operation Matrix OR Operation Matrix XOR Operation Matrix XNR Operation Matrix Inverse Operation Matrix Compare Read Matrix Bit Write Matrix Bit Matrix Bit Displacement Matrix Bit Rotation Matrix Bit Status Counting End of a FOR-NEXT Loop 2s Complement (Negative) S1 & S2 S1 | S2 S1 ^ S2 S1 = S2 S1 > S2 S1 < S2 S1 S2 S1 S2 S1 S2 Pulse Y Output Pulse Width Modulation Pulse Ramp Print (ASCII Code Output) Parallel Run PID Control Loop Floating Point Power Operation Detection of Input Pulse Width Adjustable Speed Pulse Output 2-Axis Relative Point to Point Motion (*) 2-Axis Absolute Point to Point Motion (*) Single-Axis Pulse Output by Table (*) Rotation Right Rotation Left
Applicable to
ES
SA
EH
Page
229 LD<= 230 LD>= 12 22 45 52 100 101 112 148 149 150 174 180 181 182 183 184 185 186 187 188 189 190 09 29 221 222 223 240 241 242 244 245 246 57 58 59 77 81 88 128 151 157 191 192 195 30 31 MOV MUL MEAN MTR MODRD MODWR MEMR MEMW MODRW MAND MOR MXOR MXNR MINV MCMP MBRD MBWR MBS MBR MBC NEXT NEG OR& OR| OR^ OR= OR> OR< OR<> OR<= OR>= PLSY PWM PLSR PR PRUN PID PWD PLSV ROR ROL
10-10 10-10 6-20 6-35 6-65 7-3 8-1 8-5 8-23 8-62 8-63 9-1 9-66 9-69 9-71 9-72 9-73 9-74 9-75 9-77 9-79 9-81 9-83 9-85 6-15 6-44 10-9 10-9 10-9 10-12 10-12 10-12 10-12 10-12 10-12 7-26 7-32 7-35 7-73 7-93 7-107 8-37 9-19 9-20 9-86 9-89 9-101 6-46 6-47
DNEG DOR& DOR| DOR^ DOR= DOR> DOR< DOR<> DOR<= DOR>= DPLSY DPLSR DPRUN DPID DPOW DPLSV DPPMR DPPMA DPTPO DROR DROL
5-18
P Instruction
Function Rotation Right with Carry Rotation Left with Carry Refresh Refresh and Filter Adjust Ramp Variable Value Serial Communication Instruction Reverse Running of VFD-A Read VFD-A Status Reset Abnormal VFD-A Angle Radian Start of the Measurement of Execution Time of I Interruption End of the Measurement of the Execution Time of I Interruption Random Number Subroutine Return Shift Move Subtraction Bit Shift Right Bit Shift Left Shift Register Write Shift Register Read Sum of Active Bits Square Root Speed Detection Search a Data Stack Special Timer Sort Tabulated Data Seven Segment Decoder Seven Segment with Latch Stop VFD-A Read Digital Switch Sine Hyperbolic Sine Byte Swap Floating Point Subtraction Proportional Value Calculation Parameter Proportional Value Calculation
Applicable to
ES
SA
EH
Page
DRCR DRCL -
DRAD
6-48 6-49 7-1 7-2 7-55 7-80 8-10 8-13 8-15 8-24 9-20 9-20 9-22 6-5 6-21 6-34 6-50 6-51 6-55 6-56 6-63 6-72 7-24 7-45 7-52 7-57 7-66 7-67 8-10 8-20 8-39 8-48 8-61 9-65 10-1 10-3
152 RTMU 153 RTMD 154 02 13 21 34 35 38 39 43 48 56 61 65 69 73 74 104 109 130 136 173 RAND SRET SMOV SUB SFTR SFTL SFWR SFRD SUM SQR SPD SER STMR SORT SEGD SEGL STOP SWRD -
DSUB
147 SWAP 202 SCAL 203 SCLP 64 70 79 132 138 TTMR TKY TO -
Teaching Timer Ten Key Input Write CR Data into Special Modules Tangent Hyperbolic Tangent Time Compare Time Zone Compare Time Addition Time Subtraction Time Read
160 TCMP 161 TZCP 162 TADD 163 TSUB 166 TRD
5-19
API
P Instruction
Function Time Write Volume Read Volume Scale Watchdog Timer Refresh Logical Word AND Logical Word OR Logical Exclusive OR Word Shift Right Word Shift Left Exchange Zone Compare Zero Reset Zero Return
Applicable to
ES
SA
EH
Page
T V
167 TWR 85 86 07 26 27 28 36 37 17 VRRD VRSC WDT WAND WOR WXOR WSFR WSFL XCH
9-58 7-103 7-105 6-14 6-41 6-42 6-43 6-52 6-54 6-27 6-19 6-57 9-28
X Z
Instructions marked with * are available in EH2/SV series MPU. Note: 1. For applicable models, ES includes ES/EX/SS; SA includes SA/SX/SC; EH includes EH/EH2/SV. 2. ES/EX/SS series MPU does not support pulse execution type instructions (P instruction).
5-20
Operands: S: The destination pointer of conditional jump Explanations: 1. 2. 3. 4. 5. 6. 7. 8. Operand S can designate P P can be modified by index register E, F In ES/EX/SS series models: Operand S can designate P0 ~ P63 In SA/SX/SC/EH/EH2/SV series models: Operand S can designate P0 ~ P255 When the user does not wish a particular part of PLC program in order to shorten the scan time and execute dual outputs, CJ instruction or CJP instruction can be adopted. When the program designated by pointer P is prior to CJ instruction, WDT timeout will occur and PLC will stop running. Please use it carefully. CJ instruction can designate the same pointer P repeatedly. However, CJ and CALL cannot designate the same pointer P; otherwise an error will occur. Actions of all devices while conditional jumping is being executed. a) Y, M and S remain their previous status before the conditional jump takes place. b) Timer 10ms and 100ms that is executing stops. c) Timer T192 ~ T199 that execute the subroutine program will continue and the output contact executes normally. d) The high-speed counter that is executing the counting continues counting and the output contact executes normally. e) The ordinary counters stop executing. f) If the reset instruction of the timer is executed before the conditional jump, the device will still be in the reset status while conditional jumping is being executed. g) Ordinary application instructions are not executed. h) The application instructions that are being executed, i.e. API 53 DHSCS, API 54 DHSCR, API 55 DHSZ, API 56 SPD, API 57 PLSY, API 58 PWM, API 59 PLSR, API 157 PLSV, API 158 DRVI, API 159 DRVA, continue being executed. Program Example 1: 1. 2. When X0 = On, the program automatically jumps from address 0 to N (the designated label P1) and keeps its execution. The addresses between 0 and N will not be executed. When X0 = Off, as an ordinary program, the program keeps on executing from address 0. CJ instruction will not be executed at this time.
6-1
Program Example 2: 1. CJ instruction can be used in the following 5 conditions between MC and MCR instructions. a) Without MC ~ MCR. b) From without MC to within MC. Valid in the loop P1 as shown in the figure below. c) In the same level N, inside of MC~MCR. d) From within MC to without MCR. e) Jumping from this MC ~ MCR to another MC ~ MCR1. 2. Actions in ES/EX/SS series models V4.7 (and below): When CJ instruction is used between MC and MCR, it can only be applied without MC ~ MCR or in the same N layer of MC ~ MCR. Jumping from this MC ~ MCR to another MC ~ MCR will result in errors, i.e. a) and c) as stated above can ensure correct actions; others will cause errors. 3. When MC instruction is executed, PLC will push the status of the switch contact into the self-defined stack in PLC. The stack will be controlled by the PLC, and the user cannot change it. When MCR instruction is executed, PLC will obtain the previous status of the switch contact from the top layer of the stack. Under the conditions as stated in b), d) and e), the times of pushing-in and obtaining stack may be different. In this case, the maximum stack available to be pushed in is 8 and the obtaining of stacks cannot resume once the stack becomes empty. Thus, when using CALL or CJ instructions, the user has to be aware of the pushing-in and obtaining of stacks.
X0 MC X2 CJ X3 CJ X1 MC M1000 P1 Y1 MCR M1000 P0 Y0 MCR N0 N1 N1 P1 P0 N0
This function is only available in ES/EX/SS series models V4.9 (and above) and SA/SX/SC/EH/EH2/SV series models.
6-2
1 1
Timer T0 is not enabled. Timer T0 immediately stops and is latched. M0 On Off, T0 is reset as 0. Timer T240 is not enabled. Once the timer function is enabled and when met with CJ instruction, all accumulative timers will stop timing and stay latched. M0 On Off. T240 remains unchanged. Counter does not count. Counter C0 stops counting and stays latched. After M0 goes Off, C0 resumes its counting. Application instructions are not executed. The skipped application instructions are not executed, but API 53 ~ 59, API 157 ~ 159 keep being executed.
M6 On
M6 On Off
M11 Off On
M11 On
M11 On Off
*1: Y1 is a dual output. When M0 is Off, M1 will control Y1. When M0 is On, M12 will control Y1. *2: When the timers (T192 ~ T199, applicable in SA/EH series MPU) used by a subroutine re driven and encounter the execution of CJ instruction, the timing will resume. After the timing target is reached, the output contact of the timer will be On. *3: When the high-speed counters (C235 ~ C255) are driven and encounter the execution of CJ instruction, the
counting will resume, as well as the action of the output points.
6-3
6-4
Operands: S: The pointer of call subroutine. Explanations: 1. 2. 3. 4. 5. 6. 7. 8. Operand S can designate P. P can be modified by index register E, F. In ES/EX/SS series models: Operand S can designate P0 ~ P63. In SA/SX/SC/EH/EH2/SV series models: Operand S can designate P0 ~ P255. Edit the subroutine designated by the pointer after FEND instruction. The number of pointer P, when used by CALL, cannot be the same as the number designated by CJ instruction. If only CALL instruction is in use, it can call subroutines of the same pointer number with no limit on times. Subroutine can be nested for 5 levels including the initial CALL instruction. (If entering the sixth level, the subroutine wont be executed.)
API 02 OP N/A
Function
Controllers
ES/EX/SS SA/SX/SC EH/SV
Automatically returns to the step immediately following the CALL instruction which activated the subroutine
Explanations: 1. 2. No operand. No contact to drive the instruction is required. The subroutine will return to main program by SRET after the termination of subroutine and execute the sequence program located at the next step to the CALL instruction. Program Example 1: When X0 = On, CALL instruction is executed and the program jumps to the subroutine designated by P2. When SRET instruction is executed, the program returns to address 24 and continues its execution.
6-5
Program Example 2: 1. 2. 3. 4. 5. 6. When X10 goes from Off to On, its rising-edge trigger executes CALL P10 instruction and the program jumps to the subroutine designated by P10. When X11 is On, CALL P11 is executed and the program jumps to the subroutine designated by P11. When X12 is On, CALL P12 is executed and the program jumps to the subroutine designated by P12. When X13 is On, CALL P13 is executed and the program jumps to the subroutine designated by P13. When X14 is On, CALL P14 is executed and the program jumps to the subroutine designated by P14. When SRET is executed, the program returns to the previous P subroutine and continues its execution. After SRET instruction is executed in P10 subroutine, returning to the main program.
6-6
6-7
Function
Controllers
ES/EX/SS SA/SX/SC EH/SV
Explanations: 1. 2. 3. No operand. No contact to drive the instruction is required. Interruption return refers to interrupt the subroutine. After the interruption is over, returning to the main program from IRET to execute the next instruction where the program was interrupted. API 04 OP N/A Mnemonic EI Enable Interrupts Descriptions See more details of the explanation on this instruction in DI EI: 1 steps (Disable Interruption) instruction.
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Function
Controllers
ES/EX/SS SA/SX/SC EH/SV
Program Steps
Explanations: 1. 2. 3. 4. API 05 OP No operand. No contact to drive the instruction is required. The pulse width of the interruption signal should be >200us. See DI instruction for the range of the No. of I for all models. See DI instruction for more details about M1050 ~ M1059, M1280 ~ M1299. Mnemonic DI Disable Interrupts Descriptions When the special auxiliary relay M1050 ~ M1059, M1280 ~ N/A M1299 for disabling interruption is driven, the corresponding interruption request will not be executed even in the range allowed for interruptions.
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Function
Controllers
ES/EX/SS SA/SX/SC EH/SV
Explanations: 1. 2. No operand. No contact to drive the instruction is required. EI instruction allows interrupting subroutine in the program, e.g. external interruption, timed interruption, and high-speed counter interruption.
6-8
Disable interruption
Interruption subroutine B
Remarks: 1. No. of interruption pointer I in ES/EX/SS: a) External interruptions: (I001, X0), (I101, X1), (I201, X2), (I301, X3) 4 points2. b) Time interruptions: I6, 1 point ( = 10 ~ 99, time base = 1ms) (support V5.7 and above)
2
Input points occupied by external interruptions cannot be used for inputs of high-speed counters; otherwise grammar check errors may occur when the program is written in PLC.
6-9
Disable interruption flags in SA/SX/SC: Flag M1050 M1051 M1052 M1053 M1054 M1055 Function Disable external interruption I001 Disable external interruption I101 Disable external interruption I201 Disable external interruption I301 Disable external interruption I401 Disable external interruption I501
6-10
Disable interruption flags in EH/EH2/SV: Flag M1280 M1281 M1282 M1283 M1284 M1285 M1286 M1287 M1288 M1289 M1290 M1291 M1292 M1293 M1294 M1295 M1296 M1297 M1298 M1299 M1300 M1301 M1302 M1340 M1341 M1342 M1343 Function Disable external interruption I00 Disable external interruption I10 Disable external interruption I20 Disable external interruption I30 Disable external interruption I40 Disable external interruption I50 Disable time interruption I6 Disable time interruption I7 Disable time interruption I8 Disable high-speed counter interruption I010 Disable high-speed counter interruption I020 Disable high-speed counter interruption I030 Disable high-speed counter interruption I040 Disable high-speed counter interruption I050 Disable high-speed counter interruption I060 Disable pulse output interruption I110 Disable pulse output interruption I120 Disable pulse output interruption I130 Disable pulse output interruption I140 Disable communication interruption I150 Disable communication interruption I160 Disable communication interruption I170 Disable frequency measurement card interruption I180 Generate interruption I110 after CH0 pulse is sent Generate interruption I120 after CH1 pulse is sent Generate interruption I130 when CH0 pulse is being sent Generate interruption I140 when CH1 pulse is being sent
6-11
Explanations: 1. 2. 3. 4. 5. This instruction denotes the end of the main program. It has the same function as that of END instruction when being executed by PLC. CALL must be written after FEND instruction and add SRET instruction in the end of its subroutine. Interruption program has to be written after FEND instruction and IRET must be added in the end of the service program. If several FEND instructions are in use, place the subroutine and interruption service programs between the final FEND and END instruction. After CALL instruction is executed, executing FEND before SRET will result in errors in the program. After FOR instruction is executed, executing FEND before NEXT will result in errors in the program.
P0
main program
P63
I301
Interruption subroutine
6-12
P0
main program
P63
I301
Interruption subroutine
6-13
Explanations: 1. 2. 3. No operand. The watchdog timer in DVP series PLCs is used for monitoring the operation of the PLC system. WDT instruction can be used to reset Watch Dog Timer. If the PLC scan time (from step 0 to END or when FEND instruction is executed) exceeds 200ms, PLC ERROR LED will flash. The user will have to turn off PLC and back On again. PLC will determine RUN/STOP status by RUN/STOP switch. If there is no RUN/STOP switch, PLC will return to STOP status automatically. 4. When to use WDT: a) When errors occur in the PLC system. b) When the executing time of the program is too long, resulting in the scan time being larger than the content in D1000, the user can improve the problem by the following two methods. Using WDT instruction
STEP0 WDT END(FEND)
t1
t2
Using the set value in D1000 (default value: 200ms) to change the time for watchdog. Program Example: Assume the scan time of the program is 300ms, divide the program into two parts and place WDT instruction in the middle of the two parts, making scan time of the first half and second half of the program being less than 200ms.
300ms program END
Dividing the program to two parts so that both parts' scan time are less than 200ms.
6-14
Program Steps
Operands: S: The number of repeated nested loops Explanations: 1. 2. No contact to drive the instruction is required. See the specifications of each model for their range of use.
API 09 OP N/A
Mnemonic NEXT
Controllers
ES/EX/SS SA/SX/SC EH/SV
Explanations: 1. 2. 3. 4. 5. No operand. No contact to drive the instruction is required. FOR instruction indicates FOR ~ NEXT loops executing back and forth N times before escaping for the next execution. N = K1 ~ K32,767. N is regarded as K1 when N 1. When FOR~NEXT loops are not executed, the user can use the CJ instruction to escape the loops. Error will occur when
a) NEXT instruction is before FOR instruction. b) FOR instruction exists but NEXT instruction does not exist. c) There is NEXT instruction after FEND or END instruction. d) The number of instructions between FOR ~ NEXT differs. 6. FOR~NEXT loops can be nested for maximum five levels. Be careful that if there are too many loops, the increased PLC scan time may cause timeout of watchdog timer and error. Users can use WDT instruction to modify this problem. Program Example 1: After program A has been executed for 3 times, it will resume its execution after NEXT instruction. Program B will be executed for 4 times whenever program A is executed once. Therefore, program B will be executed 3 4 = 12 times in total.
6-15
Program Example 2: When X7 = Off, PLC will execute the program between FOR ~ NEXT. When X7 = On, CJ instruction jumps to P6 and avoids executing the programs between FOR ~ NEXT.
X7 CJ M0 MOV FOR M0 MOV INC MEXT P6 X10 Y10 D0 D0 D1 K0 K3 D0 P6
6-16
6-17
Bit Devices X Y M S
*
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S1: Comparison Value 1 S2: Comparison Value 2 D: Comparison result Explanations: 1. 2. 3. 4. 5. If S1 and S2 are used in device F, only 16-bit instruction is applicable. Operand D occupies 3 consecutive devices. See the specifications of each model for their range of use. The contents in S1 and S2 are compared and the result will be stored in D. The two comparison values are compared algebraically and the two values are signed binary values. When b15 = 1 in 16-bit instruction or b31 = 1 in 32-bit instruction, the comparison will regard the value as negative binary values. Program Example: 1. 2. 3. Designate device Y0, and operand D automatically occupies Y0, Y1, and Y2. When X10 = On, CMP instruction will be executed and one of Y0, Y1, and Y2 will be On. When X10 = Off, CMP instruction will not be executed and Y0, Y1, and Y2 remain their status before X10 = Off. If the user need to obtain a comparison result with , and , make a series parallel connection between Y0 ~ Y2.
X10 CMP Y0 If K10>D10, Y0 = On Y1 If K10=D10, Y1 = On Y2 If K10<D10, Y2= On K10 D10 Y0
4.
6-18
Bit Devices X Y M S
Program Steps
*
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S1: Lower bound of zone comparison D: Comparison result Explanations: 1. 2. 3. 4. 5. 6. 7. If S1, S2 and S are used in device F, only 16-bit instruction is applicable. The content in S1 should be smaller than the content in S2. Operand D occupies 3 consecutive devices. See the specifications of each model for their range of use. S is compared with its S1, S2 and the result is stored in D. When S1 > S2, the instruction performs comparison by using S1 as the lower/upper bound. The two comparison values are compared algebraically and the two values are signed binary values. When b15 = 1 in 16-bit instruction or b31 = 1 in 32-bit instruction, the comparison will regard the value as negative binary values. Program Example: 1. 2. Designate device M0, and operand D automatically occupies M0, M1 and M2. When X0 = On, ZCP instruction will be executed and one of M0, M1, and M2 will be On. When X0 = Off, ZCP instruction will not be executed and M0, M1, and M2 remain their status before X0 = Off.
X0 ZCP M0 If C10 < K10, M0 = On M1 M2 If K10 < C10 < K100, M1 = On = = If C10 > K100, M2 = On K10 K100 C10 M0
3.
6-19
Bit Devices X Y M S
Operands: S: Source of data Explanations: 1. 2. 3. 4. If S and D are used in device F, only 16-bit instruction is applicable. See the specifications of each model for their range of use. When this instruction is executed, the content of S will be moved directly to D. When this instruction is not executed, the content of D remains unchanged. If the operation result refers to a 32-bit output, (i.e. application instruction MUL and so on), and the user needs to move the present value in the 32-bit high-speed counter, DMOV instruction has to be adopted. Program Example: 1. MOV instruction has to be adopted in the moving of 16-bit data. register. b) When X1 = Off, the content in D10 will remain unchanged. If X1 = On, the present value T0 will be moved to D10 data register. 2. DMOV instruction has to be adopted in the moving of 32-bit data. When X2 = Off, the content in (D31, D30) and (D41, D40) will remain unchanged. If X2 = On, the present value of (D21, D20) will be sent to (D31, D30) data register. Meanwhile, the present value of C235 will be moved to (D41, D40) data register.
X0 MOV X1 MOV X2 DMOV DMOV D20 C235 D30 D40 T0 D10 K10 D0
D: Destination of data
a) When X0 = Off, the content in D10 will remain unchanged. If X0 = On, the value K10 will be moved to D10 data
6-20
Bit Devices X Y M S
Program Steps
Operands: S: Source of data source data Explanations: 1. This instruction is able to re-allocate or combine data. When the instruction is executed, m2 digits of contents starting from digit m1 (from high digit to low digit) of S will be sent to m2 digits starting from digit n (from high digit to low digit) of D. 2. 3. 4. Range: m1 = 1 ~ 4; m2 = 1 ~ m1; n = m2 ~ 4 See the specifications of each model for their range of use. M1168 is designated by SMOV working mode. When M1168 = On, the program is in BIN mode. When M1168 = Off, the program is in BCD mode. Program Example 1: 1. When M1168 = Off (in BCD mode) and X0 = On, the 4th (thousand) and 3rd (hundred) digit of the decimal value in D10 start to move to the 3rd (hundred) and 2nd (ten) digit of the decimal value in D20. 103 and 100 of D20 remain unchanged after this instruction is executed. 2. When the BCD value exceeds the range of 0 ~ 9,999, PLC will determine an operation error and will not execute the instruction. M1067, M1068 = On and D1067 records the error code OE18 (hex).
M1001 M1168 X0 SMOV D10 K4 K2 D20 K3
m1: Start digit to be moved of the source data m2: Number of digits (nibbles) to be moved of the n: Start digit of the destination position for the moved digits
D: Destination device
D10(BIN 16 bits)
Auto conversion
10
10
10
10
D10(BCD 4 digits)
Shift move
Unchanged
Unchanged
10
10
10
10
D20(BCD 4 digits)
Auto conversion
D20(BIN 16 bits)
Before the execution, assume D10 = K1234 and D20 = K5678. After the execution, D10 will remain unchanged and D20 will become K5128.
6-21
Digit 4
Digit 3
Digit 2
Digit 1
D10(BIN 16 bits)
Moving digits
D20(BIN 16 bits)
Digit 4 Unchanged Digit 3 Digit 2 Digit 1 Unchanged
Before the execution, assume D10 = H1234 and D20 = H5678. After the execution, D10 will remain unchanged and D20 will become H5128. Program Example 3: 1. 2. 3. This instruction can be used to combine the DIP switches connected to the input terminals with interrupted No. Move the 2nd right digit of the DIP switch to the 2nd right digit of D2, and the 1st left digit of the DIP switch to the 1st right digit of D1. Use SMOV instruction to move the 1st digit of D1 to the 3rd digit of D2 and combine the two DIP switches into one.
10 6
8 8 8
2
10 4
10 2
X13~X10
X27~X20
PLC
M1001 M1168 M1000 BIN BIN SMOV K2X20 K1X10 D1 D2 D1 K1 (X20~X27)BCD 2 digits D2(BIN) (X10~X13)BCD 1 digit D1(BIN) K1 D2 K3
6-22
Bit Devices X Y M S
Program Steps
K H KnX KnY KnM KnS T C D E F CML, CMLP: 5 steps * * * * * * * * * * * DCML, DCMLP: 9 steps * * * * * * * *
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S: Source of data D: Destination device Explanations: 1. 2. 3. 4. If S and D are used in device F, only 16-bit instruction is applicable. See the specifications of each model for their range of use. This instruction can be used for phase-reversed output. Reverse the phase (01, 10) of all the contents in S and send the contents to D. Given that the content is a constant K, K will be automatically converted into a BIN value. Program Example 1: 1. When X10 = On, b0 ~ b3 in D1 will be phase-reversed and send to Y0 ~ Y3.
X10 CML D1 K1Y0
b3 1
b2 0
b1 1
b0 0
0 No data
Program Example 2: The loop below can also adopt CML instruction (see right below).
X000 M0 X001 M1 X002 X003 M3 M1000 CML X000 M0 X001 M1 X002 X003 M3 M2 Normally on contact K1X0 K1M0 M2
6-23
Bit Devices X Y M S
Operands: S: Start of source devices D: Start of destination devices n: Number of data to be moved Explanations: 1. 2. 3. Range of n: 1 ~ 512 See the specifications of each model for their range of use. The contents in n registers starting from the device designated by S will be moved to n registers starting from the device designated by D. If n exceeds the actual number of available source devices, only the devices that fall within the valid range will be used. Program Example 1: When X10 = On, the contents in registers D0 ~ D3 will be moved to the 4 registers D20 ~ D23.
X10 D20 K4 D0 D1 D2 D3 D20 D21 D22 D23 n=4
Program Example 2: 1. 2. Assume the bit devices KnX, KnY, KnM and KnS are designated for moving, the number of digits of S and D has to be the same, i.e. their n has to be the same. ES/EX/SS do not support the use of KnX, KnY, KnM, KnS and E, F index register modification.
M1000 K1M0 K1Y0 K3 M0 M1 M2 M3
M4 M5 M6 M7 n=3
M8 M9 M10 M11
6-24
2.
In EH/EH2/SV, when S < D, the instruction is processed following the order 123
X11 BMOV D10 D11 K3 D10 D11 D12
3 2 1
D11 D13
3.
In ESEX/SS/SA/SX/SC, when S < D, avoid the number difference of 1 and the instruction is processed following the order 321. If the devices have the number difference of 1, the contents in D11 ~ D13 will all be the content in D10.
X11 BMOV D10 D11 K3 D10 D11 D12
3 2 1
D11 D13
6-25
Bit Devices X Y M S
Operands: S: Source of data D: Destination of data n: Number of data to be moved Explanations: 1. 2. 3. 4. If S is used in device F, only 16-bit instruction is applicable. Range of n: 1~ 512 (16-bit, 32-bit instructions) See the specifications of each model for their range of use. The contents in n registers starting from the device designated by S will be moved to n registers starting from the device designated by D. If n exceeds the actual number of available source devices, only the devices that fall within the valid range will be used. 5. ES/EX/SS do not support the use of KnX, KnY, KnM, KnS and E, F index register modification.
Program Example: When X10 = On, K10 will be moved to the 5 consecutive registers starting from D10.
X10 FMOV K10 D10 K5
K10
6-26
Bit Devices X Y M S
Program Steps
K H KnX KnY KnM KnS T C D E F XCH, XCHP: 5 steps * * * * * * * * DXCH, DXCHP: 9 steps * * * * * * * *
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: D1: Data to be exchanged 1 Explanations: 1. 2. 3. 4. If D1 and D2 are used in device F, only 16-bit instruction is applicable. See the specifications of each model for their range of use. The contents in the devices designated by D1 and D2 will exchange. Flag: M1303 (designated by XCH working mode). D2: Data to be exchanged 2
Program Example 1: When X0 = OffOn, the contents in D20 and D40 exchange with each other.
X0 XCHP
D20
D40
D20 D40
Program Example 2: When X0 = Off On, the contents in D100 and D200 exchange with each other.
X0 DXCHP D100 D200 D100 D101 D200 D201 40 20 20 40 Before execution After execution D100 D101 D200 D201
Remarks: 1. 2. 3. 4. ES/EX/SS do not support M1303. As a 16-bit instruction, when the devices designated by D1 and D2 are the same and M1303 = On, the upper and lower 8 bits of the designated devices exchange with each other. As a 32-bit instruction, when the devices designated by D1 and D2 are the same and M1303 = On, the upper and lower 16 bits in the individual designated device exchange with each other. When X0 = On and M1303 = On, the 16-bit contents in D100 and those in D101 will exchange with each other.
6-27
Before execution
After execution
9 20 8 40
8 40 9 20
6-28
Bit Devices X Y M S
Program Steps
K H KnX KnY KnM KnS T C D E F BCD, BCDP: 5 steps * * * * * * * * * DBCD, DBCDP: 9 steps * * * * * * * *
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S: Source of data D: Conversion result Explanations: 1. 2. 3. 4. 5. 6. If S and D are used in device F, only 16-bit instruction is applicable. See the specifications of each model for their range of use. Flags: M1067 (operation error); M1068 (operation error); D1067 (error code) The content in S (BIN value) is converted into BCD value and stored in D. As a 16-bit (32-bit) instruction, when the conversion result exceeds the range of 0 ~ 9,999 (0 ~ 99,999,999), and M1067, M1068 = On, D1067 will record the error code 0E18 (hex). The four arithmetic operations and applications in PLC and the execution of INC and DEC instructions are performed in BIN format. Therefore, if the user needs to see the decimal value display, simply use this instruction to convert the BIN value into BCD value. Program Example: 1. When X0 = On, the binary value of D10 will be converted into BCD value, and the 1s digit of the conversion result will be stored in K1Y0 (Y0 ~ Y3, the 4 bit devices).
X0 BCD D10 K1Y0
2.
When D10 = 001E (hex) = 0030 (decimal), the execution result will be: Y0 ~ Y3 = 0000(BIN).
6-29
Bit Devices X Y M S
Operands: S: Source of data D: Conversion result Explanations: 1. 2. 3. 4. 5. 6. 7. If S and D are used in device F, only 16-bit instruction is applicable. See the specifications of each model for their range of use. Flags: M1067 (operation error); M1068 (operation error); D1067 (error code) The content in S (BCD value) is converted into BIN value and stored in D. Valid range of S : BCD (0 ~ 9,999), DBCD (0 ~ 99,999,999) Provided the content in S is not a BCD value (in hex and any one of its digits does not fall in the range of 0 ~ 9), an operation error will occur. M1067, M1068 = On and D1067 records the error code 0E18 (hex). Constant K and H will automatically be converted into BIN format. Thus, they do not need to adopt this instruction. Program Example: When X0 = On, the BCD value of K1M0 will be converted to BIN value and stored in D10.
X0 BIN K1M0 D10
Remarks: Explanations on BCD and BIN instructions: 1. 2. 3. When PLC needs to read an external DIP switch in BCD format, BIN instruction has to be first adopted to convert the read data into BIN value and store the data in PLC. When PLC needs to display its stored data by a 7-segment display in BCD format, BCD instruction has to be first adopted to convert the data into BCD value and send the data to the 7-segment display. When X0 = On, the BCD value of K4X0 is converted into BIN value and sent it to D100. The BIN value of D100 will then be converted into BCD value and sent to K4Y20.
X0 BIN BCD K4X0 D100 D100 K4Y20
6-30
10 6
10 4
8
10 2
8
X17
X0
4-digit BCD value Using BIN instruction to store the BIN value into D100 Using BCD instruction to convert the content in D100 into a 4-digit BCD value.
Y37 Y20
6-31
Bit Devices X Y M S
Operands: S1: Summand Explanations: 1. 2. 3. 4. 5. 6. If S1, S2 and D are used in device F, only 16-bit instruction is applicable. See the specifications of each model for their range of use. Flags: M1020 (zero flag); M1021 (borrow flag); M1022 (carry flag) This instruction adds S1 and S2 in BIN format and store the result in D. The highest bit is symbolic bit 0 (+) and 1 (-), which is suitable for algebraic addition, e.g. 3 + (-9) = -6. Flag changes in binary addition In 16-bit BIN addition, a) If the operation result 0, zero flag M1020 = On. b) c) If the operation result -32,768, borrow flag M1021 = On. If the operation result 32,767, carry flag M1022 = On. S2: Addend D: Sum
In 32-bit BIN addition, a) b) c) If the operation result 0, zero flag M1020 = On. If the operation result -2,147,483,648, borrow flag M1021 = On. If the operation result 2,147,483,647, carry flag M1022 = On.
Program Example 1: In 16-bit BIN addition: When X0 = On, the content in D0 will plus the content in D10 and the sum will be stored in D20.
X0 ADD D0 D10 D20
Program Example 2: In 32-bit BIN addition: When X0 = On, the content in (D31, D30) will plus the content in (D41, D40) and the sum will be stored in (D51, D50). D30, D40 and D50 are low 16-bit data; D31, D41 and D51 are high 16-bit data.
X10 DADD D30 D40 D50
6-32
-2-10-32,768
-101
32,767012
Borrow flag
Carry flag
32-bit :
Zero flag
Zero flag
Zero flag
-2-10-2,147,483,648
-101
2,147,483,647012
Borrow flag
Carry flag
6-33
Bit Devices X Y M S
Operands: S1: Minuend Explanations: 1. 2. 3. 4. 5. 6. If S1, S2 and D are used in device F, only 16-bit instruction is applicable. See the specifications of each model for their range of use. Flags: M1020 (zero flag); M1021 (borrow flag); M1022 (carry flag) This instruction subtracts S1 and S2 in BIN format and stores the result in D. The highest bit is symbolic bit 0 (+) and 1 (-), which is suitable for algebraic subtraction. Flag changes in binary subtraction In 16-bit instruction: a) If the operation result 0, zero flag M1020 = On. b) If the operation result 32,768, borrow flag M1021 = On. c) If the operation result 32,767, carry flag M1022 = On. In 32-bit instruction: a) If the operation result 0, zero flag M1020 = On. b) If the operation result 2,147,483,648, borrow flag M1021 = On. c) If the operation result 2,147,483,647, carry flag M1022 = On. 7. For flag operations of SUB instruction and the positive/negative sign of the value, see the explanations in ADD instruction on the previous page. Program Example 1: In 16-bit BIN subtraction: When X0 = On, the content in D0 will minus the content in D10 and the remainder will be stored in D20.
X0 SUB D0 D10 D20
S2: Subtrahend
D: Remainder
Program Example 2: In 32-bit BIN subtraction: When X10 = On, the content in (D31, D30) will minus the content in (D41, D40) and the remainder will be stored in (D51, D50). D30, D40 and D50 are low 16-bit data; D31, D41 and D51 are high 16-bit data.
X10 DSUB D30 D40 D50
(D31, D30) (D41, D40) = (D51, D50) 6-34 DVP-PLC Application Manual
Bit Devices X Y M S
Program Steps
Operands: S1: Multiplicand Explanations: 1. 2. 3. 4. 5. 6. 7. If S1 and S2 are used in device F, only 16-bit instruction is applicable. If D is used in device E, only 16-bit instruction is applicable. In 16-bit instruction, D occupies 2 consecutive devices. In 32-bit instruction, D occupies 4 consecutive devices. See the specifications of each model for their range of use. This instruction multiplies S1 by S2 in BIN format and stores the result in D. Be careful with the positive/negative signs of S1, S2 and D when doing 16-bit and 32-bit operations. In 16-bit BIN multiplication,
+1 b15................ b00 X b15 is a symbol bit b15 is a symbol bit b15................ b00 b31............ b16 b15............. b00
S2: Multiplicator
D: Product
=
b31 is a symbol bit (b15 of D+1)
Symbol bit = 0 refers to a positive value. Symbol bit = 1 refers to a negative value.
When D serves as a bit device, it can designate K1 ~ K4 and construct a 16-bit result, occupying consecutive 2 groups of 16-bit data. ES/EX/SS only stores low 16-bit data. 8. 32-bit BIN multiplication,
+1 b31.. b16 b15.. b00 X b31 is a symbol bit b31 is a symbol bit +1 b31.. b16 b15.. b00 +3 +2 +1
=
b63 is a symbol bit (b15 of D+3 )
Symbol bit = 0 refers to a positive value. Symbol bit = 1 refers to a negative value.
When D serves as a bit device, it can designate K1 ~ K8 and construct a 32-bit result, occupying consecutive 2 groups of 32-bit data. Program Example: The 16-bit D0 is multiplied by the 16-bit D10 and brings forth a 32-bit product. The higher 16 bits are stored in D21
6-35
6-36
Bit Devices X Y M S
Program Steps
Operands: S1: Dividend Explanations: 1. 2. 3. 4. 5. 6. 7. 8. If S1 and S2 are used in device F, only 16-bit instruction is applicable. If D is used in device E, only 16-bit instruction is applicable. In 16-bit instruction, D occupies 2 consecutive devices. In 32-bit instruction, D occupies 4 consecutive devices. See the specifications of each model for their range of use. This instruction divides S1 and S2 in BIN format and stores the result in D. Be careful with the positive/negative signs of S1, S2 and D when doing 16-bit and 32-bit operations. This instruction will not be executed when the divisor is 0. M1067 and M1068 will be On and D1067 records the error code 0E19 (hex). In 16-bit BIN division,
Quotient Remainder +1
S2: Divisor
When D serves as a bit device, it can designate K1 ~ K4 and construct a 16-bit result, occupying consecutive 2 groups of 16-bit data and bringing forth the quotient and remainder. ES/EX/SS is able to bring forth only quotient without the remainder. 9. In 32-bit BIN division,
Quotient +1 +1 +1 Remainder +3 +2
When D serves as a bit device, it can designate K1 ~ K8 and construct a 32-bit result, occupying consecutive 2 groups of 32-bit data and bringing forth the quotient and remainder. Program Example: When X0 = On, D0 will be divided by D10 and the quotient will be stored in D20 and remainder in D21. On/Off of the highest bit indicates the positive/negative status of the result value.
6-37
6-38
Program Steps
K H KnX KnY KnM KnS T C D E F INC, INCP: 3 steps * * * * * * * * DINC, DINCP: 5 steps
Operands: D: Destination device Explanations: 1. 2. 3. 4. 5. 6. If D is used in device F, only 16-bit instruction is applicable. See the specifications of each model for their range of use. If the instruction is not a pulse execution one, the content in the designated device D will plus 1 in every scan period whenever the instruction is executed. This instruction adopts pulse execution instructions (INCP, DINCP). In 16-bit operation, 32,767 pluses 1 and obtains -32,768. In 32-bit operation, 2,147,483,647 pluses 1 and obtains -2,147,483,648. The operation results will not affect M1020 ~ M1022.
6-39
Operands: D: Destination device Explanations: 1. 2. 3. 4. 5. 6. If D is used in device F, only 16-bit instruction is applicable. See the specifications of each model for their range of use. If the instruction is not a pulse execution one, the content in the designated device D will minus 1 in every scan period whenever the instruction is executed. This instruction adopts pulse execution instructions (DECP, DDECP). In 16-bit operation, -32,768 minuses 1 and obtains 32,767. In 32-bit operation, -2,147,483,648 minuses 1 and obtains 2,147,483,647. The operation results will not affect M1020 ~ M1022.
6-40
Program Steps
Operands: S1: Source data device 1 Explanations: 1. 2. 3. 4. If S1, S2 and D are used in device F, only 16-bit instruction is applicable. See the specifications of each model for their range of use. This instruction conducts logical AND operation of S1 and S2 and stores the result in D. Operation rule: The corresponding bit of the operation result in D will be 0 if any of the bits in S1 or S2 is 0. S2: Source data device 2 D: Operation result
Program Example 1: When X0 = On, the 16-bit D0 and D2 will perform WAND, logical AND operation, and the result will be stored in D4.
X0 WAND D0 D2 D4
b0 b15 D0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 WAND D2 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 D4 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0
Program Example 2: When X1 = On, the 32-bit (D11, D10) and (D21, D20) will perform DAND, logical AND operation, and the result will be stored in (D41, D40).
X1 DAND D10 D20 D40
Before execution
After execution
6-41
Operands: S1: Source data device 1 Explanations: 1. 2. 3. 4. If S1, S2 and D are used in device F, only 16-bit instruction is applicable. See the specifications of each model for their range of use. This instruction conducts logical OR operation of S1 and S2 and stores the result in D. Operation rule: The corresponding bit of the operation result in D will be 1 if any of the bits in S1 or S2 is 1. S2: Source data device 2 D: Operation result
Program Example 1: When X0 = On, the 16-bit D0 and D2 will perform WOR, logical OR operation, and the result will be stored in D4.
X0 WOR D0 D2 D4
Before execution
b0 b15 D0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 WOR D2 0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1 D4 0 1 0 1 1 1 1 1 1 1 1 1 0 1 0 1
After execution
Program Example 2: When X1 = On, the 32-bit (D11, D10) and (D21, D20) will perform DOR, logical OR operation, and the result will be stored in (D41, D40).
X1 DOR D10 D20 D40
b15
b0
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 DOR 0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1 0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 0 1 0 1
D41 D40 0 1 0 1 1 1 1 1 1 1 1 1 0 1 0 1
6-42
Program Steps
Operands: S1: Source data device 1 Explanations: 1. 2. 3. 4. If S1, S2 and D are used in device F, only 16-bit instruction is applicable. See the specifications of each model for their range of use. This instruction conducts logical XOR operation of S1 and S2 and stores the result in D. Operation rule: If the bits in S1 and S2 are the same, the corresponding bit of the operation result in D will be 0; if the bits in S1 and S2 are different, the corresponding bit of the operation result in D will be 1. Program Example 1: When X0 = On, the 16-bit D0 and D2 will perform WXOR, logical XOR operation, and the result will be stored in D4.
X0 WXOR D0 D2 D4
D: Operation result
b0 b15 D0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 WOR D2 0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1 D4 0 1 0 1 1 0 1 0 1 1 1 1 0 0 0 0
Program Example 2: When X1 = On, the 32-bit (D11, D10) and (D21, D20) will perform DXOR, logical XOR operation, and the result will be stored in (D41, D40).
X1 DXOR D10 D20 D40
Before execution
b0 1 1 1 1
0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 1 1 1 0 1 1 0 1 0 0 1 1 1 0 1 1
After execution
D41 D40 1 1 1 0 1 1 0 1 0 0 1 1 1 0 1 1
6-43
Operands: D: Device to store 2s complement Explanations: 1. 2. 3. 4. If D is used in device F, only 16-bit instruction is applicable. See the specifications of each model for their range of use. This instruction converts a negative BIN value into an absolute value. This instruction adopts pulse execution instructions (NEGP, DNEGP).
Program Example 1: When X0 = OffOn, the phase of every bit of the content in D10 will be reversed (01, 10) and pluses 1. The result will then be stored in D10.
X0 NEGP D10
Program Example 2: Obtaining the absolute value of a negative value: a) When the 15th bit of D0 is 1, M0 = On. (D0 is a negative value). b) When M0 = OffOn, NEG instruction will obtain 2s complement of D0 and further its absolute value.
M1000 BON Normal ON contact M0 NEGP D0 D0 M0 K15
Program Example 3: Obtaining the absolute value by the remainder of the subtraction. When X0 = On, a) If D0 > D2, M0 = On. b) If D0 = D2, M1 = On. c) If D0 < D2, M2 = On. d) D4 is then able to remain positive.
6-44
Remarks: Negative value and its absolute value a) The sign of a value is indicated by the highest (most left) bit in the register. 0 indicates that the value is a positive one and 1 indicates that the value is a negative one. b) NEG instruction is able to convert a negative value into its absolute value.
(D0=2) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 (D0=1) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 (D0=0) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (D0=-1) 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 (D0=-2) 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 (D0=-3) 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 (D0=-4) 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 (D0=-5) 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 (D0)+1=1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 (D0)+1=2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 (D0)+1=3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 (D0)+1=4 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 (D0)+1=5 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1
6-45
Operands: D: Device to be rotated Explanations: 1. 2. 3. 4. 5. 6. 7. If D is used in device F, only 16-bit instruction is applicable. If D is designated as KnY, KnM, and KnS, only K4 (16-bit) and K8 (32-bit) are valid. Range of n: K1 ~ K16 (16-bit); K1 ~ K32 (32-bit) See the specifications of each model for their range of use. Flag: M1022 (carry flag) This instruction rotates the device content designated by D to the right for n bits. This instruction adopts pulse execution instructions (RORP, DRORP). n: Number of bits to be rotated in 1 rotation
Program Example: When X0 = OffOn, the 16 bits (4 bits as a group) in D10 will rotate to the right, as shown in the figure below. The bit marked with will be sent to carry flag M1022.
X0 RORP D10 K4
D10 0 1 1 1 1 0 1 1 0 1 0 0 0 1 0 1
16 bits After one rotation to the right
h igher bit
D10 0 1 0 1 0 1 1 1 1 0 1 1 0 1 0 0
6-46
Program Steps
K H KnX KnY KnM KnS T C D E F ROL, ROLP: 5 steps * * * * * * * * DROL, DROLP: 9 steps * *
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: D: Device to be rotated Explanations: 1. 2. 3. 4. 5. 6. 7. If D is used in device F, only 16-bit instruction is applicable. If D is designated as KnY, KnM, and KnS, only K4 (16-bit) and K8 (32-bit) are valid. Range of n: K1 ~ K16 (16-bit); K1 ~ K32 (32-bit) See the specifications of each model for their range of use. Flag: M1022 (carry flag) This instruction rotates the device content designated by D to the left for n bits. This instruction adopts pulse execution instructions (ROLP, DROLP). n: Number of bits to be rotated in 1 rotation
Program Example: When X0 = OffOn, the 16 bits (4 bits as a group) in D10 will rotate to the left, as shown in the figure below. The bit marked with will be sent to carry flag M1022.
X0 D10 K4
Rotate to the left higher bit Carry flag higher bit 1 Carry flag lower bit D10 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 16 bits After one rotation to the left lower bit D10
1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1
6-47
Operands: D: Device to be rotated Explanations: 1. 2. 3. 4. 5. 6. 7. If D is used in device F, only 16-bit instruction is applicable. If D is designated as KnY, KnM, and KnS, only K4 (16-bit) and K8 (32-bit) are valid. Range of n: K1 ~ K16 (16-bit); K1 ~ K32 (32-bit) See the specifications of each model for their range of use. Flag: M1022 (carry flag) This instruction rotates the device content designated by D together with carry flag M1022 to the right for n bits. This instruction adopts pulse execution instructions (RCRP, DRCRP). n: Number of bits to be rotated in 1 rotation
Program Example: When X0 = OffOn, the 16 bits (4 bits as a group) in D10 together with carry flag M1022 (total 17 bits) will rotate to the right, as shown in the figure below. The bit marked with will be sent to carry flag M1022.
X0 D10 Rotate to the right K4
D10
1 Carry flag
After one rotation to the right higher bit lower bit D10 1 1 0 1 0 0 0 0 1 1 1 1 0 0 0 0
0 Carry flag
6-48
Program Steps
K H KnX KnY KnM KnS T C D E F RCL, RCLP: 5 steps * * * * * * * * DRCL, DRCLP: 9 steps * *
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: D: Device to be rotated Explanations: 1. 2. 3. 4. 5. 6. 7. If D is used in device F, only 16-bit instruction is applicable. If D is designated as KnY, KnM, and KnS, only K4 (16-bit) and K8 (32-bit) are valid. Range of n: K1 ~ K16 (16-bit); K1 ~ K32 (32-bit) See the specifications of each model for their range of use. Flag: M1022 (carry flag) This instruction rotates the device content designated by D together with carry flag M1022 to the left for n bits. This instruction adopts pulse execution instructions (RCLP, DRCLP). n: Number of bits to be rotated in 1 rotation
Program Example : When X0 = OffOn, the 16 bits (4 bits as a group) in D10 together with carry flag M1022 (total 17 bits) will rotate to the left, as shown in the figure below. The bit marked with will be sent to carry flag M1022.
X0 RCLP D10 K4 Rotate to the left lower bit higher bit 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 D10 Carry flag higher bit Carry flag 16 bits After one rotation to the left
6-49
* *
* *
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S: Start No. of the shifted device D: Start No. of the device to be shifted n1: Length of data to be shifted n2: Number of bits to be shifted in 1 shift Explanations: 1. 2. 3. 4. 5. 6. 7. Range of n1: 1~ 1,024 Range of n2: 1 ~ n1 In ES/EX/SS, 1 n2 n1 512 ES/EX/SS series MPU does not support E, F index register modification. See the specifications of each model for their range of use. This instruction shifts the bit device of n1 bits (desired length for shifted register) starting from D to the right for n2 bits. S is shifted into D for n2 bits to supplement empty bits. This instruction adopts pulse execution instructions (SFTRP).
Program Example: 1. 2. When X0 = OffOn, M0 ~M15 will form 16 bits and shifts to the right (4 bits as a group). The figure below illustrates the right shift of the bits in one scan. M3 ~ M0 M7 ~ M4 carry M3 ~ M0 M7 ~ M4 M11 ~ M8
carry
6-50
Program Steps
* *
* *
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S: Start No. of the shifted device D: Start No. of the device to be shifted n1: Length of data to be shifted n2: Number of bits to be shifted in 1 shift Explanations: 1. 2. 3. 4. 5. 6. 7. Range of n1: 1~ 1,024 Range of n2: 1 ~ n1 In ES/EX/SS, 1 n2 n1 512 ES/EX/SS series MPU does not support E, F index register modification. See the specifications of each model for their range of use. This instruction shifts the bit device of n1 bits (desired length for shifted register) starting from D to the left for n2 bits. S is shifted into D for n2 bits to supplement empty bits. This instruction adopts pulse execution instructions (SFTLP).
Program Example: 1. 2. When X0 = OffOn, M0 ~M15 will form 16 bits and shifts to the left (4 bits as a group). The figure below illustrates the left shift of the bits in one scan. M15 ~ M12 M11 ~ M8 M7 ~ M4 M3 ~ M0 X3 ~ X0
X0 SFTR X0 M0 K16 K4
M3 ~ M0 completed
carry
6-51
Operands: S: Start No. of the shifted device D: Start No. of the device to be shifted n1: Length of data to be shifted n2: Number of words to be shifted in 1 shift Explanations: 1. 2. 3. 4. 5. 6. 7. The type of devices designated by S and D has to be the same, e.g. KnX, KnY, KnM, and KnS as a category and T, C, and D as another category. Provided the devices designated by S and D belong to Kn type, the number of digits of Kn has to be the same. Range of n1: 1~ 512 Range of n2: 1 ~ n1 See the specifications of each model for their range of use. This instruction shifts the stack data of n1 words starting from D to the right for n2 words. S is shifted into D for n2 words to supplement empty words. This instruction adopts pulse execution instructions (WSFRP)
Program Example 1: 1. 2. When X0 = OffOn, the 16 register stack data composed of D20 ~ D35 will shift to the right for 4 registers. The figure below illustrates the right shift of the words in one scan. D23 ~ D20 carry D27 ~ D24 D23 ~ D20 D31 ~ D28 D27 ~ D24 D35 ~ D32 D31 ~ D28 D13 ~ D10 D35 ~ D32 completed
X0 WSFRP D10 D20 K16 K4
D13 5 D35
D12 D34
D11
D33 D32
D28
D27 D26
D25
D24 D23
D22
D21 D20
Carry
6-52
X0
K4
K2
X27
X26 Y26
X25 Y25
X24 Y24
X23 Y23
X22 Y22
X21
3
Y27 Y21 Y20 Y15 Y14 Y13 Y12 Y11 Y10 Carry
6-53
Operands: S: Start No. of the shifted device D: Start No. of the device to be shifted n1: Length of data to be shifted n2: Number of words to be shifted in 1 shift Explanations: 1. 2. 3. 4. 5. 6. 7. The type of devices designated by S and D has to be the same, e.g. KnX, KnY, KnM, and KnS as a category and T, C, and D as another category. Provided the devices designated by S and D belong to Kn type, the number of digits of Kn has to be the same. Range of n1: 1~ 512 Range of n2: 1 ~ n1 See the specifications of each model for their range of use. This instruction shifts the stack data of n1 words starting from D to the left for n2 words. S is shifted into D for n2 words to supplement empty words. This instruction adopts pulse execution instructions (WSFLP)
Program Example: 1. 2. When X0 = OffOn, the 16 register stack data composed of D20 ~ D35 will shift to the left for 4 registers. The figure below illustrates the left shift of the words in one scan. D35 ~ D32 carry D31 ~ D28 D35 ~ D32 D27 ~ D24 D31 ~ D28 D23 ~ D20 D27 ~ D24 D13 ~ D10 D23 ~ D20 completed
X0 WSFLP D10 D20 K16 K4 D12 D22
Left-shifiting for 4 registers Carry D35 D34 D33 D32 D31 D30 D29 D28 D27 D26 D25
D11
D10 5
D21 D20
6-54
Program Steps
Operands: S: Device of stack data written in Explanations: 1. 2. 3. 4. Range of n: 2 ~ 512 See the specifications of each model for their range of use. Flag: M1022 (carry flag) The stack data of n words starting from D are defined as first-in, first-out stack data and designate the first device as the pointer. When the instruction is executed, the content in the pointer pluses 1, and the content in the device designated by S will be written into the designated location in the first-in, first-out stack data designated by the pointer. When the content in the pointer exceeds n - 1, this instruction will not process any new value written in and the carry flag M1022 = On. 5. This instruction adopts pulse execution instructions (SFWRP) D: Start No. of stack data n: Length of stack data
Program Example: 1. Pointer D0 is reset as 0. When X0 = OffOn, the content in D20 will be sent to D1 and the content in pointer D0 becomes 1. After the content in D20 is changed, make X0 = OffOn again, and the content in D2 will be sent to D2 and the content in D0 becomes 2. 2. The figure below illustrates the shift and writing in 1~2 execution of the instruction. The content in D20 is sent to D1. The content in pointer D0 becomes 1.
X10 RST X0 SFWRP D20 D0 K10 D0 Reset the content of D0 as 0 in advance
D0 =
Remarks: This instruction can be used together with API 39 SFRD for the reading/writing of first-in, first-out stack data.
6-55
Bit Devices X Y M S
Operands: S: Start No. of stack data Explanations: 1. 2. 3. 4. Range of n: 2 ~ 512 See the specifications of each model for their range of use. Flag: M1020 (zero flag) The stack data of n words starting from S are defined as first-in, first-out stack data. After the content in S minuses 1, the content in the device designated by (S + 1) will be written into the location designated by D, and (S + n-1) ~ (S + 2) will all right shift for one register while the content in (S + n-1) remains the same. When the content in S equals 0, this instruction will not process any new value read out and the zero flag M1020 = On. 5. This instruction adopts pulse execution instructions (SFRDP) D: Device of stack data read out n: Length of stack data
Program Example: 1. 2. When X0 = OffOn, the content in D1 will be sent to D21 and D9~D2 will shift to the right for 1 register (content in D9 remains unchanged) and the content in D0 minus 1. The figure below illustrates the shift and reading in 1~3 execution of the instruction. The content in D1 is sent to D21. D9 ~ D2 shift to the right for 1 register. The content in D0 minuses 1.
X0 SFRDP D0 D21 K10
Remarks: This instruction can be used together with API 38 SFWR for the reading/writing of first-in, first-out stack data.
6-56
Bit Devices X Y * * M * * S * *
Program Steps
Operands: D1: Start device of the range to be reset Explanations: 1. 2. 3. 4. 5. 6. 7. 8. No. of operand D1 No. of operand D2. D1 and D2 have to designate devices of the same type. ES/EX/SS series MPU does not support E, F index register modification. See the specifications of each model for their range of use. When the instruction is executed, area from D1 to D2 will be cleared. In ES/EX/SS, 16-bit counter and 32-bit counter cannot use ZRST instruction together. In SA/EH, 16-bit counter and 32-bit counter can use ZRST instruction together. When D1 > D2, only operands designated by D2 will be reset. D2: End device of the range to be reset
Program Example: 1. 2. 3. 4. 5. 6. When X0 = On, auxiliary relays M300 ~ M399 will be reset to Off. When X1 = On, 16 counters C0 ~ C127 will all be reset (writing in 0; contact and coil being reset to Off). When X10 = On, timers T0 ~ T127 will all be reset (writing in 0; contact and coil being reset to Off). When X2 = On, steps S0 ~ S127 will be reset to Off. When X3 = On, data registers D0 ~ D100 will be reset to 0. When X4 = On, 32-bit counters C235 ~ C254 will all be reset. (writing in 0; contact and coil being reset to Off)
X0 ZRST X1 ZRST X10 ZRST X2 ZRST X3 ZRST X4 ZRST C235 C254 D0 D100 S0 S127 T0 T127 C0 C127 M300 M399
Remarks: 1. 2. Devices, e.g. bit devices Y, M, S and word devices T, C, D, can use RST instruction. API 16 FMOV instruction is also to send K0 to word devices T, C, D or bit registers KnY, KnM, KnS for reset.
6-57
6-58
Bit Devices X * Y * * M * * S * *
Program Steps
Operands: S: Source device to be decoded Explanations: 1. 2. 3. 4. 5. 6. Range of n when D is a bit device: 1 ~ 8 Range of n when D is a word device: 1 ~ 4 ES/EX/SS series MPU does not support E, F index register modification. See the specifications of each model for their range of use. The lower n bits of S are decoded and the results of 2n bits are stored in D. This instruction adopts pulse execution instructions (DECOP) D: Device for storing the decoded result n: Length of decoded bits
Program Example 1: 1. 2. 3. 4. 5. When D is used as a bit device, n = 1 ~ 8. Errors will occur if n = 0 or n > 8. When n = 8, the maximum points to decode is 28 = 256 points. (Please be aware of the storage range of the devices after the decoding and do not use the devices repeatedly.) When X10 = OffOn, this instruction will decode the content in X0 ~ X2 to M100 ~ M107. When the source of data is 1 + 2 = 3, set M103, the 3rd bit starting from M100, as 1. After the execution of this instruction is completed and X10 turns to Off, the content that has been decoded and output keeps acting.
X10 DECOP
X2 0 4 7 0 6 0 5 0 4 0 X1 1 2 3 3 1
D10
X0 1 1 2 0
D20
K3
1 0
0 0
Program Example 2: 1. 2. 3. When D is used as a word device, n = 1 ~ 4. Errors will occur if n = 0 or n > 4. When n = 4, the maximum points to decode is 24 = 16 points. When X10 = OffOn, this instruction will decode b2 ~ b0 in D10 to b7 ~ b0 in D20. b15 ~ b8 that have not been used in D20 will all become 0.
6-59
b15 0 1 0 1 0 1 0
D10 1 0 1 0 1 0 0 4 2 0
b0 1 1 2 1 1 0 0 0 b0
all be 0 7 0 b15 0 0 0 0 0 0 0 0 6 0 5 0 4 0 3 1
D20
6-60
Bit Devices X * Y * M * S *
Program Steps
Operands: S: Source device to be encoded Explanations: 1. 2. 3. 4. 5. 6. 7. 8. Range of n when S is a bit device: 1 ~ 8 Range of n when S is a word device: 1 ~ 4 ES/EX/SS series MPU does not support E, F index register modification. See the specifications of each model for their range of use. The lower 2n bits of S are encoded and the result is stored in D. If several bits of S are 1, the first bit that is 1 will be processed orderly from high bit to low bit. If no bits of S is 1, M1067, M1068 = On and D1067 records the error code 0E1A (hex). This instruction adopts pulse execution instructions (ENCOP) D: Device for storing the encoded result n: Length of encoded bits
Program Example 1: 1. 2. 3. 4. When S is used as a bit device, n = 1 ~ 8. Errors will occur if n = 0 or n > 8. When n = 8, the maximum points to encode is 28 = 256 points. When X10 = OffOn, this instruction will encode the 23 bits data (M0 ~ M7) and store the result in the lower 3 bits (b2 ~ b0) of D0. b15 ~ b3 that have not been used in D0 will all become 0. After the execution of this instruction is completed and X10 turns to Off, the content in D remains unchanged.
X0 ENCOP
M7 M6 M5
M0
M4
D0
M3 M2
K3
M1 M0
0 7
0 6
0 5
0 4
all be 0
1 3
0 2
0 1
0 0 4 2 1
0 0 b15
D0
1 b0
Program Example 2: 1. 2. 3. When S is used as a word device, n = 1 ~ 4. Errors will occur if n = 0 or n > 4. When n = 4, the maximum points to decode is 24 = 16 points. When X10 = OffOn, this instruction will encode 23 bits (b0 ~ b7) in D10 and stores the result in the lower 3 bits (b2 ~ b0) of D20. b15 ~ b3 that have not been used in D20 will all become 0. b8 ~ b15 of D10 are invalid data.
6-61
D10
D20
K3
D10
all be 0
0 0 b15
1 b0
D20
6-62
Bit Devices X Y M S
Program Steps
K H KnX KnY KnM KnS T C D E F SUM, SUMP: 5 steps * * * * * * * * * * * DSUM, DSUMP: 9 steps * * * * * * * *
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S: Source device Explanations: 1. 2. 3. 4. 5. 6. If S and D are used in device F, only 16-bit instruction is applicable. See the specifications of each model for their range of use. Flag: M1020 (zero flag) Among the bits of S, the total of bits whose content is 1 will be stored in D. When all the 16 bits of S are 0, zero flag M1020 = On. When 32- instruction is in use, D will occupy 2 registers. D: Destination device for storing counted value
Program Example: When X10 = On, among the 16 bits of D0, the total of bits whose content is 1 will be stored in D2.
X10 SUM D0 D2
0 0 D0
K3 D2
6-63
Bit Devices X Y * M * S *
Operands: S: Source device Explanations: 1. 2. 3. 4. If S is used in device F, only 16-bit instruction is applicable. Range of n: 0 ~ 15 (16-bit instruction); 0 ~ 31 (32-bit instruction) See the specifications of each model for their range of use. When the nth bit of S is 1, D = On; when the nth bit of S is 0, D = Off. D: Device for storing check result n: Bits specified for check
Program Example: 1. 2. When X0 = On, assume the 15th bit of D0 is 1, and M0 = On. Assume the 15th bit of D0 is 0, and M0 = Off. When X0 goes Off, M0 will remains in its previous status.
X0 BON D0 M0 K15
b15 0 0 b15 1 0
0 0 D0 0 0 D0
b0 0 M0=Off b0 0 M0=On
6-64
Bit Devices X Y M S
Program Steps
Operands: S: Start device to obtain mean value source devices used Explanations: 1. 2. 3. 4. 5. 6. 7. 8. 9. If D is used in device F, only 16-bit instruction is applicable. Range of n: 1 ~ 64 In ES/EX/SS series models: Operand S cannot designate KnX, KnY, KnM, KnS. ES/EX/SS series MPU does not support E, F index register modification. See the specifications of each model for their range of use. After the content of n devices starting from S are added up, the mean value of the result will be stored in D. Remainders in the operation will be left out. Provided the No. of designated device exceeds its normal range, only the No. within the normal range can be processed. If n falls without the range of 1 ~ 64, PLC will determine it as an instruction operation error. D: Destination device for storing mean value n: The number of consecutive
Program Example: When X10 = On, the contents in 3 (n = 3) registers starting from D0 will be summed and then divided by 3. The obtained mean value will be stored in D10 and the remainder will be left out.
X10 MEAN (D0+D1+D2)/3 D0 D1 D2 K100 K113 K125 D10 K112 D0 D10 D10 K3
6-65
Operands
Controllers
ES/EX/SS SA/SX/SC EH/SV
Operands: S: Timer for monitoring annunciator Explanations: 1. 2. 3. 4. 5. 6. Range of S: for SA/SX/SC T0 ~ T191; for EH/EH2/SV T0 ~ T199. m can designate K1 ~ K32,767 (unit: 100ms) Range of D: for SA/SX/SC S896 ~ S1023; for EH/EH2/SV S900 ~ S1023. See the specifications of each model for their range of use. Flags: M1048 (annunciator in action); M1049 (valid monitoring) This instruction is used for enabling the annunciator. m: Time setting D: Annunciator device
Program Example: If X3 = On for more than 5 seconds, annuniciator point S999 = On. Even X3 goes Off afterwards, S999 will still keep On. However, T10 will be reset to Off and the present value = 0.
X3 ANS T10 K50 S999
API 47 OP N/A
Mnemonic ANR P
Operands
Controllers
ES/EX/SS SA/SX/SC EH/SV
Descriptions
Explanations: 1. 2. 3. 4. No operand. This instruction is used for resetting the annunciator. When more than one annuciators are On, the annunciator of smaller number will be reset. This instruction adopts pulse execution instructions (ANRP)
Program Example: 1. If X10 and X11 = On at the same time for more than 2 seconds, annuniciator point S910 = On. Even X10 and X11 go Off afterwards, S910 will still keep On. However, T10 will be reset to Off and the present value = 0.
6-66
Remarks: 1. Flag: a) M1048 (annunciator in action): When M1049 = On, any of the annunciators among S896 ~ S1023 in SA/SX/SC or S900 ~ S1023 in EH/EH2/SV starts output, M1048 will be On. b) M1049 (valid monitoring): When M1049 = On, D1049 will automatically display the annuciator of the smallest number in action. 2. Application of annunciators: I/O point configuration: X0: Forward switch X1: Backward switch X2: Front position switch X3: Back position switch X4: Annunciatro reset button
M1000 M1049 Y0 Y1 X0 Y0 X1 Y1 M1048 Y2 X4 ANRP X3 Y1 X2 ANS X3 ANS X2 Y0 T1 K200 S920 T0 K100 S910
1. 2. 3.
M1048 and D1049 are valid only when M1049 = On. When Y0 = On for more than 10 seconds and the device fails to reach the frong position X2, S910= On. When Y1 = On for more than 10 seconds and the device fails to reach the back position X3, S920= On.
6-67
6-68
Bit Devices X Y M S
Program Steps
K H KnX KnY KnM KnS T C D E F SQR, SQRP: 5 steps * * * DSQR, DSQRP: 9 steps *
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S: Source device Explanations: 1. 2. 3. 4. 5. 6. See the specifications of each model for their range of use. Flags: M1020 (zero flag); M1021 (borrow flag); M1067 (instruction operation error) This instruction performs a square root operation on S and stores the result in D. S can only be a positive value. If S is negative, PLC will regard it as an instruction operation error and will not execute this instruction. M1067 and M1068 = On and D1067 records the error code 0E1B (hex). The operation result D should be integer only, and the decimal will be left out. Borrow flag M1021 = On. When the operation result D = 0, zero flag M1020 = On. D: Device for storing the result
Program Example: When X10 = On, the instruction performs a square root on D0 and stores the result in D12.
X10 SQR D0 D12
D0
D12
6-69
Bit Devices X Y M S
Operands: S: Source device for conversion Explanations: 1. 2. 3. 4. See the specifications of each model for their range of use. Flags: M1081 (FLT instruction function switch); M1020 (zero flag); M1021 (borrow flag); M1022 (carry flag) D will occupy 2 consecutive devices When M1081 is Off, BIN integer is converted into binary floating point value. At this time, S of the 16-bit instruction, FLT, occupies 1 register and D occupies 2 registers. a) If the absolute value of the conversion result max. floating value, carry flag M1022 = On. b) If the absolute value of the conversion result min. floating value, carry flag M1021 = On. c) If the conversion result is 0, zero flag M1020 = On. 5. When M1081 is On, binary floating point value is converted into BIN integer (digits after decimal point are left out). At this time, S of the 16-bit instruction, FLT, occupies 2 registers and D occupies 1 register (action same as that of INT instruction). a) If the conversion result exceeds the range of BIN integer available in D (for 16-bit: -32,768 ~ 32,767; for 32-bit: -2,147,483,648 ~ 2,147,483,647), D will obtain the maximum or minimum value and carry flag M1022 = On. b) If any digits is left out during the conversion, borrow flag M1021 = On. c) If S = 0, zero flag M1020 = On. d) After the conversion, D stores the result in 16 bits. Program Example 1: 1. 2. 3. 4. 5. When M1081 = Off, the BIN integer is converted into binary floating point value. When X10 = On, D0 (BIN integer) is converted into D13 and D12 (binary floating point value). When X11 = On, D1 and D0 (BIN integer) are converted into D21 and D20 (binary floating point value). If D0 = K10, X10 will be On. The 32-bit value of the converted floating point will be H41200000 and stored in 32-bit register D12 (D13). If 32-bit register D0 (D1) = K100,000, X11 will be On. The 32-bit value of the converted floating point will be H47C35000 and stored in 32-bit register D20 (D21). D: Device for storing the conversion result
6-70
Program Example 2: 1. 2. When M1081 = On, the binary floating point value is converted into BIN integer (the decimal is left out). When X10 = On, D0 and D1 (binary floating point value) are converted into D12 (BIN integer). If D0 (D1) = H47C35000, the floating point value will be presented as 100,000. Due to that the value is larger than the value presentable by the 16-bit register D12, the result will be D12 = K32, 767 and M1022 = On. 3. When X11 = On, D1 and D0 (binary floating point value) are converted into D21 and D20 (BIN integer). If D0 (D1) = H47C35000, the floating point value will be presented as 100,000. The result will be stored in the 32-bit register D20 (D21).
M1002 SET X10 FLT X11 DFLT D0 D20 D0 D12 M1081
Program Example 3: Please use this instruction to complete the following operation.
(D21,D20) binary floating point
(D10)
K61.5 6
7 8
(D101,D100) (D200) BIN (D301,D300) binary floating point binary floating point 3 (D203,D202) binary floating point (D401,D400) binary floating point
6-71
1 D10 (BIN integer) is converted to D101 and D102 (binary floating point value). 2 X7 ~ X0 (BCD value) are converted to D200 (BIN value). 3 D200 (BIN integer) is converted to D203 and D202 (binary floating point value).
4The result of K615 K10 is stored in D301 and D300 (binary floating point value).
5 The result of binary decimal division (D101, D100) (D203, D202) is stored in D401 and D400 (binary floating
point value).
6 The result of binary decimal multiplication (D401, D400) (D301, D300) is stored in D21 and D20 (binary
6-72
Bit Devices X * Y * M S
Program Steps
Operands: D: Start device to be I/O refreshed Explanations: 1. 2. 3. 4. D must designate X0, X10, Y0, Y10the points whose 1s digit is 0. See remarks for more details. Range of n: 8 ~ 256 (has to be the multiple of 8). See the specifications of each model for their range of use. The status of all PLC input/output terminals will be updated after the program scans to END. When the program starts to scan, the status of the external input terminal is read and stored into the memory of the input point. The output terminal will send the content in the output memory to the output device after END instruction is executed. Therefore, this instruction is applicable when the latest input/output data are needed for the operation. 5. D has to be designated to be X0, X10, Y0, Y10such forms whose 1st digit is 0. Range of n: 8 ~ 256 (must be 8s multiple); otherwise it will be regarded as an error. The range varies in different models. See Remarks for more details. Program Example 1: When X0 = On, PLC will read the status of input points X0 ~ X17 immediately and refresh the input signals without any input delay.
X0 REF X0 K16
Program Example 2: When X0 = On, the 8 output signal from Y0 ~ Y7 will be sent to output terminals and refreshed without having to wait for the END instruction for output.
X0 REF Y0 K8
Remarks: The instruction only process the I/O points X0 ~ X17 and Y0 ~ Y17 of ES/EX/SS/SA/SX/SC series MPU, namely n = K8 or n = K16.
D V P - P L C A P P L I C AT I O N M A N U A L
7-1
Bit Devices X Y M S
Program Steps
Operands: n: Response time (unit: ms) Explanation: 1. 2. Range of n: for SA/SX/SC, n = K0 ~ K20; for EH/EH2/SV, n = K0 ~ K60. To avoid interferences, X0 ~ X17 of EH/EH2/SV series MPU and X0 ~ X7 of SA/SX/SC series MPU are equipped with digital filters on output terminals. Digital filters adjust the response time by REFF instruction. This instruction sets up n directly in D1020 (adjusting the response time of X0 ~ X7) and D1021 (adjusting the response time of X10 ~ X17). 3. Rules for adjusting the reponse time of the filter at X0 ~ X17: a) When the power of PLC turns from Off to On or the END instruction is being executed, the response time will be determined upon the contents in D1020 and D1021. b) You can use MOV instruction in the program to move the time values to D1020 and D1021 and make adjustments in the next scan. c) You can use REFF instruction to change the response time during the execution of the program. The changed response time will be move to D1020 and D1021 and you can make adjustments in the next scan. Program Example: 1. When the power of PLC turns from Off to On, the response time of X0 ~ X17 will be determined by the contents in D1020 and D1021. 2. When X20 = On, REFF K5 will be executed and the response time will be changed to 5ms for the adjustment in the next scan. 3. When X20 = Off, the REFF K20 will be executed and the response time will be changed to 20ms for the adjustment in the next scan.
END X20 REFF X0 Y1 X20 REFF X1 Y2 K20 K5
Remarks: When inserting an interruption subroutine in the program or using the high speed counter or API 56 SPD instruction, the corresponding signals at the input terminals will not delay and has nothing to do with this instruction.
7-2
D V P - P L C A P P L I C AT I O N M A N U A L
Program Steps
* * *
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S: Start device of matrix input D1: Start device of matrix output D2: Corresponding start device for matrix scan n: Number of arrays in matrix scan Explanations: 1. 2. 3. 4. 5. 6. 7. 8. 9. S must designate X0, X10the X points whose 1st digit is 0 and occupies 8 consecutive points. D1 must designate Y0, Y10the Y points whose 1st digit is 0 and occupies n consecutive points. D2 must designate Y0, M0. S0the Y, M, S points whose 1st digit is 0. Range of n: 2 ~ 8. See the specifications of each model for their range of use. Flag: M1029 (execution of the instruction is completed). S is the start device No. of all input terminals connected to the matrix. Once S is designated, the 8 points following the No. will be the input terminals in the matrix. D1 designate the start device No. of transistor output Y in the matrix scan. This instruction occupies continuous 8 input devices starting from S. n external output terminals starting from D1 read the 8 switches of n arrays by matrix scan, obtaining 8 n multiple-matrix input points. The status of scanned switches will be stored in the devices starting from D2. 10. 11. Maximum 8 input switches can be parallelly connected in 8 arrays and obtaining 64 input points (8 8 = 64). When the 8-point 8-array matrix inputs are in use, the reading time of each array is approximately 25ms, totaling the reading of 8 arrays 200ms, i.e. the input signals with On/Off speed of over 200ms are not applicable in a matrix input. 12. 13. 14. The drive contact of this instruction uses normally On contact M1000. Whenever this instruction finishes a matrix scan, M1029 will be On for one scan period. There is no limitation on the number of times using the instruction, but only one instruction can be executed in a period of time. Program Example: 1. When PLC RUN, MRT instruction will start to be executed. The statuses of the external 2 arrays of 16 switches will be read in order and stored in the internal relays M10 ~ M17, M20 ~ M27.
M1000 MTR X40 Y40 M10 K2
D V P - P L C A P P L I C AT I O N M A N U A L
7-3
X 41
X 42
X 43
X 44
X 45
X 46
X 47
M1 0
M11
M1 2
M1 3
M1 4
M1 5
M1 6
M1 7
X40
X41
X42
X43
X44
X45
X46
X47
Y40
Y41
Y42
Y43
Y44
Y45
Y46
Y47
3.
See the figure above. The 8 points starting from X40 start to perform a matrix scan from Y40 ~ Y41 (n = 2). D2 designates that the start device No. of the read results is M10, indicating that the first array is read to M10 ~ M17 and the second array is read to M20 ~ M27.
Read input signals in the 1st array
Y40
Y41
4 25ms
7-4
D V P - P L C A P P L I C AT I O N M A N U A L
*
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S1: Comparative value Explanations: 1. 2. 3. 4. 5. 6. S2 has to designate the No. of high speed counters C235 ~ C255. See remarks for more details. D can designate I00; = 1 ~ 6. ES series MPU does not support this. D of ES and SA series MPU does not support E, F index register modification. See the specifications of each model for their range of use. Flags: M1289 ~ M1294 are interruption disability of the high speed counters in EH/EH2/SV series MPU. See Program Example 3 for more details. The high speed counter inputs counting pulses from the corresponding external input terminals X0 ~ X17 by inserting an interruption. When the high speed counter designated in S2 pluses 1 or minuses 1, DHSCS instruction will perform a comparison immediately. When the present value in the high speed counter equals the comparative value designated in S1, device designated in D will turn On. Even the afterward comparison results are unequal, the device will still be On. 7. If the devices specified as the device D are Y0 ~ Y17, when the compare value and the present value of the high-speed counter are equal, the comparison result will immediately output to the external inputs Y0 ~ Y17, and other Y devices will be affected by the scan cycle. However, M, S devices are immediate output and will not be affected by the scan cycle. Program Example 1: After PLC RUN and M0 = On, DHSCS instruction will be executed. When the present value in C235 changes from 99 to 100 or 101 to 100, Y10 will be On constantly.
M1000 DCNT M0 DHSCS K100 C235 Y10 On immediately C235 K1000
D: Comparison result
Program Example 2: Differences between Y output of DHSCS instruction and general Y output: a) When the present value in C249 changes from 99 to 100 or 101 to 100, Y10 outputs immediately to the external output point by interruption and has nothing to do with the PLC scan time. However, the time will still be delayed by the relay (10ms) or transistor (10us) of the output module.
D V P - P L C A P P L I C AT I O N M A N U A L
7-5
Program Example 3: 1. High speed counter interruption: a) Operand D of DHSCS instruction can designate I00, = 1 ~ 6, as the timing of interruption when the counting reaches its target. b) ES/EX/SS series MPU does not support high speed counter interruption. c) SA/SX/SC series MPU supports high speed counter interruption. However, when DHSCS instruction designates an I interruption, the designated high speed counter cannot be used in DHSCS, DHSCR, DHSZ instructions. Misuse of high speed counter will result in error. d) For SA/SX/SC series MPU, when the counting reaches the target, the interruption will occur. X0 is the counter for counting input and the interruption No. is I010 (1 phase 2 inputs and A-B phase counter No. C246 ~ C254 can only designate I010). X1 designates I020; X2 designates I030; X3 designates I040; X4 designates I050; X5 designates I060, totaling 6 points. e) When the present value in C251 changes from 99 to 100 or 101 to 100, the program will jump to I010 and execute the interruption service subroutine.
EI M1000 DCNT DHSCS FEND M1000 I010 Y1 IRET END C251 K100 K1000 C251 I010
2. In SA/SX/SC series MPU, M1059 is I010 ~ I060 high speed counter interruption forbidden flag. 3. In EH/EH2/SV series MPU, M1289 ~ M1294 are the respectively for I010 ~ I060 high speed counter interruption forbidden flags, i.e. when M1294 = On, I060 interruption will be forbidden. Interruption pointer I No. Interruption forbidden flag I010 I020 I030
7-6
D V P - P L C A P P L I C AT I O N M A N U A L
1-phase 1 input C235 U/D U/D U/D U/D C236 C237 C238 C241 U/D R U/D R S C242 C244 U/D R
X0 X1 X2 X3
a)
Input points X0 and X1 can be planned as counters of higher speed (1 phase input can reach 20kHz). However, the total counting frequency of the two input points has to be smaller or equal 20kHz. Provided the input is a 2-phas input signal, the counting frequency will be approximately 4kHz. The frequency of the input points X2 and X3 (1-phase) can reach 10kHz.
b) 3.
For ES/EX/SS series MPU, the uses of DHSCS instructio with DHSCR instruction cannot be more than 4 times.
High speed counters supported by SA/SX series MPU (total bandwidth: 40kHz):
Type Input
1-phase 1 input
1-phase 2 inputs
2-phase 2 inputs
C235 C236 C237 C238 C239 C240 C241 C242 C244 C246 C247 C249 C251 C252 C253 C254 U/D U/D U/D U/D U/D U/D A: A phase input B: B phase input S: Input started R: Input cleared U/D R U/D R S U/D R U D U D R U D R S A B A B R B A A B R S
X0 X1 X2 X3 X4 X5
a)
Input points X0 and X1 for 1-phase input can reach a frequency of 20kHz and X2 ~ X5 can reach 10kHz. 2-phase input (X0, X1) C251, C252 and C254 can reach a frequency of 4kHz and C253 reach 25kHz (only supports 4 times frequency counting).
b)
Functions of the input point X5: i) When M1260 = Off, C240 is the general U/D high speed counuter. C235 ~ C239. The counter C240 will still receive the counting input signals from X5. ii) When M1260 = On and C240 is enabled by DCNT instruction, X5 will be the shared reset signal for
D V P - P L C A P P L I C AT I O N M A N U A L
7-7
1-phase 1 input
1-phase 2 inputs
2-phase inputs
C235 C236 C237 C238 C239 C240 C241 C242 C243 C244 C245 C246 C247 C249 C250 C251 C252 C254 C255
X0 X1 X2 X3 X4 X5 X10 X11
U/D R S
U D
U D R
U D R S U D
A B
A B R
A B R S A B
a) The functions of the high speed counters of input points X0 ~ X5 are the same of those in SA/SX series MPU. b) The input points of 1-phase input X10 (C243), X11 (C245) and (X10, X11) C250 can reach a frequency of 100kHz. The total bandwidth of X10 ~ X11 is 130kHz. C255 of the 2-phase input (X10, X11) can reach a frequency of 50kHz. c) For SA/SX/SC series MPU, the uses of DHSCS instruction with DHSCR instruction cannot be more than 6 times and the uses of DHSZ instruction cannot be more than 6 times as well. When DHSCR instruction designates I interruption, the designated high speed counter cannot be used in other DHSCS, DHSCR and DHSZ instructions. d) The functions of X10 ~ X11 high speed counters in SC series MPU: i) When X10 and X11 are set as 1-phase 1 input or 1-phase 2 inputs. The maximum frequency of a single phase can reach 100kHz. When they are set as 2-phase 2 inputs, the maximum frequency can reach 50kHz. ii) X10 and X11 can select rising-edge counting mode or falling-edge counting mode. X10 is set by D1166 and X11 is set by D1167. K0: rising-edge counting. K1: falling-edge counting. K2: rising/falling edge counting (only supports X10). iii) The counting up and down of C243 are determined by the On/Off of M1243. The counting up and down of C245 are determined by the On/Off of M1245. Rising-edge and falling-edge counting are not able to take place at the same time. The rising-edge trigger and falling-edge trigger of C250 are determined by the content (K0 or K1) of D1166. C255 can only be used in a 4 times frequency counting and you can only select rising-edge trigger. iv) When C243 or C245 is in use, you will not be able to use C250 or C255, and vice versa. v) High speed counter and high speed comparator:
7-8
D V P - P L C A P P L I C AT I O N M A N U A L
C255
vi) Explanations on high speed counter and high speed comparator: (1) When DHSCS and DHSCR instructions use the high speed counter (C243/C245/C250/C255), they can only use the set values of 2 groups of high speed comparative instructions. Assume that a group of comparative instruction DHSCS D0 C243 Y10 is already in use, you can only set another group DHSCR D2 C243 Y10 or DHSCS D4 C245 Y10. (2) When DHSZ instruction use the high speed counter (C243/C245/C250/C255), it can only use the set value of a group of comparators. (3) The number of set values in a high-speed comparative instruction offered in SA/SX series MPU will not decrease becasus of the addition of the new high speed counters. (4) If the high-speed comparative instruction DHSCS requires a high-speed reponse output, it is suggested that you use Y10 or Y11 for the output. If you use other general devices for the output, there will be delay of 1 scan period. For example, when in I0x0 interruption, C234 will correspond to I020, C245 to I040 and C250/C255 to I060. (5) The high-speed comparative instruction DHSCR can clear output devices and counter devices, but only the counters used by the same instruction, e.g. DHSCR K10 C243 C243. This function can only applied in the four special high speed counters C243, C245, C250 and C255. e) Counting modes: i) The 2-phase 2 inputs counting mode of the high speed counters in ES/EX/SS (V5.5 and above) and SA/SX/SC series MPU is set by special D1022 with normal frequency, double frequency and 4 times frequency modes. The contents in D1022 will be loaded in in the first scan when PLC is switched from STOP to RUN. Device No. D1022 D1022 = K1 D1022 = K2 or 0 D1022 = K4 Function Setting up the multiplied frequency of the counter Normal frequency mode selected Double frequency mode selected (default) 4 times frequency mode selected
D V P - P L C A P P L I C AT I O N M A N U A L
7-9
1 (Normal frequency)
Counting up
Counting down
2-phase 2 inputs
A-phase
2 (Double frequency)
B-phase
Counting up
Counting down
A-phase
4 (4 times frequency)
B-phase
Counting up
Counting down
5.
EH/EH2/SV series MPU supports high speed counters. C235 ~ C240 are program-interruption 1-phase high speed counter with a total bandwidth of 20kHz, can be used alone with a counting frequency of up to 10kHz. C241 ~ C254 are hardware high speed counter (HHSC). There are four HHSC in EH/EH2/SV series MPU, HHSC0 ~ 3. The pulse input frequency of HHSC0 and HHSC1 can reach 200kHz and that of HHSC2 and HHSC3 can reach 20kHz (1 phase or A-B phase). The pulse input frequency of HHSC0 ~ 3 of 40EH2 series MPU can reach 200kHz, among which: C241, C246 and C251 share HHSC0 C242, C247 and C252 share HHSC1 C243, C248 and C253 share HHSC2 C244, C249 and C254 share HHSC3 a) b) Every HHSC can only be designated to one counter by DCNT instruction. There are three counting modes in every HHSC (see the table below): i) 1-phase 1 input refers to pulse/direction mode.
ii) 1-phase 2 inputs refers to clockwise/counterclockwise (CW/CCW) mode. iii) 2-phase 2 inputs refers to A-B phase mode.
7-10
D V P - P L C A P P L I C AT I O N M A N U A L
C235 C236 C237 C238 C239 C240 C241 C242 C243 C244 C246 C247 C248 C249 C251 C252 C253 C254
U/D
U D
A B R S U D A B R S U D A B R S U D A B R S
R S U/D
R S
R S U/D
R S
R S U/D
R S
c)
In EH/EH2/SV series MPU, there is no limitation on the times of using the hardware high speed counter related instructions, DHSCS, DHSCR and DHSZ. However, when these instructions are enabled at the same time, there will be some limitations. DHSCS instruction will occupy 1 group of settings, DHSCR 1 group of settings and DHSZ 2 groups of settings. There three instructions cannot occupy 8 groups of settings in total; otherwise the system will ignore the instructions which are not the first scanned and enabled.
d)
System structure of the hardware high speed counters: i) HHSC0 ~ 3 have reset signals and start signals from external inputs. Settings in M1272, M1274, M1276 and M1278 are reset signals of HHSC0, HHSC1, HHSC2 and HHSC3. Settings in M1273, M1275, M1277 and M1279 are start signals of HHSC0, HHSC1, HHSC2 and HHSC3. ii) If the external control signal inputs of R and S are not in use, you can set M1264/M1266/M1268/M1270 and M1265/M1267/M1269/M1271 as True and disable the input signals. The corresponding external inputs can be used again as general input points (see the figure below). iii) When special M is used as a high speed counter, the inputs controlled by START and RESET will be affected by the scan time.
D V P - P L C A P P L I C AT I O N M A N U A L
7 - 11
Comparator
8 set values
HHSC0 HHSC1 HHSC2 HHSC3 D1225 D1226 D1227 D1228 Select counting m odes Counting up/dow n monitoring flag Set values 1 ~ 4 indicate Mode 1 ~ 4 (1 ~ 4 times frequency) HHSC0 HHSC1 HHSC2 HHSC3 U/D mode setup flag C241 M1241 C242 M1242 C243 M1243 C244 M1244 H HSC0 M1246 H HSC1 M1247 H HSC2 M1248 H HSC3 M1249
AND OR
HHSC0 HHSC1 HHSC2 HHSC3 X2 M1264 X6 M1266 X12 M1268 X16 M1270 Reset signal R
Interruption forbidden flag I 010 M1289 I 020 M1290 I 030 M1291 I 040 M1292 I 050 M1293 I 060 M1294
M1272
M1274
M1276
M1278
HHSC0 HHSC1 HHSC2 HHSC3 X3 M1265 X7 M1267 X13 M1269 X17 M1271
AND OR
Start signal S
M1273
M1275
M1277
M1279
e)
Counting modes: Special D1225 ~ D1228 are for setting up different counting modes of the hardware high speed counters (HHSC0 ~ 3) in EH/EH2/SV series MPU. There are normal ~ 4 times frequency for the counting and the default setting is double frequency. Counting modes
Type Set value in special D 1 (Normal frequency) 2 (Double frequency) 1 (Normal frequency) 2 (Double frequency) 1 (Normal frequency) 2 (Double frequency) 3 (Triple frequency) 4 (4 times frequency) Counting up(+1)
U/D U/D FLAG
U/D U/D FLAG
Wave pattern
Counting down(-1)
1-phase 1 input
U D U D A B A B A B A B
1-phase 2 inputs
2-phase 2 inputs
7-12
D V P - P L C A P P L I C AT I O N M A N U A L
D V P - P L C A P P L I C AT I O N M A N U A L
7-13
Function Multiplied frequency of A-B phase counters for ES/SA series MPU Table counting register for DHSZ multiple set values comparison mode Register for DHSZ instruction frequency control mode (counting by table)
D1152 (low word) In frequency control mode, DHSZ reads the upper and lower limits in the table D1153 (high word) counting register D1153 and D1152. D1166 Switching between rising/falling edge counting modes of X10 (for SC series MPU only) Switching between rising/falling edge counting modes of X11 (for SC series MPU only) The counting mode of the 1st group counters (C241, C246, C251) The counting mode of the 2nd group counters (C242, C247, C252) The counting mode of the 3rd group counters (C243, C248, C253) The counting mode of the 4th group counters (C244, C249, C254) Counting modes of HHSC0 ~ HHSC3 in EH/EH2/SV series MPU (default = 2) 1: Normal frequency counting mode D1225 ~ D1228 2: Double frequency counting mode 3: Triple frequency counting mode 4: 4 times frequency counting mode
7-14
D V P - P L C A P P L I C AT I O N M A N U A L
Operands: S1: Comparative value Explanations: 1. 2. 3. 4. 5. 6. 7. S2 has to designate the No. of high speed counters C235 ~ C255. See remarks of API 53 DHSCS for more details. D of EH/EH2/SV series MPU can designate the No. of high speed counters C241 ~ C254 that are the same as the counters designated by S2. D of SC series MPU can designate the No. of high speed counters C243, C245, C248, C250 and C255 that are the same as the counters designated by S2. D of ES/EX/SS/SA/SX series MPU does not support device C. See the specifications of each model for their range of use. Flags: M1150 ~ M1333; see remarks of API 53 DHSCS for more details. ES/EX/SS/SA/SX/SC series MPU does not support M1261 (high speed counter external reset mode designation); see remarks for more details. The high speed counter inputs counting pulses from the corresponding external input terminals X0 ~ X17 by inserting an interruption. When the No. of high-speed counter designated in S2 +1 or -1, DHSCR will perform a comparison immediately. When the present value in the high speed counter equals the comparative value designated in S1, the device designated in D will turn Off and even the afterward comparison results are unequal, the device will still be Off. 8. If the devices designated in D are Y0 ~ Y17, when the comparative value equals the present value in the high speed counter, the comparison result will immediately output to the external output terminals Y0 ~ Y17 (and clear the designated Y output) and the rest of Y devices will be affected by the scan cycle. Devices M and S act immediately without being affected by the scan cycle. Program Example 1: 1. 2. 3. When M0 = On and the present value in the high speed counter C251 changes from 99 to 100 or 101 to 100, Y10 will be cleared and Off. When the present value in the high speed counter C251 changes from 199 to 200, the contact of C251 will be On and make Y0 = On. However, the program scan time will delay the output. Y10 will immediately reset the status when the counting reaches its target. D is also able to designate high speed counters of the same No. See Program Example 2. S2: No. of high speed counter D: Comparison result
D V P - P L C A P P L I C AT I O N M A N U A L
7-15
Program Example 2: When DHSCR instruction designates the same high speed counter, and the present value in the high speed counter C251 changes from 999 to 1,000 or 1,001 to 1,000, C251 will be reset to Off.
1,000
200
DHSCR K1000
Remarks: 1. 2. DVP all series MPU support high speec counters. For the limitation on the use of instructions, see remarks of API 53 DHSCS for more details. M1261 of EH/EH2/SV series MPU designates the external reset modes of the high speed counter. Some high speec counters have input points for external reset; therefore, when the input point is On, the present value in the corresponding high speed counter will be cleared to 0 and the output contact will be Off. If you wish the reset to be executed immediately by the external output, you have to set M1261 to be On. 3. 4. M1261 can only be used in the hardware high speed counter C241 ~ C255. Example: a) b) c) X2 is the input point for external reset of C251. Assume Y10 = On. When M1261 = Off and X2 = On, the present value in C251 will be cleared to 0 and the contact of C251 will be Off. When DHSCR instruction is executed, there will be no counting input and the comparison result will not output. The external output will not execute the reset; therefore Y10 = On will remain unchanged. d) When M1261 = On and X2 = On, the present value in C251 will be cleared to 0 and the contact of C251 will be Off. When DHSCR instruction is executed, there will be no counting input but the comparison result will output. Therefore, Y10 will be reset.
M1000 DCNT DHSCR X10 M1261 C251 K0 K1000 C251 Y10
7-16
D V P - P L C A P P L I C AT I O N M A N U A L
*
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S1: Lower bound of the comparison zone counter D: Comparison result S2: Upper bound of the comparison zone S: No. of high speed
Explanations: 1. 2. 3. 4. 5. S1 has to be euqal to or smaller than S2. (S1 S2) When S1 > S2, the instruction will perform a comparison by using S1 as the upper bound and S2 as the lower bound. S has to designate high speed counters C235 ~ C255, See remarks of API 53 DHSCS for more details. D will occupy 3 consecutive devices. Flags: M1150 ~ M1333; see remarks of API 53 DHSCS for more details. M1150, M1151 DHSZ executing multiple points comparison mode; see Program Example 3 for more details; SA/SX/SC series MPU does not support. M1152, M1153 DHSZ as frequency control mode; see Program Example 4 for more details; SA/SX/SC series MPU does not support. 6. 7. The output will not be affected by the scan time. The zone comparisons and outputs are all processed by inserting interruptions.
Program Example 1: 1. 2. Designate device Y0 and Y0 ~ Y2 will be automatically occupied. When DHSZ instruction is being executed and the counting of the high speed counter C246 reaches upper and lower bounds, one of Y0 ~ Y2 will be On
M1000 DCNT DHSZ Y0 When the present value in C246 < K1,500, Y0 = On Y1 Y2 When K1,500 < present value in C246 < K2,000, Y1 = On When the present value in C246 > K2,000, Y2 = On C246 K1500 K20000 K2000 C246 Y0
D V P - P L C A P P L I C AT I O N M A N U A L
7-17
4.
X10 high speed forward Y10 low speed Y11 forward Stop Y12
2,400 2,000
Program Example 3: 1. 2. Program Example 3 is only applicable to EH/EH2/SV series MPU. The multiple set values comparison mode: If D of DHSZ instruction designates a special auxiliary relay M1150, the instruction will be able to compare (output) the present value in the high speed counter with many set values.
7-18
D V P - P L C A P P L I C AT I O N M A N U A L
The No. of start register designated in S1 and the number of rows (groups) designated in S2 construct a comparison table. Please enter the set values in every register in the table before executing the instruction. When the present value in the counter C251 designated in S equals the set values in D1 and D0, the Y output designated by D2 will be reset to Off (D3 = K0) or On (D3 = K1) and be kept. Output Y will be processed as an interruption. No. of Y output pointss are in decimal (range: 0 ~ 255). If the No. falls without the range, SET/RESET will not be enabled when the comparison reaches its target.
6.
When this mode is enabled, PLC will first acquire the set values in D0 and D1 as the target value for the first comparison section. At the same time, the index value displayed in D1150 will be 0, indicating that PLC performs the comparison based on the group 0 data.
7.
When the group 0 data in the table have been compared, PLC will first execute the Y output set in group 0 data and determine if the comparison reaches the target number of groups. If the comparison reaches the target, M1151 will be On; if the comparison has not reached the final group, the content in D1150 will plus 1 and continue the comprison for the next group.
8. 9.
M1151 is the flag for the completion of one execution of the table, can be Off by the user. Or when the next comparion cycle takes place and the group 0 data has been compared, PLC will automatically reset the flag. When the drive contact of the instruction X10 goes Off, the execution of the instruction will be interrupted and the content in D1150 (table counting register) will be reset to 0. However, the On/Off status of all outputs will be remained.
When the instruction is being executed, all set values in the comparison table will be regarded as valid values only when the scan arrives at END instruction for the first time. This mode can only be used once in the program. This mode can only be used on the hardware high speed counters C241 ~ C254. When in this mode, the frequency of the input counting pulses cannot exceed 50kHz or the neighboring two groups of comparative values cannot differ by 1; otherwise there will not be enough time for the PLC to react and result in errors.
X10 DHSZ D0 K4 C251 M1150
D V P - P L C A P P L I C AT I O N M A N U A L
7-19
D13 (K0)
D12 (K400)
Present value in C251 400 300 200 100 Y10 Y11 M1151 D1150 0 1 2
3 0
14.
Special registers for flags and relevant settings: Flag M1150 M1151 Special D D1150 Function DHSZ instruction in multiple set values comparison mode The execution of DHSZ multiple set values comparison mode is completed. Function Table counting register for DHSZ multiple set values comparison mode
Program Example 4: 1. 2. Program Example 4 is only applicable to EH/EH2/SV series MPU. DHSZ and DPLSY instructions are combined for frequency control. If D of DHSZ instruction is a special auxiliary relay M1152, the present value in the counter will be able to control the pulse output frequency of DPLSY instruction. 3. In this mode, - S1: start device in the comparison table. S1 can only designate data register D and can be modified by E and F. Once this mode is enabled, S1 will not be changed even the E and F has been changed. - S2: number of group data to be compared. S2 can only designate K1 ~ K255 or H1 ~ HFF and can be modified by E and F. Once this mode is enabled, S2 cannot be changed. If S2 is not within its range, error code 01EA (hex) will display and the instruction will not be executed. - S: No. of high speed counter (designated as C241 ~ C254).
7-20 D V P - P L C A P P L I C AT I O N M A N U A L
The comparison table: 32-bit data for comparison High word D1 D5 D9 (K0) (K0) (K0) D0 D4 D8 Low word (K0) (K100) (K200) Pulse output frequency 0 ~ 200kHz D3, D2 D7, D6 D11, D10 D15, D14 D19, D18 (K5,000) (K10,000) (K15,000) (K6,000) (K0) Table counting register D1151 0 1 2 3 4 01234 Cyclic scan
D V P - P L C A P P L I C AT I O N M A N U A L
7-21
D1151
12.
Special registers for flags and relevant settings: Flag M1152 M1153 Special D D1151 D1152 (low word) D1153 (high word) D1336 (low word) D1337 (high word) Function DHSZ instruction in frequency control mode The execution of DHSZ frequency control mode is completed. Function Table counting register for DHSZ multiple set values comparison mode In frequency control mode, DHSZ reads the upper and lower limits in the table counting register D1153 and D1152. Current number of pulses output by DPLSY instruction
13.
DMOVP K10000 DMOVP K15000 DMOVP DMOVP DMOVP DMOVP K6000 K0 K0 K100
7-22
D V P - P L C A P P L I C AT I O N M A N U A L
K0
Y0
Output point
14. 15.
During the execution of DHSZ instruction, do not modify the set values in the comparison table. The designated data will be arranged into the the above program diagram when the program executes to END instruction. Therefore, PLSY instruction has to be executed after DHSZ instruction has been executed once.
D V P - P L C A P P L I C AT I O N M A N U A L
7-23
Operands: S1: External pulse input terminal Explanations: 1. 2. 3. See the specifications of each model for their range of use. Flag: M1100 (SPD instruction performs sampling for one time) External pulse input terminals designated in S1 for all series MPU: MPU Input Available input points 4. ES/EX/SS (V5.7and above) X1, X2 SA/SX/SC X0 / X1, X1, X2 EH EH2/SV X0 / X1, X1, X2, X3 S2: Pulse receiving time (ms) D: Detected result
For SA/SX (V1.4 and above) series MPU and SC (V1.2 and above) series MPU, the new X0 and X1 can be used together with A-B phase input points. When A ahead of B detection result is a positive value and B ahead of A detection result is a negative value, the multiplied frequency of the counter can be set by D1022.
5.
Input points on EH series are single-phase input. EH2/SV series support A-B phase input, and X0 has to be designated in the instruction as the speed detection point and X1 occupied. When B is ahead of A, the detection result will be positive value. If A is ahead of B, the detection result will be negative value.
6. 7.
The received number of pulses of the input terminal designated in S1 is calculated within the time (in ms) designated in S2. The result is stored in the register designated in D. D will occupy 5 consecutive devices. D + 1 and D are the detected value obtained from the previous pulses; D +3 and D + 2 are the current accumulated number of values; D + 4 is the counting time remaining (max. 32,767ms).
8.
Pulse frequency detection for all series: MPU ES/EX/SS (V5.7 and later versions) SA/SX/SC EH EH2/SV Max. frequency X1 (20kHz), X2 (10kHz) X0/X1 (4kHz), X1 (30kHz), X2 (10kHz) X0 (200kHz), X1 (200kHz), X2 (20kHz), X3 (20kHz) X0/X1 (200kHz), X1 (200kHz), X2 (20kHz), X3 (20kHz)
9.
7-24
This instruction is mainly used for obtaining a proportional value of rotation speed. The result D and rotation
D V P - P L C A P P L I C AT I O N M A N U A L
nt
t:
The X input point designated by this instruction cannot be used again as the pulse input terminal of the high speed counter or as an external interruption signal. When M1036 in SC (V1.4 and above) series MPU is enabled, SPD instruction can detect the speeds at X0 ~ X5 at the same time with a total bandwidth of 40kHz. See 2.11 for more details for how to use M1036. There is no limitation on the times of using this instruction in the program, but only one instruction will be executed at a time. When SPD instruction is enabled and M1100 = On, SPD instruction will perform a sampling at the moment when M1100 goes from Off to On and stop the sampling. If you wish to resume the sampling, you have to turn Off M1100 and re-enable SPD instruction.
Program Example: 1. 2. When X7 = On, D2 will calculate the high-speed pulses input by X1 and stop the calculation automatically after 1,000ms. The result will be stored in D0. When the 1,000ms counting is completed, D2 will be cleared to 0. When X7 is On again, D2 will start the calculation again.
X7 SPD X1 K1000 D0
X7 X1
Remarks: 1. 2. When ES/EX/SS (V5.7 and above) and SA/SX/SC series MPU use X1 or X2, the relevant high speed counters or external interruptions I101 and I201 cannot be used. For SC (V1.4 and above) series MPU, when M1036 is enabled, the speed of X0 ~ X5 can be detected at the same time.
D V P - P L C A P P L I C AT I O N M A N U A L
7-25
*
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S1: Pulse output frequency module) Explanations: 1. The program of ES/EX/SS series MPU can use PLSY instruction two times but cannot designate the same Y device. 2. 3. Flags: M1010 ~ M1345. See remarks for more details. S1 designates the pulse output frequency. With M1133 ~ M1135 and D1133, Y0 of SA/SX series MPU is able to output pulses at 50kHz. EH2/SV series MPU of V1.4 and later versions use M1190 ~ M1191, and Y0 and Y2 are able to output 0.01 ~ 500Hz. Range of output frequency for all series: MPU ES/EX/SS SA/SX SC Y0: 0 ~ 30kHz Frequency range Y0: 0 ~10kHz Y1: 0 ~10kHz Y0: 0 ~ 32kHz Y1: 0 ~10kHz Y1: 0 ~ 30kHz Y10: 77 ~ 100kHz Y11: 77 ~ 100kHz 4. Y0: 1 ~ 200kHz Y2: 1 ~ 200kHz EH EH2/SV Y0: 0 ~ 200kHz Y2: 0 ~ 200kHz Y4: 0 ~ 200kHz Y6: 0 ~ 200kHz S2: Number of output pulses D: Pulse output device (please use transistor output
S2 designates the number of output pulses. The 16-bit instruction can designate 1 ~ 32,767 pulses and the 32-bit instruction can designate 1 ~ 2,147,483,647 pulses. Number of continuous pulses for all series: MPU ES/EX/SS/SA/SX/SC M1010 (Y0) On How to designate continuous pulses M1010 (Y0) On M1023 (Y1) On M1023 (Y1) On The number of output pulses designated for Y10 and Y11 is set to K0. SC EH/EH2/SV The number of output pulses designated for Y0, Y2, Y4 and Y6 is set to K0
5.
For EH/EH2/SV series MPU, when the number of output pulses is set to 0, there will be continuous pulse output with no limitation on the number of pulses. For ES/EX/SS/SA/SX/SC series MPU, you have to make M1010 (Y0) or M1023 (Y1) On to allow a continuous pulse output with no limitation on the number of pulses.
6.
For the pulse output device designated in D, EH series MPU can designate Y0 and Y2, EH2/SV series MPU can designate Y0, Y2, Y4 and Y6, ES/EX/SS/SA/SX series MPU can designate Y0 and Y1, SC series MPU can
7-26
D V P - P L C A P P L I C AT I O N M A N U A L
For ES/EX/SS/SA/SX/SC/EH series MPU, when PLSY and DPLSY instruction is disabled, the pulse output completed flags will all be Off automatically.
12.
For EH2/SV series MPU, when PLSY and DPLSY instruction is disabled, the user will have to reset the pulse output completed flags.
13. 14.
The user has to reset the pulse output completed flags after the pulse output is completed. After PLSY instruction starts to be executed, Y will start a pulse output. Modifying S2 at this moment will not affect the current output. If you wish to modify the number of output pulses, you have to first stop the execution of PLSY instruction and modify the number.
S1 can be modified when the program executes to PLSY instruction. Off time : On time of the pulse output = 1 : 1. When the program executes to PLSY instruction, the current number of output pulses will be stored in the special data registers D1336 ~ D1339. See remarks for more details.
18.
For SA/EH series MPU, there is no limitation on the times using this instruction. For SA/SX/SC/EH series MPU, the program allows two instructions being executed at the same time. For EH2/SV series MPU, the program allows four instructions being executed at the same time.
Program Example: 1. 2. When X0 = On, there will be 200 pulses output from Y0 at 1kHz. When the pulse output is completed, M1029 will be On and Y10 will be On. When X0 = Off, the pulse output from Y0 will stop immediately. When X0 is On again, the output will start again ffrom the first pulse.
D V P - P L C A P P L I C AT I O N M A N U A L
7-27
K1000
K200
Y0
Y0 output
1 1ms
200
Remarks: 1. Flags and special registers for ES/EX/SS series MPU: M1010: M1023: M1029: M1030: M1078: M1079: D1030: D1031: D1032: D1033: M1010: M1023: M1029: M1030: M1078: M1079: M1102: M1103: M1347: M1348: M1524: M1525:
7-28
When On, Y0 output will be continuous with no limitation on the number of pulses. When Off, the number of output pulses from Y0 will be decided by S2. When On, Y1 output will be continuous with no limitation on the number of pulses. When Off, the number of output pulses from Y1 will be decided by S2. On when Y0 pulse output is completed. On when Y1 pulse output is completed. Y0 output pauses. Y1 output pauses. Low word of the current number of output pulses from Y0 High word of the current number of output pulses from Y0 Low word of the current number of output pulses from Y1 High word of the current number of output pulses from Y1 (SA/SX/SC) When On, Y0 output will be continuous with no limitation on the number of pulses. When Off, the number of output pulses from Y0 will be decided by S2. (SA/SX/SC) When On, Y1 output will be continuous with no limitation on the number of pulses. When Off, the number of output pulses from Y1 will be decided by S2. (SA/SX/SC) On when Y0 pulse output is completed. (SA/SX/SC) On when Y1 pulse output is completed. (SA/SX/SC) Y0 output pauses. (SA/SX/SC) Y1 output pauses. (SC) On when Y10 pulse output is completed. (SC) On when Y11 pulse output is completed. (SA/SC) Auto zero return after Y0 output is completed. (Available only in SA V1.8 and later versions, SC V1.6 and later versions) (SA/SC) Auto zero return after Y1 output is completed. (Available only in SA V1.8 and later versions, SC V1.6 and later versions) (SC) Auto zero return after Y10 output is completed. (Available only in V1.6 and later versions) (SC) Auto zero return after Y11 output is completed. (Available only in V1.6 and later versions)
D V P - P L C A P P L I C AT I O N M A N U A L
D V P - P L C A P P L I C AT I O N M A N U A L
7-29
(EH/EH2/SV) Phase setting of CH1 (Y2, Y3): D1221 determines the phase by the last two bits; other bits are invalid. 1. K0: Y2 output 2. K1: Y2, Y3 AB-phase output; A ahead of B. 3. K2: Y2, Y3 AB-phase output; B ahead of A. 4. K3: Y3 output (EH2/SV) Phase setting of CH2 (Y4, Y5): D1229 determines the phase by the last two bits; other bits are invalid. 1. K0: Y4 output 2. K1: Y4, Y5 AB-phase output; A ahead of B. 3. K2: Y4, Y5 AB-phase output; B ahead of A. 4. K3: Y5 output (EH2/SV) Phase setting of CH3 (Y6, Y7): D1230 determines the phase by the last two bits; other bits are invalid. 1. K0: Y6 output 2. K1: Y6, Y7 AB-phase output; A ahead of B. 3. K2: Y6, Y7 AB-phase output; B ahead of A. 4. K3: Y7 output (EH/EH2/SV) Low word of the number of CH0 offset pulses (EH/EH2/SV) High word of the number of CH0 offset pulses (EH/EH2/SV) Low word of the number of CH1 offset pulses (EH/EH2/SV) High word of the number of CH1 offset pulses (EH/EH2/SV) Low word of the number of remaining pulses at CH0 (EH/EH2/SV) High word of the number of remaining pulses at CH0 (EH/EH2/SV) Low word of the number of remaining pulses at CH1 (EH/EH2/SV) High word of the number of remaining pulses at CH1 (EH/EH2/SV) Low word of the current number of output pulses at CH0 (EH/EH2/SV) High word of the current number of output pulses at CH0 (EH/EH2/SV) Low word of the current number of output pulses at CH1 (EH/EH2/SV) High word of the current number of output pulses at CH1 (EH2/SV) Low word of the current number of output pulses at CH2 (EH2/SV) High word of the current number of output pulses at CH2 (EH2/SV) Low word of the current number of output pulses at CH3 (EH2/SV) High word of the current number of output pulses at CH3 (EH/EH2/SV) Low word of the number of compensation pulses at CH0 (EH/EH2/SV) High word of the number of compensation pulses at CH0 (EH/EH2/SV) Low word of the number of compensation pulses at CH1 (EH/EH2/SV) High word of the number of compensation pulses at CH1
D V P - P L C A P P L I C AT I O N M A N U A L
D1229:
D1230:
D1328: D1329: D1330: D1331: D1332: D1333: D1334: D1335: D1336: D1337: D1338: D1339: D1375: D1376: D1377: D1378: D1344: D1345: D1346: D1347:
7-30
EI FEND M1000 I 001 DPLSY SET IRET M1000 I 101 DPLSY SET IRET END K1000 M1348 K1000 Y2 K1000 M1347 K1000 Y0
Explanations: a) Whenever X0 is triggered, Y0 will output 1,000 pulses; whenever X1 is triggered, Y2 will output 1,000 pulses. b) When X triggers Y pulse output, there should be an interval of at least one scan time between the end of Y pulse output and the next X-triggered output. Program Example 2:
X1 M1347 X2 PLSY END K1000 K1000 Y0
Explanations:
D V P - P L C A P P L I C AT I O N M A N U A L
7-31
7-32
D V P - P L C A P P L I C AT I O N M A N U A L
*
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S1: Pulse output width Explanations: 1. 2. 3. 4. 5. 6. 7. S1 S2. See the specifications of each model for their range of use. In ES/EX/SS series MPU, PWM instruction can only be used once in the program. Flags: See remarks for more details. Range of S1: (t) 0 ~ 32,767ms. Range of S2: (T) 1 ~ 32,767ms (but S1 S2). D for all series MPU: MPU Output point 8. 9. 10. ES/EX/SS/SA/SX/SC Y1 EH Y0, Y2 EH2/SV Y0, Y2, Y4, Y6 S2: Pulse output period D: Pulse output device (please use transistor output module)
When PWM instruction is used in the program, its outputs cannot be the same as those of API 57 PLSY and API 59 PLSR. PWM instruction designates the pulse output width in S1 and pulse output period in S2 and outputs from output device D. For SA/SX/SC series MPU, When, S1 0 or S2 0 or S1 > S2, there will be operational errors (M1067 and M1068 will not be On), and there will be no output from the pulse output device. When S1 = S2, the pulse output device will keep being On.
11.
For EH/EH2/SV series MPU, When, S1 < 0 or S2 0 or S1 > S2, there will be operational errors (M1067 and M1068 will be On), and there will be no output from the pulse output device. When S1 = 0, M1067 and M1068 will not be On and there will be no output from the pulse output device. When S1 = S2, the the pulse output device will keep being On.
12. 13.
S1 and S2 can be changed when PWM instruction is being executed. For SA/EH series MPU, there is no limitation on the times using this instruction in the program. However, for EH series MPU, two instructions are allowed to be executed at the same time; for EH2/SV series MPU, four instructions are allowed to be executed at the same time.
D V P - P L C A P P L I C AT I O N M A N U A L
7-33
t=1,000ms
Y1 output
T=2,000ms
Remarks: 1. Flags for ES/EX/SS/SA/SX/SC series MPU: M1070: M1010: M1070: M1071: M1258: M1259: M1334: M1335: M1336: M1337: M1520: M1521: M1522: M1523: M1526: M1527: M1530: M1531: D1336: D1337: D1338: D1339: D1371: D1372: Y1 pulse output time unit switch. When Off: 1ms; when On: 100us (EH/EH2/SV) When On, CH0, CH1, CH2 and CH3 will output pulses when END instruction is executed. Off when the output starts. (EH/EH2/SV) The setting of time unit of CH0 has to work with D1371. (EH/EH2/SV) The setting of time unit of CH1 has to work with D1372. (EH/EH2/SV) CH0 pulse output signals reverse. (EH/EH2/SV) CH1 pulse output signals reverse. (EH/EH2/SV) CH0 pulse output pauses. (EH/EH2/SV) CH1 pulse output pauses. (EH/EH2/SV) CH0 pulse output has been sent. (EH/EH2/SV) CH1 pulse output has been sent. (EH2/SV) CH2 pulse output pauses. (EH2/SV) CH3 pulse output pauses. (EH2/SV) CH2 pulse output has been sent. (EH2/SV) CH3 pulse output has been sent. (EH2/SV) CH2 pulse output signals reverse. (EH2/SV) CH3 pulse output signals reverse. (EH2/SV) The setting of time unit of CH2 has to work with D1373. (EH2/SV) The setting of time unit of CH3 has to work with D1374. (EH/EH2/SV) Low word of the current number of output pulses from CH0. (EH/EH2/SV) High word of the current number of output pulses from CH0. (EH/EH2/SV) Low word of the current number of output pulses from CH1. (EH/EH2/SV) High word of the current number of output pulses from CH1. (EH/EH2/SV) Time unit of CH0 output pulses when M1070 = On. (EH/EH2/SV) Time unit of CH1 output pulses when M1071 = On. 2. Flags and special registers for EH/EH2/SV series MPU:
7-34
D V P - P L C A P P L I C AT I O N M A N U A L
3. Time unit settings for EH/EH2/SV series MPU: You cannot modify M1070 in the program. D1371, D1372, D1373 and D1374 determine the time unit of the output pulses from CH0, CH1, CH2 and CH3 and the default setting is K1. If your set value is not within the range, the default value will be adopted. D1371, D1372, D1373, D1374 Time unit K0 10us K1 100us K2 1ms K3 10ms
4. When there are many high speed pulse output instructions (PLSY, PWM, PLSR) in a program for Y0 output, and provided these instructions are being executed in the same scan period, PLC will set up and output the instructions with the fewest steps.
D V P - P L C A P P L I C AT I O N M A N U A L
7-35
*
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S1: Maximum speed of pulse output S2: Total number of output pulses S3: Acceleration/deceleration time (ms) D: Pulse output device (please use transistor output module) Explanations: 1. 2. 3. 4. See the specifications of each model for their range of use. For ES/EX/SS series MPU, PLSR instruction can be used twice in the program but the outputs cannot be overlapped. Flags: See remarks of API 57 PLSY. Range of S1: 10 ~ 32,767Hz (16-bit); 10 ~ 200,000Hz (32-bit). The maximum speed has to be 10s multiple; if not, the 1s digit will be left out. 1/10 of the maximum speed is the variation of one acceleration or deleration. Please be aware if the variation reponds to the acceleration/deceleration demand from the step motor, in case the step motor may crash. 5. 6. Range of S2: 110 ~ 32,767 (16-bit); 110 ~ 2,147,483,647 (32-bit). If S2 is less than 110, the pulet output will be abnormal. Range of S3: below 5,000ms. The acceleration time and deceleration time have to be the same. a) The acceleration/deceleration time has to be 10 times longer than the maximum scan time (D1012). If not, the slope of accleration and deceleration will be incorrect. b) The minimum set value of acceleration/deceleration time can be obtained from the following equation:
S3 >
90,000 S1
If the set value is less than the result obtained from the equation, the acceleration/deceleration time will be longer. If the set value is less than 90,000/S1, use the result of 90,000/S1 as the set value. c) The maximum set value of acceleration/deceleration time can be obtained from the following equation:
S3 < S2 S1
X
818
d) The speed variation is fixed to 10 steps. If the input acceleration/deceleration time is longer than the maximum set value, the acceleration/deceleration time will follow the maximum set time. If shorter than the minimum set value, the accleration/deceleration time will follow the minimum set time.
7-36
D V P - P L C A P P L I C AT I O N M A N U A L
EH series MPU has two groups pf A-B phase pulse output CH0 (Y0, Y1) and CH1 (Y2, Y3). EH2/SV series MPU has four groups pf A-B phase pulse output CH0 (Y0, Y1), CH1 (Y2, Y3), CH2 (Y4, Y5) and CH3 (Y6, Y7). See remarks of API 57 PLSY for how to set up.
9.
PLSR instruction is a pulse output instruction with acclerating and decelerating functions. The pulses accelerate from the static status to target speed and decelerates when the target distance is nearly reached. The pulse output will stop when the target distance is reached.
When PLSR instruction is executed, after S1, S2 and S3 are set, the pulses will output from D. The output starts at the frequency of increasing S1/10 at a time. The time forf every frequency is fixed at S3/9. S1, S2 and S3 can be changed when PLSR instruction is being executed. For ES/EX/SS/SA/SX/SC series MPU, when all the Y0 pulses have been sent, M1029 will be On; when all the Y1 pulses have been sent, M1030 will be On. Next time when PLSR instruction is enabled, M1029 or M1030 will be 0 again and after the pulse output is completed, it will become 1 again.
13.
For EH/EH2/SV series MPU, when all the CH0 (Y0, Y1) pulses have been sent, M1029 will be On; when all the CH1 (Y2, Y3) pulses have been sent, M1030 will be On; when CH2 (Y4, Y5) pulses have been sent, M1036 will be On; when CH3 (Y6, Y7) pulses have been sent, M1037 will be On. Next time when PLSR instruction is enabled, M1029, M1030, M1036 or M1037 will be 0 again and after the pulse output is completed, they will become 1 again.
14. 15.
For EH2/SV series MPU V1.4 and later versions, when the instruction designate incorrect parameters, the default output will become the maximum value or mininum value. During every acceleration section, the number of pulses ( frequency time) may not all be integers. PLC will round up the number to an integer before the output. Therefore, the acceleration time of every section may not be exactly the same. The offset is determined upon the frequency and the decimal after rounding up. In order to ensure the correct number of output pulses, PLC will supplement insufficient pulses in the last section.
16.
For SA/EH series MPU, there is no limitation on the times of using this instruction in the program. However, for SA/SX/SC/EH series MPU, two instructions can be exeucted at the same time; for EH2/SV series MPU, four instructions can be executed at the same time.
Program Example: 1. 2. When X0 = On, the pulses will output at the maximum frequency 1,000Hz with the total number D10 at 3,000ms from Y0. The frequency will increase by 1,000/10Hz at a time and every frequency will last for 3,000/9 (ms). When X10 is Off, the output will be interrupted. When X0 is On again, the counting of pulses will start from 0.
X0 PLSR K1000 D10 K3000 Y0
D V P - P L C A P P L I C AT I O N M A N U A L
7-37
Pulse speed (Hz) Time interval among Targeted speed: 10 ~ 200,000Hz pulse outputs 10 10 = S 3 x 1/10 9 9 Every speed variation 8 8 = S 1 x 1/10 S2 7 7 6 6 10-step 5 5 10-step variations variations 4 4 3 3 16-bit command:110~32,767PLS 2 2 32-bit command:110~2,147,483,647PLS 1 1 Time(Sec) Accel time ( S 3) Decel time ( S 3) below 5,000ms below 5,000ms
Remarks: 1. 2. The outputs cannot be the same as those of API 57 PLSY and API 58 PWM. When there are many high speed pulse output instructions (PLSY, PWM, PLSR) in a program for Y0 output, and provided these instructions are being executed in the same scan period, PLC will set up and output the instructions with the fewest steps. 3. With M1133 ~ M1135 and D1133, Y0 of SA/SX/SC series MPU can output pulses at up to 50kHz. See 2.11 for more details of special D and special M. Range of output frequecies for all series: MPU ES/EX/SS SA/SX/SC EH EH2/SV Y0: 10 ~ 200,000Hz Range Y0: 10 ~ 10,000Hz Y1: 10 ~ 10,000Hz Y0: 10 ~ 30,000Hz Y1: 10 ~ 30,000Hz Y0: 10 ~ 200,000Hz Y2: 10 ~ 200,000Hz Y2: 10 ~ 200,000Hz Y4: 10 ~ 200,000Hz Y6: 10 ~ 200,000Hz 4. Flags and special registers for SA/SC series MPU: M1347 For SA/SC. Reset flag for Y0 pulse output (Available in SA V1.8 and later version, SC V1.6 and later versions) For SA/SC. Reset flag for Y1 pulse output (Availabe in SA V1.8 and later versions, SC V1.6 and later versions) For SC (V1.6 and later versions). Reset flag for Y10 pulse output For SC (V1.6 and later versions). Reset flag for Y11 pulse output
Flags and special registers for EH2/SV series MPU: M1347 M1348 M1524 M1525 For EH2/SV (V1.4 and later versions). Reset flag for CH0 pulse output For EH2/SV (V1.4 and later versions). Reset flag for CH1 pulse output For EH2/SV (V1.4 and later versions). Reset flag for CH2 pulse output For EH2/SV (V1.4 and later versions). Reset flag for CH3 pulse output
7-38
D V P - P L C A P P L I C AT I O N M A N U A L
2.
The range of pulse speed for this instruction is 10 ~ 200,000Hz. If the set values of maximum speed and acceleration/deceleration time exceed the range, PLC will operate by the default value that is within the range. Operand Explanation Range 16-bit 32-bit S1 Max. frequency 10 ~ 32,767Hz 10 ~ 200kHz K0: No output Kn: Designated frequency S2 Total number of pulses 110 ~ 32,767 110 ~ 2,147,483,647 Kn: Designated number S3 Accel/Decel time 1 ~ 5,000ms D Output point Y0 ~ Y7 See settings of D1220, D1221
Definition
Frequency F
Total number of output pulses F0 Start frequency 16-bit instruction: 110 ~ 32,767PLS 32-bit instruction: 110 ~ 2,147,483,647PLS Accel time 1 ~ 5,000ms Decel time 1 ~ 5,000ms
3.
The acceleration/deceleration of EH/EH2/SV series MPU is based on the number of pulses. If the output cannot reach the maximum acceleration frequency within the acceleration/deceleration time offered, the instruction will automatically adjust the acceleration/deceleration time and the maximum frequency.
4. 5.
The operands have to be set before the execution of the instruction. All acceleration/deceleration instructions are included with the brake function. The brake function will be enabled when PLC is performing acceleration and the switch contact is suddenly Off. The deceleration will operate at the slope of the acceleration.
Frequency F Original acceleration path Brake path S1
F0 Time T
D V P - P L C A P P L I C AT I O N M A N U A L
7-39
Function
Controllers
ES/EX/SS SA/SX/SC EH/SV
Operands: S: Start device in the designated operation mode D2: The biggest No. of designated step in auto mode Explanations: 1. S will occupy 8 consecutive points. 2. Range of D1 and D2: for SA/SX/SC/EH/EH2/SV S20 ~ S899; for ES/EX/SS S20 ~ S127; D2 > D1. 3. See the specifications of each model for their range of use. 4. ES/SA series MPU does not support E, F index register modification. 5. IST instruction can only be used once in the program. 6. Flags: M1040 ~ M1047. See remarks for more details. 7. IST instruction is a handy instruction specifically for the initial status of step ladder control procedure to accommodate special auxiliary relay. Program Example 1: 1. Use of IST instruction
M1000 IST X10 S20 S60
X10: Individual operation X11: Zero return X12: Step operation X13: One cycle operation M1040: Operation forbidden M1041: Operation starts M1042: Pulse output enabled M1047: STL monitor enabled
X14: Continuous operation X15: Zero return enabled switch X16: Start switch X17: Stop switch S0: Initiates manual operation S1: Initiates zero return S2: Initiates auto operation
2. When IST instruction is being executed, the following special auxiliary relays will switch automatically.
3. S10 ~ S19 are for zero return and cannot be used as general steps. When S0 ~ S9 are in use, S0 ~ S2 represent manual operation mode, zero return mode and auto operation mode. Therefore, in the program , you have to write the circuit of the three steps in advance. 4. When switched to S1 (zero return) mode, any On in S10 ~ S19 will result in no zero return. 5. When switched to S2 (auto operation) mode, any On of the S in D1 ~ D2 or M1043 = On will result in no auto operation.
7-40 D V P - P L C A P P L I C AT I O N M A N U A L
Big
Small
2. Operation modes: Manual operation: Turn On/Off of the load by a single button. Zero return: Press the zero return button to automatically zero-return the machine. Auto operation: a) Single step operation: Press auto start button for every one step forward. b) One cycle operation: Press auto start button at the zero point. After a cycle of auto operation, the operation will stops at the zero point. Press auto stop button in the middle of the operation to stop the operation and press auto start to restart the operation. The operation will resume until it meets the zero point. c) Continuous operation: Press auto start button at the zero point to resume the operation. Press auto stop to operate until it meets the zero point. 3. The control panel:
Start Power Stop Power
Clip Ball Ascend Right Shift
Step X12 Zero Return X11 One cycle Operation X13 Continuous Operation X14
X20
X22
X24
Left Shift
X21
X23
X25
a) Ball size sensor X0. b) Robot arm: left limit X1, big ball right limit X2, small ball right limit X3, upper limit X4, lower limit X5. c) Robot arm: ascending Y0, descending Y1, right shifting Y2, left shifting Y3, clipping Y4. Start Circuit
X0 X1 Y4 M1044 M1000 IST X10 S20 S80
D V P - P L C A P P L I C AT I O N M A N U A L
7-41
S10
RST RST
Y4 Y1
Clipping released Descending stops Robot arm ascends to upper limit (X4 On)
X4
S11
X1
Right shifting stops Robot arm left shifting to left limit (X1 On) Enable zero return completed flag Zero return operation completed
S12
Ladder Diagram:
S1 X15 S S10 S
S10 Y4 Y1
Enter zero return mode Clipping released Descending stops Robot arm ascends to upper limit (X4 On)
X4
SET
S11 S
S11 Y2
Right shifting stops
RST Y3
X1
SET
S12 S
Robot arm left shifting to left limit (X1 On) Enable zero return completed flag Zero return operation completed
SET RST
7-42
D V P - P L C A P P L I C AT I O N M A N U A L
S20
X5 X0
S30
T0
S40
SET TMR
Y4 T1 K30
X4
S31
X4 X2
S41
X4 X3
Y0
S32
X2 X5
Y2
S42
X3
Y2
S50
X5
Y1
S60
T2
RST TMR X4 Y0
Y4 T2 K30
S70
X4 X1
S80
X1
Y3
S2
D V P - P L C A P P L I C AT I O N M A N U A L
7-43
7-44
D V P - P L C A P P L I C AT I O N M A N U A L
D V P - P L C A P P L I C AT I O N M A N U A L
7-45
Bit Devices Y M
Operands: S1: Start device for data stack comparison result n: Length of data to be compared S2: Data to be compared D: Start device for storing comparison
Explanations: 1. 2. 3. 4. 5. 6. 7. When S2 are used in device F, only 16-bit instruction is applicable. D will occupy 5 consecutive points. Range of n: for 16-bit instruction 1 ~ 256; for 32-bit instruction 1 ~ 128. See the specifications of each model for their range of use. The n data in the registers starting from S1 are compared with S2 and the results are stored in the registers starting from D. In the 32-bit instruction, S1, S2, D and n will designate 32-bit registers. For D, the 16-bit counters and 32-bit counters in SA/SX/SC series MPU cannot be mixed when being used.
Program Example: 1. 2. 3. When X0 = On, the data stack consist of D10 ~ D19 will be compared against D0 and the result will be stored in D50 ~ D52. If there are equivalent values appearing during the comparison, D50 ~ D52 will all be 0. The data are compared algebraically. (-10 < 2). The No. of the register with the smallest value among the compared data will be recorded in D53; the biggest will be recorded in D54. When there are more than one smallest value or biggest value, device D will record the No. of the register with bigger value.
X0 SER D10 D0 D50 K10
S1 D10 D11 D12 D13 D14 D15 D16 D17 D18 D19
Data to be compared S2
Data No. 0 1 2 3 4 5 6 7 8 9
Result
D D50
Content 4 1 8 7 9
Description Total number of data with equivalent values No. of the first equivalent value No. of the last equivalent value No. of the smallest value No. of the biggest value
D0 = K100
7-46
D V P - P L C A P P L I C AT I O N M A N U A L
Controllers
ES/EX/SS SA/SX/SC EH/SV
* *
Operands: S1: Start device in the data table n: Number of data for comparison Explanations: 1. 2. 3. 4. 5. 6. When S1 designates KnX, KnY, KnM and KnS, the 16-bit instruction has to designate K4 and 32-bit instruction has to designate K8. For SA/SX/SC series MPU, S2 only supports C device. Range of n: 1 ~ 64 See the specifications of each model for their range of use. ABSD instruction is for the absolute control of the multiple output pulses generated by the present value in the counter. S2 of DABSD instruction can designate high speed counters. However, when the present value in the high speed counter is compared with the target value, the result cannot output immediately owing to the scan time. If an immediate output is required, please use DHSZ instruction that is exclusively for high speed counters. Program Example: 1. 2. 3. Before the execution of ABSD instruction, use MOV instruction to write all the set values into D100 ~ D107 in advance. The even-number D is for lower bound value and the odd-number D is for upper bound value. When X10 = On, the present value in counter C10 will be compared with the four groups of lower and upper bound values in D100 ~ D107. The comprison results will be stored in M10 ~ M13. When X10 = Off, the original On/Off status of M10 ~ M13 will be remained.
X10 ABSD C10 X11 CNT C10 K400 X11 RST C10 D100 C10 M10 K4
4.
M10~ M13 will be On when the present value in C10 upper bound value or lower bound value. Lower bound value D100 = 40 Upper bound value D101 = 100 Present value in C10 40 C10 100 Output M10 = On
D V P - P L C A P P L I C AT I O N M A N U A L
7-47
If the lower bound value > upper bound value, when C10 < upper bound value (60) or > upper bound value (140), M12 will be On. Lower bound value D100 = 40 D102 = 120 D104 = 140 D106 = 150
40 M10 120 M11 60 M12 150 M13 0 200 400 390 140 210 100
Upper bound value D101 = 100 D103 = 210 D105 = 60 D107 = 390
Present value in C10 40 C10 100 120 C10 210 60 C10 140 150 C10 390
7-48
D V P - P L C A P P L I C AT I O N M A N U A L
Controllers
ES/EX/SS SA/SX/SC EH/SV
* *
Operands: S1: Start device in the data table n: Number of data for comparison Explanations: 1. When S1 designates KnX, KnY, KnM and KnS, it has to designate K4. 2. In the 16-bit instruction, S2 has to designate C0 ~ C198 and will occupy 2 consecutive No. of counters. 3. Range of n: 1 ~ 64 4. See the specifications of each model for their range of use. 5. Flag: M1029 (instruciton execution completed) 6. INCD instruction is for the relative control of the multiple output pulses generated by the present value in the counter. 7. The present value in S2 is compared with S1. S2 will be reset to 0 whenever a comparison is completed. The current number of data processed in temporarily stored in S2 + 1. 8. When n data have been processed, M1029 will be On for one scan period. Program Example: 1. 2. 3. 4. 5. 6. 7. Before the execution of INCD instruction, use MOV instruction to write all the set values into D100 ~ D104 in advance. D100 = 15, D101 = 30, D102 = 10, D103 = 40, D104 = 25. The present value in C10 is compared against the set values in D100 ~ D104. The present value will be reset to 0 whenever a comparison is completed. The current number of data having been processed is temporarily stored in C11. The number of times of reset is temporarily stored in C11. Whenever the content in C11 pluses 1, M10 ~ M14 will also correspondingly change. See the timing diagram below. After the 5 groups of data have been compared, M1029 will be On for one scan period. When X0 goes from On to Off, C10 and C11 will both be reset to 0 and M10 ~ M14 will all be Off. When X0 is On again, the instruction will start its execution again from the beginning.
X0 M1013 CNT INCD C10 D100 K100 C10 M10 K5
D V P - P L C A P P L I C AT I O N M A N U A L
7-49
40 25 15 15
30
15
10 2 3 4
C11
Present value 0
0 1 0
7-50
D V P - P L C A P P L I C AT I O N M A N U A L
Function
Controllers
ES/EX/SS SA/SX/SC EH/SV
Operands: D: Device No. for storing the On time of button switch Explanations: 1. 2. 3. 4. 5. 6. D will occupy 2 consecutive devices. Range of n: 0 ~ 2 See the specifications of each model for their range of use. For SA series MPU, TTMR instruction can be used 8 times in the program. The On time (unit: 100ms) of the external button switch is stored in device No. D + 1. The On time (unit: second) of the switch is multiplied by n and stored in D. Multiple setting: When n = 0, unit of D = second When n = 1, unit of D = 100ms (D 10) When n = 2, unit of D = 10ms (D 100) Program Example 1: 1. 2. The On (being pressed) time of button switch X0 is stored in D1. The setting of n is stored in D0. Therefore, the button switch will be able to adjust the set value in the timer. When X0 goes Off, the content in D1 will be cleared to 0, but the content in D0 will remain.
X0 TTMR D0 K0
n: Multiple setting
X0
D1 D1 D0 T On time (sec)
D0
T On time (sec)
3.
Assume the On time of X0 is T (sec.), see the relation between D0, D1 and n in the table below. n K0 (unit: s) K1 (unit: 100 ms) K2 (unit: 10 ms) 1T 10 T 100 T D0 D1 (unit: 100ms) D1 = D0 10 D1 = D0 D1 = D0/10
7-51
D V P - P L C A P P L I C AT I O N M A N U A L
M19 TMR M1000 BIN X10 TTMR X10 PLF M0 MOV D200 D100E M0 D200 K0 K1X0 E T9 D109
Remarks: 1. 2. For SA series MPU, TTMR instruction can be used 8 times in the program. But in a subroutine or interruption subroutine, the instruction can only be used once. For EH series MPU, there is no limitation on the times using this instruction in the program and 8 instructions can be executed at the same time.
7-52
D V P - P L C A P P L I C AT I O N M A N U A L
Function
Controllers
ES/EX/SS SA/SX/SC EH/SV
Operands: S: No. of timer Explanations: 1. 2. 3. 4. 5. 6. Range of S: for SA/SX/SC T0 ~ T191; for EH/EH2/SV T0 ~ T199 Range of m: 1 ~ 32,767 D will occupy 4 consecutive devices. See the specifications of each model for their range of use. STMR instruction is used for Off-delay, one shot timer and flashing sequence. The No. of timers designated by STMR instructions can be used only once. m: Set value in timer (unit: 100ms) D: No. of start output device
Program Example: 1. 2. 3. 4. 5. When X10 = On, STMR instruction will designate timer T0 and set the set value in T0 as 5 seconds. Y0 is the contact of Off-delay. When X10 goes from Off to On, Y0 will be On. When X10 goes from On to Off, Y0 will be Off after a five seconds of delay. When X10 goes from On to Off, there will be a five seconds of Y1 = On output. When X10 goes from Off to On, there will be a five seconds of Y2 = On output. When X10 goes from Off to On, Y3 will be On after a five seconds of delay. When X10 goes from On to Off, Y3 will be Off after a five seconds of delay.
X10 STMR X10 Y0 Y1 Y2 Y3
5 sec 5 sec 5 sec
T0
K50
Y0
5 sec
5 sec
5 sec
6.
Add a b contact of Y3 after X10, and Y1 and Y2 can operate for flashing sequence output. When X10 goes Off, Y0, Y1 and Y3 will be Off and the content in T10 will be reset to 0.
D V P - P L C A P P L I C AT I O N M A N U A L
7-53
T10
K50
Y0
7-54
D V P - P L C A P P L I C AT I O N M A N U A L
Bit Devices Y * M *
Operands: D: Destination device Explanations: 1. See the specifications of each model for their range of use. 2. When ALT instruction is executed, On and Off of D will switch. 3. This instruction adopts pulse execution instructions (ATLP). Program Example 1: When X0 goes from Off to On, Y0 will be On. When X0 goes from Off to On for the second time, Y0 will be Off.
X0 ALTP Y0
X0
Y0
Program Example 2: Using a single switch to enable and disable control. At the beginning, M0 = Off, so Y0 = On and Y1 = Off. When X10 switches between On/Off for the first time, M0 will be On, so Y1 = On and Y0 = Off. For the second time of On/Off switching, M0 will be Off, so Y0 = On and Y1 = Off.
X10 ALT M0 Y0 M0 Y1 M0
Program Example 3: Generating flashing. When X10 = On, T0 will generate a pulse every 2 seconds and Y0 output will switch between On and Off following the T0 pulses.
X10 T0 TMR T0 ALTP Y0 T0 K20
D V P - P L C A P P L I C AT I O N M A N U A L
7-55
*
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S1: Start of ramp signal Explanations: 1. 2. 3. 4. 5. 6. Range of n: 1 ~ 32,767 D will occupy 2 consecutive points. See the specifications of each model for their range of use. Flags: M1026 (enabling RAMP; see remarks for more details); M1029 (RAMP execution completed). This instruction is for obtaining slope (the relation between linearity and scan time). Before using this instruction, you have to preset the scan time. The set value of start ramp signal is pre-written in D10 and set value of end ramp signal in D11. When X10 = On, D10 increases towards D11 through n (= 100) scans (the duration is stored in D12). The times of scans are stored in D13. 7. In the program, first drive M1039 = On to fix the scan time. Use MOV instruction to write the fixed scan time to the special data register D1039. Assume the scan time is 30ms and take the above program for example, n = J100, the time for D10 to increase to D11 will be 3 seconds (30ms 100). 8. 9. When X10 goes Off, the instruction will stop its execution. When X10 goes On again, the content in D12 will be reset to 0 for recalculation. When M1026 = Off, M1029 will be On and the content in D12 will be reset to the set value in D10. S2: End of ramp signal D: Duration of ramp signal n: Scan times
Program Example: When this instruction is used with analog signal outputs, it will be able to buffer START and STOP.
X10 RAMP D10
D11 D12 D10
D11
D12
K100
D10
D12 D11
n scans D10<D11
7-56
D V P - P L C A P P L I C AT I O N M A N U A L
X10
Start signal
X10
Start signal
Operand n in SA/SX V1.8, SC V1.6 and later versions support D device. Please be noted that the content in D can only be modified when the instruction stops executing. Modification cannot be made in the execution of the instruction.
D V P - P L C A P P L I C AT I O N M A N U A L
7-57
Operands: S: Start device for the original data D: Start device for the sorted data Explanations: 1. 2. 3. 4. 5. 6. 7. 8. 9. Range of m1: 1 ~ 32. Range of m2: 1 ~ 6 Range of n: 1 ~ m2 See the specifications of each model for their range of use. Flag: M1029 (SORT execution completed). The sorted result is stored in m1 m2 registers starting from the device designated in D. Therefore, if S and D designate the same register, the sorted result will be the same as the data designated in S. It is better that the start No. designated in S is 0. The sorting will be completed after m1 times of scans. After the sorting is completed, M1029 will be On. There is no limitation on the times of using this instruction. However, only one instruction can be executed at a time. Program Example: 1. When X0 = On, the sorting will start. When the sorting is completed, M1029 will be On. DO NOT change the data to be sorted during the execution of the instruction. If you wish to change the data, please make X0 go from Off to On again.
X0 SORT D0 K5 K5 D50 D100
7-58
D V P - P L C A P P L I C AT I O N M A N U A L
Sorted data when D100 = K3. Columns of data: m2 Column Row Groups of data: m1 1 2 3 4 5 1 Students No. (D50) 4 (D51) 2 (D52) 1 (D53) 5 (D54) 3 2 Physics (D55) 70 (D56) 55 (D57) 90 (D58) 95 (D59) 80 Data Column 3 English (D60) 60 (D61) 65 (D62) 75 (D63) 79 (D64) 98 4 Math (D65) 99 (D66) 54 (D67) 66 (D68) 75 (D69) 89 5 Chemistry (D70) 50 (D71) 63 (D72) 79 (D73) 69 (D74) 90
Sorted data when D100 = K5. Columns of data: m2 Column Row Groups of data: m1 1 2 3 4 5 1 Students No. (D50) 4 (D51) 2 (D52) 5 (D53) 1 (D54) 3 2 Physics (D55) 70 (D56) 55 (D57) 95 (D58) 90 (D59) 80 Data Column 3 English (D60) 60 (D61) 65 (D62) 79 (D63) 75 (D64) 98 4 Math (D65) 99 (D66) 54 (D67) 75 (D68) 66 (D69) 89 5 Chemistry (D70) 50 (D71) 63 (D72) 69 (D73) 79 (D74) 90
D V P - P L C A P P L I C AT I O N M A N U A L
7-59
Function
Controllers
ES/EX/SS SA/SX/SC EH/SV
Operands: S: Start device for key input D1: Device for storing keyed-in value D2: Key output signal
Explanations: 1. S will occupy 10 consecutive points; D2 will occupy 11 consecutive points. 2. 3. 4. See the specifications of each model for their range of use. For SA series MPU, S and D2 do not support E, F index register modification. This instruction designates 10 external input points (representing decimal numbers 0 ~ 9) starting from S. The 10 points are respectively connected to 10 keys. By pressing the keys, you can enter a 4-digit decimal figure 0 ~ 9,999 (16-bit instruction) or a 8-digit figure 0 ~ 99,999,999 (32-bit instruction) and store the figure in D1. D2 is used for storing key status. 5. There is no limitation on the times of using this instruction. However, only one instruction can be executed at a time. Program Example: 1. Connect the 10 input points starting from X0 to the 10 keys (0 ~ 9). When X20 = On, the instruction will be executed and the keyed-in values will be stored in D0 in bin form. The key status will be stored in M10 ~ M19.
X20 TKY X0
0 1
D0
2
M10
3 4 5 6 7 8 9
0V
+24V
S/S
X0
X1
X2
X3
X4
X5
X6
X7
X10
X11
PLC
7-60
D V P - P L C A P P L I C AT I O N M A N U A L
number key
overflow
10
10
10
10
2.
As shown in the timing chart below, the 4 points X5, X3, X0, and X1 connected to the keys are entered in order and you can obtain the result 5,301. Store the result in D0. 9,999 is the maximum value allowed to stored in D0. Once the value exceeds 4 digits, the highest digit will overflow.
3. 4. 5. 6.
M12 = On when from X2 is pressed to the other key is pressed. Same to other keys. When any of the keys in X0 ~ X11 is pressed, one of M10 ~ 19 will be On correspondingly. M20 = On when any of the keys is pressed. When X20 goes Off, the keyed-in value prior to D0 will remain unchanged, but M10 ~ M20 will all be Off.
X0 X1 X3 X5 1 2 3 4
D V P - P L C A P P L I C AT I O N M A N U A L
7-61
Operands
Controllers
ES/EX/SS SA/SX/SC EH/SV
Operands: S: Start device for key scan input D3: Key output signal Explanations: 1. 2. 3. 4. 5. 6. 7. S will occupy 4 consecutive points. D1 will occupy 4 consecutive points. D3 will occupy 8 consecutive points. See the specifications of each model for their range of use. For SA series MPU, S, D1 and D3 do not support E, F index register modification. Flags: M1029 (On whenever a matrix scan period is completed); M1167 (HKY input modes switch). See remarks for more details. This instruction designates 4 continuous external input points starting from S and 4 continuous external input points starting from D1 to construct a 16-key keyboard by a matrix scan. The keyed-in value will be stored in D2 and D3 is used for storing key status. If several keys are pressed at the same time, the first key pressed has the priority. 8. The keyed-in value is termporarily stored in D0. When the 16-bit instruction HKY is in use, 9,999 is the maximum value D0 is able to store. When the value exceeds 4 digits, the highest digit will overflow. When the 32-bit instruction DHKY is in use, 99,999,999 is the maximum value D0 is able to store. When the value exceeds 8 digits, the highest digit will overflow. 9. There is no limitation on the times of using this instruction. However, only one instruction can be executed at a time. Program Example: 1. Designate 4 input points X10 ~ X13 and the other 4 input points Y10 ~ Y13 to construct a 16-key keyboard. When X4 = On, the instruction will be executed and the keyed-in value will be stored in D0 in bin form. The key status will be stored in M0 ~ M7.
X4 HKY X10 Y10 D0 M0
7-62
D V P - P L C A P P L I C AT I O N M A N U A L
number key
BCD value
overflow
103
102
101
100
D0
3.
Function keys input: a) When A is pressed, M0 will be On and retained. When D is pressed next, M0 will be Off, M3 will be On and retained. b) When many keys are pressed at the same time, the first key pressed has the priority.
M5 M4 M3 M2 M1 M0
4.
Key output signal: a) b) When any of A ~ F is pressed, M6 will be On for once. When any of 0 ~ 9 is pressed, M7 will be On for once.
5. 6.
When X4 goes Off, the keyed-in value prior to D0 will remain unchanged, but M0 ~ M7 will all be Off. External wiring:
C D E F
X10
X11
X12
X13
Y10
Y11
Y12
Y13
D V P - P L C A P P L I C AT I O N M A N U A L
7-63
Functions of D1037 (only supports EH/EH2/SV series MPU): Write D1037 to set the overlapping time for keys (unit: ms). The overlapping time will vary upon different program scan time and the settings in D1037.
7-64
D V P - P L C A P P L I C AT I O N M A N U A L
Operands
Controllers
ES/EX/SS SA/SX/SC EH/SV
Operands: S: Start device for switch scan input of switch n: Groups of switches D1: Start device for switch scan output D2: Device for storing the set value
Explanations: 1. 2. 3. 4. 5. Range of n: 1 ~ 2 S and D1 in SA/SX/SC series MPU do not support E, F index register modification. See the specifications of each model for their range of use. Flag: M1029 (DSW execution completed) This instruction designates 4 or 8 consecutive external input points starting from S and 4 consecutive external input points starting from D1 to scan read 1 or 2 4-digit DIP switches.The set values of DIP switches are stored in D2. n decides to read 1 or 2 4-digit DIP switches. 6. There is no limitation on the times of using this instruction in the program. However, for SA series MPU, only one instruction can be executed at a time. For EH series MPU, two instructions are allowed to be executed at a time. Program Example: 1. The first group of DIP switches consist of X20 ~ X23 and Y20 ~ Y23. The second group of switches consist of X24 ~ X27 and Y20 ~ Y23. When X10 = On, the instruction will be executed and the set values of the first group switches will be read and converted into bin values before being stored in D20. The set values of the second group switches will be read, converted into bin values and stored in D21.
X10 DSW X20 Y20 D20 K2
2. 3.
When X10 = On, the Y20 ~ Y23 auto scan cycle will be On. Whenever a scan cycle is completed, M1029 will be On for a scan period. Please use transistor output for Y20 ~ Y23. Every pin 1, 2, 4, 8 shall be connected to a diode (0.1A/50V) before connecting to the input terminals on PLC.
D V P - P L C A P P L I C AT I O N M A N U A L
7-65
0.1s
0.1s
Interruption
4.
10
10
10
2 X21
4 X22
8 X23
1 X24
2 X25
4 X26
8 X27
PLC
C Y20 10
0
Y21 10
1
Y22 10
2
Y23 10
3
Remarks: 1. 2. When n = K1, D2 will occupy one register. When n = K2, D2 will occupy 2 consecutive registers. Follow the methods below for the transistor scan output: a) When X10 = On, DSW instruction will be executed. When X10 goes Off, M10 will keep being On until the scan output completes a scan cycle and go Off. b) When X10 is used as a button switch, whenever X10 is pressed once, M10 will be reset to Off when the scan output designated by DSW instruction completes a scan cycle. The DIP switch data will be read completely and the scan output will only operate during the time when the button switch is pressed. Therefore, even the scan output is a transistor type, the life span of the transistor can be extended because it does not operate too frequently.
X10 SET M10 DSW M1029 RST M10 X20 Y20 D20 K2 M10
7-66
D V P - P L C A P P L I C AT I O N M A N U A L
Bit Devices Y M
Operands: S: Source device to be decoded Explanations: See the specifications of each model for their range of use. Program Example: When X10 = On, the contents (0 ~ F in hex) of the lower 4 bits (b0 ~ b3) of D10 will be decoded into a 7-segment display for output. The decoded results will be stored in Y10 ~ Y17. If the content exceeds 4 bits, the lower 4 bits are still used for the decoding.
X10 SEGD D10 K2Y10
Hex
Data displayed
0 1 2 3 4 5 6 7 8 9 A B C D E F
0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
d a g b c
ON
ON
ON ON OFF ON ON
ON
ON
ON
OFF
OFF ON ON ON ON ON
OFF OFF OFF OFF ON ON ON OFF OFF OFF ON ON ON ON ON ON ON ON ON OFF ON ON ON ON ON ON ON OFF ON ON ON ON OFF ON ON ON
OFF ON ON ON ON ON ON ON
OFF ON OFF ON ON ON ON ON ON ON ON ON
OFF ON ON ON ON OFF
OFF ON ON ON
D V P - P L C A P P L I C AT I O N M A N U A L
7-67
Operands
Controllers
ES/EX/SS SA/SX/SC EH/SV
K *
Operands: S: Source device to be displayed in 7-segment display n: Polarity setting of output signal and scan signal Explanations: 1. 2. Range of n: 0 ~ 7. See remarks for more details. For ES series MPU, the instruction can only be used once in the program. For EH series MPU, the instruction can be used twice in the program. For SA series MPU, there is no limitation on the times of using the instruction, but only one instruction can be executed at a time. 3. 4. 5. For ES/EX/SS/SA/SX/SC series MPU, the last digit of D should be 0 and it does not support E, F index register modification. Flag: M1029 (SEGL execution completed) This instruction occupies 8 or 12 continuous external input points starting from D for displaying 1 or 2 4-digit 7-segment display data and outputs of scanned signals. Every digit carries a 7-segment display drive (to convert the BCD codes into 7-segment display signal). The drive also carries latch control signals to retain the 7-segment display. 6. 7. 8. n decides there be 1 group or 2 groups of 4-digit 7-segment display and designates the polarity for the output. When there is 1 group of 4-digit output, 8 output points will be occupied. When there are 2 groups of 4-digit output, 12 output points will be occupied. When this instruction is being executed, the scan output terminals will circulate the scan in sequence. When the drive contact of the instruction goes from Off to On again, the scan output terminal will restart the scan again. Program Example: 1. When X10 = On, this instruction starts to be executed, Y10 ~ Y17 construct a 7-segment display scan circuit. The value in D10 will be converted into BCD codes and sent to the first group 7-segment display. The value in D11 will be converted into BCD codes as well and sent to the second group 7-segment display. If the values in D10 and D11 exceed 9,999, operational error will occur.
X10 SEGL D10 Y10 K4
2.
When X10 = On, Y14 ~ Y17 will circulate the scan automatically. Every cycle requires 12 scan period. Whenever a cycle is completed, M1029 will be On for a scan period.
7-68
D V P - P L C A P P L I C AT I O N M A N U A L
COM Y10
Y11
Y12
Y13
COM Y14
Y15
0
Y16
1
Y17
2
COM Y20
3
Y21
Y22
Y23
10
10
10
10
10 3
1 2 4 8
10 2 10
100
10 3
10 2 10
10 0
V+
The first group
1 2 4 8
V+
The second group
Remarks: 1. 2. 3. 4. 5. ES/EX/SS series MPU (V4.9 and above) supports this instruction but only supports 1 group of 4-digit 7-segment display and 8 points of output. This instruction can only be used once in the program. Range of n: 0 ~ 3. D of ES/EX/SS series MPU can only designate Y0. When this instruction is executed, the scan time has to be longer than 10ms. If the scan time is shorter than 10ms, please fix the scan time at 10ms. n is for setting up the polarity of the transistor output and the number of groups of the 4-digit 7-segment display. The output point must be a transistor module of NPN output type with open collector outputs. The output has to connect to a pull-up resistor to VCC (less than 30VDC). Therefore, when output point Y is On, the signal output will be in low voltage.
D V P - P L C A P P L I C AT I O N M A N U A L
7-69
PLC
6. Positive logic (negative polarity) output of BCD code BCD value b3 0 0 0 0 0 0 0 0 1 1 7. b2 0 0 0 0 1 1 1 1 0 0 b1 0 0 1 1 0 0 1 1 0 0 b0 0 1 0 1 0 1 0 1 0 1 Y output (BCDcode) 8 0 0 0 0 0 0 0 0 1 1 4 0 0 0 0 1 1 1 1 0 0 2 0 0 1 1 0 0 1 1 0 0 1 0 1 0 1 0 1 0 1 0 1 A 1 1 1 1 1 1 1 1 0 0 Signal output B 1 1 1 1 0 0 0 0 1 1 C 1 1 0 0 1 1 0 0 1 1 D 1 0 1 0 1 0 1 0 1 0
Negative logic (positive polarity) output of BCD code BCD value b3 0 0 0 0 0 0 0 0 1 1 b2 0 0 0 0 1 1 1 1 0 0 b1 0 0 1 1 0 0 1 1 0 0 b0 0 1 0 1 0 1 0 1 0 1 Y output (BCDcode) 8 1 1 1 1 1 1 1 1 0 0 4 1 1 1 1 0 0 0 0 1 1 2 1 1 0 0 1 1 0 0 1 1 1 1 0 1 0 1 0 1 0 1 0 A 0 0 0 0 0 0 0 0 1 1 Signal output B 0 0 0 0 1 1 1 1 0 0 C 0 0 1 1 0 0 1 1 0 0 D 0 1 0 1 0 1 0 1 0 1
8.
Scan latched signal display Positive logic (negative polarity) Y output (latch) 1 Output signal 0 Negative logic (positive polarity) Y output (latch) 0 Output signal 1
9.
Settings of n: Groups of 7-segment display Y output of BCD code Scan latched signal display n 0 1 2 1 group 3 4 5 6 2 groups 7
10. The polarity of transistor output and the polarity of the 7-segment display input can be the same or different by the setting of n.
7-70 D V P - P L C A P P L I C AT I O N M A N U A L
Operands
Controllers
ES/EX/SS SA/SX/SC EH/SV
M *
S *
Operands: S: Start device for key input display scan output Explanations: 1. S will occupy 4 consecutive points. 2. Range of n: 0 ~ 3. See remarks of API 74 SEGL for more details. 3. There no limitation on the times of using this instruction in the program. However, only one instruction is allowed to be executed at a time. 4. S and D2 of SA series MPU do not support E, F index register modification, and D2 can only designate the devices whose last digit is 0 (e.g. Y0, Y10.) 5. See the specifications of each model for their range of use. 6. The output points designated by this instruction shall be transistor output. 7. When using this instruction, please fix the scan time, or place this instruction in the time interruption subroutine (I6 ~ I8). Program Example: 1. When this instruction is executed, X20 is defined as down key, X21 is defined as up key, X22 is defined as right key and X23 is defined as left key. The keys are used for setting up and displaying external set values. The set values (range: 0 ~ 9,999) are stored in D20. 2. 3. When X10 = On, digit 103 will be the valid digit for setup. If you press the left key at this time, the valid digit will circulate as 103 100 101 102 103 100. If you press the right key at this time, the valid digit will circulate as 103 102 101 100 103 102. During the circulation, the digit indicators connected Y24 ~ Y27 will also be On interchangeably following the circulation. 4. If you press the up key at this time, the valid digit will change as 0 1 2 8 9 0 1. If you press the down key, the valid digit will change as 0 9 8 1 0 9. The changed value will also be displayed in the 7-segment display.
X10 ARWS X20 D20 Y20 K0
D V P - P L C A P P L I C AT I O N M A N U A L
7-71
7-72
D V P - P L C A P P L I C AT I O N M A N U A L
Operands: S: English letter to be converted into ASCII code Explanations: 1. 2. 3. 4. 5. S: enter 8 Engligh letters by using WPLSoft on computer or enter ASCII code by HPP. S in SA series MPU only accepts A, B, C, D, E, F, G, H, the 8 English character. See the specifications of each model for their range of use. Flag: M1161 (8/16 bit mode switch) If the execution of this instruction is connected to a 7-segment display, the error message can be displayed by English letters. Program Example: 1. When X0 = On, convert A ~ H into ASCII code and stored it in D0 ~ D3.
X0 ASC ABC D EFGH D0
D0 D1 D2 D3
b15 42H (B) 44H (D) 46H (F) 48H (H) Upper 8 bits
b0 41H (A) 43H (C) 45H (E) 47H (G) Lower 8 bits
2.
When M1161 = On, every ASCII code converted from the letters will occupy the lower 8 bits (b7 ~ b0) of a register. The upper 8 bits are invalid (filled by 0). One register stores a letter.
D V P - P L C A P P L I C AT I O N M A N U A L
7-73
7-74
D V P - P L C A P P L I C AT I O N M A N U A L
Operands
Controllers
ES/EX/SS SA/SX/SC EH/SV
Operands: S: Device for storing ASCII code Explanations: 1. 2. 3. 4. 5. 6. 7. S will occupy 4 consecutive points. D will occupy 10 consecutive points. This instruction can only be used twice in the program. D in SA series MPU does not support E, F, index register modification. See the specifications of each model for their range of use. Flags: M1029 (PR execution completed); M1027 (number of PR outputs) This instruction will output the ASCII codes in the 4 registers starting from S from the output devices in the order designated in D. Program Example 1: 1. 2. Use API 76 ASC to convert A ~ H into ASCII codes and store them in D0 ~ D3 and use this instruction to output the codes in sequence. When M1027 = Off and X10 goes On, the instruction will be executed. Designate Y10 (low bits) ~ Y17 (high bits) as the data output points and Y20 for scan signals. Designate Y21 for the monitor signals during the execution. In this mode, you can execute an output for 8 letters in sequence. During the output, if the drive contact goes Off, the data output will stop immediately and all the outputs will go Off. 3. During the execution of the instruction, when X10 goes Off, all the data output will be interrupted. When X10 is On again, the output will be restarted.
X10 PR D0 Y10
A B C D
T T T
H
T: scan time (ms)
D V P - P L C A P P L I C AT I O N M A N U A L
7-75
Program Example 2: 1. PR instruction is for outputing a string of 8 bits. When the special auxiliary relay M1027 = Off, PR is able to execute an output of maximum 8 letters in string. When M1027 = On, PR is able to execute an output of 1 ~ 16 letters in string. 2. When M1027 = On and X10 goes from Off to On, the instruction will be executed. Designate Y10 (low bits) ~ Y17 (high bits) as the data output points and Y20 for scan signals. Designate Y21 for the monitor signals during the execution. In this mode, you can execute an output for 16 letters in sequence. During the output, if the drive contact goes Off, the data output will stop after it is completed. 3. 4. When the string encounters 00H (NUL), the string output will finish. The letters coming after it will not be processed. When X10 goes from On to Off, the data output will automatically stop after one cycle. If X10 keeps being On, M1029 will not be enabled.
M1002 SET X10 PR D0 Y10 M1027
Remarks: 1. 2. Please use transistor output for the output designated by this instruction. When using this instruction, please fix the scan time or place this instruction in a timed interruption subroutine.
7-76
D V P - P L C A P P L I C AT I O N M A N U A L
Bit Devices Y M
Operands: m1: No. of special module m2: CR# in special module to be read D: Device for storing read data n: Number of data to be read at a time Explanations: 1. 2. 3. Range of m1 (16-bit and 32-bit): for ES/SA: 0 ~ 7, for EH/EH2 :0 ~ 255, for SV: 0 ~ 107. Range of m2 (16-bit and 32-bit): for ES/SA: 0 ~ 48, for EH: 0 ~ 254, for EH2/SV: 0 ~ 499. Range of n: a) 16-bit: for ES/SA: 1 ~ (49 m2), for EH: 1 ~ (255 m2), for EH2/SV: 1 ~ (500 m2). b) 32-bit: for ES/SA: 1 ~ (49 m2)/2, for EH: 1 ~ (255 m2)/2, for EH2/SV: 1 ~ (500 m2)/2. 4. 5. 6. 7. 8. 9. ES series MPU does not support E, F index register modification. m1, m2 and n of EH series MPU do not support word device D. Flag: M1083 (On when allowing interruptions during FROM/TO instruction). This instruction is for reading the data in the CR in special modules. The 16-bit instruction can designate D = K1 ~ K4; the 32-bit instruction can designate D = K1 ~ K8. See application examples in API 79 TO insitruction for how to calculate the No. where the special module is located. Program Example: 1. 2. Read CR#29 of special module No.0 into D0 and CR#30 into D1. Only 2 groups of data is read at a time (n = 2). When X0 = On, the instruction will be executed. When X0 = Off, the instruction will not be executed and the data read will not be changed.
X0 FROM K0 K29 D0 K2
D V P - P L C A P P L I C AT I O N M A N U A L
7-77
Bit Devices Y M
Operands: m1: No. of special module of data to be written at a time Explanations: 1. 2. 3. Range of m1 (16-bit and 32-bit): for ES/SA: 0 ~ 7, for EH/EH2: 0 ~ 255, for SV: 0 ~ 107. Range of m2 (16-bit and 32-bit): for ES/SA: 0 ~ 48, for EH: 0 ~ 254, for EH2/SV: 0 ~ 499. Range of n: a) 16-bit: for ES/SA: 1 ~ (49 m2), for EH: 1 ~ (255 m2), for EH2/SV: 1 ~ (500 m2). b) 32-bit: for ES/SA: 1 ~ (49 m2)/2, for EH: 1 ~ (255 m2)/2, for EH2/SV: 1 ~ (500 m2)/2. 4. 5. 6. 7. 8. ES series MPU does not support E, F index register modification. m1, m2 and n of EH series MPU do not support word device D. Flag: M1083 (On when allowing interruptions during FROM/TO instruction). See remarks for more details. This instruction is for writing the data into the CR in special modules. The 16-bit instruction can designate S = K1 ~ K4; the 32-bit instruction can designate S = K1 ~ K8. m2: CR# in special module to be written S: Data to be written in CR n: Number
Program Example: 1. 2. Use 32-bit instruction DTO to write the content in D11 and D10 into CR#13 and CR#12 of special module No.0. Only 1 group of data is written in at a time (n = 1). When X0 = On, the instruction will be executed. When X0 = Off, the instruction will not be executed and the data written will not be changed.
X0 DTO K0 K12 D10 K1
3.
Operand rules a) m1: The No. of special modules connected to PLC MPU. No. 0 is the module closest to te MPU. Maximum 8 modules are allowed to connected to a PLC MPU and they will not occupy any I/O points. b) m2: CR#. CR (control register) is the n 16-bit memories built in the special module, numbered in decimal as #0 ~ #n. All operation status and settings of the special module are contained in the CR. c) FROM/TO instruction is for reading/writing 1 CR at a time. DFROM/DTO instruction is for reading/writing 2 CRs at a time.
7-78
D V P - P L C A P P L I C AT I O N M A N U A L
CR #10
CR #9
Designated CR number
d) Number of groups n to be transmitted: n = 2 in 16-bit instructions and n = 1 in 32-bit instructions mean the same.
Designated device Designated CR Designated device Designated CR
D0 D1 D2 D3 D4 D5
CR #5 CR #6 CR #7 CR #8 CR #9 CR #10
D0 D1 D2 D3 D4 D5
CR #5 CR #6 CR #7 CR #8 CR #9 CR #10
4.
ES/EX/SS series MPU does not have M1083. During the execution of FROM/TO instruction, all external or internal interruption subroutines will be forbidden. The interruptions are allowed only after FROM/TO instruction finishes its execution. FROM/TO instruction can also be used in an interruption subroutine.
5.
M1083 for switching instruction modes in SA/SX/SC/EH/EH2/SV series MPU: a) When M1083 = Off, during the execution of FROM/TO instruction, all external or internal interruption subroutines will be forbidden. The interruptions are allowed only after FROM/TO instruction finishes its execution. FROM/TO instruction can also be used in an interruption subroutine. b) When M1083 = On and an interruption signal occurs during the execution of FROM/TO instruction, the interruption will be processed first (with a 100us delay) and the execution of FROM/TO will be stopped. After the interruption subroutine finishes its execution, the program will jump to the next instructio of FROM/TO. FROM/TO cannot be used in an interruption subroutine.
FROM/TO Application Example 1: Adjust the A/D conversion curve of DVP-04AD. Set the OFFSET value of CH1 as 0V (= K0LSB) and GAIN value as 2.5V (= K2,000LSB).
M1002 TO TO X0 TO TO K0 K0 K18 K24 K0 K2000 K1 K1 K0 K0 K1 K33 H0 H0 K1 K1
1. 2. 3.
Write H0 to CR#1 of anlog input module No. 0 and set CH1 as mode 0 (voltage input: -10V ~ +10V). Write H0 to CR#33 and allow OFFSET/GAIN tuning in CH1 ~ CH4. When X0 goes from Off to On, write the OFFSET value K0 LSB into CR#18 and the GAIN value K2,000 LSB into
D V P - P L C A P P L I C AT I O N M A N U A L
7-79
1. Write H18 to CR#1 of anlog input module No. 0 and set CH2 as mode 3 (current input: -20mA ~ +20mA). 2. Write H0 to CR#33 and allow OFFSET/GAIN tuning in CH1 ~ CH4. 3. When X0 goes from Off to On, write the OFFSET value K400 LSB into CR#19 and the GAIN value K3,600 LSB into CR#25. FROM/TO Application Example 3: Adjust the D/A conversion curve of DVP-02DA. Set the OFFSET value of CH2 as 0mA (= K0LSB) and GAIN value as 10mA (= K1,000LSB).
M1002 TO TO X0 TO TO K1 K1 K22 K28 K0 K1000 K1 K1 K1 K1 K1 K33 H18 H0 K1 K1
1. Write H18 to CR#1 of anlog output module No. 1 and set CH2 as mode 3 (current output: 0mA ~ +20mA). 2. Write H0 to CR#33 and allow OFFSET/GAIN tuning in CH1 and CH2. 3. When X0 goes from Off to On, write the OFFSET value K0 LSB into CR#22 and the GAIN value K1,000 LSB into CR#28. FROM/TO Application Example 4: Adjust the D/A conversion curve of DVP-02DA. Set the OFFSET value of CH2 as 2mA (= K400LSB) and GAIN value as 18mA (= K3,600LSB). 1. Write H10 to CR#1 of anlog output module No. 1 and set CH2 as mode 2 (current output: +4mA ~ +20mA). 2. Write H0 to CR#33 and allow OFFSET/GAIN tuning in CH1 and CH2. 3. When X0 goes from Off to On, write the OFFSET value K400 LSB into CR#23 and the GAIN value K3,600 LSB into CR#29.
7-80 D V P - P L C A P P L I C AT I O N M A N U A L
1. Read CR#0 of the extension module No. 0 and see if it is DVP-04AD-S: H88. 2. If D0 = H88, set the input modes: (CH1, CH3) mode 0, (CH2, CH4) mode 3. 3. Set the average times in CH1 and CH2 from CR#2 and CR#3 as K32. 4. Read the average of input signals at CH1 ~ CH4 from CR#6 ~ CR#9 and store the 4 data in D20 ~ D23. 5. Read CR#0 of the extension module No. 1 and see if it is DVP-02DA-S: H49. 6. D100 increases K1 and D101 increases K5 every second. 7. When D100 and D101 reach K4,000, they will be cleared as 0. 8. See if the model is DVP-02DA-S when M1 = On. If so, set up output mode: CH1 in mode 0 and CH2 is mode 2. 9. Write the output settings of D100 and D101 into CR#10 and CR#11. The analog output will change by the changes in D100 and D101.
D V P - P L C A P P L I C AT I O N M A N U A L
7-81
Operands: S: Start device for the data to be transmitted data n: Length of data to be received m: Length of data to be transmitted D: Start device for receiving
Explanations: 1. 2. 3. 4. 5. Range of m: 0 ~ 256 Range of n: 0 ~ 256 See the specifications of each model for their range of use. ES series MPU does not support E, F index register modification. This instruction is a handy instruction exclusively for MPU to use RS-485 serial communication interface. The user has to pre-store word data in S data register, set up data length m and the data receiving register D and received data length n. If E, F index registers are used to modify S and D, the user cannot change the set values of E and F when the instruction is being executed; otherwise errors may cause in data writing or reading. 6. 7. 8. 9. Designate m as K0 if you do not need to send data. Designate n as K0 if you do not need to receive data. There is no limitation on the times of using this instruction in the program, but only one instruction is allowed to be executed at a time. During the execution of RS instruction, changing the data to be transmitted will be invalid. If the peripheral devices, e.g. AC motor drive, are equipped with RS-485 serial communication and its communication format is open, you can use RS instruction to design the program for the data transmission between PLC and the peripheral device. 10. If the communication format of the peripheral device is Modbus, DVP series PLC offers handy communication instructions API 100 MODRD, API 101 MODWR, and API 150 MODRW, to work with the device. See explanations of the instructions in this application manual. 11. For the special auxiliary relays M1120 ~ M1161 and special data registers D1120 ~ D1131 relevant to RS-485 communication, see remarks for more details. Program Example 1: 1. 2. Write the data to be transmitted in advance into registers starting from D100 and set M1122 (sending request flag) as On. When X10 = On, RS instruction will be executed and PLC will start to wait for the sending and receiving of data. D100 starts to continuousl send out 10 data and when the sending is over, M1122 will be automatically reset to
7-82
D V P - P L C A P P L I C AT I O N M A N U A L
M1122 D100
Process of received data RST M1123 Receiving of data is completed the flag is reset. The flag is reset.
M1123
Program Example 2: Switching between 8-bit mode (M1161 = On) and 16-bit mode (M1161 = Off) 1. 8-bit mode: The head code and tail code of the data are set up by M1126 and M1130 together with D1124 ~ D1126. When PLC is executing RS instruction, the head code and tail code set up by the user will be sent out automatically. M1161 = On indicates PLC in 8-bit conversion mode. The 16-bit data will be divided into the higher 8 bits and lower 8 bits. The higher 8 bits are ignored and only the lower 8 bits are valid for data transmission.
M1000 M1161 X0 RS D100 K4 D120 K7
Head code
source data register, starting from the lower 8 bits of D100 length = 4
Tail code 1
Tail code 2
D V P - P L C A P P L I C AT I O N M A N U A L
7-83
Head code
received data register, starting from the lower 8 bits of D120 length = 7
Tail code 1
Tail code 2
When receiving data, PLC will receive the head code and tail code of the data from the external equipment; therefore, the user has to be aware of the setting of data length n. 2. 16-bit mode: The head code and tail code of the data are set up by M1126 and M1130 together with D1124 ~ D1126. When PLC is executing RS instruction, the head code and tail code set up by the user will be sent out automatically. M1161 = Off indicates PLC in 16-bit conversion mode. The 16-bit data will be divided into the higher 8 bits and lower 8 bits for data transmission.
M1001 M1161 X0 RS D100 K4 D120 K7
source data register, starting from the lower 8 bits of D100 length = 4
D120L
D120H
D121L
D121H
D122L
D122H
D123L
Head code
received data register, starting from the lower 8 bits of D120 length = 7
Tail code 1
Tail code 2
When receiving data, PLC will receive the head code and tail code of the data from the external equipment; therefore, the user has to be aware of the setting of data length n. Program Example 3: Connect PLC to VFD-B series AC motor drives (AC motor drive in ASCII Mode; PLC in 16-bit mode and M1161 = Off). Write in the 6 data starting from parameter address H2101 in VFD-B in advance as the data to be transmitted.
7-84
D V P - P L C A P P L I C AT I O N M A N U A L
D1120
MOV
M1122 D100
Process of received data M1123 RST M1123 Receiving of data is completed. The flag is reset.
PLC VFD-B
VFD-B, PLC sends : 01 03 2101 0006 D4 CR LF PLC, PLC receives : 01 03 0C 0100 1766 0000 0000 0136 0000 3B CR LF
Registers for sent data (PLC sends out message) Register D100 low D100 high D101 low D101 high D102 low D102 high D103 low D103 high D104 low D104 high D105 low D105 high D106 low D106 high D107 low D107 high D108 low Register D120 low D120 high D121 low D121 high D122 low D122 high D123 low : 0 1 0 3 0 C : 0 1 0 3 2 1 0 1 0 0 0 6 D 4 CR LF Data 3A H 30 H 31 H 30 H 33 H 32 H 31 H 30 H 31 H 30 H 30 H 30 H 36 H 44 H 34 H DH AH Data 3A H 30 H 31 H 30 H 33 H 30 H 43 H STX ADR 1 ADR 0 CMD 1 CMD 0 Number of data (counted by byte) LRC CHK 1 LRC CHK 0 END Error checksum: LRC CHK (0,1) Number of data (counted by words) Start data address STX ADR 1 ADR 0 CMD 1 CMD 0 Address of AC motor drive: ADR (1,0) Instruction code: CMD (1,0) Explanation
D V P - P L C A P P L I C AT I O N M A N U A L
7-85
Program Example 4: Connect PLC to VFD-B series AC motor drives (AC motor drive in RTU Mode; PLC in 16-bit mode and M1161 = On). Write in H12 to parameter address H2000 in VFD-B in advance as the data to be transmitted.
7-86
D V P - P L C A P P L I C AT I O N M A N U A L
8-bit mode
Write in data to be transmitted in advance SET X10 RS M1123 Process of received data RST M1123 Receiving of data is completed. The flag is reset. D100 K8 D120 K8 M1122 Set up sending request
PLC VFD-B
VFD-B, PLC sends: 01 06 2000 0012 02 07 PLC, PLC receives: 01 06 2000 0012 02 07 Data 01 H 06 H 20 H 00 H 00 H 12 H 02 H 07 H Data 01 H 06 H 20 H 00 H 00 H 12 H 02 H 07 H Address Function Data address Data content CRC CHK Low CRC CHK High Address Function Data address Data content CRC CHK Low CRC CHK High Explanation Explanation
Registers for sent data (PLC sends out messages) Register D100 low D101 low D102 low D103 low D104 low D105 low D106 low D107 low Register D120 low D121 low D122 low D123 low D124 low D125 low D126 low D127 low Remarks: 1. Flags for the RS-485 communication of RS/MODRD/MODWR/FWD/REV/STOP/RDST/RSTEF/MODRW instructions
D V P - P L C A P P L I C AT I O N M A N U A L
7-87
M1120
M1121
M1122
M1123
By the system.
7-88
D V P - P L C A P P L I C AT I O N M A N U A L
D1070 ~ D1085
D1129
D V P - P L C A P P L I C AT I O N M A N U A L
7-89
When RS instruction is in use, the frequently used communication format in the peripheral device will define the start word and end word of the control string. Therefore, you can set up the start word and end word in D1124 ~ D1126 or use the start word and end word defined by the PLC. When you use M1126, M1130 and D1124 ~ D1126 to set up the start word and end word, b8 ~ b10 of D1120 have to be set as 1 to make valid the RS-485 communication protocol. See the table below for how to set up. M1130 0 0 M1126 D1124: user defined D1125: user defined D1126: user defined D1124: user defined D1125: user defined D1126: user defined 1 D1124: H 0002 D1125: H 0003 D1126: H 0000 (no setting) D1124: H 003A (:) D1125: H 000D (CR) D1126: H 000A (LF)
1 5.
Example of how to set up the communication format: Assume there is a communication format: Baud rate 9600 7, N, 2 STX : : ETX1 : CR ETX2 : LF Check the table and obtain the communication format H788 and write it into D1120.
b15 b0
D1120 0 0 0 0 0 1 1 1 1 0 0 0 1 0 0 0
0 Don t care 7 8 8
7-90
D V P - P L C A P P L I C AT I O N M A N U A L
The communication protocol is in Modbus ASCII mode, i.e. every byte is composed of 2 ASCII characters. For example, 64Hex is 64 in ASCII, composed by 6 (36Hex) and 4 (34Hex). Every hex 09, AF corresponds to an ASCII code. Character ASCII code 0 30H 1 31H 2 32H 3 33H 4 34H 5 35H 6 36H 7 37H
8 38H
9 39H
A 41H
B 42H
C 43H
D 44H
E 45H
F 46H
Fixed as : (3AH) Address: 0 0: Broadcasting to all drivers 0 1: To the driver at address 01 0 F: To the driver at address 15 1 0: To the driver at address 16 .and so on, maximum to the driver at address 255 (F F) Function code: 0 3: Read contents of many registers 0 6: Write 1 word to register 1 0: Write in contents of many registers Data characters: The data sent by the user. LRC checksum: LCR checksum is 2s complement of the value added from Address to Data Content. For example: 01H + 03H + 21H + 02H + 00H + 02H = 29H. 2s complement of 29H = D7H End word (END):
D V P - P L C A P P L I C AT I O N M A N U A L 7-91
: 0 1 0 3 0 4 1 7 7 0 0 0 0 0 7 1 CR LF
See the following explanation Communication address: In 8-bit binary Function code: In 8-bit binary Data: n 8-bit data CRC checksum: 16-bit CRC consists of 2 8-bit binary See the following explanation
RTU timeout timer (ms) Baud rate (bps) RTU timeout timer (ms) 40 9,600 2 21 10 5 3 19,200 38,400 57,600 115,200 1 1 1 1
For example: Read 2 continuous data stored in the registers of the driver at address 01H (see the table below). The start register is at address 2102H. Inquiry message: Address Function Start data address Number of data (counted by words) CRC CHK Low CRC CHK High 01 H 03 H 21 H 02 H 00 H 02 H 6F H F7 H Responding message: Address Function Number of data (counted by byte) Content in data address 8102H Content in data address 8103H CRC CHK Low CRC CHK High 01 H 03 H 04 H 17 H 70 H 00 H 00 H FE H 5C H
D V P - P L C A P P L I C AT I O N M A N U A L
7-93
D1120
MOV
M1122 D100
Process of received data M1123 RST M1123 Receiving of data is completed. The flag is reset.
SET M1122 X0 Execution of RS instruction X10 Transmission ready M1121 Sending request M1122 Receiving completed M1123 Waiting for receiving M1124 Communication status cleared M1125 MODRD/RDST/MODRW data M1127 receiving and conversion completed Transmitting and receiving M1128 Receiving time-out M1129 Receiving time-out timer, set by D1129 MODRD/RDST/MODRW data converted to hex M1131
3 2 1 0 8 7 6 5 4
Auto reset after the data transmission is completed The user has to do the reset in the program.
Using this in the program will return the status to the initial transmission ready status. ASCII data being converted to hex takes less than 1 scan period.
On when receiving message from the time-out counter Stop counting when receiving all the data Converting data
3 2 1 0
7-94
D V P - P L C A P P L I C AT I O N M A N U A L
Bit Devices Y M
Operands: S: Source device Explanations: 1. 2. 3. 4. The most right digit of X, Y and M of KnX, KnY and KnM has to be 0. When S designates KnX, D has to designate KnM; when S designates KnM, D has to designate KnY. See the specifications of each model for their range of use. This instruction sends the content in S to D in the form of octal system. D: Destination device
Program Example 1: When X3 = On, the content in K4X10 will be sent to K4M10 in octal form.
X3 PRUN K4X10 K4M10
X27 X26 X25 X24 X23 X22 X21 X20 X17 X16 X15 X14 X13 X12 X11 X10
M27 M26 M25 M24 M23 M22 M21 M20 M19 M18 M17 M16 M15 M14 M13 M12 M11 M10 No change
Program Example 2: When X2 = On, the content in K4M10 will be sent to K4Y10 in octal form.
X2 PRUN K4M10 K4Y10
Will not be transmitted M27 M26 M25 M24 M23 M22 M21 M20 M19 M18 M17 M16 M15 M14 M13 M12 M11 M10
Y27 Y26 Y25 Y24 Y23 Y22 Y21 Y20 Y17 Y16 Y15 Y14 Y13 Y12 Y11 Y10
D V P - P L C A P P L I C AT I O N M A N U A L
7-95
Bit Devices Y M
Operands: S: Start device for source data Explanations: 1. 2. 3. 4. 5. Range of n: 1 ~ 256 See the specifications of each model for their range of use. Flag: M1161 (8/16 bit mode switch) 16-bit conversion mode: When M1161 = Off, the instruction converts every bit of the hex data in S into ASCII codes and send them to the 8 high bits and 8 low bits of D. n = the converted number of bits. 8-bit conversion mode: When M1161 = On, the instruction converts every bit of the hex data in S into ASCII codes and send them to the 8 low bits of D. n = the number of converted bits. (All 8 high bits of D = 0) Program Example 1: 1. 2. M1161 = Off: The 16-bit conversion mode When X0 = On, convert the 4 hex values in D10 into ASCII codes and send the result to registers starting from D20.
M1001 M1161 X0 ASCI D10 D20 K4
3.
Assume (D10) = 0123 H (D11) = 4567 H (D12) = 89AB H (D13) = CDEF H 0 = 30H 1 = 31H 2 = 32H 3 = 33H 4 = 34H 5 = 35H 6 = 36H 7 = 37H 8 = 38H 9 = 39H A = 41H B = 42H
4.
0 D20
0 0
1 High byte
1 1 0 0 0 1 0 0
2 Low byte
1 1 0 0
3
0 0
1 D21
0 0
33H
32H
7-96
D V P - P L C A P P L I C AT I O N M A N U A L
H 36 0 0 0 b0 0
H 30 b0 0
6.
When n = 1 ~ 16: n D D20 Low byte D20 High byte D21 Low byte D21 High byte D22 Low byte D22 High byte D23 Llow byte D23 High byte D24 Low byte D24 High byte D25 Low byte D25 High byte D26 Low byte D26 High byte D27 Low byte D27 High byte n D D20 Low byte D20 High byte D21 Low byte D21 High byte D22 Low byte D22 High byte D23 Llow byte D23 High byte D24 Low byte D24 High byte D25 Low byte D25 High byte D26 Low byte D26 High byte D27 Low byte D27 High byte K1 3 K2 2 3 K3 1 2 3 K4 0 1 2 3 K5 7 0 1 2 3 K6 6 7 0 1 2 3 K7 5 6 7 0 1 2 3 K8 4 5 6 7 0 1 2 3
no change
K9 B 4 5 6 7 0 1 2 3
K10 A B 4 5 6 7 0 1 2 3
K11 9 A B 4 5 6 7 0 1 2 3 no change
K12 8 9 A B 4 5 6 7 0 1 2 3
K13 F 8 9 A B 4 5 6 7 0 1 2 3
K14 E F 8 9 A B 4 5 6 7 0 1 2 3
K15 D E F 8 9 A B 4 5 6 7 0 1 2 3
K16 C D E F 8 9 A B 4 5 6 7 0 1 2 3
D V P - P L C A P P L I C AT I O N M A N U A L
7-97
3.
Assume (D10) = 0123 H (D11) = 4567 H (D12) = 89AB H (D13) = CDEFH 0 = 30H 1 = 31H 2 = 32H 3 = 33H 4 = 34H 5 = 35H 6 = 36H 7 = 37H 8 = 38H 9 = 39H A = 41H B = 42H
4.
0
0 0 0 0 0 0
1
0 0 0 0
2
1 1
5.
0 0
b0 1
H 31 0 0 1 b0 0
H 32 b0 1
7-98
D V P - P L C A P P L I C AT I O N M A N U A L
no change
K9 B 4 5 6 7 0 1 2 3
K10 A B 4 5 6 7 0 1 2 3
K11 9 A B 4 5 6 7 0 1 2 3 no change
K12 8 9 A B 4 5 6 7 0 1 2 3
K13 F 8 9 A B 4 5 6 7 0 1 2 3
K14 E F 8 9 A B 4 5 6 7 0 1 2 3
K15 D E F 8 9 A B 4 5 6 7 0 1 2 3
K16 C D E F 8 9 A B 4 5 6 7 0 1 2 3
D V P - P L C A P P L I C AT I O N M A N U A L
7-99
Bit Devices Y M
Operands: S: Start device for source data Explanations: 1. Range of n: 1 ~ 256 2. See the specifications of each model for their range of use. 3. Flag: M1161 (8/16 bit mode switch) 4. 16-bit conversion mode: When M1161 = Off, the instruction is in 16-bit conversion mode. ASCII codes of the 8 high bits and 8 low bits of the hex data in S are converted into hex value and sent to D (every 4 bits as a group). n = the number of bits converted into ASCII codes. 5. 8-bit conversion mode: When M1161 = On, the instruction is in 8-bit conversion mode. Every bit of the hex data in S are converted into ASCII codes and sent to the 8 low bits of D. n = the number of converted bits. (All 8 high bits of D = 0) Program Example 1: 1. 2. M1161 = Off: The 16-bit conversion mode When X0 = On, convert the ASCII codes stored in the registers starting from D20 into hex value and send the result (every 4 bits as a group) to registers starting from D10. n = 4.
M1001 M1161 X0 HEX D20 D10 K4
3.
Assume S D20 low byte D20 high byte D21 low byte D21 high byte D22 low byte D22 high byte D23 low byte D23 high byte ASCII code H 43 H 44 H 45 H 46 H 38 H 39 H 41 H 42 Converted to hex C D E F 8 9 A B S D24 low byte D24 high byte D25 low byte D25 high byte D26 low byte D26 high byte D27 low byte D27 high byte ASCII code H 34 H 35 H 36 H 37 H 30 H 31 H 32 H 33 Converted to hex 4 5 6 7 0 1 2 3
4.
7-100
D V P - P L C A P P L I C AT I O N M A N U A L
44H D21
0 1 0 0 0
D
1 1 0 0 1
43H
0 0 0 1
C
0 1
46H D10
1 1 0 0 1
F
1 0 1 1 1
45H
1 0 1 1
E
1 1
5.
When n = 1 ~ 16: D n 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 D13 D12 D11 D10 ***C H **CD H *CDE H CDEF H DEF8 H EF89 H F89A H 89AB H 9AB4 H AB45 H B456 H 4567 H 5670 H 6701 H 7012 H 0123 H
***C H **CD H *CDE H CDEF H DEF8 H EF89 H F89A H 89AB H 9AB4 H AB45 H B456 H 4567 H
2.
Assume S D20 D21 D22 D23 D24 D25 D26 D27 ASCII code H 43 H 44 H 45 H 46 H 38 H 39 H 41 H 42 Converted to hex C D E F 8 9 A B S D28 D29 D30 D31 D32 D33 D34 D35 ASCII code H 34 H 35 H 36 H 37 H 30 H 31 H 32 H 33 Converted to hex 4 5 6 7 0 1 2 3
D V P - P L C A P P L I C AT I O N M A N U A L
7-101
43H D21
C
0 0 1 0 0
44H D10
0 0 0 0 0 0 0 0 1 1 0 0 1 1
D
0 1
4.
When n = 1 ~ 16: D n 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 D13 D12 D11 D10 ***C H **CD H *CDE H CDEF H DEF8 H EF89 H F89A H 89AB H 9AB4 H AB45 H B456 H 4567 H 5670 H 6701 H 7012 H 0123 H
***C H **CD H *CDE H CDEF H DEF8 H EF89 H F89A H 89AB H 9AB4 H AB45 H B456 H 4567 H
7-102
D V P - P L C A P P L I C AT I O N M A N U A L
Bit Devices Y M
Operands: S: Start device for source data Explanations: 1. 2. 3. 4. 5. Range of n: 1 ~ 256 See the specifications of each model for their range of use. Flag: M1161 (8/16 bit mode switch) The sum check is used for ensuring the correctness of the data transmission. 16-bit conversion mode: When M1161 = Off, the instruction is in 16-bit conversion mode. The instruction sums up n data (8 bits as a unit) from the start register designated in S and stores the results in the registers designated in D. The parity bits are stored in D + 1. 6. 8-bit conversion mode: When M1161 = On, the instruction is in 8-bit conversion mode. The instruction sums up n data (8 bits as a unit; only 8 low bits are valid) from the start register designated in S and stores the results in the registers designated in D. The parity bits are stored in D + 1. Program Example 1: 1. 2. M1161 = Off: The 16-bit conversion mode When X0 = On, the instruction will sum up 6 data stored in the register designated in D0 (8 bits as a unit; n = 6 indicates D0 ~ D2 are designated) and store the result in the register designated in D100. The parity bits are stored in D101.
M1000 M1161 X0 CCD D0 D100 K6
n: Number of data
D V P - P L C A P P L I C AT I O N M A N U A L
7-103
D2 high byte K211 = 1 1 0 1 0 0 1 1 D100 D101 K867 00010001 Total The parity is 1 when there is a odd number of 1. The parity is 0 when there is a even number of 1.
D100 0 D101 0
0 0
0 0
0 0
0 0
0 0
1 1 0 0
0 0
1 0
1 0
0 1
0 0
0 0
1 0
1 1 Parity
Program Example 2: 1. 2. M1161 = On: The 8-bit conversion mode When X0 = On, the instruction will sum up 6 data stored in the register designated in D0 (8 bits as a unit; n = 6 indicates D0 ~ D5 are designated) and store the result in the register designated in D100. The parity bits are stored in D101.
M1000 M1161 X0 CCD D0 D100 K6
(S) D0 low byte D1 low byte D2 low byte D3 low byte D4 low byte D5 low byte D100 D101
Content of data K100 = 0 1 1 0 0 1 0 0 K111 = 0 1 1 0 1 1 1 1 K120 = 0 1 1 1 1 0 0 0 K202 = 1 1 0 0 1 0 1 0 K123 = 0 1 1 1 1 0 1 1 K211 = 1 1 0 1 0 0 1 1 K867 00 01 00 01 Total The parity is 1 when there is a odd number of 1. The parity is 0 when there is a even number of 1.
D 10 0 0 D 10 1 0
0 0
0 0
0 0
0 0
0 0
1 0
1 0
0 0
1 0
1 0
0 1
0 0
0 0
1 0
1 1 Parity
7-104
D V P - P L C A P P L I C AT I O N M A N U A L
Bit Devices Y M
Operands: S: No. of VR Explanations: 1. 2. 3. 4. 5. Range of S: 0 ~ 7; without function card: 0 ~ 1. See the specifications of each model for their range of use. Flags: M1178, M1179. See remarks for more details. VRRD instruction is used for reading 2 points (No.0, No.1) of PLC or the VR rotary switch volume change in the 6 points of the function cards (No.2 ~ No.7) and converting the data into values 0 ~ 255 (stored in D). If you are to set up the timer by the VR volume, simply rotate the VR to modify the set time in the timer. If you are to acquire a value larger than 255, multiply D by a constant. Program Example 1: 1. 2. When X0 = On, VR0 volume changed will be converted into an 8-bit BIN value (0 ~ 255) and stored in D0. When X1 = On, the imer T0 will start to time with the content in D0 as the set value in the timer.
X0 VRRD X1 TMR T0 D0 K0 D0
Program Example 2: 1. 2. Read the VR volume in order: The VR0 ~ VR7 rotary switches on the PLC correspond to S = K0 ~ K7 of VRRD instruction. E index register modification is used in the example below, K0E = K0 ~ K7. The timer converts the scale 0 ~ 10 on the rotary switch into 0 ~ 255. The timing unit of T0 ~ T7 is 0.1 second; therefore, the set time in the timer will be 0 ~ 25.5 seconds.
M1000 RST F OR M1000 VRRD INC NEXT K 0E E D100E E K8
D V P - P L C A P P L I C AT I O N M A N U A L
7-105
3.
Operation of FOR ~ NEXT instruction: a) In the area between FOR ~ NEXT instruction, FOR designating K8 indicates the loop between FOR ~ NEXT will be executed repeatedly for 8 times before the next instruction is executed. b) Between FOR ~ NEXT (INC E), E will be 0, 1, 2, 7 plusing 1. Therefore, the 8 VR rotary switch volumes will be VR0D100, VR1D101, VR2D102VR7D107 and be read to designated registers in order.
Remarks: 1. 2. VR refers to Variable Resister. The 2 points of VR rotary switch built in SA/SC/EH/EH2/SV series MPU can be used together with special D and special M. Device M1178 M1179 D1178 D1179 3. Enabling VR0 Enabling VR1 VR0 value VR1 value Function
If there is no VR extension card inserted in the PLC, setting up the No. of rotary switches as K2 ~ K7 in VRRD and VRSC instruction in the program will result in errors in grammar check.
7-106
D V P - P L C A P P L I C AT I O N M A N U A L
Bit Devices Y M
Operands: S: No. of VR Explanations: 1. 2. 3. Range of S: 0 ~ 7; without function card: 0 ~ 1 See the specifications of each model for their range of use. VRSC instruction is used for reading 2 points (No.0, No.1) of PLC or the VR rotary switch scale (0 ~ 10) in the 6 points of the function cards (No.2 ~ No.7) and storing the data in D. If the position of the VR falls in the middle of two scales, VRSC will round up the value into an integer of 0 ~ 10. Program Example 1: When X0 = On, the scale of VR0 (0 ~ 10) will be stored in D10.
X0 VRSC K0 D10
Program Example 2: 1. 2. 3. When the VR is used as DIP switch, they will correspond to scale 0 ~ 10 and only one of M10 ~ M20 will be On. Use API 41 DECO instruction to decode the scales into M10 ~ M25. When X0 = On, store the scale (0 ~ 10) of VR1 into D1. When X1 = On, use API 41 DECO to decode the scales into M10 ~ M25.
X0 VRSC X1 DECO M10 On when the scale is 0 M11 On when the scale is 1 M20 On when the scale is 10 D1 M10 K4 K1 D1
Remarks: If the MPU is not inserted with a VR extension card, and the No. of the rotary switches inVRRD or VRSC instruction in the program are set as K2 ~ K7, errors will occur in the execution of grammar check.
D V P - P L C A P P L I C AT I O N M A N U A L
7-107
Bit Devices Y M
Operands: D: Device of the absolute value Explanations: 1. 2. 3. See the specifications of each model for their range of use. This instruction obtains the absolute value of the content in the designated in D. This instruction adopts pulse execution instructions (ABSP, DABSP).
Program Example: When X0 = OffOn, obtain the absolute value of the content in D0.
X0 ABS D0
7-108
D V P - P L C A P P L I C AT I O N M A N U A L
Operands: S1: Set value (SV) Explanations: 1. 2. 3. 4. In 16-bit instruction, S3 will occupy 20 consecutive devices; in 32-bit instruction, S3 will occupy 21 consecutive devices. See the specifications of each model for their range of use. See the Remarks below for the times of using PID instruction allowed in the program. This instruction is specifically for PID control. PID operation will be executed by the scan only when the sampling time is reached. PID refers to proportion, integration and differential. PID control is widely applied to many machines, pneumatic and electronic equipments. 5. For the 16-bit instruction, the parameters are S3 ~ S3+19; for the 32-bit instruction, the parameters are S3 ~ S3+20. After all the parameters are set up, PID instruction will start to be executed and the results will be stored in D. D has to be the data register area without latched function. (If you wish to designate a latched data register area, place the data register in the latched area at the beginning of the program and clear it as 0.) Program Example: 1. 2. Complete the parameter setting before executing PID instruction. When X0 = On, the instruction will be executed and the result will be stored in D150. When X0 goes Off, the instruction will not be executed and the data prior to the instruction will stay intact.
X0 PID D0 D1 D100 D150
S3: Parameter
Remarks: 1. 2. 3. ES/EX/SS series MPU V5.7 (and above) supports PID instruction. Other versions do not support the instruction. There is no limitation on the times of using this instruction. However, the register No. designated in S3 cannot be repeated. For the 16-bit instruction, S3 will occupy 20 registers. In the program example above, the area designated in S3 is D100 ~ D119. Before the execution of PID instruction, you have to transmit the setting value to the designated register area by MOV instruction, If the designated registers are latched, use MOVP instruction to transmit all setting value at a time. 4. Settings of S3 in the 16-bit instruction
7-109
D V P - P L C A P P L I C AT I O N M A N U A L
S3:
Proportional gain (KP) 0 ~ 30,000 (%) Integral gain (KI) Differential gain (KD) 0 ~ 30,000 (%) -30,000 ~ 30,000 (%)
S3 +4:
0: automatic control 1: forward control (E = SV - PV) 2: inverse control (E = PV - SV) 3: Auto-tuning of parameter exclusively for the temperature control. The device will automatically become K4 when the auto-tuning is completed and be filled in with the appropriate parameter KP, KI and KD (not avaliable in the 32-bit instruction). 4: Exclusively for the adjusted temperature control (not avaliable in the 32-bit instruction). 5: Auto direction control (limited integrall upper/lower limit) P.S. K5 mode is only available in EH2/SV V1.2, SA/SX V1.8 and SC V1.6. 0 ~ 32,767 E = the error of SV PV. When S3 +5 = K0, the function will not be enabled, e.g. when S3 +5 is set as 5, MV of E between -5 and 5 will be 0. Ex: if S3 +6 is set as 1,000, the output will be 1,000 when MV is bigger than 1,000. S3 +6 has to be bigger or equal S3 +7; otherwise the upper bound and lower bound will switch. Ex: if S3 +7 is set as -1,000, the output will be -1,000 when MV is smaller than -1,000. Ex: if S3 +8 is set as 1,000, the output will be 1,000 when the integral value is bigger than 1,000 and the integration will stop. S3 +8 has to be bigger or equal S3 +9; otherwier the upper bound and lower bound will switch. Ex: if S3 +9 is set as -1,000, the output will be -1,000 when the integral value is smaller than -1,000 and the integration will stop. The accumulated integral value is only for reference. You can still clear or modify it (in 32-bit floating point) according to your need. The previous PV is only for reference. You can still modify it according to your need.
S3 +5:
S3 +6:
Upper bound of output -32,768 ~ 32,767 value (MV) Lower bound of output -32,768 ~ 32,767 value (MV) Upper bound of integral value
S3 +7:
S3 +8:
-32,768~32,767
S3 +9:
Lower bound of integral value Accumulated integral value The previous PV For system use only.
-32,768 ~ 32,767
When parameter setting exceeds its range, the upper bound and lower bound will become the setting value. However, if the motion direction (DIR) exceeds the range, it will be set to 0. PID instruction can be used in interruption subroutines, step points and CJ instruction. The maximum error of sampling time TS = - (1 scan time + 1ms) ~ + (1 scan time). When the error affects the
D V P - P L C A P P L I C AT I O N M A N U A L
7 - 11 0
S3:
Proportional gain (KP) Integral gain (KI) Differential gain (KD) Control direction (DIR)
0: automatic control 1: forward control (E = SV PV) 2: inverse control (E = PV SV) E = the error of SV PV. When S3 +5,6 = K0, the function will not be enabled, e.g. when S3 +5,6 is set as 5, MV of E between -5 and 5 will be 0. Ex: if S3 +7,8 is set as 1,000, the output will be 1,000 when MV is bigger than 1,000. S3 +7,8 has to be bigger or equal S3 +9,10; otherwise the upper bound and lower bound will switch. Ex: if S3 +9,10 is set as -1,000, the output will be -1,000 when MV is smaller than -1,000. Ex: if S3 +11,12 is set as 1,000, the output will be 1,000 when the integral value is bigger than 1,000 and the integration will stop. S3 +11,12 has to be bigger or equal S3 +13,14; otherwier the upper bound and lower bound will switch. Ex: if S3 +13,14 is set as -1,000, the output will be -1,000 when the integral value is smaller than -1,000 and the integration will stop. The accumulated integral value is only for reference. You can still clear or modify it (in 32-bit floating point) according to your need. The previous PV is only for reference. You can still modify it according to your need.
S3 +5, 6:
The range that 32-bit error value (E) doesnt 0 ~ 2,147,483,647 work
S3 +7, 8:
Upper bound of 32-bit output value (MV) Lower bound of 32-bit output value (MV)
S3 +9, 10:
S3 +11, 12:
-2,147,483,648 ~ 2,147,483,647
S3 +13, 14:
Lower bound of 32-bit integral value 32-bit accumulated integral value 32-bit previous PV -
-2,147,483,648 ~ 2,147,483,647
D V P - P L C A P P L I C AT I O N M A N U A L
7 - 111
PV (t )S is the differential value of PV (t ) ; E (t ) 1 is the integral value of E (t ) . When E(t ) is less than 0
S
as the control direction is selected as forward or inverse, E(t ) will be regarded as 0".
The equation above illustrates that this instruction is different from a general PID instruction by the variable use of the differential value. To avoid the flaw that the transient differential value is too big when a general PID instruction is executed for the first time, our PID instruction monitors the differentiation status of the PV. When the variation of PV is too big, this instruction will reduce the output of MV. 4. Symbol explanation:
MV : Output value
K P : Proprotional gain
E (t ) : Error value
SV : Target value
K D : Differential gain
5.
Temperature Control Equation: When S3 +4 is K3 and K4, the equation used in diagram 2 (see below) will be changed as:
MV = 1 KP 1 1 E (t ) + K E (t ) S + K D * PV (t )S I
In which the error value is fixed as E(t) = SV PV This equation is exclusively designed for temperature control. Therefore, when the sampling time (TS) is set as 4
7 - 11 2
D V P - P L C A P P L I C AT I O N M A N U A L
1/S + KP
KI + + G(s) + KD
Diagram 1:S3 + 4 = K0 ~ K2
In Diagram 1, S is differentiation, referring to PV previous PV / sampling time. 1 / S is integration, referring to (previous integral value + error value) sampling time. G(S) refers to the device being controlled.
PID operation is within the dotted-lined area
1/S +
Diagram 2: S 3 + 4 = K3 ~ K4
In Diagram 2, 1/KI and 1/KP refer to divided by KI and divided by KP. Due to that this is exclusively for temperature control, you have to use PID instruction together with GPWM instruction. See Application 3 for more details. 7. Notes: a) S3 + 6 ~ S3 + 13 are only available in SA/SX/SC/EH/EH2/SV series, and ES/EX/SS (v5.7 and above) series MPU.
D V P - P L C A P P L I C AT I O N M A N U A L
7 - 11 3
PID
Encoder PV
Example 2: Diagram of using PID instruction with AC motor drive on the control (S3 + 4 = 0)
S+MV AC motor drive
7 - 11 4
D V P - P L C A P P L I C AT I O N M A N U A L
PID
Heater
Example 4: How to adjust PID parameters Assume that the transfer function of the controlled device G(S) in a control system is a first-order function
G (s ) = b (most models of motors are first-order function), SV = 1, and sampling time (TS) = 10ms, we s+a
suggest you to follow the steps below for adjusting the parameters. Step 1: Set KI and KD as 0 and KP as 5, 10, 20 and 40. Record the SV and PV respectively and the results are as the figure below.
1.5
K P =40 K P =20
1
SV=1 K P =10
K P =5
0.5
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
Time (sec)
Step 2: From the figure, we can see that when KP = 40, there will be over-reaction, so we will not select it. When KP = 20, the PV reaction curve will be close to SV and there will not be over-reaction, but due to its fast start-up with big transient MV, we will consider to put it aside. When KP = 10, the PV reaction curve will get close to SV value more smoothly, so we will use it. Finally when KP = 5, we will not consider it due to the slow reaction. Step 3: Select KP = 10 and adjust KI from small to big (e.g. 1, 2, 4 to 8). KI should not be bigger than KP. Adjust KD from small to big (e.g. 0.01, 0.05, 0.1 and 0.2). KD should not exceed 10% of KP. Finally we obtain the figure of PV and SV below.
D V P - P L C A P P L I C AT I O N M A N U A L
7 - 11 5
PV=SV
1
0.5
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
Time (sec)
Note: This example is only for your reference. Please adjust your parameters to proper ones according to your actual condition of the control system. Application Examples: Application 1 Using PID instruction in the pressure control system (use the diagram of Example 1). Purpose: Enabling the control system to reach the target pressure. Explanation: The system requires a gradual control. Therefore, the system will be overloaded or out of control if the process progresses too fast. Suggested solution: Solution 1: Longer sampling time Solution 2: Using delay instruction. See the figure below.
0 511 Pressure instruction value (D0) Pressure instruction SV delay D1 MV MV converted D5 to speed Voltage converted to instruction value 0 511
Instruction value 280 Instruction value 280 250 200 150 100 50 t A wave 0 B wave
0 255
0V 5V
PID PV
A wave
B wave
D1110
D2: Instruction interval value D3: Instruction interval time Adjusted by the user according to the actual condition t
7 - 11 6
D V P - P L C A P P L I C AT I O N M A N U A L
Application 2 Speed control system and pressure control system work individually (use diagram of Example 2). Purpose: After the speed control operates in open loop for a period of time, adding into it the pressure control system (PID instruction) for close loop control. Explanation: Since the speed and pressure control systems are not interrelated, we have to structure a open loop for speed control first following by a close loop pressure control. If you fear that the control instruction of the pressure control system changes too fast, you can consider to add the instruction delay illustrated in Application 1 into the control. See the control diagram below.
0 M3 D40 Speed instruction 0rpm 3,000rpm + D30 D31 + D32 M2 = On 255 Speed converted D1116 to voltage AC motor drive
D0 Pressure instruction
M0 = On Delay (optional) D1 SV
M1 = On
D V P - P L C A P P L I C AT I O N M A N U A L
7 - 11 7
Application 3 Using auto-tuning on the parameter for the temperature control. Purpose: Using auto-tuning to calculate the most suitable parameters for PID temperature control. Explanation: You may not be familiar with the temperature environment for the first time, so you can use auto-tuning (S3 + 4 = K3) for an initial adjustment. After this, PID instruction will become exclusively for temperature control (S3 + 4 = K4). In this example, the control environment is an oven. See the example program below.
M1002 MOV MOV MOV TO M1013 F RO M M0 MOV RST K3 M0 D204 K0 K6 D11 K1 K4000 K400 K800 K0 D20 D200 D10 K2 K2 K1
7 - 11 8
D V P - P L C A P P L I C AT I O N M A N U A L
The experiment result of using the adjusted parameter exclusively for temperature control after auto-tuning:
From the figure above, we can see that the temperature control after auto-tuning is working fine and we use only
D V P - P L C A P P L I C AT I O N M A N U A L 7 - 11 9
From the result above, we can see that when the parameter is 100C, we can still control the temperature without spending too much time.
7-120
D V P - P L C A P P L I C AT I O N M A N U A L
Operands: S1: Address of communication device Explanations: 1. 2. 3. 4. 5. 6. Range of S1: K0 ~ K254 Range of n: K1 n K6 See the specifications of each model for their range of use. ES/EX/SS series MPU does not support E, F index register modification. Flags: See API 80 RS for explanations on M1120 ~ M1131, M1140 ~ M1143 MODRD is a drive instruction exclusively for peripheral communication equipment in MODBUS ASCII mode /RTU mode. The built-in RS-485 communication ports in Delta VFD drives (except for VFD-A series) are all compatible with MODBUS communication format. MODRD can be used for controlling communication (read data) of Delta drives. 7. 8. 9. 10. If the address of S2 is illegal to the designed communication device, the device will respond with an error, PLC will records the error code in D1130 and M1141 will be On. The feedback (returned) data from the peripheral equipment will be stored in D1070 ~ D1085. After receiving the feedback data is completed, PLC will auto-check if all data are correct. If there is an error, M1140 will be On. In ASCII mode, due to that the feedback data are all in ASCII, PLC will convert the feedback data into numerals and store them in D1050 ~ D1055. D1050 ~ D1055 will be invalid in RTU mode. After M1140 or M1141 turn On, the program will send a correct datum to the peripheral equipment. If the feedback datum is correct, M1140 and M1141 will be reset. Program Example 1: Communication between PLC and VFD-S series AC motor drives (ASCII Mode, M1143 = Off) S2: Address of data to be read n: Length of read data
M1002 MOV SET MOV X1 SET M1122 Set up sending request H87 M1120 K100 D1120 Set up communication protocol 9600, 8, E, 1
8-1
The received data are stored in D1070 ~ D1085 in ASCII format. PLC will automatically convert the data into numerals and store them in D1050 ~ D1055. Sending/receiving of data is completed. The flag is reset.
PLC VFD-S
VFD-S, PLC sends: 01 03 2101 0006 D4 PLC , PLC receives: 01 03 0C 0100 1766 0000 0000 0136 0000 3B
Registers for sent data (sending messages) Register D1089 low D1089 high D1090 low D1090 high D1091 low D1091 high D1092 low D1092 high D1093 low D1093 high D1094 low D1094 high D1095 low D1095 high 0 1 0 3 2 1 0 1 0 0 0 6 D 4 DATA 30 H 31 H 30 H 33 H 32 H 31 H 30 H 31 H 30 H 30 H 30 H 36 H 44 H 34 H ADR 1 ADR 0 CMD 1 CMD 0 Explanation Address of AC motor drive: ADR (1,0) Instruction code: CMD (1,0)
Number of data (counted by words) LRC CHK 1 LRC CHK 0 Checksum: LRC CHK (0,1)
Registers for received data (responding messages) Register D1070 low D1070 high D1071 low D1071 high D1072 low D1072 high D1073 low D1073 high D1074 low D1074 high D1075 low D1075 high D1076 low D1076 high D1077 low D1077 high D1078 low D1078 high D1079 low D1079 high D1080 low D1080 high D1081 low D1081 high D1082 low D1082 high DATA 30 H 31 H 30 H 33 H 30 H 43 H 30 H 31 H 30 H 30 H 31 H 37 H 36 H 36 H 30 H 30 H 30 H 30 H 30 H 30 H 30 H 30 H 30 H 31 H 33 H 36 H Explanation ADR 1 ADR 0 CMD 1 CMD 0 Number of data (counted by byte) PLC automatically convert Content of ASCII codes to numerals address 2101 H and store the numeral in D1050 = 0100 H PLC automatically convert Content of ASCII codes to numerals address 2102 H and store the numeral in D1051 = 1766 H PLC automatically convert Content of ASCII codes to numerals address 2103 H and store the numeral in D1052 = 0000 H PLC automatically convert Content of ASCII codes to numerals address 2104 H and store the numeral in D1053 = 0000 H PLC automatically convert Content of ASCII codes to numerals address 2105 H and store the numeral in D1054 = 0136 H
0 1 0 3 0 C 0 1 0 0 1 7 6 6 0 0 0 0 0 0 0 0 0 1 3 6
8-2
0 0 0 0 3 B
DATA 30 H 30 H 30 H 30 H 33 H 42 H
Explanation PLC automatically convert Content of ASCII codes to numerals address 2106 H and store the numeral in D1055 = 0000 H LRC CHK 1 LRC CHK 0
RST
M1127
PLC VFD-S
VFD-S, PLC sends: 01 03 2102 0002 6F F7 PLC, PLC receives: 01 03 04 1770 0000 FE 5C
Registers for sent data (sending messages) Register D1089 low D1090 low D1091 low D1092 low D1093 low D1094 low D1095 low D1096 low Register D1070 low D1071 low D1072 low D1073 low D1074 low D1075 low D1076 low D1077 low D1078 low DATA 01 H 03 H 21 H 02 H 00 H 02 H 6F H F7 H DATA 01 H 03 H 04 H 17 H 70 H 00 H 00 H FE H 5C H Explanation Address Function Starting data address Number of data (counted by words) CRC CHK Low CRC CHK High Explanation Address Function Number of data (counted by bytes) Content of address 2102 H Content of address 2103 H CRC CHK Low CRC CHK High
8-3
M1127
The received data are stored in D1070~D1085 in ASCII format. PLC will automatically convert the data into numerals and store them in D1050~D1055.
Remarks: 1. The activation criteria placed before the three instructions, API 100 MODRD, API 105 RDST, and API 150 MODRW (Function Code H03), cannot use rising-edge contacts (LDP, ANDP ORP) and falling-edge contacts (LDF, ANDF, ORF); otherwise, the data stores in the receiving registers will be incorrect. 2. 3. M1127 for MODRD instruction stands for the response of data is completed. M1127 will only be On if the responded data are correct. M1123 will be On no matter the responded data are correct or wrong. There is no limitation on the times of using this instruction in the program, but only one instruction is allowed to be executed at a time.
8-4
Operands: S1: Address of communication device Explanations: 1. 2. 3. 4. 5. Range of S1: K0 ~ K254 See the specifications of each model for their range of use. ES/EX/SS series MPU does not support E, F index register modification. Flags: See API 80 RS for explanations on M1120 ~ M1131, M1140 ~ M1143 MODWR is a drive instruction exclusively for peripheral communication equipment in MODBUS ASCII mode/RTU mode. The built-in RS-485 communication ports in Delta VFD drives (except for VFD-A series) are all compatible with MODBUS communication format. MODRD can be used for controlling communication (write data) of Delta drives. 6. If the address of S2 is illegal to the designed communication device, the device will respond with an error, PLC will records the error code in D1130 and M1140 will be On. For example, if 8000H is illegal to VFD-S, M1141 will be On and D1130 = 2. For error codes, see the user manual of VFD-S. 7. The feedback (returned) data from the peripheral equipment will be stored in D1070 ~ D1076. After receiving the feedback data is completed, PLC will auto-check if all data are correct. If there is an error, M1140 will be On. 8. After M1140 or M1141 turn On, the program will send a correct datum to the peripheral equipment. If the feedback datum is correct, M1140 and M1141 will be reset. Program Example 1: Communication between PLC and VFD-S series AC motor drives (ASCII Mode, M1143 = Off) S2: Address of data to be read n: Data to be written
8-5
Set up sending request Set up communication instruction device address 01 data address H0100 data H1770
The received data are stored in D1070 ~ D1085 in ASCII format. PLC will automatically convert the data into numerals and store them in D1050 ~ D1055.
PLC VFD-B
VFD-B, PLC sends: 01 06 0100 1770 71 PLC, PLC receives: 01 06 0100 1770 71
Registers for sent data (sending messages) Register D1089 low D1089 high D1090 low D1090 high D1091 low D1091 high D1092 low D1092 high D1093 low D1093 high D1094 low D1094 high D1095 low D1095 high Register D1070 low D1070 high D1071 low D1071 high D1072 low D1072 high D1073 low D1073 high D1074 low D1074 high D1075 low D1075 high D1076 low D1076 high Program Example 2: Communication between PLC and VFD-S series AC motor drives (RTU Mode, M1143 = On) 0 1 0 6 0 1 0 0 1 7 7 0 7 1 0 1 0 6 0 1 0 0 1 7 7 0 7 1 DATA 30 H 31 H 30 H 36 H 30 H 31 H 30 H 30 H 31 H 37 H 37 H 30 H 37 H 31 H DATA 30 H 31 H 30 H 36 H 30 H 31 H 30 H 30 H 31 H 37 H 37 H 30 H 37 H 31 H ADR 1 ADR 0 CMD 1 CMD 0 Data address ADR 1 ADR 0 CMD 1 CMD 0 Data address Explanation Address of AC motor drive: ADR (1,0) Instruction code: CMD (1,0)
Data contents LRC CHK 1 LRC CHK 0 Error checksum: LRC CHK (0,1) Explanation
8-6
Set up as RTU mode Set up as sending flag Set up communication instruction device address 01 data address H2000 Write in data H12
PLC VFD-S
VFD-S, PLC sends: 01 06 2000 0012 02 07 PLC, PLC receives: 01 06 2000 0012 02 07
Registers for sent data (sending messages) Register D1089 low D1090 low D1091 low D1092 low D1093 low D1094 low D1095 low D1096 low Register D1070 low D1071 low D1072 low D1073 low D1074 low D1075 low D1076 low D1077 low Program Example 3: 1. In the communication between PLC and VFD-S series AC motor drive (ASCII Mode, M1143 = Off), retry when communication time-out, data receiving error and sending address error occur. 2. When X0 = On, PLC will write H1770(K6000) into VFD-S data adress H0100 of device 01. 3. M1129 will be On when communication time-out occurs. The program will trigger M1129 and send request to M1122 for writing the data again. 4. M1140 will be On when data receiving error occurs. The program will trigger M1140 and send request to M1122 for writing the data again. 5. M1141 will be On when sending address error occurs. The program will trigger M1141 and send request to M1122 for writing the data again. DATA 01 H 06 H 20 H 00 H 00 H 12 H 02 H 07 H DATA 01 H 06 H 20 H 00 H 00 H 12 H 02 H 07 H Explanation Address Function Data address Data contents CRC CHK Low CRC CHK High Explanation Address Function Data address Data contents CRC CHK Low CRC CHK High
8-7
Program Example 4: 1. In the communication between PLC and VFD-S series AC motor drive (ASCII Mode, M1143 = Off), retry when communication time-out, data receiving error and sending address error occur. Times of retry = D0 (default = 3). When communication Retry is successful, the user can return to controlling by triggering criteria. 2. When X0 = On, PLC will write H1770(K6000) into VFD-S data adress H0100 of device 01. 3. M1129 will be On when communication time-out occurs. The program will trigger M1129 and send request to M1122 for writing the data again. Times of Retry = D0 (default = 3) 4. M1140 will be On when data receiving error occurs. The program will trigger M1140 and send request to M1122 for writing the data again. Times of Retry = D0 (default = 3) 5. M1141 will be On when sending address error occurs. The program will trigger M1141 and send request to M1122 for writing the data again. Times of Retry = D0 (default = 3)
8-8
Data receive error Retry Sending address error Retry Set up communication instruction: device address 01, data address H0100 data H1770
X0 MODWR M1122 INC M1127 Receiving completed handle received data RST RST M1129 RST M1140 RST M1141 RST M1141 M1140 M1129 M1127 D100 D100 K1 H0100 H1770
Remarks: 1. 2. For the registers for flag settings, see explanations in API 80 RS. The activation criteria placed before the two instructions, API 101 MODWR and API 150 MODRW (Function Code H06, H10), cannot use rising-edge contacts (LDP, ANDP ORP) and falling-edge contacts (LDF, ANDF, ORF) and have to enable sending request M1122 first. 3. 4. M1127 for MODWR instruction stands for the response of data is completed. M1127 will only be On if the responded data are correct. M1123 will be On no matter the responded data are correct or wrong. There is no limitation on the times of using this instruction in the program, but only one instruction is allowed to be executed at a time.
8-9
API 103
Mnemonic REV
Operands
Controllers
ES/EX/SS SA/SX/SC EH/SV
Type OP S1 S2 n X
Bit Devices Y M S K * * *
API 104
Mnemonic STOP
Function
Controllers
ES/EX/SS SA/SX/SC EH/SV
Type OP S1 S2 n X
Bit Devices Y M S K * * *
Operands: S1: Address of communication device Explanations: 1. 2. 3. 4. 5. 6. Range of S1: K0 ~ K31 Range of n: K1 or K2 See the specifications of each model for their range of use. ES series MPU does not support E, F index register modification. Flags: See API 80 RS for explanations on M1120 ~ M1131, M1140 ~ M1143 FWD/REV/STOP are handy instructions exclusively for Delta VFD-A/H series AC motor drive to perform forward running/reverse running/stop. Be sure to set up communication time-out (D1129) when executing this instruction. 7. S2 = operation frequency of AC motor drive. Set frequency in A-series AC motor drive: K0 ~ K4,000 (0.0Hz ~ S2: Rotation frequency of AC motor drive n: Target to be instructed
8-10
Retain communication protocol D1129 Set up communication time-out: 100ms Communication command setting:Device address: 0 Frequency: 500Hz K1: indicated AC motor drive
Communication time-out Retry Data receive error Retry Receiving completed handle received data RST M1127 The received data are stored in the low bit group of D1070 ~ D1080 by ASCI format.
PLC VFD-A
VFD-A, PLC sends: C 0001 0500 PLC, PLC sends: C 0001 0500
Registers for sent data (sending messages) Register D1089 low D1090 low D1091 low D1092 low D1093 low D1094 low D1095 low D1096 low D1097 low D1098 low D1099 low C 0 0 0 1 0 5 0 0 DATA 43 H 03 H 01 H 30 H 30 H 30 H 31 H 30 H 35 H 30 H 30 H Explanation Start word of instruction Checksum Instructed target Communication address
Running instruction
8-11
Running instruction
8-12
Operands: S: Address of communicatino device Explanations: 1. 2. 3. 4. 5. 6. Range of S: K0 ~ K31 Range of n: K0 ~ K3 See the specifications of each model for their range of use. ES series MPU does not support E, F index register modification. Flags: See API 80 RS for explanations on M1120 ~ M1131, M1140 ~ M1143 n: Instructed target (to be read) in AC motor drive n=0, frequency n=1, output frequency n=2, output current n=3, running instruction Data sent back (feedback) from AC motor drive (11 bytes, see VFD-A user manual) are stored in the low bytes of D1070 ~ D1080. Q, S, B, Uu, Nn, ABCD Feedback Q S B U U N N A B C D Explanation Start word: Q (51H). Checksum code: 03H. Instruction authorization. correct: 06H, incorrect: 07H. Communication address (address: 00~31). Uu = (00 ~ 31) indicated in ASCII format. Instructed target (00 ~ 03).Nn = (00 ~ 03) indicated in ASCII format. Instructed data. The content of ABCD differs upon the instructed targets (00 ~ 03). 00 ~ 03 indicate frequency, current and running mode respectively. Please refer to the explanations below for details. Nn = 00 Nn = 01 Nn = 02 Frequency instruction = ABC.D (Hz) Output instruction = ABC.D (Hz) Output current = ABC.D (A) Data storage D1070 low D0171 low D1072 low D1073 low D1074 low D1075 low D1076 low D1077 low D1078 low D1079 low D1080 low n: Target to be instructed
7.
PLC will automatically convert the ASCII characters of ABCD into numerals and store the numeral in D1050. For example, assume ABCD = 0600, PLC will convert ABCD into K0600 (0258 H) and store it in the special register D1050.
8-13
B =
CD =
Remarks: 1. The activation criteria placed before the three instructions, API 100 MODRD, API 105 RDST and API 150 MODRW (Function Code 03), cannot use rising-edge contacts (LDP, ANDP ORP) and falling-edge contacts (LDF, ANDF, ORF); otherwise, the data stores in the receiving registers will be incorrect. 2. 3. For the registers for flag settings, see explanations in API 80 RS. There is no limitation on the times of using this instruction in the program, but only one instruction is allowed to be executed at a time.
8-14
Operands: S: Address of communication device Explanations: 1. 2. 3. 4. 5. 6. 7. Range of S: K0 ~ K31 Range of n: K1 or K2 See the specifications of each model for their range of use. Flags: See API 80 RS for explanations on M1120 ~ M1131, M1140 ~ M1143 RSTEF is a handy communication instruction exclusively for Delta VFD-A series AC motor drives and is used for reset when the AC motor drive operates abnormally. n: instructed target. n=1: AC motor drive at assigned address. n=2: all connected AC motor drives. The feedback (returned) data from the peripheral equipment will be stored in D1070 ~ D1089. If n = 2, there will be no feedback data. Remarks: 1. The activation criteria placed before the three instructions, API 100 MODRD, API 105 RDST and API 150 MODRW (Function Code 03), cannot use rising-edge contacts (LDP, ANDP ORP) and falling-edge contacts (LDF, ANDF, ORF); otherwise, the data stores in the receiving registers will be incorrect. 2. 3. For the registers for flag settings, see explanations in API 80 RS. There is no limitation on the times of using this instruction in the program, but only one instruction is allowed to be executed at a time. n: Target to be instructed
8-15
Bit Devices Y M
Operands: S: Start operation device for ASCII mode checksum operation result Explanations: 1. 2. 3. 4. 5. Range of n: K1 ~ K256 See the specifications of each model for their range of use. Flag: M1161 (switching between 8/16 bit modes) n has to be even. If n does not fall within its range, an operation error will occur, the instruction will not be executed, M1067, M1068 = On and D1067 will record the error code H0E1A. In 16-bit conversion mode: When M1161 = Off, S divides its hex data area into higher 8 bits and lower 8 bits and performs LRC checksum operation on each bit. The data will be sent to the higher 8 bits and lower 8 bits in D. n = the number of calculated bits. 6. In 8-bit conversion mode: When M1161 = On, S divides its hex data area into higher 8 bits (invalid data) and lower 8 bits and performs LRC checksum operation on each bit. The data will be sent to the lower 8 bits in D and occupy 2 registers. n = the number of calculated bits. (All higher bits in D are 0.) Program Example: When PLC communicates with VFD-S series AC motor drives (In ASCII mode, M1143 = Off), (In 8-bit mode, M1161 = On), the sent data write in advance the 6 data read starting from H2101 of VFD-S.
M1002 MOV SET MOV sending request pulse Write in sent data in advance pulse SET X10 RS receiving completed Process of receiving data M1123 RST M1123 Sending/receiving of data is completed. The flag is reset. D100 K17 D120 K35 M1122 Set up transmission request H86 M1120 K100 D1120
8-16
Registers for sent data (sending messages) Register D100 low D101 low D102 low D103 low D104 low D105 low D106 low D107 high D108 low D109 low D110 low D111 low D112 low D113 low D114 low D115 low D116 low : 0 1 0 3 2 1 0 1 0 0 0 6 D 4 CR LF DATA 3A H 30 H 31 H 30 H 33 H 32 H 31 H 30 H 31 H 30 H 30 H 30 H 36 H 44 H 34 H AH DH STX ADR 1 ADR 0 CMD 1 CMD 0 Starting data address Explanation Address of AC motor drive: ADR (1,0) Instruction code: CMD (1,0)
Number of data (counted by words) LRC CHK 1 LRC CHK 0 END Error checksum: LRC CHK (0,1)
The error checksum LRC CHK (0,1) can be calculated by LRC instruction (in 8-bit mode, M1161 = On).
M1000 LRC D101 K12 D113
LRC checksum: 01 H + 03 H + 21 H + 01 H + 00 H + 06 H = 2C H. Obtain 2s complement, D4H, and store D(44H) in the lower 8 bits of D113 and 4(34H) in the lower 8 bits of D114. Remarks: 1. The format of ASCII mode with a communication datum STX Address Hi Address Lo Function Hi Function Lo DATA (n-1) . DATA 0 : 0 1 0 3 2 1 0 2 0 0 0 2 D 7 CR LF Start word = : (3AH) Communication: 8-bit address consists of 2 ASCll codes Function code: 8-bit function consists of 2 ASCll codes Data content: n 8-bit data consists of 2n ASCll codes
LRC checksum: 8-bit checksum consists of 2 ASCll codes End word: END Hi = CR (0DH), END Lo = LF(0AH)
LRC checksum: 2s complement of the summed up value of communication address and data. For example, 01 H + 03 H + 21 H + 02 H + 00 H + 02 H = 29 H. Obtain 2s complement = D7H.
8-17
Bit Devices Y M
Operands: S: Start operation device for RTU mode checksum operation result Explanations: 1. 2. 3. 4. Range of n: K1 ~ K256 Flags: M1161 (switching between 8/16-bit modes) If n does not fall within its range, an operation error will occur, the instruction will not be executed, M1067, M1068 = On and D1067 will record the error code H0E1A. In 16-bit conversion mode: When M1161 = Off, S divides its hex data area into higher 8 bits and lower 8 bits and performs CRC checksum operation on each bit. The data will be sent to the higher 8 bits and lower 8 bits in D. n = the number of calculated bits. 5. In 8-bit conversion mode: When M1161 = On, S divides its hex data area into higher 8 bits (invalid data) and lower 8 bits and performs CRC checksum operation on each bit. The data will be sent to the lower 8 bits in D and occupy 2 registers. n = the number of calculated bits. (All higher 8 bits in D are 0.) Program Example: When PLC communicates with VFD-S series AC motor drives (In RTU mode, M1143 = On), (In 16-bit mode, M1161 = On), the sent data write in advance H12 into H2000 of VFD-S.
M1002 MOV SET MOV SET transmission request pulse SET X10 RS D100 K8 D120 K8 M1122 Set up transmission request SET H87 M1120 K100 M1143 M1161 D1120 Set up communication protocol to 9600, 8, E, 1
8-18
PLC
Registers for sent data (sending messages) Register D100 low D101 low D102 low D103 low D104 low D105 low D106 low D107 low DATA 01 H 06 H 20 H 00 H 00 H 12 H 02 H 07 H Explanation Address Function Data address Data content CRC CHK 0 CRC CHK 1
The error checksum CRC CHK (0,1) can be calculated by CRC instruction (in 8-bit mode, M1161 = On).
M1000 CRC D100 K6 D106
CRC checksum: 02 H is stored in the lower 8 bits of D106 and 07 H in the lower 8 bits of D107, Remarks: 1. The format of RTU mode with a communication datum START Address Function DATA (n-1) . DATA 0 CRC CHK Low CRC CHK High END 2. Time interval Communication address: 8-bit binary Function code: 8-bit binary Data content: n 8-bit data CRC checksum: 16-bit CRC checksum consists of 2 8-bit binaries Time interval
CRC checksum starts from Address and ends at Data content. The operation of CRC checksum: Step 1: Make the 16-bit register (CRC register) = FFFFH Step 2: Exclusive OR the first 8-bit byte message instruction and the low-bit 16-bit CRC register. Store the result in CRC register. Step 3: Shift the CRC register one bit to the right and fill 0 in the higher bit. Step 4: Check the value that shifts to the right. If it is 0, store the new value from Step 3 into the CRC register, otherwise, Exclusive OR A001H and the CRC register, and store the result in the CRC register. Step 5: Repeat Step 3 ~ 4 and finish calculating the 8 bits. Step 6: Repeat Steps 2 ~ 5 for obtaining the next 8-bit message instruction until all the message instructions are calculated. In the end, the obtained CRC register value is the CRC checksum. Be aware that CRC checksum should be placed in the checksum of the message instruction.
8-19
Bit Devices Y M
Operands: D: Device for storing the read value Explanations: 1. 2. 3. 4. 5. See the specifications of each model for their range of use. Flags: M1104 ~ M1111 (status of digital switch) This instruction stores the value read from digital switch function card into D. The read value is stored in the low byte in D. Every switch has a corresponding bit. When there is no digital function card inserted, the error message C400 (hex) will appear in grammar check.
Program Example: 1. There are l 8 DIP switches on the digital switch function card. After the switches are read by SWRD instruction, the status of each switch will correspond to M0 ~ M7.
M1000 SWRD M0 Y0 M1 MOV M2 CNT M3 RST M4 TMR T0 K100 C0 C0 K10 K2M0 D0 K2M0
2. 3. 4.
The status of M0 ~ M7 can be executed by each contact instruction. The execution of END instruction indicates that the process of input is completed. REF (I/O refresh) instruction will be invalid. When SWRD instruction uses the data in digital switch function card, it can read minimum 4 bits (K1Y*, K1M* or K1S*).
Remarks: When digital switch function card is inserted, the status of the 8 DIP switches will correspond to M1104 ~ M1111.
8-20
Type OP S1 S2 D X
Bit Devices Y M
*
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S1: Binary floating point comparison value 1 result Explanations: 1. 2. 3. 4. D occupies 3 consecutive devices. See the specifications of each model for their range of use. The binary floating point values S1 and S2 are compared with each other. The comparison result (>, =, <) is stored in D. If S1 or S2 is an designated constant K or H, the instruction will convert the constant into a binary floating point value before the comparison. Program Example: 1. 2. 3. 4. Designated device M10 and M10 ~ M12 are automatically occupied. When X0 = On. DECMP instruction will be executed and one of M10 ~ M12 will be On. When X0 = Off, DECMP instruction will not be executed and M10 ~ M12 will remain their status before X0 = Off. To obtain results , , , serial-parallel M10 ~ M12. Use RST or ZRST instruction to clear the result.
X0 DECMP M10 M11 M12 On when (D1,D0)<(D101,D100) D0 D100 M10
D: Comparison
Remarks: For floating point operations, see 5.3 Handling of Numeric Values.
8-21
Bit Devices Y M
*
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S1: Lower bound of binary floating point comparison result Explanations: 1. 2. 3. 4. 5. D occupied 3 consecutive devices. S1 S2. See the specifications of each model for their range of use. S is compared with S1 and S2 and the result (>, =, <) is stored in D. If S1 or S2 is andesignated constant K or H, the instruction will convert the constant into a binary floating point value before the comparison. When S1 > S2, S1 will be used as upper/lower bound for the comparison. D: Comparison result S2: Upper bound of binary floating point S: Binary floating point
Program Example: 1. 2. 3. Designated device M0 and M0 ~ M2 are automatically occupied. When X0 = On. DEZCP instruction will be executed and one of M0 ~ M2 will be On. When X0 = Off, EZCP instruction will not be executed and M0 ~ M2 will remain their status before X0 = Off. Use RST or ZRST instruction to clear the result.
X0 DEZCP M0 On when (D1,D0) > (D21, D20) M1 M2 On when (D21, D20) > (D11, D10) On when (D1,D0) < (D21, D20) < (D11, D10) D0 D10 D20 M0
Remarks: For floating point operations, see 5.3 Handling of Numeric Values.
8-22
Type OP S D X
Bit Devices Y M
Operands: SSource floating point data Explanations: 1. 2. 3. 4. S can only be in floating point (FX.XX). See the specifications of each model for their range of use. This instruction is able to enter floating point values directly in S. When the instruction is executed, the content in S is moved directly into D. When the instruction is not executed, the content in D will not be modified. Program Example: 1. 2. User DMOVR instruction to move 32-bit floating point data. When X0 = Off, the content in (D11D10) remains unchanged. When X0 = On, the present value F1.20000004768372 will be moved to data registers (D11, D10).
X0 DMOVR F1.20000004768372 D10
DDestination device
Remarks: This instruction only supports ES V6.1, SA/SX_V1.1, SV_V1.2, EH_V1.2, EH2/SV_V1.0 and above versions.
8-23
Type OP S D X
Bit Devices Y M S K *
Operands: S: Source (angle) Explanations: 1. 2. 3. 4. 5. 6. See the specifications of each model for their range of use. Flags: M1020 (zero flag); M1021 (borrow flag); M1022 (carry flag) Radian = degree (/180) If the absolute value of the result maximum floating point available, the carry flag M1022 = On. If the absolute value of the result minimum floating point available, the borrow flag M1021 = On. If the result = 0, the zero flag M1020 = On. D: Result (radian)
Program Example: When X0 = On, designate the degree of binary floating point (D1, D0). Convert the angle into radian and store the result in binary floating point in (D11, D10).
X0 DRAD D0 D10
D1
D0
Angle binary floating point Radian ( degree X / 180) binary floating point
D 11
D 10
Remarks: For floating point operations, see 5.3 Handling of Numeric Values.
8-24
Type OP S D X
Bit Devices Y M S K *
Operands: S: Source (radian) Explanations: 1. 2. 3. 4. 5. 6. See the specifications of each model for their range of use. Flags: M1020 (zero flag); M1021 (borrow flag); M1022 (carry flag) Degree = radian (180/) If the absolute value of the result maximum floating point available, the carry flag M1022 = On. If the absolute value of the result minimum floating point available, the borrow flag M1021 = On. If the result = 0, the zero flag M1020 = On. D: Result (angle)
Program Example: When X0 = On, designate the angle of binary floating point (D1, D0). Convert the radian into angle and store the result in binary floating point in (D11, D10).
X0 DDEG D0 D10
D1
D0
Radian binary floating point Angle (radian X 180/ ) binary floating point
D 11
D 10
Remarks: For floating point operations, see 5.3 Handling of Numeric Values.
8-25
Bit Devices Y M
Explanations: 1. 2. 3. 4. 5. 6. 7. See the specifications of each model for their range of use. Flags: M1020 (zero flag); M1021 (borrow flag); M1022 (carry flag) This instruction converts binary floating point value in the register designated by S into decimal floating point value and stores it in the register designated by D. PLC conducts floating point operation in binary format. DEBCD instruction is exclusively for converting floating points from binary to decimal. If the absolute value of the result maximum floating point available, the carry flag M1022 = On. If the absolute value of the result minimum floating point available, the borrow flag M1021 = On. If the result = 0, the zero flag M1020 = On.
Program Example: When X0 = On, the binary floating points in D1 and D0 will be converted into decimal floating points and stored in D3 and D2.
X0 DEBCD D0 D2
D1
D0
32 bits for real number, 8 bits for exponent 1 bit for symbol bit
Exponent Real number Exponent Real number [D3] Decimal D3 D2 [D2] * 10 Floating Point
Remarks: For floating point operations, see 5.3 Handling of Numeric Values.
8-26
Type OP S D X
Bit Devices Y M
Explanations: 1. 2. 3. 4. 5. 6. See the specifications of each model for their range of use. Flag: M1020 (zero flag) This instruction converts decimal floating point value in the register designated by S into binary floating point value and stores it in the register designated by D. DEBIN instruction is exclusively for converting floating points from decimal to binary. Range of decimal floating point real numbers: -9.999 ~ +9,999. Range of exponants: -41 ~ +35. Range of PLC decimal floating points: 1,175 10-41 ~ 3,402 10+35. If the result = 0, the zero flag M1020 = On.
Program Example 1: When X1 = On, the decimal floating points in D1 and D0 will be converted into binary floating points and stored in D3 and D2.
X1 DEBIN D0 D2
Real number
[D0]
D1
D0
[D1] * 10
D3
D2
23 bits for real number, 8 bits for exponent 1 bit for symbol bit
Program Example 2: 1. Use FLT instruction (API 149) to convert BIN integer into binary floating point before performing floating point operation. The value to be converted must be BIN integer and use DEBIN instruction to convert the floating point into a binary one. 2. When X0 = On, move K3,140 to D0 and K-3 to D1 to generate decimal floating point (3.14 = 3140 10-3).
8-27
D0 D1
Remarks: For floating point operations, see 5.3 Handling of Numeric Values.
8-28
Type OP S1 S2 D X
Bit Devices Y M
Operands: S1: Summand Explanations: 1. 2. 3. 4. 5. See the specifications of each model for their range of use. Flags: M1020 (zero flag); M1021 (borrow flag); M1022 (carry flag) S1 + S2 = D. The floating point value in the register designated by S1 and S2 are added up and the result is stored in the register designated by D. The addition is conducted in binary floating point system. If S1 or S2 is an designated constant K or H, the instruction will convert the constant into a binary floating point value before the operation. S1 and S2 can designate the same register. In this case, if the continuous execution instruction is in use, during the period when the criteria contact in On, the register will be added once in every scan by pulse execution instruction DEADDP. 6. 7. 8. If the absolute value of the result maximum floating point available, the carry flag M1022 = On. If the absolute value of the result minimum floating point available, the borrow flag M1021 = On. If the result = 0, the zero flag M1020 = On. S2: Addend D: Sum
Program Example 1: When X0 = On, binary floating point (D1, D0) + binary floating point (D3, D2) and the result is stored in (D11, D10).
X0 DEADD D0 D2 D10
Program Example 2: When X2 = On, binary floating point (D11, D10) + K1234 (automatically converted into binary floating point) and the result is stored in (D21, D20).
X2 DEADD D10 K1234 D20
Remarks: For floating point operations, see 5.3 Handling of Numeric Values.
8-29
Type OP S1 S2 D X
Bit Devices Y M
Operands: S1: Minuend Explanations: 1. 2. 3. See the specifications of each model for their range of use. Flags: M1020 (zero flag); M1021 (borrow flag); M1022 (carry flag) S1 S2 = D. The floating point value in the register designated by S2 is subtracted from the floating point value in the register assigned by S1 and the result is stored in the register designated by D. The subtraction is conducted in binary floating point system. 4. 5. If S1 or S2 is an designated constant K or H, the instruction will convert the constant into a binary floating point value before the operation. S1 and S2 can designate the same register. In this case, if the continuous execution instruction is in use, during the period when the criteria contact in On, the register will be subtracted once in every scan by pulse execution instruction DESUBP. 6. 7. 8. If the absolute value of the result maximum floating point available, the carry flag M1022 = On. If the absolute value of the result minimum floating point available, the borrow flag M1021 = On. If the result = 0, the zero flag M1020 = On. S2: Subtrahend D: Remainder
Program Example 1: When X0 = On, binary floating point (D1, D0) binary floating point (D3, D2) and the result is stored in (D11, D10).
X0 DESUB D0 D2 D10
Program Example 2: When X2 = On, K1234 (automatically converted into binary floating point) binary floating point (D1, D0) and the result is stored in (D11, D10).
X2 DESUB K1234 D0 D10
Remarks: For floating point operations, see 5.3 Handling of Numeric Values.
8-30
Type OP S1 S2 D X
Bit Devices Y M
Operands: S1: Multiplicand Explanations: 1. 2. 3. See the specifications of each model for their range of use. Flags: M1020 (zero flag); M1021 (borrow flag); M1022 (carry flag) S1 S2 = D. The floating point value in the register assigned by S1 is multiplied with the floating point value in the register designated by S2 and the result is stored in the register designated by D. The multiplication is conducted in binary floating point system. 4. 5. If S1 or S2 is an designated constant K or H, the instruction will convert the constant into a binary floating point value before the operation. S1 and S2 can designate the same register. In this case, if the continuous execution instruction is in use, during the period when the criteria contact in On, the register will be multiplied once in every scan by pulse execution instruction DEMULP. 6. 7. 8. If the absolute value of the result maximum floating point available, the carry flag M1022 = On. If the absolute value of the result minimum floating point available, the borrow flag M1021 = On. If the result = 0, the zero flag M1020 = On. S2: Multiplicator D: Product
Program Example 1: When X1 = On, binary floating point (D1, D0) binary floating point (D11, D10) and the result is stored in (D21, D20).
X1 DEMUL D0 D10 D20
Program Example 2: When X2 = On, K1234 (automatically converted into binary floating point) binary floating point (D1, D0) and the result is stored in (D11, D10).
X2 DEMUL K1234 D0 D10
Remarks: For floating point operations, see 5.3 Handling of Numeric Values.
8-31
Type OP S1 S2 D X
Bit Devices Y M
Operands: S1: Dividend Explanations: 1. 2. 3. See the specifications of each model for their range of use. Flags: M1020 (zero flag); M1021 (borrow flag); M1022 (carry flag) S1 S2 = D. The floating point value in the register designated by S1 is divided by the floating point value in the register assigned by S2 and the result is stored in the register designated by D. The division is conducted in binary floating point system. 4. 5. 6. 7. 8. If S1 or S2 is an designated constant K or H, the instruction will convert the constant into a binary floating point value before the operation. If S2 = 0, operation error will occur, the instruction will not be executed, M1067, M1068 = On and D1067 will recorded the error code H0E19. If the absolute value of the result maximum floating point available, the carry flag M1022 = On. If the absolute value of the result minimum floating point available, the borrow flag M1021 = On. If the result = 0, the zero flag M1020 = On. S2: Divisor D: Quotient and remainder
Program Example 1: When X1 = On, binary floating point (D1, D0) binary floating point (D11, D10) and the quotient is stored in (D21, D20).
X1 DEDIV D0 D10 D20
Program Example 2: When X2 = On, binary floating point (D1, D0) K1234 (automatically converted into binary floating point) and the result is stored in (D11, D10).
X2 DEDIV D0 K1234 D10
Remarks: For floating point operations, see 5.3 Handling of Numeric Values.
8-32
Type OP S D X
Bit Devices Y M
Operands: S: Device for operation source Explanations: 1. 2. 3. 4. See the specifications of each model for their range of use. Flags: M1020 (zero flag); M1021 (borrow flag); M1022 (carry flag) e = 2.71828 as the base and S as exponent for EXP operation: EXPD +1, D=S +1, S Both positive and negative values are valid for S. When designating D registers, the data should be 32-bit and the operation should be performed in floating point system. Therefore, S should be converted into a floating point value. 5. 6. 7. 8. The content in D = eS; e = 2.71828, S = designated source data If the absolute value of the result maximum floating point available, the carry flag M1022 = On. If the absolute value of the result minimum floating point available, the borrow flag M1021 = On. If the result = 0, the zero flag M1020 = On. D: Device for operation result
Program Example: 1. 2. 3. When M0 = On, convert (D1, D0) into binary floating point and store it in register (D11, D10). When M1= On, use (D11, D10) as the exponent for EXP operation and store the binary floating point result in register (D21, D20). When M2 = On, convert the binary floating point (D21, D20) into decimal floating point (D30 10[D31]) and store it in register (D31, D30).
M0 RST DFLT M1 DEXP M2 DEBCD D20 D30 D10 D20 M1081 D0 D10
Remarks: For floating point operations, see 5.3 Handling of Numeric Values.
8-33
Type OP S D X
Bit Devices Y M
Operands: S: Device for operation source Explanations: 1. 2. 3. 4. 5. 6. 7. 8. See the specifications of each model for their range of use. Flags: M1020 (zero flag); M1021 (borrow flag); M1022 (carry flag) This instruction performs natural logarithm LN operation by S: LNS + 1, S=D + 1, D Only positive values are valid for S. When designating D registers, the data should be 32-bit and the operation should be performed in floating point system. Therefore, S should be converted into a floating point value. eD = S .The content in D = lnS; S = designated source data. If the absolute value of the result maximum floating point available, the carry flag M1022 = On. If the absolute value of the result minimum floating point available, the borrow flag M1021 = On. If the result = 0, the zero flag M1020 = On. D: Device for operation result
Program Example: 1. 2. 3. When M0 = On, convert (D1, D0) into binary floating point and store it in register (D11, D10). When M1= On, use register (D11, D10) as the real number for LN operation and store the binary floating point result in register (D21, D20). When M2 = On, convert the binary floating point (D21, D20) into decimal floating point (D30 10[D31]) and store it in register (D31, D30).
M0 RST DFLT M1 DLN M2 DEBCD D20 D30 D10 D20 M1081 D0 D10
Remarks: For floating point operations, see 5.3 Handling of Numeric Values.
8-34
Type OP S1 S2 D X
Bit Devices Y M
Operands: S1: Device for base Explanations: 1. See the specifications of each model for their range of use. 2. Flags: M1020 (zero flag); M1021 (borrow flag); M1022 (carry flag) 3. This instruction performs log operation of the content in S1 and S2 and stores the result in D. 4. Only positives are valid for the content in S1 and S2. When designating D registers, the data should be 32-bit and the operation should be performed in floating point system. Therefore, S1 and S2 should be converted into floating point values. 5. S1D = S2, D = ? LogS1S2 = D 5D = 125 D = log5125 = 3 Example: Assume S1 = 5, S2 = 125, D = log5125 = ? S1D = S2 6. If the absolute value of the result maximum floating point available, the carry flag M1022 = On. 7. If the absolute value of the result minimum floating point available, the borrow flag M1021 = On. 8. If the result = 0, the zero flag M1020 = On. Program Example: 1. 2. 3. When M0 = On, convert (D1, D0) and (D3, D2) into binary floating points and store them in the 32-bit registers (D11, D10) and (D13, D12). When M1= On, perform log operation on the binary floting points in 32-bit registers (D11, D10) and (D13, D12) and store the result in the 32-bit register (D21, D20). When M2 = On, convert the binary floating point (D21, D20) into decimal floating point (D30 10[D31]) and store it in register (D31, D30).
M0 RST DFLT DFLT M1 DLOG M2 DEBCD D20 D30 D10 D12 D20 M1081 D0 D2 D10 D12
Remarks: For floating point operations, see 5.3 Handling of Numeric Values.
8-35
Bit Devices Y M
Operands: S: Source device Explanations: 1. 2. 3. 4. 5. 6. 7. Range of S: 0 See the specifications of each model for their range of use. Flags: M1020 (zero flag); M1067 (operation error) This instruction performs a square root operation on the content in the register designated by S and stores the result in the register designated by D. The square root operation is performed in floating point system. If S is an designated constant K or H, the instruction will convert the constant into a binary floating point value before the operation. If the result of the operation = 0, the zero flag M1020 = On. S can only be a positive value. Performing any square root operation on a negative value will result in an operation error and this instruction will not be executed. M1067 and M1068 will be On and D1067 will record the error code H0E1B. Program Example 1: When M0 = On, calculate the square root of the binary floating point (D1, D0) and store the result in register (D11, D10).
X0 DESQR (D1, D0)
binary floating point
D: Operation result
D0 (D11 , D10)
D10
Program Example 2: When M2 = On, calculate the square root of K1,234 (automatically converted into binary floating point) and store the result in register (D11, D10).
X2 DESQR K1234 D10
Remarks: For floating point operations, see 5.3 Handling of Numeric Values.
8-36
Type OP S1 S2 D X
Bit Devices Y M
Operands: S1: Device for base. Explanations: 1. 2. 3. See the specifications of each model for their range of use. This instruction performs power multiplication of binary floating point S1 and S2 and stores the result in D. D = POWS1 + 1, S1^S2 + 1, S2 Only positives are valid for the content in S1. Both positives and negatives are valid for the content in S2. When designating D registers, the data should be 32-bit and the operation should be performed in floating point system. Therefore, S1 and S2 should be converted into floating point values. Example: When S1S2 = D, D = ? Assume S1 = 5, S2 = 3, D = 53 =125 4. 5. 6. If the absolute value of the result maximum floating point available, the carry flag M1022 = On. If the absolute value of the result minimum floating point available, the borrow flag M1021 = On. If the result = 0, the zero flag M1020 = On. S2: Device for exponent. D: Device for operation result
Program Example: 1. 2. 3. When M0 = On, convert (D1, D0) and (D3, D2) into binary floating points and store them in the 32-bit registers (D11, D10) and (D13, D12). When M1= On, perform POW operation on the binary floting points in 32-bit registers (D11, D10) and (D13, D12) and store the result in the 32-bit register (D21, D20). When M2 = On, convert the binary floating point (D21, D20) into decimal floating point (D30 10[D31]) and store it in register (D31, D30).
M0 RST DFLT DFLT M1 DPOW M2 DEBCD D20 D30 D10 D12 D20 M1081 D0 D2 D10 D12
Remarks: For floating point operations, see 5.3 Handling of Numeric Values.
8-37
Type OP S D X
Bit Devices Y M
Operands: S: Source device Explanations: 1. 2. 3. 4. 5. S occupies 2 consecutive devices. See the specifications of each model for their range of use. Flags: M1020 (zero flag); M1021 (borrow flag); M1022 (carry flag) The binary floating point value of the register designated by S is converted to BIN integer and stored in the register designated by D. The decimal of BIN integer is left out. This instruction is the inverse operation of API 49 FLT instruction. If the converstion result = 0, the zero flag M1020 = On If there is any decimal left out, the borrow flag M1021 = On. If the result exceeds the range listed below, the carry flag M1022 = On. 16-bit instruction: -32,768 ~ 32,767 32-bit instruction: -2,147,483,648 ~ 2,147,483,647 Program Example: 1. 2. When X0 = On, the binary floating point (D1, D0) will be converted into BIN integer and the result will be stored in (D10). The decimal of BIN integer will be left out. When X1 = On, the binary floating point (D21, D20) will be converted into BIN integer and the result will be stored in (D31, D30). The decimal of BIN integer will be left out.
X0 INT X1 DINT D20 D30 D0 D10
D: Converted result
Remarks: For floating point operations, see 5.3 Handling of Numeric Values.
8-38
Type OP S D X
Bit Devices Y M
Operands: S: Source value Explanations: 1. 2. 3. 4. 5. 6. 7. 0 S < 360. See the specifications of each model for their range of use. Flags: M1018 (angle or radian); M1020 (zero flag) S can be an angle or radian, decided by M1018. When M1018 = Off, the program will be in radian mode and the RAD value = angle /180 When M1018 = On, the program will be in angle mode and the range of angle should be 0 angle < 360 If the result = On, M1020 = On. The SIN value obtained by S is calculated and stored in the register designated by D. The figure below offers the relation between radian and the result.
R
1
D: SIN result
-2
-3 2
-2
-2
-1
3 2
Program Example 1: When M1018 = Off, the program is in radian mode. When X0 = On, use the RAD value of binary floating point (D1, D0) and obtain its SIN value. The binary floating point result will be stored in (D11, D10).
M1002 RST X0 DSIN D0 D10 M1018
D1
D0
/ 180)
D11
D10
Program Example 2: When M1018 = Off, the program is in radian mode. Input terminals X0 and X1 select the angle. The angles are converted into RAD value for calculating the SIN value.
8-39
K30 K60
D10 D10
(K30 (K60
D10) D10)
DEDIV K31415926 K1800000000 DEMUL DSIN D14 D40 D20 D50 D40
(D15, D14) angle x /180 (D41, D40) RAD binary floating point (D51, D50) SIN binary floating point
Program Example 3: When M1018 = On, the program is in angle mode. When X0 = On, use the angle of (D1, D0) to obtain SIN value and store the binary floating point result in (D11, D10). (0 angle < 360)
M1002 SET X0 DSIN D0 D10 M1018
D1
D0
D 11
D 10
Remarks: For floating point operations, see 5.3 Handling of Numeric Values.
8-40
Type OP S D X
Bit Devices Y M
Operands: S: Source value Explanations: 1. 0 S < 360. See the specifications of each model for their range of use. 2. Flags: M1018 (angle or radian); M1020 (zero flag) 3. S can be an angle or radian, decided by M1018. 4. When M1018 = Off, the program will be in radian mode and the RAD value = angle /180 5. When M1018 = On, the program will be in angle mode and the range of angle should be 0 angle < 360 6. If the result = On, M1020 = On. 7. The COS value obtained by S is calculated and stored in the register designated by D. The figure below offers the relation between radian and the result.
R
1
D: COS result
-2
-3 2
-2
-2
-1
3 2
8. Switch between radian and angle by M1018: When M1018 = Off, S will be a RAD value; when M1018 = On, S will be an angle (0 ~ 360). Program Example 1: When M1018 = Off, the program is in radian mode. When X0 = On, use the RAD value of binary floating point (D1, D0) and obtain its COS value. The binary floating point result will be stored in (D11, D10).
M1002 RST X0 DCOS D0 D10 M1018
D1
D0
/180)
D11
D10
8-41
D1
D0
angle value
D11
D 10
Remarks: For floating point operations, see 5.3 Handling of Numeric Values.
8-42
Type OP S D X
Bit Devices Y M
Operands: S: Source value Explanations: 1. 0 S < 360. See the specifications of each model for their range of use. 2. Flags: M1018 (angle or radian); M1020 (zero flag) 3. S can be an angle or radian, decided by M1018. 4. When M1018 = Off, the program will be in radian mode and the RAD value = angle /180 5. When M1018 = On, the program will be in angle mode and the range of angle should be 0 angle < 360 6. If the result = On, M1020 = On. 7. The TAN value obtained by S is calculated and stored in the register designated by D. The figure below offers the relation between radian and the result.
R
D: TAN result
-2
-2
-3 2
2 0 -1 1
2 3 2
Program Example 1: When M1018 = Off, the program is in radian mode. When X0 = On, use the RAD value of binary floating point (D1, D0) and obtain its TAN value. The binary floating point result will be stored in (D11, D10).
M1002 RST X0 DTAN
D1 D0
M1018 D0 D10
/180)
D11
D10
Program Example 2:
8-43
D1
D0
angle value
D 11
D 10
Remarks: For floating point operations, see 5.3 Handling of Numeric Values.
8-44
Type OP S D X
Bit Devices Y M
Operands: S: Source value (binary floating point) Explanations: 1. 2. 3. See the specifications of each model for their range of use. Flag: M1020 (zero flag) ASIN value=sin1. The figure below offers the relation between the entered sin value and the result.
R
D: ASIN result
-1,0
1,0
-2
4.
The decimal floating point of the SIN value designated by S should be within -1.0 ~ +1.0. If the value falls without the range, M1067 and M1068 will be On without performing any action.
5.
Program Example: When X0 = On, obtain the ASIN value of binary floating point (D1, D0) and store the binary floating point result in (D11, D10).
X0 DASIN D0 D10
D1
D0
D11
D10
Remarks: For floating point operations, see 5.3 Handling of Numeric Values.
8-45
Type OP S D X
Bit Devices Y M
Operands: S: Source value (binary floating point) Explanations: 1. 2. 3. See the specifications of each model for their range of use. Flag: M1020 (zero flag) ACOS value=cos1. The figure below offers the relation between the entered cos value and the result.
R
D: ACOS result
-1,0
1,0
4.
The decimal floating point of the COS value designated by S should be within -1.0 ~ +1.0. If the value falls without the range, M1067 and M1068 will be On without performing any action.
5.
Program Example: When X0 = On, obtain the ACOS value of binary floating point (D1, D0) and store the binary floating point result in (D11, D10).
X0 DACOS D0 D10
D1
D0
D11
D10
Remarks: For floating point operations, see 5.3 Handling of Numeric Values.
8-46
Type OP S D X
Bit Devices Y M
Operands: S: Source value (binary floating point) Explanations: 1. 2. 3. See the specifications of each model for their range of use. Flag: M1020 (zero flag) ATAN value=tan1. The figure below offers the relation between the entered tan value and the result.
R
2
D: ATAN value
-2
4.
Program Example: When X0 = On, obtain the ATAN value of binary floating point (D1, D0) and store the binary floating point result in (D11, D10).
X0 DATAN D0 D10
D1
D0
D11
D10
Remarks: For floating point operations, see 5.3 Handling of Numeric Values.
8-47
Type OP S D X
Bit Devices Y M
Operands: S: Source value (binary floating point) Explanations: 1. See the specifications of each model for their range of use. 2. Flags: M1020 (zero flag); M1021 (borrow flag); M1022 (carry flag) 3. SINH value=(es-e-s)/2. The result is stored in D. Program Example: 1. When X0 = On, obtain the SINH value of binary floating point (D1, D0) and store the binary floating point result in (D11, D10).
X0 DSINH D0 D10
D: SINH value
D1
D0
D11
D10
2. If the absolute value of the result maximum floating point available, the carry flag M1022 = On. 3. If the absolute value of the result minimum floating point available, the borrow flag M1021 = On. 4. If the result = 0, the zero flag M1020 = On. Remarks: For floating point operations, see 5.3 Handling of Numeric Values.
8-48
Type OP S D X
Bit Devices Y M
Operands: S: Source value (binary floating point) Explanations: 1. See the specifications of each model for their range of use. 2. Flags: M1020 (zero flag); M1021 (borrow flag); M1022 (carry flag) 3. COSH value=(es+e-s)/2. The result is stored in D. Program Example: 1. When X0 = On, obtain the COSH value of binary floating point (D1, D0) and store the binary floating point result in (D11, D10).
X0 DCOSH D0 D10
D: COSH value
D1
D0
D11
D10
5. If the absolute value of the result maximum floating point available, the carry flag M1022 = On. 6. If the absolute value of the result minimum floating point available, the borrow flag M1021 = On. 7. If the result = 0, the zero flag M1020 = On. Remarks: For floating point operations, see 5.3 Handling of Numeric Values.
8-49
Type OP S D X
Bit Devices Y M
Operands: S: Source value (binary floating point) Explanations: 1. See the specifications of each model for their range of use. 2. Flags: M1020 (zero flag); M1021 (borrow flag); M1022 (carry flag) 3. TANH value=(es-e-s)/(es+e-s) . The result is stored in D. Program Example: 1. When X0 = On, obtain the TANH value of binary floating point (D1, D0) and store the binary floating point result in (D11, D10).
X0 DTANH D0 D10
D: TANH result
D1
D0
D11
D10
2. If the absolute value of the result maximum floating point available, the carry flag M1022 = On. 3. If the absolute value of the result minimum floating point available, the borrow flag M1021 = On. 4. If the result = 0, the zero flag M1020 = On. Remarks: For floating point operations, see 5.3 Handling of Numeric Values.
8-50
Operands: S: delay time (unit: 0.1ms) Explanations: 1. 2. Range of S: K1 ~ K1,000. See the specifications of each model for their range of use. After DELAY instruction is executed, the program after DELAY in every scan period will execute delay outputs according to the delay time designated by the user. Program Example: When X0 goes from Off to On and generates an external interruption, the interruption subroutine will execute DELAY for 2ms before executing the next step, X1 = On and Y0 = On.
EI Main Program FEND I001 M1000 DELAY X1 Y0 REF IRET END Y0 K8 K20
Remarks: 1. 2. 3. User can define the delay time based on their needs. The delay time may increase due do the influences from communication, high-speed counters and high-speed pulse output instructions. The delay time of designated external output (transistor or relay) will increase due to the delay on the transistor or relay itself. See 2.3 for more information.
8-51
*
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S1: Width of output pulse Explanations: 1. 2. 3. 4. 5. 6. 7. 8. 9. S2 occupies 3 consecutive devices. S1 S2. See the specifications of each model for their range of use. Range of S1: t = 0 ~ 32,767ms. Range of S2: t = 1 ~ 32,767ms. S2 +1 and S2 +2 are parameters for the system. Do not occupy them. Pulse output devices D: Y, M, S. When being executed, GPWM instruction designates S1 and S2 and that pulses output will be from device D. When S1 0, there will be no pulse output. When S1 S2, the pulse output device will keep being On. S1 and S2 can be modified when GPWM instruction is being executed. S2: Pulse output cycle D: Pulse output device
Program Example: When X0 = On, D0 = K1,000, D2 = K2,000, and Y10 will output the pulse illustrated below. When X0 = Off, Y10 output will be Off.
X0 GPWM t D0 T D2 Y10
t=1000ms
Output Y10
T=2000ms
Explanations: 1. 2. This instruction counts by the scan cycle; therefore the maximum offset will be one PLC scan cycle. S1, S2 and (S2 - S1) should > PLC scan cycle; otherwise, errors will occur during GPWM outputs. Please note that placing this instruction in a subroutine or interruption will cause inaccurate GPWM outputs.
8-52
Operands: S1: Set value (SV) Explanations: 1. 2. Range of S1 : 1 ~ 5000 (shown as 0.1C ~ 500C). Unit: 0.1. If (S3 +1) is set as K0, the range will be 0.1C ~ 500C. Range of S2 : 1 ~ 5000 (shown as 0.1C ~ 500C). Unit: 0.1. If (S3 +1) is set as bit0 = 0, the range will be 0.1C ~ 500C. Therefore, when the user obtain an A/D value from the temperature sensor, the value has to be converted into a value between 1 ~ 5,000 by four arithmetic operation instructions. 3. 4. 5. If S3 < K1, the instruction will not be executed. If S3 > K200, S3 will adopt K200. S3 will occupy 7 consecutive devices. See the specifications of each model for their range of use. Settings of parameter S3 +1: bit0 = 0 ->C; bit1 = 0 ->F; bit1 = 0 -> no filter function; bit1 = 1 -> with filter function; bit2 ~ bit5 -> 4 kinds of heating environments; bit6 ~ bit15 -> reserved. See remarks for more information. 6. D is the value between 0 ~ sampling time 100. When using this instruction, the user has to adopt other instructions according to the types of the heater. For example, FTC can be used with GPWM for output pulse control. Sampling time 100 is the cycle of GPWM pulse output; MV is the width of GPWM pulse. See program example 1. 7. There is no limit on the times of using FTC instruction, but Do not repeatedly use a designated operand in case an error may occur.. Program Example: 1. 2. Set up the parameter before executing FTC instruction. When X0 = On, the instruction will be executed and and result will be stored in D150. When X0 = Off, the instruction will not be executed and the previous data remain unchanged.
X0 FTC D0 D1 D100 D150
8-53
When the value exceeds the upper bound, use upper bound. When without filter function, PV = currently measured value. When with filter function, PV = (currently measured value + previous PV)/2 Slow heating environment
2.
Control Diagram:
FTC
SV
~
+6
e
Fuzzy Controller
MV
PV Temperature Sensor
3.
Notes and suggestion: It is recommended that the sampling time be set to 2 times more than the sampling time of the temperature sensor for better temperature control. bit2 ~ bit5 of S3+1 are for the control speed. If the user does not set up the parameter, FTC will automatically activate general heating environment. When the user finds that the control is too slow to reach SV, select slow
8-54
SV D10
Fuzzy Controller
MV D22
GPWM Program
Y0
PV D11
PT Module Temperature Sensor
Output D22 (MV) of FTC instruction is the input D22 of GPWM instruction, as the duty cycle of ajustable pulses. D30 is the fixed cycle time of pulses. See below for the timing diagram of Y0 output.
D22
Y0
D30
Assume parameter settings: D10 = K1,500 (target temperature), D12 = K60 (sampling time: 6 secs.), D13 = K8 (bit3=1), D30 = K6,000 (=D12*100) The example control program is indicated as:
M1002 MOV TO FROM MOV MOV MOV SET M1 FTC GPWM M1013 FROM END K1500 K0 K0 K60 K8 K6000 M1 D10 D22 K0 D11 D30 K6 D12 Y0 D11 K1 D22 D10 K2 K6 D12 D13 D30 K2 D11 K1 K1
8-55
Example 2: Due to that the temperature once exceeds the target temperature, we modify the heating environment into fast heating environment (D13 = K16). The results are shown in the diagram below. From the diagram below, we see that though the temperature no longer exceeds the target temperature, it still needs to take more than 1 hour and 15 minutes to reach the target temperature with 1oC inaccuracy. It seems that we have chosen the right environment, but the sampling time is too long, resulting in the extension of heating time.
8-56
Example 4: To see if we can reach the target temperature faster, we modify the sampling time frim example 3 into 2 seconds (D12 = K20, D30 = K2,000). The results are shown in the diagram below. From the diagram below, we see that the sampling time that is too short will cause the control system to become too sensitive and lead to up and down fluctuations.
8-57
Function
Controllers
ES/EX/SS SA/SX/SC EH/SV
Operands: S1: Target time of valve (absolute position) D: Output device Explanations: 1. S1 occupies 3 consecutive registers when in use. S1 + 0 are for the user to store the designated value; S1 + 1 (the current position of the valve) and S1 + 2 are for storing the parameters recorded in the instruction and please DO NOT use and alter these two registers. 2. 3. 4. 5. 6. D occupies 2 consecutive output devices when in use. D + 0 is the open contact and D + 1 is the close contact. This instruction only supports EH2/SV and does not support EH. The unit of time: 0.1 second. When the scan time of the program exceeds 0.1 second, DO NOT use this instruction to adjust the position of the valve. Frequency of the output device: 10Hz. When the time of S1 + 0 the fully-opened time set in S2, D + 0 will keep being On and D + 1 being Off. When the time of S1 + 0 0, D + 0 will keep being Off and D + 1 being On. 7. When the instruction is enabled, the instruction will start to control the valve from 0 time position. Therefore, if the user cannot be sure whether the valve is at 0 before executing the instruction, please designate S1 + 0 as less than 0 and execute the instruction for S2 (time) before sending in the correct target control time. Program Example 1: 1. The control valve S2: Time from fully-closed to fully-open of valve (destination)
Fully-closed
Fully-open
Y1
Y0
8-58
Y0 Y1
M0 CVM D0 K50 Y0
4. Control phases: 1) 2) Phase 1: When M0 = On, D0 = K40 refers to the valve shall be open (Y0 = On, Y1 = Off) till the position of 4 seconds. Phase 2: Change the position of the valve and D0 = K20. Due to that the previous position was at 4 seconds, the valve shall be closed (Y0 = Off, Y1 = On) for 2 seconds, moving the valve to the position of 2 seconds. 3) Phase 3: Change the position of the valve and D0 = K30. Due to that the previous position was at 2 seconds, the valve shall be open (Y0 = On, Y1 = Off) for 1 second, moving the valve to the position of 3 seconds. 4) Phase 4: Change the position of the valve and D0 = K10. Due to that the previous position was at 2 seconds, the valve shall be closed (Y0 = Off, Y1 = On) for 2 seconds, moving the valve to the position of 1 second. 5) Phase 5: Switch off X0 and no actions at the valve (Y0 = Off, Y1 = Off).
8-59
2. Control phases: 1) Phase 1: When M0 = On, due to that we are not sure about there the valve is, set D0 = K-1 to deliberately close the valve (Y0 = Off, Y1 = On) for 5 seconds and make sure the valve is at the position of 0 second before moving on to the next step. 2) 3) Phase 2: When T0 = On, allow D0 = K40 to start is action. Open the valve (Y0 = On, Y1 = Off) for 4 seconds, moving the valve to the position of 4 seconds. Phase 3: Change the position of the valve and D0 = K10. Due to that the previous position was at 4 seconds, the valve shall be closed (Y0 = Off, Y1 = On) for 3 seconds, moving the valve to the position of 1 second. 4) Phase 4: Switch off M0 and the valve will no longer move (Y0 = Off, Y1 = Off).
8-60
Type OP S X
Bit Devices Y M
Operands: S: Device for swapping 8 high/low byte. Explanations: 1. 2. 3. 4. 5. If D is used in device F, only 16-bit instruction is applicable. See the specifications of each model for their range of use. As 16-bit instruction: the contents in the 8 high bytes and 8 low bytes are swapped. As 32-bit instruction: the 8 high bytes and 8 low bytes in the two registers swap with each other respectively. This instruction adopts pulse execution instructions (SWAPP, DSWAPP).
Program Example 1: When X0 = On, the high 8 bytes and low 8 bytes in D0 will swap with each other.
X0 SWAPP D0
Program Example 2: When X0 = On, the high 8 bytes and low 8 bytes in D11 will swap with each other and the high 8 bytes and low 8 bytes in D10 will swap with each other.
X0 DSWAPP D10
D10 High Byte Low Byte
8-61
Type OP m D n X
Bit Devices Y M
Operands: m: Address in the file register to be read n: Number of data read at a time Explanations: 1. 2. 3. 4. 5. 6. 7. 8. 9. Range of m: K0 ~ K1,599 (SA/SX/SC); K0 ~ K9,999 (EH/EH2/SV) Range of D: D2000 ~ D4999 (SA/SX/SC); D2000 ~ D9999 (EH/EH2/SV) Range of n: For 16-bit instruction K1 ~ K1,600 (SA/SX/SC), K1 ~ K8,000 (EH/EH2/SV); For 32-bit instruction K1 ~ K800 (SA/SX/SC), K1 ~ K4,000 (EH/EH2/SV) See the specifications of each model for their range of use. Flag: M1101. See explanations below. SA/SX/SC/EH/EH2/SV uses this instruction to read the data in file registers and store them into data registers. SA/SX/SC offers 1,600 16-bit file registers. m and n of SA/SX/SC do not support E and F index register modification. EH/EH2/SV offers 10,000 16-bit file registers. error code H0E1A. Program Example 1: 1. 2. The 16-bit instruction MEMR reads 100 data at address 10 in the file register and store the read data in register D starting from D2000. When X0 = On, the instruction will be executed. When X0 = Off, the instruction will not be executed and the previously read data will remain unchanged.
X0 MEMR K10 D2000 K100
D: Device for storing the read data (starting from the designated D)
10. If m, D and n fall without their range, operation error will occur. M1067, M1068 = On and D1067 will record the
Program Example 2: 1. 2. The 32-bit instruction DMEMR reads 100 data at address 20 in the file register and store the read data in register D starting from D3000. When X0 = On, the instruction will be executed. When X0 = Off, the instruction will not be executed and the previously read data will remain unchanged.
X0 DMEMR K20 D3000 K100
8-62
Type OP S m n X
Bit Devices Y M
Operands: S: Device for storing the written data (starting from the designated D) n: Number of data to be written at a time Explanations: 1. Range of S: D2000 ~ D4999 (SA/SX/SC); D2000 ~ D9999 (EH/EH2/SV) 2. Range of m: K0 ~ K1,599 (SA/SX/SC); K0 ~ K9,999 (EH/EH2/SV) 3. Range of n: For 16-bit instruction K1 ~ K1,600 (SA/SX/SC), K1 ~ K8,000 (EH/EH2/SV); For 32-bit instruction K1 ~ K800 (SA/SX/SC), K1 ~ K4,000 (EH/EH2/SV) 4. See the specifications of each model for their range of use. 5. Flag: M1101. See explanations below. 6. SA/SX/SC/EH/EH2/SV uses this instruction to read the data in data registers and write them into file registers. 7. SA/SX/SC offers 1,600 16-bit file registers. 8. m and n of SA/SX/SC do not suppot E and F index register modification. 9. EH/EH2/SV offers 10,000 16-bit file registers. 10. If S, m and n fall without their range, operation error will occur. M1067, M1068 = On and D1067 will record the error code H0E1A. Program Example: 1. 2. When X0 = On, the 32-bit instruction DMEMW writes 100 32-bit data starting from D2001 and D2000 into address 0 ~ 199 in the file register. When X0 = On, the instruction will be executed. When X0 = Off, the instruction will not be executed and the previously data written in will remain unchanged.
X0 DMEMW D2000 K0 K100
File Register: 1. EH/EH2/SV: When the PLC is powered, it will decide whether to automatically send the data in the file register to the designated data register by M1101 (whether to enable the function of file register), D1101 (start address in file register K0 ~ K9,999), D1102 (number of data to be read in file register K1 ~ k8,000), and D1103 (device for storing read data, starting from designated D, K2,000 ~ K9,999). 2. In EH/EH2/SV, the reading of data from file register to data register D will not be executed if D1101 < 0, D1101
8-63
D1102
8-64
8-65
Type OP
Operands: S1: Address of communication device S2: Function code S3: Device address of data to be read/written n: Length of read/written data
The content of S2 shall only be: K3(H03), K6(H06), K16(H10). SA/SX V1.8, SC V1.6 and EH2/SV V1.2 and later versions support K2(H02) and K15(H0F); EH2/SV V1.4 and later versions support K5(H05).
2.
ES/EX/SS V.4.9 (and above) support the continuous execution instruction (MODRW). Other versions do not support this instruction.
3. 4. 5. 6.
ES/EX/SS series MPU does not support E, F index register modification. Flags: M1120 ~ M1131, M1140 ~ M1143. See remarks for more details. Range of S1: K0 ~ K254 S2: Funcation code. Only these function codes are available currently; other function codes are still not executable. See program examples for more information. Code H02 H03 H05 H06 H0F H10 Function Read many bit devices Read many word devices Write single bit device Write single word device Write many bit devices Write many word devices Applicable models SA/SX V1.8, SC V1.6 and EH2/SV V1.2 and later versions ES/SA/EH series MPU EH2/SV V1.4 and later versions ES/SA/EH series MPU SA/SX V1.8, SC V1.6 and EH2/SV V1.2 and later versions ES/SA/EH series MPU
7.
S3: Device address of data to be read/written. The device address inside the communication device. If the address is illegal to a designated communication device, the communication device will respond with an error message and PLC will store the error code in D1130 and M1141 = On. For example, if 8000H is illegal to VFD-S, M1141 will be On and D1130 = 2. See user manual of VFD-S for error codes.
8.
S: Register for storing read/written data. The user sets up a register and stores the data to be written in the register in advance. The register can be register for storing the read data.
9.
n: Length of read/written data. In Modbus function code H05 (force On/Off), n=0: Off, n=1: On. In Modbus function code H02, H03, H0F, H10 (data length), the range = K1 ~ Km. See the table below for m
9-1
There is no limitation on the times of using this instruction. However, only one instruction can be executed at a time.
Program Example 1: 1. Function code K3(H03): For reading many data in register When PLC is connected to VFD-S AC motor drive: M1143 = Off, in ASCII mode When PLC is connected to VFD-S AC motor drive: M1143 = On, in RTU mode 2. When in ASCII mode, the received data will be stored in the designated registers starting from D0 in ASCII format and PLC will automatically convert the data into hex value and store them in special registers D1296 ~ D1311. When the conversion into hex value starts, M1131 will be On and turn Off when the conversion is completed. 3. If necessary, the user can move the hex values stored in D1296 ~ D1131 to other general registers by using MOV, DMOV or BMOV instruction. Other instructions of ES/EX/SS do not function on the data in D1296 ~ D1311. 4. 5. When in RTU mode, the received data will be stored in the designated registers starting from D0 in hex format. When In ASCII mode or RTU mode, PLC will store the data to be sent in D1256 ~ D1295. If necessary, the user can move the data to other general registers by using MOV, DMOV or BMOV instruction. Other instructions of ES/EX/SS do not function on the data in D1256 ~ D1295. 6. The data sent back from AC motor drive are stored in the registers designated by the user. After the transmission is completed, PLC will auto-check if the received data are incorrect. M1140 will be On if there is an error. 7. If the device address is illegal to a designated communication device, the communication device will respond with an error message and PLC will store the error code in D1130 and M1141 = On. For example, if 8000H is illegal to VFD-S, M1141 will be On and D1130 = 2. See user manual of VFD-S for error codes. 8. After M1140 = On or M1141 = On, PLC will send another correct datum to AC motor drive. If the data sent back from AC motor drive is correct, M1140 and M1141 will be reset.
9-2
D1120
Function Data address Register Data length code K3: H2100 for storing (word) read the data many data
M1127 Process of received data ASCII mode: The received data will be stored in the designated registers starting from D0 in ASCII format and PLC will automatically convert the data into hex value and store them in special registers D1296 ~ D1311. RTU mode: The received data will be stored in the designated registers starting from D0 in hex format. RST M1127 Sending/receiving of data is completed. The flag is reset.
9.
ASCII Mode: When PLC is connected to VFD-S AC motor drive. PLC VFD-S VFD-S, PLC sends: 01 03 2100 0006 D5 PLC, PLC receives: 01 03 0C 0100 1766 0000 0000 0136 0000 3B
Registers for sent data (sending messages) Register D1256 Low D1256 High D1257 Low D1257 High D1258 Low D1258 High D1259 Low D1259 High D1260 Low D1260 High D1261 Low D1261 High D1262 Low D1262 High 0 1 0 3 2 1 0 0 0 0 0 6 D 5 DATA 30 H 31 H 30 H 33 H 32 H 31 H 30 H 30 H 30 H 30 H 30 H 36 H 44 H 35 H ADR 1 ADR 0 CMD 1 CMD 0 Explanation Address of AC motor drive: ADR (1,0) Command code: CMD (1,0)
9-3
PLC automatically convert ASCII codes to numerals and store the numeral in D1296 = H0100
PLC automatically convert ASCII codes to numerals and store the numeral in D1297 = H1766
PLC automatically convert ASCII codes to numerals and store the numeral in D1298 = H0000
PLC automatically convert ASCII codes to numerals and store the numeral in D1299 = H0000
PLC automatically convert ASCII codes to numerals and store the numeral in D1300 = H0136
PLC automatically convert ASCII codes to numerals and store the numeral in D1301 = H0000
10. RTU Mode: When PLC is connected to VFD-S AC motor drive PLC VFD-S VFD-S, PLC sends: 01 03 2100 0006 CF F4 PLC, PLC receives: 01 03 0C 0000 0503 0BB8 0BB8 0000 012D 8E C5
Registers for sent data (sending messages) Register D1256 Low D1257 Low D1258 Low D1259 Low D1260 Low D1261 Low D1262 Low DATA 01 H 03 H 21 H 00 H 00 H 06 H CF H Address Function Starting Data Address Number of Data (counted by words) CRC CHK Low DVP-PLC Application Manual Explanation
9-4
Registers for received data D0 (responding messages) Register D0 Low D1 Low D2 Low D3 Low D4 Low D5 Low D6 Low D7 Low D8 Low D9 Low D10 Low D11 Low D12 Low D13 Low D14 Low D15 Low D16 Low Program Example 2: 1. Function code K6(H6): For writing a word data to register When PLC is connected to VFD-S AC motor drive: M1143 = Off, in ASCII mode When PLC is connected to VFD-S AC motor drive: M1143 = On, in RTU mode 2. When in ASCII mode, the user stores the data to be written in the designated register D50 in hex format. The data sent back from AC motor drive are stored in D1070 ~ D1076. 3. When in RTU mode, the user stores the data to be written in the designated register D50 in hex format. The data sent back from AC motor drive are stored in D1070 ~ D1077. 4. When In ASCII mode or RTU mode, PLC will store the data to be sent in D1256 ~ D1295. If necessary, the user can move the data to other general registers by using MOV, DMOV or BMOV instruction. Other instructions of ES/EX/SS do not function on the data in D1256 ~ D1295. 5. After receiving the data sent back from AC motor drive is completed, PLC will auto-check if the received data are incorrect. M1140 will be On if there is an error. 6. If the device address is illegal to a designated communication device, the communication device will respond with an error message and PLC will store the error code in D1130 and M1141 = On. For example, if 8000H is illegal to VFD-S, M1141 will be On and D1130 = 2. See user manual of VFD-S for error codes. 7. After M1140 = On or M1141 = On, PLC will send another correct datum to AC motor drive. If the data sent back from AC motor drive is correct, M1140 and M1141 will be reset. DATA 01 H 03 H 0C H 00 H 00 H 05 H 03 H 0B H B8 H 0B H B8 H 00 H 00 H 01 H 2D H 8E H C5 H Address Function Number of Data (byte) Content of address 2100H Content of address 2101H Content of address 2102H Content of address 2103H Content of address 2104H Content of address 2105H CRC CHK Low CRC CHK High PLC automatically convert ASCII codes to numerals and store the numeral in D1296 = H0000 PLC automatically convert ASCII codes to numerals and store the numeral in D1297 = H0503 PLC automatically convert ASCII codes to numerals and store the numeral in D1298 = H0BB8 PLC automatically convert ASCII codes to numerals and store the numeral in D1299 = H0BB8 PLC automatically convert ASCII codes to numerals and store the numeral in D1300 = H0000 PLC automatically convert ASCII codes to numerals and store the numeral in D1301 = H012D Explanation
9-5
D1120
M1122
M1127
Function Data address Register Data length code K6: H2000 for storing (word) write 1 the data word datum
Process of received data ASCII mode: the received data will be stored in special registers D1070 ~ D1076 in ASCII format. RTU mode: the received data will be stored in special registers D1070 ~ D1077 in hex format. RST M1127 Sending/receiving of data is completed. The flag is reset.
8.
ASCII Mode: When PLC is connected to VFD-S AC motor drive. PLC VFD-S VFD-S, PLC sends: 01 06 0100 1770 71 PLC, PLC receives: 01 06 0100 1770 71
Registers for sent data (sending messages) Register D1256 Low D1256 High D1257 Low D1257 High D1258 Low D1258 High D1259 Low D1259 High D1260 Low D1260 High D1261 Low D1261 High D1262 Low D1262 High 0 1 0 6 0 1 0 0 1 7 7 0 7 1 DATA 30 H 31 H 30 H 36 H 30 H 31 H 30 H 30 H 31 H 37 H 37 H 30 H 37 H 31 H ADR 1 ADR 0 CMD 1 CMD 0 Explanation Address of AC motor drive: ADR (1,0) Command code: CMD (1,0)
Data Address
Data content
Registers for received data (responding messages) Register D1070 Low D1070 High D1071 Low D1071 High 9-6 0 1 0 6 DATA 30 H 31 H 30 H 36 H ADR 1 ADR 0 CMD 1 CMD 0 DVP-PLC Application Manual Explanation
Data Address
Data content
RTU Mode: When PLC is connected to VFD-S AC motor drive PLC VFD-S VFD-S, PLC sends: 01 06 2000 0012 02 07 PLC, PLC receives: 01 06 2000 0012 02 07
Registers for sent data (sending message) Register D1256 Low D1257 Low D1258 Low D1259 Low D1260 Low D1261 Low D1262 Low D1263 Low DATA 01 H 06 H 20 H 00 H 00 H 12 H 02 H 07 H Address Function Data Address Data content CRC CHK Low CRC CHK High The content of register D50 (H12) Explanation
Registers for received data (responding message) Register D1070 Low D1071 Low D1072 Low D1073 Low D1074 Low D1075 Low D1076 Low D1077 Low Program Example 3: 1. Function code K16(H10): For writing many word data into register. When PLC is connected to VFD-S AC motor drive: M1143 = Off, in ASCII mode When PLC is connected to VFD-S AC motor drive: M1143 = On, in RTU mode 2. When in ASCII mode, the user stores the data to be written in the designated register D50 in hex format. The data sent back from AC motor drive are stored in D1070 ~ D1076. 3. When in RTU mode, the user stores the data to be written in the designated register D50 in hex format. The DATA 01 H 06 H 20 H 00 H 00 H 12 H 02 H 07 H Address Function Data Address Data content CRC CHK Low CRC CHK High Explanation
9-7
D1120
M1122
M1127
Function Data address Register Data length code K16: H2000 for storing (word) write many the data word data
Process of received data ASCII mode : The received data are stored in special registers D1070 ~ D1078 in ASCII format. RTU mode : The received data are stored in special registers D1070~1078 in hex format. RST M1127 Sending/receiving of data is completed. The flag is reset.
8.
ASCII Mode: When PLC is connected to VFD-S AC motor drive. PLC VFD-S VFD-S, PLC sends: 01 10 2000 0002 04 0012 1770 30 PLC, PLC receives: 01 10 2000 0002 CD
Registers for sent data (sending messages) Register D1256 Low D1256 High D1257 Low D1257 High D1258 Low D1258 High D1259 Low D1259 High 9-8 0 1 1 0 2 0 0 0 DATA 30 H 31 H 31 H 30 H 32 H 30 H 30 H 30 H ADR 1 ADR 0 CMD 1 CMD 0 Explanation Address of AC motor drive: ADR (1,0) Command code: CMD (1,0)
Data Address
Number of Registers
Byte Count
Data contents 1
Data contents 2
Registers for received data (responding messages) Register D1070 Low D1070 High D1071 Low D1071 High D1072 Low D1072 High D1073 Low D1073 High D1074 Low D1074 High D1075 Low D1075 High D1076 Low D1076 High 9. 0 1 1 0 2 0 0 0 0 0 0 2 C D DATA 30 H 31 H 31 H 30 H 32 H 30 H 30 H 30 H 30 H 30 H 30 H 32 H 43 H 44 H ADR 1 ADR 0 CMD 1 CMD 0 Explanation
Data Address
Number of Registers
RTU Mode: When PLC is connected to VFD-S AC motor drives PLC VFD-S VFD-S, PLC sends: 01 10 2000 0002 04 0012 1770 C4 7F PLC, PLC receives: 01 10 2000 0002 4A 08
Registers for sent data (sending messages) Register D1256 Low D1257 Low D1258 Low D1259 Low D1260 Low D1261 Low D1262 Low DATA 01 H 10 H 20 H 00 H 00 H 02 H 04 H Address Function Data Address Number of Registers Byte Count 9-9 Explanation
Registers for received data (responding messages) Register D1070 Low D1071 Low D1072 Low D1073 Low D1074 Low D1075 Low D1076 Low D1077 Low Program Example 4: 1. Function code K2(H02): Read many bit devices. The read communication code will be placed in the register designated by the 4th operand of the instruction. In the example below, K6 refers to the data length (bit). Assume Y2=Y4=Y5=Y11=Y14=On for Y0 ~ Y16 status.
M1002 MOV SET MOV X10 M1143 X0 SET X0 MODRW K1
Address of communication device K1
DATA 01 H 10 H 20 H 00 H 00 H 02 H 4A H 08 H Address Function Data Address Number of Registers CRC CHK Low CRC CHK High
Explanation
D1120
D1129
M1122
K2
Function code K2: reads many bit data
H0500
Data address: H0500 PLC device: Y0
D0
Data register
K6
Read/write data length (word)
M1127
RST
M1127
9-10
Registers for PLC1 sent data (sending messages) Register D1256 Low D1256 High D1257 Low D1257 High D1258 Low D1258 High D1259 Low D1259 High D1260 Low D1260 High D1261 Low D1261 High D1262 Low D1262 High 0 1 0 2 0 5 0 0 0 0 1 0 E 8 DATA 30 H 31 H 30 H 32 H 30 H 35 H 30 H 30 H 30 H 30 H 31 H 30 H 45 H 38 H ADR 1 ADR 0 CMD 1 CMD 0 Explanation Address of connected device: ADR (1,0) Command code: CMD (1,0)
Register (D0) for PLC1 received data (responding messages): Register D0 Low D0 High D1 Low D1 High D2 Low D2 High D3 Low D3 High D4 Low D4 High D5 Low D5 High 3. 0 1 0 2 0 2 3 4 1 2 B 5 DATA 30 H 31 H 30 H 33 H 30 H 32 H 33 H 34 H 31H 32H 52H 35 H ADR 1 ADR 0 CMD 1 CMD 0 Number of data (counted by bytes) Content in address 0500 ~ 0505 LRC CHK 1 LRC CHK 0 PLC automatically convert ASCII words and store the result in D1296 = H1234 (b0 ~ b5 are valid) Explanation
RTU Mode: When PLC1 is connected to PLC2 When X10 = On, function code 02 of MODRW instruction will start to be executed. PLC1 PLC2 PLC2, PLC1 sends: 01 02 0500 0010 79 0A PLC1, PLC1 receives: 01 02 02 34 12 2F 75
Registers for PLC sent data (sending messages): Register D1256 low D1257 low DVP-PLC Application Manual DATA 1H 2H Address Function 9-11 Explanation
Register (D0) for PLC received data (responding messages): Register D0 low D1 low D2 low D3 low D4 low D5 low D6 low Program Example 5: 1. Function code K15(H0F): Write many bit devices. The preset bit status has to be placed in the register designated by the 4th operand of the instruction in b0 ~ b5 order. 1 word is able to contain 16 bit status data.
M1002 MOV SET MOV X10 M1143 X0 SET MOV X0 MODRW K1
Address of communication device K1
DATA 01 H 02 H 02 H 34 H 12 H 2F H 75 H
Explanation Address Function Number of data (byte) Content in address PLC automatically stores the value in 0500H D1296=H1234 (b0 ~ b5 are valid) CRC CHK Low CRC CHK High
D1120
D1129
M1122 HFFFF
D0
K15
Function code K15: writes many bit data
H0500
Data address: H0500 PLC device: Y0
D0
Data register
K6
Read/write data length (word)
M1127
RST
M1127
9-12
Registers for PLC1 sent data (sending messages): Register D1256 low D1256 high D1257 low D1257 high D1258 low D1258 high D1259 low D1259 high D1260 low D1260 high D1261 low D1261 high D1262 low D1262 high D1263 low D1263 high D1264 low D1264 high 0 1 0 F 0 5 0 0 0 0 0 6 0 1 3 F A 5 DATA 30 H 31 H 30 H 46 H 30 H 35 H 30 H 30 H 30 H 30 H 30H 36 H 30 H 31 H 33 H 46 H 41 H 35 H ADR 1 ADR 0 CMD 1 CMD 0 Explanation Address of connected device: ADR (1,0) Command code: CMD (1,0)
Data address
Byte Count Data content 1 LRC CHK 1 LRC CHK 0 Content in D0 register (H3F) Error checksum: LRC CHK (0,1)
Registers for PLC1 received data (responding messages): Register D1070 low D1070 high D1071 low D1071 high D1072 low D1072 high D1073 low D1073 high D1074 low D1074 high D1075 low D1075 high D1076 low D1076 high 3. 0 1 0 F 0 5 0 0 0 0 0 6 E 5 DATA 30 H 31 H 31 H 46 H 30 H 35 H 30 H 30 H 30 H 30 H 30 H 36 H 45 H 35 H ADR 1 ADR 0 CMD 1 CMD 0 Explanation
Data address
Number of registers
RTU Mode: When PLC1 is connected to PLC2 When X10 = On, function code 15 of MODRW instruction will start to be executed. PLC1 PLC2 PLC2, PLC1 sends: 01 0F 0500 0006 01 3F PLC1, PLC1 receives: 01 0F 0500 0006 D5 05 9-13
Registers for PLC received data (responding messages): Register D1070 low D1071 low D1072 low D1073 low D1074 low D1075 low D1076 low D1077 low Program Example 6: 1. Function code K5(H5): Write status of single bit device. In the example below, Set K1 to bit On, K0 to bit Off.
M1002 MOV SET MOV M10 M1143 M0 SET M0 M0 MODRW K1
Address of communication device K1
DATA 01 H 0F H 05 H 00 H 00 H 06H D5H 05 H Address Function Data address Data content CRC CHK Low CRC CHK High
Explanation
D1120
D1129
K5
Function code K15: sets single point On/Off
H0500
Data address: H0500 PLC device: Y0
D0
K1
Set On
M0 MODRW K1 K5 H0500 D0 K0
Set Off
9-14
ASCII mode: The received data are stored in special registers D1070 ~ D1076 in ASCII format. RTU mode: The received data are stored in special registers D1070 ~ D1077 in hex format.
RST
M1127
2.
ASCII Mode: When PLC1 is connected to PLC2 When M0 = On, function code 05 (bit On) of MODRW instruction will start to be executed. PLC1 PLC2 PLC2, PLC1 sends: 01 05 0500 FF00 F6 PLC1, PLC1 receives: 01 05 0500 FF00 F6
Registers for PLC1 sent data (sending messages): Register D1256 low D1256 high D1257 low D1257 high D1258 low D1258 high D1259 low D1259 high D1260 low D1260 high D1261 low D1261 high D1262 low D1262 high 0 1 0 5 0 5 0 0 F F 0 0 F 6 DATA 30 H 31 H 30 H 35 H 30 H 35 H 30 H 30 H 46 H 46 H 30 H 30 H 46 H 36 H ADR 1 ADR 0 CMD 1 CMD 0 Explanation Address of connected device: ADR (1,0) Command code: CMD (1,0)
Registers (D0) for PLC1 received data (responding messages): Register D1070 low D1070 high D1071 low D1071 high D1072 low D1072 high D1073 low D1073 high D1074 low D1074 high D1075 low D1075 high D1076 low D1076 high 0 1 0 5 0 5 0 0 F F 0 0 F 6 DATA 30 H 31 H 30 H 35 H 30 H 35 H 30 H 30 H 46 H 46 H 30 H 30 H 46 H 36 H ADR 1 ADR 0 CMD 1 CMD 0 Explanation Address of connected device: ADR (1,0) Command code: CMD (1,0)
9-15
Registers for PLC1 sent data (sending messages): Register D1256 low D1256 high D1257 low D1257 high D1258 low D1258 high D1259 low D1259 high D1260 low D1260 high D1261 low D1261 high D1262 low D1262 high 0 1 0 5 0 5 0 0 0 0 0 0 F 5 DATA 30 H 31 H 30 H 35 H 30 H 35 H 30 H 30 H 30 H 30 H 30 H 30 H 46 H 35 H ADR 1 ADR 0 CMD 1 CMD 0 Explanation Address of connected device: ADR (1,0) Command code: CMD (1,0)
Registers (D0) for PLC1 received data (responding messages): Register D1070 low D1070 high D1071 low D1071 high D1072 low D1072 high D1073 low D1073 high D1074 low D1074 high D1075 low D1075 high D1076 low D1076 high 3. 0 1 0 5 0 5 0 0 0 0 0 0 F 5 DATA 30 H 31 H 30 H 35 H 30 H 35 H 30 H 30 H 30 H 30 H 30 H 30 H 46 H 35 H ADR 1 ADR 0 CMD 1 CMD 0 Explanation Address of connected device: ADR (1,0) Command code: CMD (1,0)
RTU Mode: When PLC1 is connected to PLC2 When M0 = On, function code 05 (bit On) of MODRW instruction will start to be executed. PLC1 PLC2 PLC2, PLC1 sends: 01 05 0500 FF00 8C F6 PLC1, PLC1 receives: 01 05 0500 FF00 8C F6
Registers for PLC sent data (sending messages): Register D1256 low D1257 low DATA 01 H 05 H Address Function Explanation
9-16
Registers (D0) for PLC received data (responding messages): Register D1070 low D1071 low D1072 low D1073 low D1074 low D1075 low D1076 low D1077 low DATA 01 H 05 H 05 H 00 H FF H 00 H 8C H F6 H Address Function Starting data address Set bit On/Off Request bit ON/OFF CRC CHK Low CRC CHK High Explanation
When M10 = Off, function code 05 (bit Off) of MODRW instruction will start to be executed. PLC1 PLC2 PLC2, PLC1 sends: 01 05 0500 0000 CD 06 PLC1, PLC1 receives: 01 05 0500 0000 CD 06
Registers for PLC sent data (sending messages): Register D1256 low D1257 low D1258 low D1259 low D1260 low D1261 low D1262 low D1263 low DATA 01 H 05 H 05 H 00 H 00 H 00 H CD H 06 H Address Function Starting data address Set bit On/Off Request bit ON/OFF CRC CHK Low CRC CHK High Explanation
Registers (D0) for PLC received data (responding messages): Register D1070 low D1071 low D1072 low D1073 low D1074 low D1075 low D1076 low D1077 low DATA 01 H 05 H 05 H 00 H 00 H 00 H CD H 06 H Address Function Starting data address Set bit On/Off Request bit ON/OFF CRC CHK Low CRC CHK High Explanation
Remarks: 1. The activation condition placed before MODRD, RDST and MODRW instructions cannot use rising-edge or
9-17
9-18
Program Steps
Operands: S: Source device Explanations: 1. 2. 3. Range of S: X10 ~ X17 Range of D: D0 ~ D999, occupying 2 consecutive devices. Can only be used once in the program. PWD instruction is for detecting the time span of output signals from X10 ~ X17; the valid frequency range is 1 ~1kHz. When M1169 = On, the instruction will detect the time span of the continuous rising edge and falling edge of the input signals (time unit: 100us). When M1169 = On, the instruction will detect the time span of 2 continuous rising edges of the input signals (time unit: 1us). It cannot designate the same X10 ~ X17 as does DCNT and ZRN instructions. 4. D occupies two continuous devices. The longest detectable time is 21,474.83647 seconds, about 357.9139 minutes or 5.9652 hours. 5. There is no limitation on the times of using this instruction. However, only one instruction can be executed at a time. Program Example: When X0 = On, record the time span of X10 = On and store it in D1 and D0.
X0 PWD X10 D0
9-19
Program Steps
Operands: D: Device for storing the measuring time (unit: 1us) (time unit: 1us) Explanations: 1. 2. 3. Range of D: K0 ~ K9 Range of n: K10 ~ K500 The designated special D registers (D1156 ~ D1165) can measure up to 10 interruption subroutines. For example, when D = K5, the designated D register will be D1161. 4. When RTMU is executed, if the D and n entered by the user are legal, interruption of the timer will be enabled and the counting starts and the special D designated by D is cleared as 0. When RTMD is executed, interruption of the timer is disabled and the calculated time will be assigned to special D designated by RTMD. 5. With API 153 RTMD, RTMU can measure the execution time of I interruption service subroutine, which can be reference for dealing with the high-speed response when the user is at the initial stage of developing the program. n: Measurement time base. Parameter range: K10 ~ K500
API 153
Operands
Function End of the Measurement of the Execution Time of I Interruption Word Devices
Controllers
ES/EX/SS SA/SX/SC EH/SV
Program Steps
OP
Operands: D: Device to store the measuring time (unit: 1us). Explanations: 1. Range of D: K0 ~ K9. The No. of D has to be the same as that designated by D in API 152 RTMU; otherwise the result of the measurement may be unexpectable. Program Example: When X0 goes from Off to On, the program will enter I001 interruption subroutine. RTMU will activate an 8-bit timer (unit: 10us) and RTMD (when D = K0) will shut down the timer and store the time in the timer in special D registers (D1156 ~ D1165, designated by K0 ~ K9). 9-20 DVP-PLC Application Manual
Remarks: 1. 2. We suggest you remove this instruction after you finish developing your PLC program. Due to the lower priority of the interruption enabled by RTMU, when RTMU is enabled, other high-speed pulse input counting or high-speed pulse output may result in failure to trigger the timer. 3. If you activate RTMU but do not activate RTMD before the end of the interruption, the interruption will not be shut down. 4. RTMU instruction activates 1 timer interruption in PLC. Therefore, if many RTMU or RTMD are executed at the same time, confusion in the timer may occur. Please be aware of the situation.
9-21
Bit Devices Y M
Operands: S1: Lower bound of the random number produced Explanations: 1. 2. 3. S1S2; K0 S1 , S2 K32,767 See the specifications of each model for their range of use. Entering S1 > S2 will result in operation error. The instruction will not be executed at this time, M1067, M1068 = On and D1067 records the error code 0E1A (hex). Program Example: When X10 = On, RAND will produce the random number between the lower bound D0 and upper bound D10 and store the result in D20.
X10 RAND D0 D10 D20
9-22
Type OP S D1 D2
Operands: S: Input signal from Servo (occupies 3 consecutive devices) consecutive devices) Explanations: 1. 2. 3. 4. 5. Operand S and D1 of SA series MPU do not support E, F index register modification. See the specifications of each model for their range of use. This instruction can only be used once in the program. Flag: see remarks for more details. This instruction reads the absolute position (ABS) of MITSUBISHI MR-J2 servo drive (with absolute position check function). 6. S will occupy 3 consecutive devices, S, S +1, and S +2. S and S +1 are connected to the absolute position (bit 0, bit 1) on the servo for data transmitting. S +2 is connected to Servo for transmitting data ready flag. See the wiring example below for more details. 7. D1 will occupy 3 consecutive devices, D1, D1 + 1, D1 + 2. D1 is connected to SERVO On (SON) of Servo. D1+1 is connected to ABS transmisstion mode of Servo and D1+2 is connected to ABS request signal. See the wiring example below for more details.
PLC DVP32EH00T CN1B VDD ABS(bit 0) ABS(bit 1) transmission data is ready D01 ZSP TLC SG
3 4 19 6 10
Y4 Y5 Y6 C4
5 8 9
8.
D2 will occupy 2 consecutive devices D2 and D2 + 1. D2 is the lower 16 bits and D2 + 1 is the higher 16 bits. The absolute position data should be written into the present value registers (D1337, D1336) of CH0 pulse (Y0, Y1) or the present value registers (D1339, D1338) of CH1 pulse (Y2, Y3) in EH series MPU; therefore, we suggest you designate the two corresponding registers. If you designate other devices as the registers, you still have to
9-23
X7
D1 Y4 K50
X0 T0
T0 M10
Read overtime
M1029 SET
execution completed flag
M11
Remarks: 1. If the instruction is interrupted when PLC is still reading the absolute position of SERVO, an ALARM message (ALE5) will occur in SERVO. 2. Timing chart of DABSR instruction reading absolute position: a) When DABSR instruction starts to execute, it will drive SERBVO On (SON) and ABS transmittion mode for output. b) By transmission is ready and ABS request signals, you can confirm the transmission and reciept of both sides as well as processing the transmission of the 32-bit present position data plus the 6-bit check data. c) The data are transmitted by ABS (bit0, bit1).
9-24
3.
This instruction is applicable to the Servo motor equipped with absolute positioning function, e.g. Mitsubishi MR-J2-A Servo drive.
4.
Select one of the following methods for the initial reading of present absolute position. a) Complete zero point return by using reset signal function to execute API 156 ZRN instruction. b) After using JOG or manual operation to adjust the zero point position, input a reset signal in SERVO AMP. See the figure of external switch below for whether to use DVP-PLC for output. For the wiring of DVP-PLC and Mitsubishi MR-H2-A, see remarks of API 159 DRVA instruction.
Ex: Mitsubishi MR-J2A
CR reset
SG
10
5.
Flags explanation: M1010: (For EH/EH2/SV series MPU) When M1010 is On, CH0 (Y0, Y1) and CH1 (Y2, Y3) will output pulses while END instruction is being executed. When the output starts, M1010 will automatically turn Off. M1029: (For EH/EH2/SV series MPU) When the first group CH0 (Y0, Y1) pulse output or the execution of other relevant instructions are completed, M1029 will turn On. M1030: (For EH/EH2/SV series MPU) When the second group CH1 (Y2, Y3) pulse output is completed, M1030 will turn on. M1102: M1103: (For SC series MPU) When the first group CH0 (Y10) pulse output is completed, M1102 will turn On. (For SC series MPU) When the second group CH1 (Y11) pulse output is completed, M1103 will turn On. M1258: M1259: M1305: (For EH/EH2/SV series MPU) When M1258 is On, CH0 (Y0, Y1) will output reverse pulses. (For EH/EH2/SV series MPU) When M1259 is On, CH1 (Y2, Y3) will output reverse pulses. (For EH/EH2/SV series MPU) PLSV, DPLSV, DRVI, DDRVI, DRVA, DDRVA instructions for CH0 (Y1, Y2) reverse running.
9-25
Special registers: D1337, D1336: 1. (For EH/EH2/SV series MPU) Registers for the first group (Y0, Y1) output pulse present value of position control instructions (API 156 ZRN, API 157 PLSV, API 158 DRVI, API 159 DRVA). The present value increases or decreases according to the corresponding rotation direction. D1337 is for high word; D1336 is for low word. 2. (For EH/EH2/SV series MPU) Registers for storing the current number of output pulses of the first group (Y0, Y1) output of pulse output instructions (API 57 PLSY, API 59 PLSR). D1337 is for high word; D1336 is for low word. D1338, D1339: 1. (For EH/EH2/SV series MPU) Registers for the second group (Y2, Y3) output pulse present value of position control instructions (API 156 ZRN, API 157 PLSV, API 158 DRVI, API 159 DRVA). The present value increases or decreases according to the corresponding rotation direction. D1339 is for high word; D1338 is for low word. 2. (For EH/EH2/SV series MPU) Registers for storing the current number of output pulses of the second group (Y2, Y3) output of pulse output instructions (API 57 PLSY, API 59 PLSR). D1339 is for high word; D1338 is for low word. D1340 (D1352): For setting up the frequencies of the first acceleration segment and the last deceleration segment when the position control instructions (API 156 ZRN, API 158 DRVI, API 159 DRVA) are executing CH0 (CH1) outputs. Range of setting: For EH/EH2/SV series MPU, the speed has to be higher than 10Hz. Frequency lower than 10Hz or higher than maximum output frequency will be output by 10Hz. The default setting in EH/EH2/SV series MPU is 200Hz. For SC series MPU, the speed has to be 100 ~ 100kHz. Frequency lower than 100Hz will be output by 100Hz and frequency higher than
9-26
9-27
Type OP
* *
*
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S1: Zero return speed transistor output module) Explanations: 1. 2. When S1 and S2 are used in device F, only 16-bit instruction is applicable. S1 and S2 of SC series MPU only support device K, H and D. S3 of SC series MPU only supports device X10 and X11. 3. 4. Flag: see remarks of API 155 ABSR and API 158 DDRVI for more details. S1 is the starting speed of zero return operation. For EH/EH2/SV series MPU, the 16-bit instruction can designate the range of the speed, which is 10 ~ 32,767Hz and the range designated by the 32-bit instruction is 10 ~ 200,000Hz. If the designated speed is slower than 10Hz, the zero return will operate at 10Hz and when the designated speed is faster than 200kHz, the zero return will operate at 200kHz. For SC series MPU, the 32-bit instruction can designate the range of speed , which is 100 ~ 100,000Hz. If the designated speed is slower than 100Hz, the zero return will operate at 100Hz, and when the designated speed is faster than 100kHz, the zero return will operate at 100kHz. 5. S2 is the designated low speed after the near point signal (DOG) is On. EH/EH2/SV series MPU can designate the range of S2, which is 10 ~ 32,767Hz and SC series MPU can designate the range 100 ~ 100,000Hz. 6. S3 is the designated near point signal (DOG) input (input from A contact). In EH/EH2/SV series MPU, if devices other than the external output device (X10 ~ X17), e.g. X, Y, M, S are designated, they will be affected by the scan period, resulting in dispersion of the zero point. In addition, please note that the MPU cannot designate the same input points X10 ~ X17 as those designated by DCNT and PWD instructions. SC series MPU can only designate X10 and X11 and cannot designate the same input points as those designated by DCNT instruction. 7. EH series MPU has two groups of A/B phase pulse output, CH0 (Y0, Y1) and CH1 (Y2, Y3); EH2/SV series MPU has four groups of A/B phase pulse output, CH0 (Y0, Y1), CH1 (Y2, Y3), CH2 (Y4, Y5) and CH3 (Y6, Y7). See remarks for the setup methods. 8. Zero return output device in different models Model Zero return output 9. SC MPU Y10, Y11 EH MPU Y0, Y2 EH2/SV MPU Y0, Y2, Y4, Y6 S2: Creep speed S3: Near p oint signal (DOG) D: Pulse output device (please use
When executing API 158 DRVI (releative positioning) or API 159 DRVA (absolute positioning), PLC will automatically store the increasing or decreasing forward/reverse pulses in the present value registers. For
9-28
Remarks: 1. Timing chart of the reset signal output for EH/EH2/SV series MPU. (SC series MPU does not support this function.) a) When the reset signal flag M1346 = On, after zero return is completed, the PLC can send the reset signal to the servo drive and the signal will last for approximately 20ms. After 20ms, the reset signal will return to Off again. b) Output devices for reset signals of EH series MPU: CH0 (Y0, Y1) reset output device (Y4) CH1 (Y2, Y3) reset output device (Y5) c) Output devices for reset signals of EH2/SV series MPU: CH0 (Y0, Y1) reset output device (Y10) CH1 (Y2, Y3) reset output device (Y11) CH2 (Y4, Y5) reset output device (Y12) CH3 (Y6, Y7) reset output device (Y13)
Zero return speed Scan in circle Creep speed On DOG ON Off Reset signal Reset signal Y4 or Y5
Inside 1 ms Greater than 20ms
Program interrupt
Note: The designated devices, X, Y, M, and S, other than the external input devices X10 ~ X17 will be affected by the scan period, 2 times of the scan period at worst. 2. The zero return operation:
9-29
g) ZRN (DZRN) instruction is applicable to servo motor with absolute positioning function, e.g. Mitsubishi MR-J2-A servo drive. Even when the power is switched off, the current position can still be recorded. In addition, the current position of servo drive can be read by API 155 DABSR of EH/EH2/SV/SV series MPU; therefore only one zero return operation is required and no zero return has to be done after the power is switched off. h) When the drive contact of ZRN instruction is On, CH0 (CH1) will read the acceleration/deceleration time set in
9-30
9-31
*
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S: Pulse output frequency the signal of rotation direction Explanations: 1. 2. 3. See remarks for the setting range of S, D1 and D2. Flag: see remarks of API 155 ABSR and API 158 DDRVI for more details. S is the designated pulse output frequency. The 16-bit instruction can designate its range 0 ~ +32,767Hz, 0 ~ -32,768Hz. The ranges designated by 32-bit instruction are 0 ~ +200,000Hz and 0 ~ -200,000Hz. +/- signs indicate forward/backward directions. During the pulse output, the frequency can be changed, but not the frequencies of different directions. 4. D1 is the pulse output device. EH series MPU can designate Y0 and Y2 and EH2/SV series MPU can designate Y0, Y2, Y4 and Y6. 5. 6. The operation of D2 corresponds to the + or - of S. When S is +, D2 will be On; when S is -, D2 will be Off. PLSV instruction does not have settings for acceleration and deceleration. Please use API 67 RAMP for the acceleration and deceleration of pulse output frequency. 7. During the pulse output executed by PLSV instruction, the drive contact turning Off will result in the immediate stop of the output without going through a deceleration. 8. When the absolute value of the input frequency during the execution of DPLSV is bigger than 200kHz, the output will operate at 200kHz. 9. For EH/EH2/SV series MPU, D1222, D1223, D1383 and D1384 are the time differences sent between the direction setup signal and pulse output points of CH0, CH1, CH2 and CH3. 10. For EH/EH2/SV series MPU, M1305, M1306, M1532 and M1533 are the flags of the direction signals of CH0, CH1, CH2 and CH3. When S is +, the output will operate towards a forward direction and the flag will go Off. When S is -, the output will operate towards a backward direction and the flag will go On. Program Example: When M10 = On, Y0 will output pulses at 20kHz. Y5 = On indicates forward pulses.
M10 PLSV K20000 Y0 Y5
9-32
Type OP
* *
*
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S1: Number of output pulses (relative designation) use transistor output module) Explanations: 1. 2. 3. 4. See remarks for the setting range of S1, S2, D1 and D2. S1 and S2 of SC series MPU only support device K, H and D. Flag: see remarks for more details. S1 is the number of output pulses (relative designation). For EH/EH2/SV series MPU, the 16-bit instruction can designate the range -32,768 ~ +32,767. The range designated by 32-bit instruction is -2,147,483,648 ~ +2,147,483,647. For SC series MPU, the 32-bit instruction can designate the range -2,147,483,648 ~ +2,147,483,647. +/- signs indicate forward/backward directions. 5. S2 is the designated pulse output frequency. For EH/EH2/SV series MPU, the 16-bit instruction can designate its range 10 ~ 32,767Hz. The range designated by 32-bit instruction is 10 ~ 200,000Hz. For SC series MPU, the 32-bit instruction can designate the range 100 ~ 100,000Hz. 6. EH series MPU has two groups of A/B phase pulse output, CH0 (Y0, Y1) and CH1 (Y2, Y3). EH2/SV series MPU has four groups of A/B phase pulse output, CH0 (Y0, Y1), CH1 (Y2, Y3), CH2 (Y4, Y5) and CH3 (Y6, Y7). See remarks for the setup methods. 7. Pulse output device D1 in different models Model Pulse output end 8. SC MPU Y10, Y11 EH MPU Y0, Y2 EH2/SV MPU Y0, Y2, Y4, Y6 S2: Pulse output frequency D1: Pulse output device (please
The operation of D2 corresponds to the + or - of S1. When S1 is +, D2 will be On; when S1 is -, D2 will be Off. D2 will not be Off immediately after the pulse output is over; it will be Off only when the drive contact of the instruction turns Off.
9.
For EH/EH2/SV series MPU, S1 is - The 32-bit data stored in the present value registers D1337 (high word) and D1336 (low word) of CH0 (Y0, Y1). - The 32-bit data stored in the present value registers D1339 (high word) and D1338 (low word) of CH1 (Y2, Y3). - The 32-bit data stored in the present value registers D1376 (high word) and D1375 (low word) of CH2 (Y4, Y5). - The 32-bit data stored in the present value registers D1378 (high word) and D1377 (low word) of CH3 (Y5,
9-33
Remarks: 1. Explanations on EH/EH2/SV series MPU: a) Relative position control: Designating the traveling distance starting from the current position by +/ - signs; also known as a relative driving method.
9-34
0 Current position
F0 the first acceleration The last deceleration segment segment (D1340) Min: 10Hz
-3,000
Acceleration slope Output pulse frequency First acceleration segment (D1340) Min: 10Hz
Accel/Decel time Accel/Decel time Default: 100ms (D1343)
Current position
Default:100ms (D1343)
2.
Explanations on SC series MPU: a) Relative position control: Designating the traveling distance starting from the current position by +/ - signs; also known as a relative driving method.
+3,000
0 Current position
F0 the first acceleration The last deceleration segment segment Y10 (D1340) Y11 (D1352) Min: 10Hz
-3,000
b) Settings of relative positioning and the acceleration/deceleration speed: D1343 (D1353) is for settings of the time of the first acceleration segment and last deceleration segment of Y10 (Y11). D1340 (D1352) is for settings of start/end frequency of Y10 (Y11).
9-35
Acceleration slope
The first acceleration segment Y10 (D1340) Y11 (D1352) Min: 100Hz
accel/decel time accel/decel time
The last deceleration segment Y10 (D1340) Y11 (D1352) Min: 100Hz
Current position
c) Many DRVI instructions can be compiled synchronously in the program, but only one instruction can be activated whenever the PLC executes the program. For example, if Y10 output has already been activated by an instruction, other instructions that are also used to activate Y10 output will not be excecuted. Therefore, the principle of the instruction activation sequence is first activated, first executed. d) When Y10 is activated by DDRVI instruction, the output function of Y10 will be disabled until DDRVI is OFF. The same rule applies to Y11. e) Once the instruction is activated, all other parameters cannot be modified until the instruction is disabled. f) When the instruction is disabled but the output has not yet completed: M1334 = On indicates that Y10 will stop output immediately. M1334 = Off indicates that Y10 will decelerate according to the deceleration time till it reaches end frequency and stop the pulse output. M1335 corresponds to Y11 output and applies the same rule. 3. Flags for SC series MPU: M1102: M1103: M1334: M1102 = On after Y10 pulse output is completed. M1103 = On after Y11 pulse outout is completed. Y10 pulse output stops immediately without deceleration when the pulse output instruction is disabled. M1335: Y11 pulse output stops immediately without deceleration when the pulse output instruction is disabled. M1347: M1348: M1524: M1525: 4. For SC (V1.6 and later versions). Auto reset after Y0 output is completed. For SC (V1.6 and later versions). Auto reset after Y1 output is completed. For SC (V1.6 and later versions). Auto reset after Y10 output is completed. For SC (V1.6 and later versions). Auto reset after Y11 output is completed.
Special registers for SC series MPU: D1348: D1349: D1350: D1351: D1340: Low word of the current number of Y10 output pulses. High word of the current number of Y10 output pulses. Low word of the current number of Y11 output pulses. High word of the current number of Y11 output pulses.. Settings of the first start frequency and the last end frequency of Y10 output pulses. DVP-PLC Application Manual
9-36
Flags for EH/EH2/SV series MPU: M1010: For EH/EH2/SV, when M1010 = On, CH0, CH1, CH2 and CH3 will output pulses when END instruction is being executed. M1010 will be Off automatically when the output starts. M1029: M1030: M1036: M1037: M1305: M1306: M1334: For EH/EH2/SV, M1029 = On after CH0 pulse output is completed. For EH/EH2/SV, M1030 = On after CH1 pulse output is completed. For EH2/SV, M1036 = On after CH2 pulse output is completed. For EH2/SV, M1037 = On after CH3 pulse output is completed. For EH/EH2/SV, direction signal of CH0. For EH/EH2/SV, direction signal of CH1. For EH, CH0 pulse output pauses. For EH2/SV, CH0 pulse output stops. M1335: For EH, CH1 pulse output pauses. For EH2/SV, CH1 pulse output stops. M1336: M1337: M1347: M1348: M1520: M1521: M1522: M1523: M1524: M1525: M1534: M1535: M1536: M1537: M1532: M1533: For EH/EH2/SV, CH0 sends out pulses indication. For EH/EH2/SV, CH1 sends out pulses indication. For EH2/SV (V1.4 and later versions). Reset flag for CH0 pulse output. For EH2/SV (V1.4 and later versions). Reset flag for CH1 pulse output. For EH2/SV, CH2 pulse output stops. For EH2/SV, CH3 pulse output stops. For EH2/SV, CH2 sends out pulses indication. For EH2/SV, CH3 sends out pulses indication. For EH2/SV (V1.4 and later versions). Reset flag for CH2 pulse output. For EH2/SV (V1.4 and later versions). Reset flag for CH3 pulse output. For EH2/SV, designated deceleration time of CH0 (should be used with D1348). For EH2/SV, designated deceleration time of CH1 (should be used with D1349). For EH2/SV, designated deceleration time of CH2 (should be used with D1350). For EH2/SV, designated deceleration time of CH3 (should be used with D1351). For EH2/SV, direction signal of CH2. For EH2/SV, direction signal of CH3.
6.
Special registers for EH/EH2/SV series MPU: D1220: For EH/EH2/SV, phase setting of CH0 (Y0, Y1): D1220 determines the phase by the last two bits; other bits are invalid.
1. 2. 3. 4.
K0: Y0 output K1: Y0, Y1 AB-phase output; A ahead of B. K2: Y0, Y1 AB-phase output; B ahead of A. K3: Y1 output
9-37
For EH/EH2/SV, the time difference between the direction signal and pulse output sent by CH0.
D1223:
For EH/EH2/SV, the time difference between the direction signal and pulse output sent by CH1.
D1229:
For EH2/SV, phase setting of CH2 (Y4, Y5): D1229 determines the phase by the last two bits; other bits are invalid. 1. 2. 3. 4. K0: Y4 output K1: Y4, Y5 AB-phase output; A ahead of B. K2: Y4, Y5 AB-phase output; B ahead of A. K3: Y5 output
D1230:
For EH2/SV, phase setting of CH3 (Y6, Y7): D1230 determines the phase by the last two bits; other bits are invalid. 1. K0: Y6 output 2. K1: Y6, Y7 AB-phase output; A ahead of B. 3. K2: Y6, Y7 AB-phase output; B ahead of A. 4. K3: Y7 output For EH/EH2/SV, low word of the current number of output pulses from CH0. For EH/EH2/SV, high word of the current number of output pulses from CH0. For EH/EH2/SV, low word of the current number of output pulses from CH1. For EH/EH2/SV, high word of the current number of output pulses from CH1. For EH/EH2/SV, settings of the first start frequency and the last end frequency of CH0. For EH/EH2/SV, settings of acceleration/deceleration time for CH0 pulse output. For EH/EH2/SV, settings of the first start frequency and the last end frequency of CH1. For EH/EH2/SV, settings of acceleration/deceleration time for CH1 pulse output. For EH2/SV, low word of the current number of output pulses from CH2. For EH2/SV, high word of the current number of output pulses from CH2. For EH2/SV, low word of the current number of output pulses from CH3. For EH2/SV, high word of the current number of output pulses from CH3. For EH2/SV, settings of the first start frequency and the last end frequency of CH2. For EH2/SV, settings of the first start frequency and the last end frequency of CH3. For EH2/SV, deceleration time for CH0 pulse output when M1534 = On. For EH2/SV, deceleration time for CH1 pulse output when M1535 = On. For EH2/SV, deceleration time for CH2 pulse output when M1536 = On. For EH2/SV, deceleration time for CH3 pulse output when M1537 = On.
D1336: D1337: D1338: D1339: D1340: D1343: D1352: D1353: D1375: D1376: D1377: D1378: D1379: D1380: D1348: D1349: D1350: D1351:
9-38
9-39
Type OP
* *
*
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S1: Number of output pulses (absolute designation) (please use transistor output module) Explanations: 1. 2. 3. 4. See remarks for the setting range of S1, S2, D1 and D2. S1 and S2 of SC series MPU only support device K, H and D. Flag: see remarks of API 158 DRVI for more details. S1 is the number of output pulses (absolute designation). For EH/EH2/SV series MPU, the 16-bit instruction can designate the range -32,768 ~ +32,767. The range designated by 32-bit instruction is -2,147,483,648 ~ +2,147,483,647. For SC series MPU, the 32-bit instruction can designate the range -2,147,483,648 ~ +2,147,483,647. +/- signs indicate forward/backward directions. 5. S2 is the designated pulse output frequency. For EH/EH2/SV series MPU, the 16-bit instruction can designate its range 10 ~ 32,767Hz. The range designated by 32-bit instruction is 10 ~ 200,000Hz. For SC series MPU, the 32-bit instruction can designate the range 100 ~ 100,000Hz. 6. EH series MPU has two groups of A/B phase pulse output, CH0 (Y0, Y1) and CH1 (Y2, Y3). EH2/SV series MPU has four groups of A/B phase pulse output, CH0 (Y0, Y1), CH1 (Y2, Y3), CH2 (Y4, Y5) and CH3 (Y6, Y7). See remarks for the setup methods. 7. Pulse output device D1 in different models Model Pulse output end 8. SC MPU Y10, Y11 EH MPU Y0, Y2 EH2/SV MPU Y0, Y2, Y4, Y6 S2: Pulse output frequency D1: Pulse output device
When S1 is larger than the current relative position, D2 will be Off; when S1 is smaller than the current relative position, D2 will be On. D2 will not be Off immediately after the pulse output is over; it will be Off only when the drive contact of the instruction turns Off.
9.
For EH/EH2/SV series MPU, S1 is - The 32-bit data stored in the present value registers D1337 (high word) and D1336 (low word) of CH0 (Y0, Y1). - The 32-bit data stored in the present value registers D1339 (high word) and D1338 (low word) of CH1 (Y2, Y3). - The 32-bit data stored in the present value registers D1376 (high word) and D1375 (low word) of CH2 (Y4, Y5). - The 32-bit data stored in the present value registers D1378 (high word) and D1377 (low word) of CH3 (Y5,
9-40
Remarks: 1. Explanations on EH/EH2/SV series MPU: a) Absolute position control: Designating the traveling distance starting from the zero point (0); also known as a absolute driving method.
9-41
F0 the first acceleration segment The last deceleration segment (D1340) Min: 10Hz
Target position
Zero point 0
Acceleration slope
Current position
2.
Explanations on SC series MPU: a) Absolute position control: Designating the traveling distance starting from the zero point (0); also known as a absolute driving method.
+3,000
F0 the first acceleration The last deceleration segment segment Y10 (D1340) Y11 (D1352) Min: 10Hz
Zero point
-3,000
b) Settings of absolute positioning and the acceleration/deceleration speed: D1343 (D1353) is for settings of the time of the first acceleration segment and last deceleration segment of Y10 (Y11). D1340 (D1352) is for settings of start/end frequency of Y10 (Y11).
9-42
Acceleration slope
Current position
c) Many DRVA instructions can be compiled synchronously in the program, but only one instruction can be activated whenever the PLC executes the program. For example, if Y10 output has already been activated by an instruction, other instructions that are also used to activate Y10 output will not be excecuted. Therefore, the principle of the instruction activation sequence is first activated, first executed. d) When Y10 is activated by DDRVA instruction, the output function of Y10 will be disabled until DDRVAis OFF. The same rule applies to Y11. e) Once the instruction is activated, all other parameters cannot be modified until the instruction is disabled. f) When the instruction is disabled but the output has not yet completed: M1334 = On indicates that Y10 will stop output immediately. M1334 = Off indicates that Y10 will decelerate according to the deceleration time till it reaches end frequency and stop the pulse output. M1335 corresponds to Y11 output and applies the same rule. 3. 4. See remarks of DDRVI instruction for more details on the flags. Wiring of DVP-EH series and Delta ASDA servo drive:
9-43
COM+ 11 DI 1 DI 5 DI 6 DI 7 DI 8 9 33 32 31 30
COM- 45 CN1
OZ /OZ
50 24 Error counter
CN2
Encoder
DC24V
VDD VDD 17
PU-HI 35 Pulse output Y0 C0 Y1 C1 Forward/backward direction Max. input pulse frequency: 200kPPS PLS 41 COM- 47 SIGN 37
Approx.
DVP32EH00T
Note: (a) The parameter setting of Delta ASDA servo drive: P1-01: position mode P1-00: pulse input type as Pulse+DIR. (b) (c) 5. The forward/reverse limit switch should be connected to SERVO AMP. The clear pulse signal will clear the current number of pulses left inside the servo.
9-44
SC MPU + 16SP
ASDA series R S T DI 1: Servo start DI 5: Servo reset Forward limit Reverse limit DI 8: Emergency stop CN1 VDD 17 24V CN1 7 6 5 4 3 2 1 DO1+ DO1DO2+ DO2DO3+ DO3DO4+ TPOS HOME ZSPD SRDY U V W
3-phase power
Servo motor
220VAC
24VDC DO_COM Start Zero return JOG(+) JOG(-) Start Error reset Forward limit Reverse limit
COM+ 11 DI 1 DI 5 DI 6 DI 7 DI 8 9 33 32 31 30
COM- 45 CN1
OZ /OZ
50 24 Error counter
CN2
Encoder
COM- 45
DC24V
VDD 17 PU-HI 35 Pulse output Y10 C2 Y0 C0 Forward/backward direction PLS 41
Electric gear
COM- 47 SIGN 37
DVP12SC11T+DVP16SP11T
Note: (a) The parameter setting of Delta ASDA servo drive: P1-01: position mode P1-00: pulse input type as Pulse+DIR. (b) The forward/reverse limit switch should be connected to SERVO AMP.
9-45
U V W
COM 13 ABS bit 0 ABS bit 1 ABS transmission D01 ZSP TLC ALM RES LSP LSN 4 19 6 18 14 16 17
SON SG ABSR
CN2
Encoder
ABSM 8
Positioning completed Preparation completed Z-phase signal (zero point) Read ABS ready Enter ABS mode
CN1A INP RD OP LG
Y6 Y7 C4
SG
20
Y4 C2
Y0 C0 Y1 C1
DVP32EH00T
Note: (a) When detecting an absolute position by using DABSR instruction, the parameter setting of a Mitsubishi MR-J2-A servo drive that connects to Delta EH series PLC: P0: position mode. P1: using absolute value. P21: pulse input type as Pulse+DIR. (b) The forward/reverse limit switch should be connected to SERVO AMP. (c) When using OP (Z-phase signal) in servo and given that the Z-phase signal is a high-frequency one when the motor is running at high speed, the valid detection can only be possible when the signal is within the range detectable by PLC. When using OP (Z phase signal) of the servo, if Z phase signal is a high frequency signal during high-speed motor operation, the high frequency signal shall be within the available range that can be detected by PLC.
9-46
9.
Follow the above output settings of PLC for the pulse input parameters of SERVO AMP or stepping motor.
10. For EH/EH2/SV series MPU, when Y0 output adopts many high-speed pulse output instructions (PLSY, PWM, PLSR) and position control instructions (ZRN, PLSV, DRVI, DRVA) in a program and these instructions are executed synchronously in the same scan period, PLC will execute the instruction with the fewest step numbers. Programming example for forward/reverse operation: For the wiring, see the wiring drawing of DVP-EH series and Mitsubishi MR-J2-A servo drive One operation mode performs positioning by absolute position:
9-47
M1000 M1002 1
M1346 With clear signal output valid zero return MOV SET SET K200 S0 Y5 SERVO On control D1343 Settings of accel/decel time 200ms--D1343
1. If the accel./decel. time (D1343) of CH1 can be default setting, (100ms) this program step can be ignored.
9-48
M10 M12 M13 S20 M12 M13 S21 M12 M13 S22 M12 M13 S23 M12 M13 S24
Reset zero point return completed flag Reset forward positioning completed flag Reset backward positioning completed flag Drive zero return (S20) Reset forward positioning completed flag Reset backward positioning completed flag Drive JOG(+) (S21) Reset forward positioning completed flag Reset backward positioning completed flag Drive JOG(-) (S22) Reset forward positioning completed flag Reset backward positioning completed flag Drive forward positioning(S23) Reset forward positioning completed flag Reset backward positioning completed flag Drive forward positioning(S24)
RST SET
RST SET
2. The max. traveling distance of a JOG operation equals to the max. number of output pulses
(-2,147,483,648 ~ +2,147,483,647) of API 158 DDRVI instruction. Please re-execute JOG of the traveling distance exceeds the range.
9-49
DZRN
K50000
Zero return speed
K5000
Creep speed
X14
DOG
Y0
Pulse output device
M1029
Execution completed
M1336
M1000 M0 S21 S
JOG(+)
Time-out 1 scan period Y0 Y1 Use relative positioning instruction to execute a JOG operation (when Y1=On) in the (+) direction.
M1336
M1 S0
Number of Output pulse Pulse output Output point for output pulses frequency device reverse signals (in + direction)
Time-out 1 scan period Y0 Y1 Use relative positioning instruction to execute a JOG operation (when Y1=On) in the ( - ) direction.
M1336 M2 S0
Y0 output being executed
Number of Output pulse Pulse output Output point for output pulses frequency device reverse signals (in + direction)
S23 S
Forward positioning
Y0
Y1
M1029 M3 SET
Execution completed
M12
M1336 M3 S0
Y0 output being executed
M1000 M3 S24 S
Backward positioning
DDRVA
K100000
Output pulse frequency
Y0
Y1
M1029 M4 SET
Execution completed
M13
M1336 M3 S0 M1000 M3 RET END Time-out 1 scan period Backward positioning is completed
9-50
13. Flags and special registers for EH/EH2/SV series MPU: M1347: M1348: M1524: M1525: For EH2/SV (V1.4 and later versions). Reset flag for CH0 pulse output. For EH2/SV (V1.4 and later versions). Reset flag for CH1 pulse output. For EH2/SV (V1.4 and later versions). Reset flag for CH2 pulse output. For EH2/SV (V1.4 and later versions). Reset flag for CH3 pulse output.
9-51
Type OP
*
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S1: Hour for comparison RTC S2: Minute for comparison S3: Second for comparison S: Current time of
D: Comparison result
Explanations: 1. 2. 3. 4. Range of S1: K0 ~ K23; range of S2 and S3: K0 ~ K59 S will occupy 3 consecutive devices; D will occupy 3 consecutive points. See the specifications of each model for their range of use. S1, S2 and S3 are compared with the present values of hour, minute and second starting from S. The comparison result is stored in D. 5. S is the hour of the current time (K0 ~ K23) in RTC; S + 1 is the minute (K0 ~ K59) and S + 2 is the second (K0 ~ K59). 6. S is read by TRD instruction and the comparison is started by TCMP instruction. If S exceeds the range, the program will regard this as an operation error and the instruction will not be executed, M1067 and M1068 = On and D1067 will record the error code 0E1A (hex). Program Example: 1. When X10= On, the instruction will compare the current time in RTC (D20 ~ D22) with the set value 12:20:45 and display the result in M10 ~ M12. When X10 goes from On to Off, the instruction will not be executed, but the On/Off stauts prior to M10 ~ M12 will remain. 2. Connect M10 ~ M12 in series or in parallel to obtain the result of , , and .
X10 TCMP M10 ON when 12:20:45 M11 ON when 12:20:45 M12 ON when 12:20:45 < = > K12 K20 K45 D20 M10
9-52
Type OP
*
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S1: Lower bound of the time for comparison RTC D: Comparison result S2: Upper bound of the time for comparison S: Current time of
Explanations: 1. 2. 3. 4. 5. 6. 7. 8. 9. S1, S2, and S will occupy 3 consecutive devices. The content in S1 must be less than the content in S2. D will occupy 3 consecutive points. See the specifications of each model for their range of use. S is compared with S1 and S2. The comparsion result is stored in D. S1 , S1 +1, S1 +2: The hour, minute and second of the lower bound of the time for comparison. S2, S2 +1, S2 +2: The hour, minute and secondond of the upper bound of the time for comparison. S , S +1, S +2: The hour, minute and second of the current time of RTC. D0 designated by S is read by TRD instruction and the comparison is started by TZCP instruction. If S1, S2, and S exceed their ranges, the program will regard this as an operation error and the instruction will not be executed, M1067 and M1068 = On and D1067 will record the error code 0E1A (hex). 10. When S < S1 and S < S2, D will be On. When S > S1 and S > S2, D + 2 will be On. In other occasions, D + 1 will be On. Program Example: When X10= On, TZCP instruction will be executed and one of M10 ~ M12 will be On. When X10 = Off, TZCP instruction will not be executed and the status of M10 ~ M12 prior to X10 = Off will remain unchanged.
X10 TZCP M10 ON when M11 ON when M12 ON when D0 D20 D10 M10
9-53
Bit Devices Y M
Operands: S1: Time summand Explanations: 1. 2. 3. 4. S1, S2, and D will occupy 3 consecutive devices. See the specifications of each model for their range of use. Flags: M1020 (zero flag); M1022 (carry flag) S1 + S2 = D. The hour, minute, and second of the RTC designated in S1 plus the hour, minute, and second designated in S2. The result is stored in the hour, minute, and second of the register designated in D. 5. If S1 and S2 exceed their ranges, the program will regard this as an operation error and the instruction will not be executed. M1067 and M1068 will be On and D1067 record the error code 0E1A (hex). 6. If the sum is larger than 24 hours, the carry flag M1022 will be On and the value in D will be the result of sum minuses 24 hours. 7. If the sum equals 0 (00:00:00), the zero flag M1020 will be On. S2: Time addend D: Time sum
Program Example: 1. When X10= On, TADD instruction will be executed and the hour, minute and second in RTC designated in D0 ~ D2 will plus the hour, minute and second in RTC designated in D10 ~ D12. The sum is stored in the hour, minute and second of the register designated in D20 ~ D22.
X10 TADD
8 10 20
D0
6 40 6
D10
D20
14 50 26
08:10:20
06:40:06
14:50:26
2.
D0
11 30 8
D10
D20
6 10 38
18:40:30
11:30:08
06:10:38
9-54
Bit Devices Y M
Operands: S1: Time minuend Explanations: 1. 2. 3. 4. S1, S2, and D will occupy 3 consecutive devices. See the specifications of each model for their range of use. Flags: M1020 (zero flag); M1021 (borrow flag) S1 S2 = D. The hour, minute, and second of the RTC designated in S1 minus the hour, minute, and second designated in S2. The result is stored in the hour, minute, and second of the register designated in D. 5. If S1 and S2 exceed their ranges, the program will regard this as an operation error and the instruction will not be executed. M1067 and M1068 will be On and D1067 record the error code 0E1A (hex). 6. If the remainder is a negative value, the borrow flag M1021 will be On. The value in D will be the result of the negative value pluses 24 hours. 7. If the remainder equals 0 (00:00:00), the zero flag M1020 will be On. S2: Time subtrahend D: Time remainder
Program Example: 1. When X10= On, TADD instruction will be executed and the hour, minute and second in RTC designated in D0 ~ D2 will minus the hour, minute and second in RTC designated in D10 ~ D12. The remainder is stored in the hour, minute and second of the register designated in D20 ~ D22.
X10 TSUB
20 20 5
D0
14 30 8
D10
5 49 57
D20
20:20:05
14:30:08
05:49:57
2.
D0
19 11 15
D10
10 9 15
D20
05:20:30
19:11:15
10:09:15
9-55
Bit Devices Y M
Operands: D: The device for storing the current time read in RTC Explanations: 1. 2. 3. 4. D will occupy 7 consecutive devices. See the specifications of each model for their range of use. Flags: M1016, M1017, M1076. See remarks for more details. The built-in RTC in EH/EH2/SV/SA/SX/SC series MPU offers 7 data (year, week, month, day, hour, minute, second) stored in D1319 ~ D1313. TRD instruction is for program designers to read the current data in RTC and store the data to the 7 registers designated. 5. D1319 only reads the 2-digit year in A.D. If you wish D1319 to read the 4-digit year, see remarks for more information. Program Example: 1. 2. When X0 = On, the instruction will read the current time in RTC to the designated registers D0 ~ D6. The content of D1318: 1 = Monday; 2 = Tuesday 7 = Sunday.
X0
TRD
Item Year (A.D.) Day (Mon ~ Sun) Month Day Hour Minute Second
General D D0 D1 D2 D3 D4 D5 D6
Item Year (A.D.) Day (Mon ~ Sun) Month Date Hour Minute Second
9-56
M1076 Malfunction of RTC D1313 D1314 D1315 D1316 D1317 D1318 D1319 2. Second Minue Hour Day Month Week Year
How to correct RTC: There are 2 ways to correct the built-in RTC. a) b) By a specific instruction. (See API 167 TWR instruction) By peripheral devices, WPLSoft, the ladder diagram editing software.
3.
How to display 4-digit year in A.D.: a) Normally, the year is only displayed in 2 digits (e.g. 2003 displayed as 03). If you wish the year to be displayed in 4 digits, please key in the following program at the start of the program.
M1002 SET M1016 display 4-digit year in A.D.
b) c)
The original 2-digit year will be switched to a 4-digit year, i.e. the 2-digit year will pluses 2,000. If you wish to write in new time in the 4-digit year display mode, you can only write in a 2-digit year (0 ~ 99, indicating year 2000 ~ 2099). For example, 00=year 2000, 50=year 2050 and 99=year 2099.
9-57
Bit Devices Y M
Operands: S: Device for storing the new time to be written into RTC Explanations: 1. 2. 3. 4. S will occupy 7 consecutive devices. See the specifications of each model for their range of use. Flags: M1016, M1017, M1076. See remarks of API 166 TRD for more details. To make adjustment on the RTC built in EH/EH2/SV/SA/SX/SC series MPU, use this instruction to write the correct time into the RTC. 5. When this instruction is executed, the new set time will be written in the RTC built in PLC immediately. Therefore, please be noted that the new set time has to match the current time then when the instruction is executed. 6. If S exceeds its range, the program will regard it as an operation error and the instruction will not be executed. M1067 and M1068 will be On and D1067 will record the error code 0E1A (hex). Program Example 1: When X0= On, write the correct current time into the RTC.
X0
TWRP
General D D20 D21 New set time D22 D23 D24 D25 D26 Program Example 2: 1. 2. 3.
Item Year (A.D.) Day (Mon ~ Sun) Month Date Hour Minute Second
Item Year (A.D.) Day (Mon ~ Sun) Month Date Hour Minute Second Real Time Clock
Set the current time in the RTC as 15:27:30, Tuesday, August 19, 2003. D0 ~ D6 indicate the new set time in the RTC. X10 = On for changing the current time in the RTC and make the changed value the new set value.
9-58
9-59
Type OP
*
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S: Period of time when D2 is On (in hour) Explanations: 1. 2. 3. 4. 5. If S is used in device F, only 16-bit instruction is applicable. D1 will occupy 2 consecutive points. D1 + 1 uses 16-bit register in 16-bit or 32-bit instruction. See the specifications of each model for their range of use. HOUR instruction can be used 4 times of SA/SX/SC. Range of S: K1 ~ K32,767 (unit: hour); range of D1: K0 ~ K32,767 (unit: hour). D1 + 1 refers to the current time that is less than an hour (range: K0 ~K3,599; unit: second). 6. This instruction times the time and when the time reaches the set time (in hour), D2 will be On. This function allows the user to time the operation of the machine or conduct maintenance works. 7. 8. After D2 is On, the timer will resume the timing. In the 16-bit instruction, when the current time measured reaches the maximum 32,767 hours/3,599 seconds, the timing will stop. To restart the timing, D1 and D1 + 1 have to be reset to 0. 9. In the 32-bit instruction, when the current time measured reaches the maximum 2,147,483,647 hours/3,599 seconds, the timing will stop. To restart the timing, D1 ~ D1 + 2 have to be reset to 0. 10. There is no limitations on the times of using this instruction in the program for EH series MPU; however, only 4 instructions can be executed at the same time. Program Example 1: In 16-bit instruction, when X0 = On, Y10 will be On and the timing will start. When the timing reaches 100 hours, Y0 will be On and D0 will record the current time measured (in hour) and D1 will record the current time that is less than an hour (0 ~ 3,599; unit: second).
X0 Y10 Y10 HOUR K100 D0 Y0
9-60
9-61
Type OP S D X
Bit Devices Y M
Operands: S: Source device for BIN value Explanations: 1. 2. 3. 4. If S and D are used in device F, only 16-bit instruction is applicable. See the specifications of each model for their range of use. This instruction converts the BIN value in the device designated in S into Gray code and stores the value in D. See the ranges of S as indicated below. If S exceeds the ranges, the program will regard it as an operation error and the instruction will not be executed. M1067 and M1068 will be On and D1067 will record the error code 0E1A (hex). In 16-bit instruction: 0 ~ 32,767 In 32-bit instruction: 0 ~ 2,147,483,647 Program Example: When X0 = On, the instruction will convert constant K6,513 into Gray code and store the result in K4Y20.
X0 GRY K6513 K4Y20
b15
b0
K6513=H1971 0 0 0 1 1 0 0 1 0 1 1 1 0 0 0 1
Y37
Y20
GRAY6513 0 0 0 1 0 1 0 1 1 1 0 0 1 0 0 1 K4Y20
9-62
Type OP S D X
Bit Devices Y M S K *
Operands: S: Source device for Gray code Explanations: 1. 2. 3. 4. If S and D are used in device F, only 16-bit instruction is applicable. See the specifications of each model for their range of use. This instruction converts the Gray code in the device designated in S into BIN value and stores the value in D. This instruction converts the content (in Gray code) in the absolute position encoder connected at the PLC input terminal into BIN value and store the result in the designated register. 5. See the ranges of S as indicated below. If S exceeds the ranges, the program will regard it as an operation error and the instruction will not be executed. M1067 and M1068 will be On and D1067 will record the error code 0E1A (hex). In 16-bit instruction: 0 ~ 32,767 In 32-bit instruction: 0 ~ 2,147,483,647 Program Example: When X20 = On, the Gray code in the absolute position encoder connected at X0 ~ X17 will be converted into BIN value and stored in D10.
X20 GBIN K4X0 D10
X17
K4X0
X0
GRAY6513 0 0 0 1 0 1 0 1 1 1 0 0 1 0 0 1
b15
b0
H1971=K6513 0 0 0 1 1 0 0 1 0 1 1 1 0 0 0 1
9-63
Type OP S1 S2 D X
Bit Devices Y M
Operands: S1: Floating point summand Explanations: 1. S1 and S2 can be floating point values (FX.XX). 2. See the specifications of each model for their range of use. 3. Flags: M1020 (zero flag), M1021 (borrow flag), M1022 (carry flag) 4. In DADDR instruction, floating point values (e.g. F1.2) can be entered directly into S1 and S2 or stored in register D for operation. When the instruction is being executed, operand D will store the operation result. 5. When S1 and S2 stores the floating point values in register D, their functions are the same as API 120 EADD. 6. S1 and S2 can designate the same register. In this case, if the continuous execution type instruction is in use and during the On period of the drive contact, the register will be added once in every scan by a pulse execution type instruction (DADDRP). 7. If the absolute value of the operation result is larger than the maximum floating point displayable, the carry flag M1022 will be On. 8. If the absolute value of the operation result is smaller than the minimum floating point displayable, the borrow flag M1021 will be On. 9. If the operation result is 0, the zero flag M1020 will be On. Program Example 1: When X0 = On, the floating point F1.20000004768372 will plus F2.20000004768372 and the result F3.40000009536743 will be stored in the data registers (D10, D11).
X0 DADDR F1.20000004768372 F2.20000004768372 D10
D: Sum
Program Example 2: When X0 = On, the floating point value (D1, D0) + floating point value (D3, D2) and the result will be stored in the registers designated in (D11, D10).
X0 DADDR D0 D2 D10
Remarks: The functions of this instruction are in V6.6 of ES/EX/SS series, V1.6 of SA/SX series and V1.4 of SC series. DADDR instruction supports EH2/SV series, but not EH series. 9-64 DVP-PLC Application Manual
Type OP S1 S2 D X
Bit Devices Y M
Operands: S1: Floating point minuend Explanations: 1. S1 and S2 can be floating point values (FX.XX). 2. See the specifications of each model for their range of use. 3. Flags: M1020 (zero flag), M1021 (borrow flag), M1022 (carry flag) 4. In DSUBR instruction, floating point values (e.g. F1.2) can be entered directly into S1 and S2 or stored in register D for operation. When the instruction is being executed, operand D will store the operation result. 5. When S1 and S2 stores the floating point values in register D, their functions are the same as API 121 ESUB. 6. S1 and S2 can designate the same register. In this case, if the continuous execution type instruction is in use and during the On period of the drive contact, the register will be subtracted once in every scan by a pulse execution type instruction (DSUBRP). 7. If the absolute value of the operation result is larger than the maximum floating point displayable, the carry flag M1022 will be On. 8. If the absolute value of the operation result is smaller than the minimum floating point displayable, the borrow flag M1021 will be On. 9. If the operation result is 0, the zero flag M1020 will be On. Program Example 1: When X0 = On, the floating point F1.20000004768372 will minus F2.20000004768372 and the result F-1 will be stored in the data registers (D10, D11).
X0 DSUBR F1.20000004768372 F2.20000004768372 D10
D: Remainder
Program Example 2: When X0 = On, the floating point value (D1, D0) floating point value (D3, D2) and the result will be stored in the registers designated in (D11, D10).
X0 DSUBR D0 D2 D10
Remarks: The functions of this instruction are in V6.6 of ES/EX/SS series, V1.6 of SA/SX series and V1.4 of SC series. DADDR instruction supports EH2/SV series, but not EH series. DVP-PLC Application Manual 9-65
Type OP S1 S2 D X
Bit Devices Y M
Operands: S1: Floating point multiplicand Explanations: 1. S1 and S2 can be floating point values (FX.XX). 2. See the specifications of each model for their range of use. 3. Flags: M1020 (zero flag), M1021 (borrow flag), M1022 (carry flag) 4. In DMULR instruction, floating point values (e.g. F1.2) can be entered directly into S1 and S2 or stored in register D for operation. When the instruction is being executed, operand D will store the operation result. 5. When S1 and S2 stores the floating point values in register D, their functions are the same as API 122 EMUL. 6. S1 and S2 can designate the same register. In this case, if the continuous execution type instruction is in use and during the On period of the drive contact, the register will be multiplied once in every scan by a pulse execution type instruction (DMULRP). 10. If the absolute value of the operation result is larger than the maximum floating point displayable, the carry flag M1022 will be On. 11. If the absolute value of the operation result is smaller than the minimum floating point displayable, the borrow flag M1021 will be On. 12. If the operation result is 0, the zero flag M1020 will be On. Program Example 1: When X0 = On, the floating point F1.20000004768372 will multiply F2.20000004768372 and the result F2.64000010490417 will be stored in the data registers (D10, D11).
X0 DMULR F1.20000004768372 F2.20000004768372 D10
D: Product
Program Example 2: When X1 = On, the floating point value (D1, D0) floating point value (D11, D10) and the result will be stored in the registers designated in (D21, D20).
X1 D0 D10 D20
Remarks: The functions of this instruction are in V6.6 of ES/EX/SS series, V1.6 of SA/SX series and V1.4 of SC series. DADDR instruction supports EH2/SV series, but not EH series. 9-66 DVP-PLC Application Manual
Type OP S1 S2 D X
Bit Devices Y M
Operands: S1: Floating point dividend Explanations: 1. S1 and S2 can be floating point values. 2. See the specifications of each model for their range of use. 3. Flags: M1020 (zero flag), M1021 (borrow flag), M1022 (carry flag) 4. In DDIVR instruction, floating point values (e.g. F1.2) can be entered directly into S1 and S2 or stored in register D for operation. When the instruction is being executed, operand D will store the operation result. 5. When S1 and S2 stores the floating point values in register D, their functions are the same as API 123 EDIV. 6. If S2 is 0, the program will regard it as an operation error and the instruction will not be executed. M1067 and M1068 will be On and D1067 will record the error code H0E19. 7. If the absolute value of the operation result is larger than the maximum floating point displayable, the carry flag M1022 will be On. 8. If the absolute value of the operation result is smaller than the minimum floating point displayable, the borrow flag M1021 will be On. 9. If the operation result is 0, the zero flag M1020 will be On. Program Example 1: When X0 = On, the floating point F1.20000004768372 will be divided by F2.20000004768372 and the result F0.545454561710358 will be stored in the data registers (D10, D11).
X0 DDIVR F1.20000004768372 F2.20000004768372 D10
D: Quotient
Program Example 2: When X1 = On, the floating point value (D1, D0) floating point value (D11, D10) and the quotient will be stored in the registers designated in (D21, D20).
X1 DDIVR D0 D10 D20
Remarks: The functions of this instruction are in V6.6 of ES/EX/SS series, V1.6 of SA/SX series and V1.4 of SC series. DADDR instruction supports EH2/SV series, but not EH series. DVP-PLC Application Manual 9-67
Bit Devices Y M
Operands: S: Data source (16-bit) Explanations: 1. MMOV instruction sends the data in the 16-bit S device to the 32-bit D device. The designated sign bit will be copied and stored in the destination device. Program Example 1: When X23 = On, the data in D4 will be sent to D6 and D7. D: Data destination (32-bit)
X23 MMOV D4 D6
0 1
"" ""
b15
b0
1 0 0 1 1 0 0 1 0 1 1 1 0 0 0 1 D4
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 0 0 1 0 1 1 1 0 0 0 1 D7, D6
b31 b16 b15 b0
In the example, b15 of D4 is sent to b15 ~ b31 of (D7, D6) as a negative value (same as it is in D4).
9-68
Bit Devices Y M
Operands: S1: Matrix source device 1 Explanations: 1. 2. 3. 4. 5. Range of n: K1 ~ K256 S1, and S2 designate KnX, KnY, KnM and KnS; D designates KnYm KnM and KnS SA/SX/SC can designate n = 4. EH/EH2/SV can designate n 4. See the specifications of each model for their range of use. The two matrix sources S1 and S2 perform matrix AND operation according to the array length n. The result is stored in D. 6. Operation rule of matix AND : The result will be 1 if both two bits are 1; otherwise the result will be 0. S2: Matrix source device 2 D: Operation result n: Array length
Program Example: When X0 = On, the 3 arrays of 16-bit registers D0 ~ D2 and the 3 arrays of 16-bit registers D10 ~ D12 will perform a matrix AND operation. The result will be stored in the 3 arrays of 16-bitd registers D20 ~ D22.
X0 MAND D0 D10 D20 K3
b15
b0
1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1
Before execution
MAND
0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
After execution
0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0
Remarks: 1. Explanations on the matrix instruction: a) A matix consists of more than 1 consecutive 16-bit registers. The number of registers in the matrix is the
9-69
D0 D1 D2
Length: n
0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 Dn-1
b16n-1 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
f)
g) Pr: matrix pointer. E.g. if Pr is 15, the designated point will be b15. h) Array length (R) is n: n = 1 ~ 256. Example: The matrix is composed of D0, n = 3; D0 = HAAAA, D1 = H5555, D2 = HAAFF R0 R1 R2 C15 1 0 1 C14 0 1 0 C13 1 0 1 C12 0 1 0 C11 1 0 1 C10 0 1 0 C9 C8 C7 C6 C5 C4 C3 C2 C1 C0 1 0 1 0 1 0 1 0 1 0 D0 0 1 0 1 0 1 0 1 0 1 D1 1 0 1 1 1 1 1 1 1 1 D2
Example: The matrix is composed of K2X0, n = 3; K2X0 = H37, K2X10 = H68, K2X20 = H45 R0 R1 R2 C15 0 0 0 C14 0 0 0 C13 0 0 0 C12 0 0 0 C11 0 0 0 C10 0 0 0 C9 C8 C7 C6 C5 C4 C3 C2 C1 C0 0 0 0 0 1 1 0 1 1 1 0 0 0 1 1 0 1 0 0 0 0 0 0 1 0 0 0 1 0 1 X0~X7 X10~X17 X20~X27
9-70
Bit Devices Y M
Operands: S1: Matrix source device 1 Explanations: 1. 2. 3. 4. 5. Range of n: K1 ~ K256 S1, and S2 designate KnX, KnY, KnM and KnS; D designates KnYm KnM and KnS SA/SX/SC can designate n = 4. EH/EH2/SV can designate n 4. See the specifications of each model for their range of use. The two matrix sources S1 and S2 perform matrix OR operation according to the array length n. The result is stored in D. 6. Operation rule of matrix OR: The result will be 1 if either of the two bits is 1. The result is 0 only when both two bits are 0. Program Example: When X0 = On, the 3 arrays of 16-bit registers D0 ~ D2 and the 3 arrays of 16-bit registers D10 ~ D12 will perform a matrix OR operation. The result will be stored in the 3 arrays of 16-bit registers D20 ~ D22.
X0 MOR D0 D10 D20 K3
D: Operation result
n: Array length
b15
b0
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
Before Execution
MOR
0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1 0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1 0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1
After Execution
0 1 0 1 1 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 0 1 0 1
9-71
Bit Devices Y M
Operands: S1: Matrix source device 1 Explanations: 1. 2. 3. 4. 5. Range of n: K1 ~ K256 S1, and S2 designate KnX, KnY, KnM and KnS; D designates KnYm KnM and KnS SA/SX/SC can designate n = 4. EH/EH2/SV can designate n 4. See the specifications of each model for their range of use. The two matrix sources S1 and S2 perform matrix XOR operation according to the array length n. The result is stored in D. 6. Operation rule of matrix XOR: The result will be 1 if the two bits are different. The result will be 0 if the two bits are the same. Program Example: When X0 = On, the 3 arrays of 16-bit registers D0 ~ D2 and the 3 arrays of 16-bit registers D10 ~ D12 will perform a matrix XOR operation. The result will be stored in the 3 arrays of 16-bit registers D20 ~ D22.
X0 MXOR D0 D10 D20 K3
D: Operation result
n: Array length
b15
b0
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
Before Execution
MXOR MOR
0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1 0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1 0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1
After Execution
0 1 0 1 1 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 0 1 0 1
9-72
Bit Devices Y M
Operands: S1: Matrix source device 1 Explanations: 1. 2. 3. 4. 5. Range of n: K1 ~ K256 S1, and S2 designate KnX, KnY, KnM and KnS; D designates KnYm KnM and KnS SA/SX/SC can designate n = 4. EH/EH2/SV can designate n 4. See the specifications of each model for their range of use. The two matrix sources S1 and S2 perform matrix XNR operation according to the array length n. The result is stored in D. 6. Operation rule of matrix XNR: The result will be 1 if the two bits are the same. The result will be 0 if the two bits are different. Program Example: When X0 = On, the 3 arrays of 16-bit registers D0 ~ D2 and the 3 arrays of 16-bit registers D10 ~ D12 will perform a matrix XNR operation. The result will be stored in the 3 arrays of 16-bit registers D20 ~ D22.
X0 MXNR D0 D10 D20 K3
D: Operation result
n: Array length
b15
b0
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
Before Execution
MXNR
0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1 0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1 0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1
After Execution
1 0 1 0 0 1 0 1 0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1 0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1 0 0 0 0 1 1 1 1
9-73
Bit Devices Y M
Operands: S: Matrix source device Explanations: 1. 2. 3. 4. 5. Range of n: K1 ~ K256 S designates KnX, KnY, KnM and KnS; D designates KnY, KnM and KnS. SA/SX/SC can designate n = 4. EH/EH2/SV can designate n 4. See the specifications of each model for their range of use. S performs an inverse matrix operation according to the array length n. The result is stored in D. D: Operation result n: Array length
Program Example: When X0 = On, the 3 arrays of 16-bit registers D0 ~ D2 perform a matrix inverse operation. The result will be stored in the 3 arrays of 16-bit registers D20 ~ D22.
X0 MINV D0 D20 K3
b0
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
MINV
After Execution
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
9-74
Bit Devices Y M
Operands: S1: Matrix source device 1 S2: Matrix source device 2 n: Array length
D: Pointer (Pr), for storing the value of target location Explanations: 1. 2. 3. 4. 5. 6. Range of n: K1 ~ K256 S1, and S2 designate KnX, KnY, KnM and KnS; D designates KnY, KnM and KnS. SA/SX/SC can designate n = 4. EH/EH2/SV can designate n 4. See the specifications of each model for their range of use. Flags: M1088 ~ M1092. See remarks for more details. This instruction compares every bit in S1 with every bit in S2 starting from location D + 1 and finds out the location of different bits. The location will be stored in D. 7. The matrix comparison flag (M1088) decides to compare between equivalent values (M1088 = 1) or different values (M1088 = 0). When the comparison is completed, it will stop immediately and the matrix bit search flag will turn On (M1091 = 1). When the comparison progresses to the last bit, the matrix search end flag (M1089) will turn On and the No. where the comparison is completed is stored in D. The comparison will start from the 0th bit in the next scan period when the matrix search start flag turns On (M1090 = 1). When D exceeds the range, the pointer error flag will turn On (M1092 = 1). 8. The matrix operation will need a 16-bit register to designate a point among the 16n points in the matrix for the operation. The register is the Pointer (Pr) of the matrix, designated by the user in the instruction. The vaild range of Pr is 0 ~ 16n -1, corresponding to b0 ~ b16n-1 in the matrix. Please avoid changing the Pr value during the operation in case the comparing and searching will not ne correct. If the Pr value exceeds its range, M1092 will be On and the instruction will not be executed. 9. When M1089 and M1091 take place at the same time, both flags will be 1 at the same time.
Program Example: 1. When X0 goes from Off to On, the matrix search start falg M1090 = 0. The searching will start from the bit marked with * (current Pr value +1) for bits of different status (M1088 = 0). 2. Set the Pr value D20 = 2. When X0 goes from Off to On for 4 times, we can obtain the 4 execution results , . , ,
D20 = 5, M1091 = 1, M1089 = 0. D20 = 45, M1091 = 1, M1089 = 0. DVP-PLC Application Manual 9-75
2 b0
0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
D20 pointer
b47 MCMP b0
0 1 0 1 0 1 0 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1
b47
Remarks: Flags explanations: Flags M1088 M1089 M1090 M1091 M1092 Function Matrix comparison flag. Comparing between equivalent values (M1088 = 1) or different values (M1088 = 0). Matrix search end flag. When the comparison reaches the last bit, M1089 = 1. Matrix search start flag. Comparing from bit 0 (M1090 = 1). Matrix bit search flag. When the comparison is completed, the comparison will stop immediately (M1091=1). Matrix pointer error flag. When the pointer Pr exceeds its range, M1092 = 1.
9-76
Bit Devices Y M
Operands: S: Matrix source device Explanations: 1. 2. 3. 4. 5. 6. Range of n: K1 ~ K256 S designates KnX, KnY, KnM and KnS; D designates KnY, KnM and KnS. SA/SX/SC can designate n = 4. EH/EH2/SV can designate n 4. See the specifications of each model for their range of use. Flags: M1089 ~ M1095. See remarks for more details. When this instruction is executed, it first determines if the matrix pointer clear flag (M1094) is On. If it is On, pointer D is cleared as 0. The instruction then reads the On/Off status from the 0th bit of S to the matrix rotation/displacement/output carry flag (M1095). Whenever finishing reading 1 bit, the instruction determines whether the matrix pointer increasing flag (M1093) is On. If it is On, the value of pointer D will plus 1. When the reading is processed to the last bit, the matrix search end flag (M1089) will turn On and pointer D record the No. of read bits. 7. The Pointer (Pr) of the matrix is designated by the user in the instruction. The vaild range of Pr is 0 ~ 16n -1, corresponding to b0 ~ b16n-1 in the matrix. If the Pr value exceeds its range, M1092 will be On and the instruction will not be executed. Program Example: 1. When X0 goes from Off to On, M1094 will be set to 0 and M1093 to 1. Therefore, the Pr will plus 1 after every reading. 2. Set the Pr value D20 = 45. When X0 goes from Off to On for 3 times, we can obtain the 3 execution results , . , n: Array length D: Pointer (Pr), for storing the value of target location
D20 = 46, M1095 = 0, M1089 = 0. D20 = 47, M1095 = 1, M1089 = 0. D20 = 47, M1095 = 1, M1089 = 1.
X0 MBRDP D0 K3 D20
9-77
0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
b 47
45 D20
Pointer
Remarks: Flag explanations: Flags M1088 M1092 M1093 M1094 M1095 Function Matrix search end flag. When the comparison reaches the last bit, M1089 = 1. Matrix pointer error flag. When the pointer Pr exceeds its range, M1092 = 1. Matrix pointer increasing flag. Adding 1 to the current value of the Pr. Matrix pointer clear flag. Clearing the current value of the Pr to 0. Matrix rotation/displacement/output carry flag.
9-78
Bit Devices Y M
Operands: S: Matrix source device Explanations: 1. 2. 3. 4. 5. 6. Range of n: K1 ~ K256 S designates KnX, KnY, KnM and KnS; D designates KnY, KnM and KnS. SA/SX/SC can designate n = 4. EH/EH2/SV can designate n 4. See the specifications of each model for their range of use. Flags: M1089 ~ M1096. See remarks for more details. When this instruction is executed, if first determines if the matrix pointer clear flag (M1094) is On, If it is On, pointer D is cleared as 0. The instruction then writes the value in the matrix displacement/input complement flag (M1096) into the location starting from the 0th bit of S. Whenever finishing writing 1 bit, the instruction determines whether the matrix pointer increasing flag (M1093) is On. If it is On, the value of pointer D will plus 1. When the writing is processed to the last bit, the matrix search end flag (M1089) will turn On and pointer D records the No. of written bits. If D exceeds its range, M1092 will be On. 7. The Pointer (Pr) of the matrix is designated by the user in the instruction. The vaild range of Pr is 0 ~ 16n -1, corresponding to b0 ~ b16n-1 in the matrix. If the Pr value exceeds its range, M1092 will be On and the instruction will not be executed. Program Example: 1. When X0 goes from Off to On, M1094 will be set to 0 and M1093 to 1. Therefore, the Pr will plus 1 after every writing. 2. Set the Pr value D20 = 45 and M1096 = 1. When X0 goes from Off to On for 1 time, we can obtain the execution results: D20 = 46, M1096 = 1, M1089 = 0.
X0 MBWRP D0 K3 D20
n: Array length
9-79
Before Execution
0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
b47
1 45
After Execution
0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1
b47
46
D20 pointer
Remarks: Flag explanations: Flags M1088 M1092 M1093 M1094 M1096 Function Matrix search end flag. When the comparison reaches the last bit, M1089 = 1. Matrix pointer error flag. When the pointer Pr exceeds its range, M1092 = 1. Matrix pointer increasing flag. Adding 1 to the current value of the Pr. Matrix pointer clear flag. Clearing the current value of the Pr to 0. Matrix displacement/input complement flag.
9-80
Bit Devices Y M
Operands: S: Matrix source device Explanations: 1. 2. 3. 4. 5. 6. Range of n: K1 ~ K256 S designates KnX, KnY, KnM and KnS; D designates KnY, KnM and KnS. SA/SX/SC can designate n = 4. EH/EH2/SV can designate n 4. See the specifications of each model for their range of use. Flags: M1095 ~ M1097. See remarks for more details. This instruction performs left-right displacement on the matrix bits in S according to array length n. M1097 determines the left (M1097 = 0) or right (M1097 = 1) displacement of matrix bits. The empty bits derived from every displacement of 1 bit (when left displacement: b0; when right displacement: b16n-1) is filled by the status of the complement flag (M1096). The spare bits (when left displacement: b16n-1; when right displacement: b0) are sent to the carry flag (M1095). The result is stored in D. 7. The pulse execution instruction MBSP is generally adopted. D: Operation result n: Array length
Program Example 1: When X0 = On, M1097 = Off, indicating a left matrix displacement is performed. Set M1096 = 0 and the 16-bit registers D0 ~ D2 will perform a left matrix displacement and the result will be stored in the matrix of the 16-bit registers D20 ~ D22. The carry flag M1095 will be 1.
X0 RST MBSP M1097 D0 D20 K3
0
b 15 Before execution b0
M1096
Complement flag
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
M1095
Carry flag
MBS
M1097=0
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
M1095
Carry flag
9-81
Before execution
b15
S
b0 M1095
Carry flag
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
1
Complement flage
M1096
MBS
M1097=1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0
Carry flag
M1095
Explanations: Flag explanations: Flags M1095 M1096 M1097 Function Matrix rotation/displacement/output carry flag. Matrix displacement/input complement flag. Matrix rotation/displacement direction flag.
9-82
Bit Devices Y M
Operands: S: Matrix source device Explanations: 1. 2. 3. 4. 5. 6. Range of n: K1 ~ K256 S designates KnX, KnY, KnM and KnS; D designates KnY, KnM and KnS. SA/SX/SC can designate n = 4. EH/EH2/SV can designate n 4. See the specifications of each model for their range of use. Flags: M1095, M1097. See remarks for more details. This instruction performs left-right rotation on the matrix bits in S according to array length n. M1097 determines the left (M1097 = 0) or right (M1097 = 1) rotation of matrix bits. The empty bits derived from every rotation of 1 bit (when left rotation: b0; when right rotation: b16n-1) is filled by rotation bits (when left rotation: b16n-1; when right rotation: b0). The result is stored in D. Rotation bits not only fill the empty bits but also send the status of bits to the carry flag M1095. 7. The pulse execution instruction MBRP is generally adopted. D: Operation result n: Array length
Program Example 1: When X0 = On, M1097 = Off, indicating a left matrix rotation is performed. The 16-bit registers D0 ~ D2 will perform a left matrix rotation and the result will be stored in the matrix of the 16-bit registers D20 ~ D22. The carry flag M1095 will be 1.
X0 RST MBRP M1097 D0 D20 K3
b15
b0
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
9-83
b15
b0
Before Execution
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
M1095
M1095
Remarks: Flag explanations: Flags M1095 M1097 Function Matrix rotation/displacement/output carry flag. Matrix rotation/displacement direction flag.
9-84
Bit Devices Y M
Operands: S: Matrix source device Explanations: 1. 2. 3. 4. 5. 6. 7. Range of n: K1 ~ K256 S designates KnX, KnY, KnM and KnS; D designates KnY, KnM and KnS. SA/SX/SC can designate n = 4. EH/EH2/SV can designate n 4. See the specifications of each model for their range of use. Flags: M1098, M1099. See remarks for more details. This instruction counts the number of bits which are 1 or 0 in S by array length n. The result is stored in D. The instruction counts the number of bits which are 1 when M1098 = 1 and counts the number of bits which are 0 when M1098 = 0. When the operation result is 0, M1099 = 1. Program Example: When X10 = On, in the matrix of D0 ~ D2, when M1098 = 1, the instruction counts the total number of bits which are 1 and store the number in D10. When M1098 = 0, the instruction counts the total number of bits which are 0 and store the number in D10.
X10 MBC D0 K3 D10
n: Array length
D: Counting result
1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1
12 36
M1098=0 M1098=1
Remarks: Flag explanations: Flags M1098 M1099 Function Counting the number of bits which are 1 or 0 On when the counting result is 0.
9-85
Type OP
*
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S1: Number of output pulses of X axis S: Max. point to point output frequency Explanations: 1. 2. Flags: M1029, M1030, M1334, M1335. See remarks for more details. This instruction only supports EH2/SV series MPU, not EH series. In terms of pulse output methods, this instructin only supports pulse + direction mode. 3. S1 and S2 are the designated (relative designation) number of output pulses in X axis (Y0 or Y4) and Y axis (Y2 or Y6). The range of the number is -2,147,483,648 ~ +2,147,483,647 (+/- represents the forward/backward direction). When in forward direction, the pulse present value registers CH0 (D1337 high word, D1336 low word), CH1 (D1339 high word, D1338 low word), CH2 (D1376 high word, D1375 low word) and CH3 (D1378 high word, D1377 low word) will increase. When in backward direction, the present value will decrease. 4. D can designate Y0 and Y4. When Y0 is designated: Y0 refers to 1st group X-axis pulse output device. Y1 refers to 1st group X-axis direction signal. Y2 refers to 1st group Y-axis pulse output device. Y3 refers to 1st group Y-axis direction signal. Y4 refers to 2nd group X-axis pulse output device. Y5 refers to 2nd group X-axis direction signal. Y6 refers to 2nd group Y-axis pulse output device. Y7 refers to 2nd group Y-axis direction signal. When direction signal outputs, Off will not occur immediately after the pulse output is over. Direction signal will turn Off when the drive contact is Off. 5. D1340 (D1379) refers to the settings of the start/end frequencies of the 1st/2nd 2-axis motion. D1343 (D1381) refers to the time of the first acceleration segment and last deceleration segment of the 1st/2nd 2-axis motion. The time shall be longer than 10ms. If the time is shorter than 10ms or longer than 10,000ms, the output will be operated at 10ms. Default setting = 100ms. 6. If the maximum output frequency setting is less than 10Hz, the output will be operated at 10Hz. If the setting is more than 200kHz, the output will be operated at 200kHz. 9-86 DVP-PLC Application Manual S2: Number of output pulses of Y axis D: Pulse output device
(0, -5 5000)
2. Steps: a) Set the four coordinates (0,0), (-27000, -27000), (0, -55000), (27000, -27000) (as the figure above). Calculate the relative coordinates of the four points and obtain (-27000, -27000), (27000, -28000), (27000, 27000), and (-27000, 27000). Place them in the 32-bit (D200, D202), (D204, D206), (D208, D210), (D212, D214). b) Write program codes as follows. c) PLC RUN. Set M0 as On and start the 2-axis line drawing.
= D0 K1 = D0 K2 = D0 K3 = D0 K4 M0 RST MOV M0 M1029 INCP END D0 M1029 K1 D0 DPPMR DPPMR DPPMR DPPMR D200 D204 D208 D212 D202 D206 D210 D214 K100000 K100000 K100000 K100000 Y0 Y0 Y0 Y0
3. Motion explanation: When PLC RUN and M0 = On, PLC will start the first point-to-point motion by 100kHz. D0 will plus 1 whenever a point-to-point motion is completed and the second point-to-point motion will start to execute automatically. The same motion will keep executing until the fourth point-to-point motion is completed. DVP-PLC Application Manual 9-87
9-88
Type OP
*
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S1: Number of output pulses of X axis S: Max. point to point output frequency Explanations: 1. Flags: M1029, M1030, M1334, M1335. See remarks of API 191 DPPMR for more details. 2. This instruction only supports EH2/SV series MPU, not EH series. In terms of pulse output methods, this instructin only supports pulse + direction mode. 3. S1 and S2 are the designated (absolute designation) number of output pulses in X axis (Y0 or Y4) and Y axis (Y2 or Y6). The range of the number is -2,147,483,648 ~ +2,147,483,647 (+/- represents the forward/backward direction). When in forward direction, the pulse present value registers CH0 (D1337 high word, D1336 low word), CH1 (D1339 high word, D1338 low word), CH2 (D1376 high word, D1375 low word) and CH3 (D1378 high word, D1377 low word) will increase. When in backward direction, the present value will decrease. 4. D can designate Y0 and Y4. When Y0 is designated: Y0 refers to 1st group X-axis pulse output device. Y1 refers to 1st group X-axis direction signal. Y2 refers to 1st group Y-axis pulse output device. Y3 refers to 1st group Y-axis direction signal. Y4 refers to 2nd group X-axis pulse output device. Y5 refers to 2nd group X-axis direction signal. Y6 refers to 2nd group Y-axis pulse output device. Y7 refers to 2nd group Y-axis direction signal. When direction signal outputs, Off will not occur immediately after the pulse output is over. Direction signal will turn Off when the drive contact is Off. 5. D1340 (D1379) refers to the settings of the start/end frequencies of the 1st/2nd 2-axis motion. D1343 (D1381) refers to the time of the first acceleration segment and last deceleration segment of the 1st/2nd 2-axis motion. The time shall be longer than 10ms. If the time is shorter than 10ms or longer than 10,000ms, the output will be operated at 10ms. Default setting = 100ms. 6. If the maximum output frequency setting is less than 10Hz, the output will be operated at 10Hz. If the setting is more than 200kHz, the output will be operated at 200kHz. DVP-PLC Application Manual 9-89 S2: Number of output pulses of Y axis D: Pulse output device
(0,0)
(-27,000, -27,000)
(27,000, -27,000)
(0, -55,000)
2. Steps: a) Set the four coordinate (-27,000, -27,000), (0, -55,000), (27,000, -27,000), (0,0) (as the figure above). Place them in the 32-bit (D200, D202), (D204, D206), (D208, D210), (D212, D214). b) Write program codes as follows. c) PLC RUN. Set M0 as On and start the 2-axis line drawing.
= D0 K1 = D0 K2 = D0 K3 = D0 K4 M0 RST ZRST MOV M0 M1029 INCP END D0 M1029 D1336 K1 D1339 D0 DPPMA DPPMA DPPMA DPPMA D200 D204 D208 D212 D202 D206 D210 D214 K100000 K100000 K100000 K100000 Y0 Y0 Y0 Y0
3. Motion explanation: When PLC RUN and M0 = On, PLC will start the first point-to-point motion by 100kHz. D0 will plus 1 whenever a point-to-point motion is completed and the second point-to-point motion will start to execute automatically. The same motion will keep executing until the fourth point-to-point motion is completed.
9-90
Type OP
*
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S1: Number of output pulses of X axis D: Pulse output device Explanations: 1. Flags: M1029, M1030, M1334, M1335. See remarks of API 191 DPPMR for more details. 2. This instruction only supports EH2/SV series MPU, not EH series. In terms of pulse output methods, this instructin only supports pulse + direction mode. 3. S1 and S2 are the designated (relative designation) number of output pulses in X axis (Y0 or Y4) and Y axis (Y2 or Y6). The range of the number is -2,147,483,648 ~ +2,147,483,647 (+/- represents the forward/backward direction). When in forward direction, the pulse present value registers CH0 (D1337 high word, D1336 low word), CH1 (D1339 high word, D1338 low word), CH2 (D1376 high word, D1375 low word) and CH3 (D1378 high word, D1377 low word) will increase. When in backward direction, the present value will decrease. 4. The lower 16 bits of S (settings of direction and resolution): K0 refers to clockwise 10-segment (average resolution) output; K2 refers to clockwise 20-segment (higher resolution) output and a 90 arc can be drawn (see figure 1 and 2). K1 refers to counterclockwise 10-segment (average resolution) output; K3 refers to counterclockwise 20-segment (higher resolution) output and a 90 arc can be drawn (see figure 3 and 4). 5. The higher 16 bits of S (settings of motion time): K1 refers to 0.1 second. The setting range for average resolution is K1 ~ K100 (0.1 sec. ~ 10 secs.), for higher resolution is K2 ~ K200 (0.2 sec. ~ 20 secs.) This instruction is restricted by the maximum pulse output frequency; therefore when the set time goes faster than the actual output time, the set time will be automatically modified.
Y ( S 1,S 2 ) Y (S 1,S 2 )
S: Parameter setting
10 segments
( 0,0) 10 segments
X (0,0) 20 segments
20 segments
Figur e 1
Figur e 2
9-91
10 segments
20 segments
Figur e 3
Figur e 4
6. D can designate Y0 and Y4. When Y0 is designated: Y0 refers to 1st group X-axis pulse output device. Y1 refers to 1st group X-axis direction signal. Y2 refers to 1st group Y-axis pulse output device. Y3 refers to 1st group Y-axis direction signal. When Y4 is designated: Y4 refers to 2nd group X-axis pulse output device. Y5 refers to 2nd group X-axis direction signal. Y6 refers to 2nd group Y-axis pulse output device. Y7 refers to 2nd group Y-axis direction signal. When direction signal outputs, Off will not occur immediately after the pulse output is over. Direction signal will turn Off when the drive contact is Off. 7. Draw four 90 arcs. 8. When the direction signal is On, the direction is positive. When the direction signal is Off, the direction is negative. When S is set as K0, K2, the arcs will be clockwise (see figure 5). When S is set as K1, K3, the arcs will be counterclockwise (see figure 6).
Qu adrant II Y Qu adrant I Y Qu adrant I
F igur e 5
F igur e 6
9. When the 2-axis motion is being executed in 10 segments (of average resolution), the operation time of the instruction when the instruction is first enabled is approximately 5ms. The number of output pulses cannot be less than 100 and more than 1,000,000; otherwise, the instruction cannot be enabled. 10. When the 2-axis motion is being executed in 20 segments (of high resolution), the operation time of the instruction when the instruction is first enabled is approximately 10ms. The number of output pulses cannot be 9-92 DVP-PLC Application Manual
Fastest suggested set time (unit:100ms) 1 2 : Less than 100 2 3 : Less than 200
( 0,0 )
X ( 32 00 ,0)
(1 6 00 ,-2 20 0)
2. Steps: a) Set the four coordinates (0,0), (1600, 2200), (3200, 0), (1600, -2200) (as the figure above). Calculate the relative coordinates of the four points and obtain (1600, 2200), (1600, -2200), (-1600, -2200), and (-1600, 2200). Place them in the 32-bit (D200, D202), (D204, D206), (D208, D210), (D212, D214). b) Select draw clockwise arc and average resolution (S = K0). c) Write program codes as follows. d) PLC RUN. Set M0 as On and start the drawing of the ellipse.
9-93
3. Motion explanation: When PLC RUN and M0 = On, PLC will start the drawing of the first segment of the arc. D0 will plus 1 whenever a segment of arc is completed and the second segment of the arc will start to execute automatically. The same motion will keep executing until the fourth segment of arc is completed. Program Example 2: 1. Draw a tilted ellipse as the figure below.
Y (2 60 00 ,2 60 00 ) (3 40 00 ,1 80 00 )
(0 ,0) (8 00 0,- 80 00 )
2. Steps: a) Find the max. and min. coordinates on X and Y axes (0,0), (26000,26000), (34000,18000), (8000,-8000) (as the figure above). Calculate the relative coordinates of the four points and obtain (26000,26000)(8000,-8000) (-26000,-26000), (-8000,8000). Place them respectively in the 32-bit (D200,D202), (D204,D206), (D208,D210) and (D212,D214). b) Select draw clockwise arc and average resolution (S = K0). c) Select DCIMR instruction for drawing arc and write program codes as follows. d) PLC RUN. Set M0 as On and start the drawing of the ellipse.
9-94
3. Motion explanation: When PLC RUN and M0 = On, PLC will start the drawing of the first segment of the arc. D0 will plus 1 whenever a segment of arc is completed and the second segment of the arc will start to execute automatically. The same motion will keep executing until the fourth segment of arc is completed.
9-95
Type OP
*
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S1: Number of output pulses of X axis output device Explanations: 1. Flags: M1029, M1030, M1334, M1335. See remarks of API 191 DPPMR for more details. 2. This instruction only supports EH2/SV series MPU, not EH series. In terms of pulse output methods, this instructin only supports pulse + direction mode. 3. S1 and S2 are the designated (absolute designation) number of output pulses in X axis (Y0 or Y4) and Y axis (Y2 or Y6). The range of the number is -2,147,483,648 ~ +2,147,483,647. When S1 and S2 are larger than pulse present value registers CH0 (D1337 high word, D1336 low word), CH1 (D1339 high word, D1338 low word), CH2 (D1376 high word, D1375 low word), and CH3 (D1378 high word, D1377 low word), the output direction will be positive and direction signals Y1, Y3, Y5, Y7 will be On. When S1 and S2 are less than pulse present value registers, the output direction will be negative and direction signals Y1, Y3, Y5, Y7 will be Off. 4. The lower 16 bits of S (settings of direction and resolution): K0 refers to clockwise 10-segment (average resolution) output; K2 refers to clockwise 20-segment (higher resolution) output and a 90 arc can be drawn (see figure 1 and 2). K1 refers to counterclockwise 10-segment (average resolution) output; K3 refers to counterclockwise 20-segment (higher resolution) output and a 90 arc can be drawn (see figure 3 and 4). 5. The higher 16 bits of S (settings of motion time): K0 refers to 0.1 second. The setting range for average resolution is K1 ~ K100 (0.1 sec. ~ 10 secs.), for higher resolution is K2 ~ K200 (0.2 sec. ~ 20 secs.) This instruction is restricted by the maximum pulse output frequency; therefore when the set time goes faster than the actual output time, the set time will be automatically modified.
Y (S1, S 2) Y (S 1, S2)
S: Parameter setting
D: Pulse
10 se gment s
(0, 0) 10 se gment s
X (0, 0) 20 se gment s
20 se gment s
F igur e 1
F igur e 2
9-96
10 se gment s
20 se gment s
F igur e 3
F igur e 4
6. D can designate Y0 and Y4. When Y0 is designated: Y0 refers to 1st group X-axis pulse output device. Y1 refers to 1st group X-axis direction signal. Y2 refers to 1st group Y-axis pulse output device. Y3 refers to 1st group Y-axis direction signal. When Y4 is designated: Y4 refers to 2nd group X-axis pulse output device. Y5 refers to 2nd group X-axis direction signal. Y6 refers to 2nd group Y-axis pulse output device. Y7 refers to 2nd group Y-axis direction signal. When direction signal outputs, Off will not occur immediately after the pulse output is over. Direction signal will turn Off when the drive contact is Off. 7. Draw four 90 arcs. 8. When the direction signal is On, the direction is positive. When the direction signal is Off, the direction is negative. When S is set as K0, K2, the arcs will be clockwise (see figure 5). When S is set as K1, K3, the arcs will be counterclockwise (see figure 6).
Y Qu adrant I Y
Qu adrant II
Qu adrant I
F igur e 5
F igur e 6
9. When the 2-axis motion is being executed in 10 segments (of average resolution), the operation time of the instruction when the instruction is first enabled is approximately 5ms. The number of output pulses cannot be less than 100 and more than 1,000,000; otherwise, the instruction cannot be enabled. 10. When the 2-axis motion is being executed in 20 segments (of high resolution), the operation time of the instruction when the instruction is first enabled is approximately 10ms. The number of output pulses cannot be less than 1,000 and more than 10,000,000; otherwise, the instruction cannot be enabled. DVP-PLC Application Manual 9-97
Fastest suggested set time (unit:100ms) 1 2 : Less than 100 2 3 : Less than 200
( 0,0 )
X ( 32 00 0,0 )
(1 6 00 0,- 22 00 0)
2. Steps: a) Set the four coordinates (0,0), (16000, 22000), (32000, 0), (16000, -22000) (as the figure above). Place them in the 32-bit (D200, D202), (D204, D206), (D208, D210), (D212, D214). b) Select draw clockwise arc and average resolution (S = K0). c) Select DCIMA instruction for drawing arc and write program codes as follows. d) PLC RUN. Set M0 as On and start the drawing of the ellipse.
9-98
3. Motion explanation: When PLC RUN and M0 = On, PLC will start the drawing of the first segment of the arc. D0 will plus 1 whenever a segment of arc is completed and the second segment of the arc will start to execute automatically. The same motion will keep executing until the fourth segment of arc is completed. Program Example 2: 1. Draw a tilted ellipse as the figure below.
Y (2 60 00 ,2 60 00 ) (3 40 00 ,1 80 00 )
(0 ,0) (8 00 0,- 80 00 )
2. Steps: a) Find the max. and min. coordinates on X and Y axes (0,0), (26000,26000), (34000,18000), (8000,-8000) (as the figure above). Place them respectively in the 32-bit (D200,D202), (D204,D206), (D208,D210) and (D212,D214). b) Select draw clockwise arc and average resolution (S = K0). c) Select DCIMA instruction for drawing arc and write program codes as follows. d) PLC RUN. Set M0 as On and start the drawing of the ellipse.
9-99
3. Motion explanation: When PLC RUN and M0 = On, PLC will start the drawing of the first segment of the arc. D0 will plus 1 whenever a segment of arc is completed and the second segment of the arc will start to execute automatically. The same motion will keep executing until the fourth segment of arc is completed.
9-100
Type OP
*
PULSE 16-bit 32-bit ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands: S1: Source start device Explanations: 1. Flags: M1029, M1030, M1334, M1335. See remarks for more details. 2. This instruction only supports EH2/SV series MPU, not EH series. 3. According to the value of S2 + 0, every segment consecutively occupy four register D. (S1 + 0) refers to output frequency. (S1 + 2) refers to the number of output pulses. 4. When the output frequency of S1 is less than 1, PLC will automatically modify it as 1. When the value is larger than 200,000kHz, PLC will automatically modify it as 200,000kHz. 5. S2 + 0: number of segments (range: 1 ~ 60). S2 + 1: number of segments being executed. Whenever the program scans to this instruction, the instruction will automatically update the segment No. that is currently being executed. 6. D can only designate output devices Y0, Y2, Y4 and Y6 and can only perform pulse output control. For the pin for direction control, the user has to compile other programs to control. 7. This instruction does not offer acceleration and deceleration functions. Therefore, when the instruction is disabled, the output pulses will stop immediately. 8. In every program scan, each channel can only be executed by one instruction. However, there is no limitation on the number of times using this instruction. 9. When the instruction is being executed, the user is not allowed to update the frequency or number of the segments. Changes made will not be able to make changes in the actual output. Program Example: 1. When X0 = On, the output will be operated according to the set frequency and number of pulses in every segment. 2. Format of the table: S2 = D300, number of segments (D300 = K60) K1 (1st segment) K2 (2 segment) : : K60 (60th segment)
nd
9-101
(D237,D236)
....
(D239,D238) (D5,D4) (D7,D6) (D3,D2)
....
Time (S) t1 t
2
(D1,D0)
t ....
t 60
Remarks: 1. Flag explanations: M1029: M1030: M1036: M1037: M1334: M1335: M1520: M1521: M1336: M1337: M1522: M1523: On when CH0 (Y0) pulse output is completed. On when CH1 (Y2) pulse output is completed. On when CH2 (Y4) pulse output is completed. On when CH3 (Y6) pulse output is completed. When On, CH0 (Y0) pulse output will be forbidden. When On, CH1 (Y2) pulse output will be forbidden. When On, CH2 (Y4) pulse output will be forbidden. When On, CH3 (Y6) pulse output will be forbidden. CH0 (Y0) pulse output indication flag CH1 (Y2) pulse output indication flag CH2 (Y4) pulse output indication flag CH3 (Y6) pulse output indication flag
2. Special register explanations: D1336, D1337: D1338, D1339: D1375, D1376: D1377, D1378: Pulse present value register of CH0 (Y0) (D1337 high word, D1336 low word) Pulse present value register of CH1 (Y2) (D1339 high word, D1338 low word) Pulse present value register of CH2 (Y4) (D1376 high word, D1375 low word) Pulse present value register of CH3 (Y6) (D1378 high word, D1377 low word)
9-102
Bit Devices Y M
Operands: S: Condition to stop the startup of high speed timer Explanations: 1. 2. 3. Range of S: S = K0 (H0), K1 (H1). Flag: M1015 When S = 1, the high speed timer will be enabled and M1015 = On. The high speed timer starts to time and record the present value in D1015 (min. unit: 100us). 4. 5. 6. Timing range of D1015: K0 ~ K32,767. When the timing reaches K32,767, the next timing will restart from 0. When S = 0, the high speed timer will be disabled and M1015 = Off. D1015 will stop the timing immediately. When S is neither 1 nor 0, HST instruction will not be executed.
Program Example : 1. When X10 = On, M1015 will be On. The high speed timer will start to time and record the present value in D1015. 2. When X10 = Off, M1015 will be Off. The high speed timer will be shut down.
X10 HST X10 HST K0 K1
Remarks: 1. Flag explanations: M1015: high speed timer start-up flag D1015: high speed timer 2. EH/EH2/SV series MPU do not use this instruction and use special M and special D directly for the timer. a) Special M and special D are only applicable when PLC RUN. b) When M1015 = On and PLC scans to END instruction, the high speed timer D1015 will be enabled. The minimum timing unit of D1015: 100us. c) Timing range of D1015: K0 ~ K32,767. When the timing reaches K32,767, the next timing will restart from K0. d) When M1015 = Off, D1015 will stop the timing when encountering END or HST instruction. 3. SA/SX/SC series MPU do not use this instruction and use special M and special D directly for the timer. a) Special M and special D are applicable when PLC RUN or STOP.
9-103
9-104
Operands
Controllers
ES/EX/SS SA/SX/SC EH/SV
Type OP S1 S2 S3 D
Operands: S1: Feedback source device D: Pulse output device Explanations: 1. Flags: M1029, M1030, M1334, M1335. See remarks for more details. 2. This instruction only supports EH2/SV series MPU, not EH series. 3. The corresponding interruption of S1: Source device Corresponding outout Interruption No. = 1: rising-edige trigger; X0 Y0 I00 X1 Y2 I10 X2 Y4 I20 X3 Y6 I30 Y0 I010 C241 ~ C254 Y2 I020 Y4 I030 Y6 I040 S2: Target number of feedbacks S3: Target frequency of output
= 0: falling-edge trigger
a) When S1 designates X as the input points and the pulse output reaches the set target number of feedbacks in S2, the output will continue to operate by the frequency of the last segment until the interruption of X input points occurs. b) When S1 designates a high speed counter and the pulse output reaches the set target number of feedbacks in S2, the output will continue to operate by the frequency of the last segment until the feedback pulses reaches the target number. c) S1 can be a high speed counter C or an external interruption X. If S1 is C, DCNT instruction should be first executed to enable the high-speed counting function and EI and I0x0 interruption service program to enable the high-speed interruption. If S1 is X, EI instruction and I0x0 interruption service program should be executed to enable the external interruption function. 4. The range of S2: -2,147,483,648 ~ +2,147,483,647 (+/- represents the forward/backward direction). When in forward direction, the pulse present value registers CH0 (D1337 high word, D1336 low word), CH1 (D1339 high word, D1338 low word), CH2 (D1376 high word, D1375 low word) and CH3 (D1378 high word, D1377 low word) will increase. When in backward direction, the present value will decrease. 5. If S3 is lower than 10Hz, the output will operate at 10Hz; if S3 is higher than 200kHz, the output will operate at 200kHz. 6. D can only designate Y0, Y2, Y4 and Y6 and the direction signals repectively are Y1, Y3, Y5 and Y7. When there is a direction signal output, the direction signal will not be Off immediately after the pulse output is completed. The direction signal will be Off only when the drive contact is Off. DVP-PLC Application Manual 9-105
Target frequency
Start/end frequency
Time Number
Acceleration time High speed time Deceleration time Idling time
3. How to adjust the time for the completion of the positioning: a) The time for the completion of the positioning refers to the time for acceleration + high speed + deceleration + idling (see the figure above). For example, you can increase or decrease the entire number of output pulses by making adjustment on the percentage value and further increase or decrease the time required for the positioning. b) Among the four segments of time, only the idling time cannot be adjusted directly by the user. However, you can determine if the execution result is good or bad by the length of the idling time. In theory, a bit of idling left is the best result for a positioning. c) Owing to the close loop operation, the length of idling time will not be the same in every execution. Therefore, when the content in the special D for displaying the actial number of output pulses is smaller or larger than the calculated number of output pulses (taget number of feedbacks x percentage value/100), you can improve the situation by adjusting the percentage value, acceleration/decelartion time or target 9-106 DVP-PLC Application Manual
100KHz
D1340
Estimated number of output pulses: 50,000 Actual number of output pulses (D1336, D1337) = K49,200
4. Observe the result of the first execution: a) The actual output number 49,200 estimated output number 50,000 = -800 (a negative value). A negative value indicates that the entire execution finishes earlier and has not completed yet. b) Try to shorten the acceleration time (D1343) into 250ms and deceleration time (D1348) into 550ms. DVP-PLC Application Manual 9-107
100KHz
D1340
Estimated number of output pulses: 50,000 Actual number of output pulses (D1336, D1337) = K50,020
6. Observe the result of the second execution: a) The actual output number 50,020 estimated output number 50,000 = 20 b) 20 x (1/200Hz) = 100ms (idling time) c) 100ms is an appropriate value. Therefore, set the acceleration time as 250ms and deceleration time as 550ms to complete the design. Program Example 2: 1. Assume the feedback of the encoder is an A/B phase input and we adopt C251 timing (we suggust you clear it to 0 before the execution); target number of feedbacks = 50,000; target output frequency = 100kHz; Y0, Y1 (CH0) as output pulses; start/end frequency (D1340) = 200Hz; acceleration time (D1343) = 300ms; deceleration time (D1348) = 600ms; precentage value (D1131) = 100; current number of output pulses (D1336, D1337) = 0. 2. Write the program codes as follows:
M1002 MOV MOV MOV SET DMOV RST EI M0 DCNT DCLLM FEND M1000 I010 INC IRET END D0 C251 C251 K100000 K50000 K100000 Y0 K100 K300 K600 M1534 K0 C251 D1336 D1131 D1343 D1348
9-108
100KHz
D1340
Estimated number of output pulses: 50,000 Actual number of output pulses (D1336, D1337) = K50,600
4. Observe the result of the first execution: a) The actual output number 50,600 estimated output number 50,000 = 600 b) 600 x (1/200Hz) = 3s (idling time) c) 3 seconds are too long. Therefore, increase the percentage value (D1131) to K101. 5. Obatin the result of the second execution:
Frequency
100KHz
D1340
Estimated number of output pulses: 50,500 Actual number of output pulses (D1336, D1337) = K50,560
6. Observe the result of the second execution: a) The actual output number 50,560 estimated output number 50,500 = 60 b) 60 x (1/200Hz) = 300ms (idling time) c) 300ms is an appropriate value. Therefore, set the percentage value (D1131) as K101 to complete the design. Remarks: 1. Flag explanations: M1010: When On, CH0, CH1, CH2 and CH3 will output pulses when encountering END instruction. Off when the output starts. M1029: M1030: M1036: M1037: M1334: On when CH0 pulse output is completed. On when CH1 pulse output is completed. On when CH2 pulse output is completed. On when CH3 pulse output is completed. When On, CH0 pulse output will be forbidden. 9-109
2. Special register explanations: D1131: D1132: D1478: D1479: D1220: Close loop output/input ratio of CH0 (default: K100) Close loop output/input ratio of CH1 (default: K100) Close loop output/input ratio of CH2 (default: K100) Close loop output/input ratio of CH3 (default: K100) Phase setting of CH0 (Y0, Y1): determined by the last 2 digits of D1220; other digits are invalid. 1. K0: Y0 output 2. K1: Y0, Y1 AB-phase output; A ahead of B 3. K2: Y0, Y1 AB-phase output; B ahead of A D1221: Phase setting of CH1 (Y2, Y3): determined by the last 2 digits of D1221; other digits are invalid. 1. K0: Y2 output 2. K1: Y2, Y3 AB-phase output; A ahead of B 3. K2: Y2, Y3 AB-phase output; B ahead of A D1229: Phase setting of CH2 (Y4, Y5): determined by the last 2 digits of D1229; other digits are invalid. 1. K0: Y4 output 2. K1: Y4, Y5 AB-phase output; A ahead of B 3. K2: Y4, Y5 AB-phase output; B ahead of A D1230: Phase setting of CH3 (Y6, Y7): determined by the last 2 digits of D1230; other digits are invalid. 1. K0: Y6 output 2. K1: Y6, Y7 AB-phase output; A ahead of B 3. K2: Y6, Y7 AB-phase output; B ahead of A D1222: D1223: D1383: Time difference between the direction signal and pulse output of CH0 Time difference between the direction signal and pulse output of CH1 Time difference between the direction signal and pulse output of CH2
9-110
9-111
9-112
Bit Devices Y M
Operands: S1: Source value Explanations: 1. Range of S1, S2, S3: -32,768 ~ 32,767 2. Unit of S2: 0.001 3. See the specifications of each model for their range of use. 4. Operation equation in the instruction: D = (S1 S2) 1,000 + S3. Users have to obtain S2 and S3 (decimals are rounded up into 16-bit integers) by using the slope and offset equations below. Slope equation: S2 = [(max. destination value min. destination value) (max. source value min. source value)] 1,000 Offset equation: S3 = min. destination value min. source value S2 1,000 The output curve is shown as the figure:
Destination value Max. Destination value
S2: Slope
S3: Offset
D: Destination device
S1
Source value
Program Example 1: 1. Assume S1 = 500, S2 = 168, S3 = -4. When X0 = On, SCAL instruction will be executed and obtain the proportional value at D0. 2. Equation: D0 = (500 168) 1,000 + (-4) = 80
X0 SCAL K500 K168 K-4 D0
10-1
D Offset=-4
Slope=168
S1=500
Source value
Program Example 2: 1. Assume S1 = 500, S2 = -168, S3 = 534. When X10 = On, SCAL instruction will be executed and obtain the proportional value at D10. 2. Equation: D0 = (500 -168) 1,000 + 534 = 450
X10 SCAL K500 K-168 K534 D10
Destination value
D Offset=534
Slope=-168
S 1=500
Source value
Remarks: 1. This instruction is applicable for known slope and offset. If slope and offset are unknown, use SCLP instruction for the calculation. 2. S2 has to be within the range -32,768 ~ 32,767. If S2 falls without the range, use SCLP instruction for the calculation. 3. When using the slope equation, please be aware that the max. source value must > min. source value, but it is not necessary that max. destination value > min. destination value. 4. If the value of D > 32,767, D = 32,767; if the value of D < -32,768, D = -32,768. 5. Only ES_V6.2, SA/SX_V1.6, SC_V1.4, EH2/SV_V1.0 and versions above support this instruction. EH series MPU does not support this instruction.
10-2
Bit Devices Y M
Operands: S1: Source value Explanations: 1. See the specifications of each model for the range of operands. 2. Flags: M1162 (decimal integer or binary floating point); M1162 = On -> Binary floating point 3. Settings of S2 for 16-bit instruction: S2 occupies 4 consecutive devices in 16-bit instruction. Device No. S2 S2 + 1 S2 + 2 S2 + 3 Parameter Maximum source value Minimum source value Maximum destination value Minimum destination value Range -32,768 ~ 32,767 -32,768 ~ 32,767 -32,768 ~ 32,767 -32,768 ~ 32,767 S2: Parameter D: Destination device
4. Settings of S2 for 32-bit instruction: S2 occupies 8 consecutive devices in 32-bit instruction. Device No. S2, S2 + 1 S2 + 2, 3 S2 + 4, 5 S2 + 6, 7 Parameter Integer Maximum source value Minimum source value Maximum destination value Minimum destination value -2,147,483,648 ~ 2,147,483,647 Range of 32-bit floating point Range Floating point
5. Operation equation in the instruction: D = [(S1 min. source value) (max. destination value min. destination value)] (max. source value min. source value) + min. destination value 6. The operational relation between source value and destination value is as stated below: y = kx + b y= Destination value (D) k= Slope = (max. destination value min. destination value) (max. source value min. source value) x= Source value (S1) b= Offset = Min. destination value Min. source value slope Bring all the parameters into equation y = kx + b and obtain the equation in the instruction: y = kx + b = D = k S1 + b = slope S1 + offset = slope S1 + min. destination value min. source value slope DVP-PLC Application Manual 10-3
S1
Source value
Program Example 1: 1. Assume S1 = 500, max. source value D0 = 3,000, min. source value D1 = 200, max. destination value D2 = 500, and min. destination value D3 = 30. When X0 = On, SCLP instruction will be executed and obtain the proportional value at D10. 2. Equation: D10 = [(500 200) (500 30)] (3,000 200) + 30 = 80.35. Round off the result into an integer D10 = 80.
X0 MOV MOV MOV MOV X0 SCLP K500 D0 D10 K3000 K200 K500 K30 D0 D1 D2 D3
Destination value
S1=500 Min. Source =200 value Max. Source =3000 value Source value
10-4
Destination value
Program Example 3: 1. Assume the source of S1 D100 = F500, max. source value D0 = F3000, min. source value D2 = F200, max. destination value D4 = F500, and min. destination value D6 = F30. When X0 = On, set up M1162, adopt floating point operation and execute DSCLP instruction. The proportional value will be obtained at D10. 2. Equation: D10 = [(F500 F200) (F500 F30)] (F3000 F200) + F30 = F80.35. Round off the result into an integer D10 = F80.
X0 SET DMOVR DMOVR DMOVR DMOVR DMOVR X0 DSCLP D100 D0 D10 M1162 F500 F3000 F200 F500 F30 D100 D0 D2 D4 D6
10-5
Source value
Remarks: 1. Range of S1 for 16-bit instruction: max. source value S1 min. source value; -32,768 ~ 32,767. If the value falls without the bounds, the bound value will be used for calculation. 2. Range of integer S1 for 32-bit instruction: max. source value S1 min. source value; -2,147,483,648 ~ 2,147,483,647. If the value falls without the bounds, the bound value will be used for calculation. 3. Range of floating point S1 for 32-bit instruction: max. source value S1 min. source value; following the range of 32-bit floating point. If the value falls without the bounds, the bound value will be used for calculation. 4. Please be aware that the max. source value must > min. source value, but it is not necessary that max. destination value > min. destination value. 5. Only ES_V6.2, SA/SX_V1.6, SC_V1.4, EH2/SV_V1.0 and versions above support this instruction. EH series MPU does not support this instruction.
10-6
Operands: S1: Data source device 1 Explanations: 1. 2. 3. See the specifications of each model for the range of operands. This instruction compares the content in S1 and S2. If the result is not 0, the continuity of the instruction is enabled. If the result is 0, the continuity of the instruction is disabled. LD# instruction is used for direct connection with BUS. API No. 215 216 217 4. 5. 6. 7. 16 -bit instruction LD& LD| LD^ 32 -bit instruction DLD& DLD| DLD^ Continuity condition S1 & S2 0 S1 | S2 0 S1 ^ S2 0 No-continuity condition S1 & S2 = 0 S1 | S2 = 0 S1 ^ S2 = 0 S2: Data source device 2
&: Logical AND operation |: Logical OR operation ^: Logical XOR operation When 32-bit counters (C200 ~ C255) are used in this instruction for comparison, make sure to adopt 32-bit instruction (DLD#). If 16-bit instructions (LD#) is adopted, a program error will occur and the ERROR indicator on the MPU panel will flash.
Program Example: 1. 2. 3. When the result of logical AND operation of C0 and C10 0, Y10 = On. When the result of logical OR operation of D200 and D300 0 and X1 = On, Y11 = On will be retained. When the result of logical XOR operation of C201 and C200 0 or M3 = On, M50 = On.
LD & LD I DLD ^ M3 C0 D200 C201 C10 X1 D300 C200 SET M50 Y011 Y10
10-7
Operands: S1: Data source device 1 Explanations: 1. See the specifications of each model for the range of operands. 2. This instruction compares the content in S1 and S2. If the result is not 0, the continuity of the instruction is enabled. If the result is 0, the continuity of the instruction is disabled. 3. AND# is an operation instruction used on series contacts. API No. 218 219 220 16 -bit instruction AND& AND| AND^ 32 -bit instruction DAND& DAND| DAND^ Continuity condition No-continuity condition S2: Data source device 2
S1 & S2 0 S1 | S2 0 S1 ^ S2 0
S1 & S2 = 0 S1 | S2 = 0 S1 ^ S2 = 0
4. &: Logical AND operation 5. |: Logical OR operation 6. ^: Logical XOR operation 7. When 32-bit counters (C200 ~ C255) are used in this instruction for comparison, make sure to adopt 32-bit instruction (DAND#). If 16-bit instructions (AND#) is adopted, a program error will occur and the ERROR indicator on the MPU panel will flash. Program Example: 1. When X0 = On and the result of logical AND operation of C0 and C10 0, Y10 = On. 2. When X1 = Off and the result of logical OR operation of D10 and D0 0 and X1 = On, Y11 = On will be retained. 3. When X2 = On and the result of logical XOR operation of 32-bit register D200 (D201) and 32-bit register D100 (D101) 0 or M3 = On, M50 = On.
X0 AND & X1 AND I X2 DAND ^ M3 D200 D100 M50 D10 D0 SET Y11 C0 C10 Y10
10-8
Operands: S1: Data source device 1 Explanations: 1. See the specifications of each model for the range of operands. 2. This instruction compares the content in S1 and S2. If the result is not 0, the continuity of the instruction is enabled. If the result is 0, the continuity of the instruction is disabled. 3. OR# is an operation instruction used on parallel contacts. API No. 221 222 223 16 -bit instruction OR& OR| OR^ 32 -bit instruction DOR& DOR| DOR^ Continuity condition S1 & S2 0 S1 | S2 0 S1 ^ S2 0 No-continuity condition S1 & S2 = 0 S1 | S2 = 0 S1 ^ S2 = 0 S2: Data source device 2
4. &: Logical AND operation 5. |: Logical OR operation 6. ^: Logical XOR operation 7. When 32-bit counters (C200 ~ C255) are used in this instruction for comparison, make sure to adopt 32-bit instruction (DOR#). If 16-bit instructions (OR#) is adopted, a program error will occur and the ERROR indicator on the MPU panel will flash. Program Example: 1. When X1 = On and the result of logical AND operation of C0 and C10 0, Y10 = On. 2. M60 will be On when X2 = On and M30 = On, or the result of logical OR operation of 32-bit register D10 (D11) and 32-bit register D20 (D21) 0, or the result of logical XOR operation of 32-bit register D200 (D201) and 32-bit counter C235 0.
X1 Y0 OR & X2 M30 M60 DOR I DOR ^ D10 D100 D20 D200 C0 C10
10-9
Operands: S1: Data source device 1 Explanations: 1. 2. 3. See the specifications of each model for the range of operands. This instruction compares the content in S1 and S2. Take API224 (LD=) for example, if the result is =, the continuity of the instruction is enabled. If the result is , the continuity of the instruction is disabled. LD instruction is used for direct connection with BUS. API No. 224 225 226 228 229 230 4. 16 -bit instruction LD = LD > LD < LD < > LD < = LD > = 32 -bit instruction DLD = DLD > DLD < DLD < > DLD < = DLD > = Continuity condition S1 = S2 S1 > S2 S1 < S2 S1 S2 S1 S2 S1 S2 No-continuity condition S1 S2 S1 S2 S1 S2 S1 = S2 S1 > S2 S1 < S2 S2: Data source device 2
When 32-bit counters (C200 ~ C255) are used in this instruction for comparison, make sure to adopt 32-bit instruction (DLD). If 16-bit instructions (LD) is adopted, a program error will occur and the ERROR indicator on the MPU panel will flash.
Program Example: 1. 2. 3. When the content in C10 = K200, Y10 = On. When the content in D200 > K-30 and X1 = On, Y11= On will be retained. When the content in C200 < K678,493 or M3 = On, M50 = On.
LD= LD> K200 D200 C10 X1 K-30 C200 SET M50 Y11 Y10
DLD> K678493 M3
10-10
Operands: S1: Data source device 1 Explanations: 1. 2. 3. See the specifications of each model for the range of operands. This instruction compares the content in S1 and S2. Take API232 (AND=) for example, if the result is =, the continuity of the instruction is enabled. If the result is , the continuity of the instruction is disabled. AND is a comparison instruction is used on series contacts. API No. 232 233 234 236 237 238 4. 16 bit instruction AND = AND > AND < AND < > AND < = AND > = 32 bit instruction DAND = DAND > DAND < DAND < > DAND < = DAND > = Continuity condition S1 = S2 S1 > S2 S1 < S2 S1 S2 S1 S2 S1 S2 No-continuity condition S1 S2 S1 S2 S1 S2 S1 = S2 S1 > S2 S1 < S2 S2: Data source device 2
When 32-bit counters (C200 ~ C255) are used in this instruction for comparison, make sure to adopt 32-bit instruction (DAND). If 16-bit instructions (AND) is adopted, a program error will occur and the ERROR indicator on the MPU panel will flash.
Program Example: 1. When X0 = On and the content in C10 = K200, Y10 = On. 2. When X1 = Off and the content in D0 K-10, Y11= On will be retained. 3. When X2 = On and the content in 32-bit register D0 (D11) < 678,493 or M3 = On, M50 = On.
X0 AND= X1 AND<> X2 DAND> K678493 M3 D10 M50 K-10 D0 SET Y11 K200 C10 Y10
10-11
Operands: S1: Data source device 1 Explanations: 1. 2. 3. See the specifications of each model for the range of operands. This instruction compares the content in S1 and S2. Take API240 (OR=) for example, if the result is =, the continuity of the instruction is enabled. If the result is , the continuity of the instruction is disabled. OR is an comparison instruction used on parallel contacts. API No. 240 241 242 244 245 246 4. 16 -bit instruction OR = OR > OR < OR < > OR < = OR > = 32 -bit instruction DOR = DOR > DOR < DOR < > DOR < = DOR > = Continuity condition S1 = S2 S1 > S2 S1 < S2 S1 S2 S1 S2 S1 S2 No-continuity condition S1 S2 S1 S2 S1 S2 S1 = S2 S1 > S2 S1 < S2 S2: Data source device 2
When 32-bit counters (C200 ~ C255) are used in this instruction for comparison, make sure to adopt 32-bit instruction (DOR). If 16-bit instructions (OR) is adopted, a program error will occur and the ERROR indicator on the MPU panel will flash.
Program Example: 1. 2. When X1 = On and the present value of C10 = K200, Y0 = On. M60 will be On when X2 = On, M30 = On and the content in 32-bit register D100 (D101) K100,000.
X1 Y0 OR= X2 M30 M60 DOR> = D100 K100000 K200 C10
10-12
11 Appendix
Poor connection or MPU problem The applicable frequency exceeds the maximum bandwidth.
Low input power supply There is no program inside the new PLC, resulting in misjudgment.
11-1
11 Appendix
11.2
DVP14ES00R2/T2
Y0 Y1 Y2 Y3 Y4 C0 C1 C2 C3 Y5
S/S X4 X5 X6 X7 C0 Y2 C1 Y5 X0 X1 X2 X3 Y0 Y1 Y3 Y4
DVP20EX00R2/T2
( AC Power IN, DC Signal IN )
S/S X4 X5 X6 X7 C0 Y2 C1 Y5 X0 X1 X2 X3 Y0 Y1 Y3 Y4
DVP20EX11R2/T2
( DC Power IN, DC Signal IN )
DVP24ES00R2/T2
( AC Power IN, DC Signal IN )
Y0
Y1 C0 C1
Y2 Y3 C2 C3
Y4 Y5 C4 C5
Y6 Y7 C6 C7
S/S
X0 X2 X4 X6 X10 X12 X14 X16 X20 X1 X3 X5 X7 X11 X13 X15 X17 X21
DVP30ES00R2
Y0
Y1 Y2 Y3 C0 C1 C2
Y4 Y6 C3 Y5 Y7
S/S
X0
X2 X4 X6 X10 X12 X14 X16 X20 X1 X3 X5 X7 X11 X13 X15 X17 X21
DVP30ES00T2
UP0 Y0 UP1 UP2 Y2 Y4 Y6 UP3 Y10 Y12 ZP0 ZP1 Y1 ZP2 Y3 Y5 Y7 ZP3 Y11 Y13
DVP32ES00R2/T2
Y0
Y1 C0 Y2
Y3
Y4 Y5 C1 Y6
11-2
11 Appendix
S/S
X0
X2 X4 X6 X10 X12 X14 X16 X20 X22 X24 X26 X1 X3 X5 X7 X11 X13 X15 X17 X21 X23 X25 X27
DVP40ES00R2/T2
S/S X22 X23 X24 X25 X26 X27 X30 X31 X32 X33 X34 X35 X36 X37 X40 X41 X42 X43 X0 X1 X2 X3 X4 X5 X6 X7 X10 X11 X12 X13 X14 X15 X16 X17 X20 X21
DVP60ES00R2/T2
Y0 Y1 Y2 Y3 Y4 Y5 C0 C1 C2 C3 C4 Y6
Y10 Y11 Y14 Y15 Y20 Y21 Y24 Y25 Y7 C5 Y12 Y13 C6 Y16 Y17 C7 Y22 Y23 C8 Y26 Y27
DVP16EH00R/T
DVP16EH00R2/T2
Y0
Y1 Y2 Y3 Y4 Y5 Y6 Y7 C0 C1 C2 C3 C4 C5 C6 C7
DVP20EH00R/T
S/S X0
DVP20EH00R2/T2
+24V Y0 Y1 Y2 Y3 24G C0 C1 C2 C3
Y4 Y6 C4 Y5 Y7
DVP32EH00R
DVP32EH00R2
Y0
Y1 Y3 C0 Y2
DVP32EH00T
DVP32EH00T2
Y0 Y1 Y2 Y3 Y4 Y5 Y7 C0 C1 C2 C3 C4 Y6
S/S X0+ X1+ X2 X4+ X5+ X6 X10 X12 X14 X16 X0- X1- X3 X4- X5- X7 X11 X13 X15 X17
DVP32EH00M2
Y0- Y1Y2- Y3- Y4 Y5 Y7 Y10 Y11 Y13 Y14 Y15 Y17 C2 Y16 Y0+ Y1+ SG0 Y2+ Y3+ C0 Y6 C1 Y12
11-3
11 Appendix
DVP40EH00R
S/S X1
X4 X6 X10 X12 X14 X16 X20 X22 X24 X26 X5 X7 X11 X13 X15 X17 X21 X23 X25 X27
DVP40EH00R2
24G Y0 Y1 Y2 Y3 24V C0 C1 C2 C3
Y4 Y6 C4 Y5 Y7
DVP40EH00T
S/S X1
X4 X6 X10 X12 X14 X16 X20 X22 X24 X26 X5 X7 X11 X13 X15 X17 X21 X23 X25 X27
DVP40EH00T2
24G Y0 Y1 24V C0
Y2 Y3 C1
Y4 Y5 C2
DVP48EH00R/T
S/S X0 X2 X4 X6 X10 X12 X14 X16 X20 X22 X24 X26 X1 X3 X5 X7 X11 X13 X15 X17 X21 X23 X25 X27
DVP48EH00R2/T2
Y0
Y1 Y3 C0 Y2
Y4 Y5 Y7 Y10 Y11 Y13 Y14 Y15 Y17 Y20 Y22 Y24 Y26 C1 Y6 C2 Y12 C3 Y16 C4 Y21 Y23 Y25 Y27
DVP64EH00R/T
S/S X0 X2 X4 X6 X10 X12 X14 X16 X20 X22 X24 X26 X30 X32 X34 X36 X1 X3 X5 X7 X11 X13 X15 X17 X21 X23 X25 X27 X31 X33 X35 X37
DVP64EH00R2/T2
Y0
Y1 Y3 C0 Y2
Y4 Y5 Y7 Y10 Y11 Y13 Y14 Y15 Y17 Y20 Y21 Y23 Y25 Y27 Y30 Y32 Y34 Y36 C4 Y22 Y24 Y26 C5 Y31 Y33 Y35 Y37 C1 Y6 C2 Y12 C3 Y16
DVP80EH00R/T
S/S X0 X2 X4 X6 X1 X3 X5 X7
DVP80EH00R2/T2
Y0
Y1 Y3 C0 Y2
Y4 Y5 Y7 Y10 Y11 Y13 Y14 Y15 Y17 Y20 Y21 Y23 Y24 C4 Y22 C5 C1 Y6 C2 Y12 C3 Y16
Y25 Y27 Y30 Y31 Y33 Y35 Y37 Y40 Y41 Y43 Y45 Y47 Y26 C6 Y32 Y34 Y36 C7 Y42 Y44 Y46
11-4
11 Appendix
RUN
S/S X0 X1 X2 X3 X4 X5 X6 X7 C0 Y0 C1 Y1 C2 Y2 Y3 Y4 Y5
RUN
S/S X0 X1 X2 X3 X4 X5 X6 X7 C0 Y0 C1 Y1 C2 Y2 Y3
RUN
RUN
STOP
STOP
STOP
STOP
RUN
STOP
S/S X0 X1 X2 X3 X4 X5 X6 X7 S/S X10 X11 X12 X13 X14 X15 X16 X17
S/S X0 X1 X2 X3 X4 X5 X6 X7 S/S X10 X11 X12 X13 X14 X15 X16 X17
STOP
11-5
11 Appendix
11.3
DVP08XM11N
( DC Power IN )
DVP08XN11R/T
( DC Power IN )
DVP08XP11R/T
( DC Power IN )
DVP16XM11N
( DC Power IN )
C0 C1 C2 C3 Y0 Y1 Y2 Y3
C4 C5 Y4 Y5
DVP16XN11R/T
( DC Power IN )
Y6 Y7 C6 C7
X0
X1
X2 X3
X4
X5 X6
X7
DVP24XP11R/T
Y0 Y1 C0 C1
Y2
Y3 C2 C3
Y4
Y5 C4 C5
Y6 Y7 C6 C7
C0 C1 C2 C3 C4 C5 C6 C7 Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7
DVP24XN00R/T
( AC Power IN )
Y10 Y11 Y12 Y14 Y15 Y16 Y20 Y21 Y22 Y24 Y25 Y26 C10 C11 Y13 C12 C13 Y17 C14 C15 Y23 C16 C17 Y27
C0 C1 C2 C3 C4 C5 C6 C7 Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7
DVP24XN00R/T
( DC Power IN )
Y10 Y11 Y12 Y14 Y15 Y16 Y20 Y21 Y22 Y24 Y25 Y26 C10 C11 Y13 C12 C13 Y17 C14 C15 Y23 C16 C17 Y27
DVP32XP00R/T
Y0 Y1 C0 Y2
Y4 Y5 Y3 C1 Y6
DVP32XP11R/T
Y0 Y1 C0 Y2
Y4 Y5 Y3 C1 Y6
11-6
11 Appendix
DVP08HM11N
X0 X2
S/S X1 X3
DVP08HN11R/T
X4 X6 X5 X7
Y0 Y1 Y3 C0 Y2 Y4 Y5 Y7 C1 Y6
DVP08HP11R/T
X0 X2
S/S X1 X3
DVP16HM11N
Y0 Y1 Y3 C0 Y2
S/S X0 X1 X2 X3 X4 X5 X6 X7
S/S X10 X11 X12 X13 X14 X15X16 X17
DVP16HP11R/T
S/S X4 X5 X6 X7 X0 X1 X2 X3 Y4 Y5 Y6 Y7 C0 Y0 Y1 Y2 Y3
C0
Y1 Y2
C1 Y3
Y4 Y5
C2
X14 X15
DVP32HN00R/T
Y16 Y21 Y22 Y23 Y25 C4 Y20 C5 Y24 Y26 Y27 Y31 Y32 Y34 Y36 C6 Y30 C7 Y33 Y35 Y37
DVP32HP00R/T
Y0 Y1 Y3 C0 Y2 Y4 Y5 Y7 Y10 Y11 Y13 Y14 Y15 Y17 C1 Y6 C2 Y12 C3 Y16
S/S X0 X2 X4 X6 X10 X12 X14 X16 X20 X22 X24 X26 X1 X3 X5 X7 X11 X13 X15 X17 X21 X23 X25 X27
DVP48HP00R/T
Y0 Y1 Y3 C0 Y2 Y4 Y5 Y7 Y10 Y11 Y13 Y14 Y15 Y17 Y20 Y22 Y24 Y26 C1 Y6 C2 Y12 C3 Y16 C4 Y21 Y23 Y25 Y27
11-7
11 Appendix
DVP08SM10N
DVP16SM11N
DVP08SN11R DVP08SN11T
C0 Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7
COM X0 X1 X2 X3 X4 X5 X6 X7
S/S X0 X1 X2 X3 X4 X5 X6 X7 S/S X10 X11 X12 X13 X14 X15 X16 X17
DVP08SP11R DVP08SP11T
S/S X0 X1 X2 X3
DVP16SP11R
DVP16SP11TS
DVP06SN11R
S/S X0 X1 X2 X3 X4 X5 X6 X7 C0 Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7
S/S X0 X1 X2 X3 X4 X5 X6 X7 UP Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 ZP
C0 Y0 C1 Y1 C2 Y2
C0 Y0 C1 Y1 C2 Y2 C3 Y3
C3 Y3 C4 Y4 C5 Y5
11-8
11 Appendix
11.4
Item
#1
instruction 1.7 Basic Program Designing Examples: Explanations on Start, Stop and Latched Special auxiliary relays: M1025, M1036, M1058, M1075, M1085, M1087, M1102~M1103, M1133~M1137, M1154~M1160, M1163~M1164, M1181~M1182, M1189~M1191, M1194~M1195, M1304, M1308~M1311, M1347~M1348, M1355, M1520~M1525, M1534~M1541
Chapter 1
#2
Special data registers: D1002, D1026~D1027, D1063~D1064, D1109, D1131~D1133, D1147, D1172, D1180~D1181, D1198~D1199, D1320~D1327, D1232~D1239, D1341~D1342, D1352~D1353, D1383~D1384, D1386~D1393, D1478~D1479, D1995~D1999 Communication addresses for DVP series PLC
Chapter 2
#3 #4 #5 #6
5.1 List of Instructions 5.5 Instruction Index Modified instructions: CJ, FMOV, INC, DEC, WSFL, SFRD, ANR, FLT Modified instructions: REF, HSCS, HSCR, SPD, PLSY, PLSR, ABSD, RAMP, SORT, DSW, ARWS, ASC, PR, FROM, TO, PID Modified instructions: MODRD, MODWR, CRC, EXP, CVM, MEMW New instruction: MMOV
#7
Modified instructions: MODRW, ABSR, ZRN, DRVI, DRVA, HOUR, MCMP, MBWR, PPMR, PPMA, CIMR, CIMA, PTPO, CLLM
Chapter 9
#8
New appendices: Table for self-detecting abnormality, terminal layouts for MPU and digital I/O modules, revision history
Chapter 11
11-9
11 Appendix
MEMO
11-10