Wiki source code of 08 High speed process

Version 4.1 by Jett on 2025/10/27 11:06

Show last authors
1 = **6.8.1 REF instruction** =
2
3 **Instruction description**
4
5 (% class="table-bordered" %)
6 |**Name**|**Function**|**Bit**|**Pulse type**|**Instruction format**|**Step**
7 |REF|(% rowspan="2" %)Forces an immediate update of inputs or outputs as specified|16|No|(% rowspan="2" %)REF D n|5
8 |REFP|16|Yes|5
9
10 Refresh n devices immediately stating from D.
11
12 * D must be the device like X0, X10, Y0 or Y10… i.e the unit’s digit need to be zero.
13 * The value of n must be the multiple of 8(n=8~~256)
14
15 (% class="table-bordered" %)
16 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
17 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
18 |D|√|√| | | | | | | | | | | | | |
19 |n|(% colspan="16" %)
20
21 Standard PLC operation processes output and input status between the END instruction of one program scould and step 0 of the following program scould. If an immediate update of the I/O device status is required, the REF instruction is used.
22
23 REF could be used between the instruction FOR~~ NEXT or CJ.
24
25 REF could be used in the interrupt subprogram to refresh the input information and the output result.
26
27 The delay of the input port state depends on the filter time of the input device. X0 to X7 have the digital filter function, the filter time is between 0 and 60 ms, the other IO ports are hardware filter that the filter time is 10 ms. The specific parameter you need to refer to the PLC manual.
28
29 The delay of the output port state change depends on the response time of the output element, such as relay. The output contact will not act until the response time of the relay or transistor is over.
30
31 The response latency of the relay output type plc is about 10 ms (max :20ms),the high speed output port of the transistor plc is about 10 us, for the common output port of the transistor plc is about 0.5 ms. The specific parameter you need to refer to the PLC manual.
32
33 **Program example**
34
35 (% style="text-align:center" %)
36 [[image:7-7 High speed process_html_db0844dad4d33f1.jpg||height="65" width="300" class="img-thumbnail"]]
37
38 During the operation, once X20 is ON, the state of the input port X0 to X17 will be read immediately, the input signal will be refreshed and there is no input delay.
39
40 (% style="text-align:center" %)
41 [[image:7-7 High speed process_html_f11c740cefc73df8.jpg||height="66" width="300" class="img-thumbnail"]]
42
43 During the operation, once X20 is ON, the state of the output port Y0 to Y17 will be read immediately, the output signal will be refreshed immediately rather than until the END instruction.
44
45 = **6.8.2 REFF instruction** =
46
47 **Instruction description**
48
49 (% class="table-bordered" %)
50 |**Name**|**Function**|**Bit(bits)**|**Pulse type**|**Instruction format**|**Step**
51 |REFF|(% rowspan="2" %)Inputs are refreshed, and their input filters are reset to the newly designated value|16|No|(% rowspan="2" %)REFF n|7
52 |REFFP|16|No|7
53
54 n is the filter time for X0 ~~ X7 input port.
55
56 X0~~X7 use digital filters, the default filter time is set by the D8020. D8020 could be changed to 0 ~~ 60ms by REFF instruction. The remaining X ports only have hardware RC filter that the filter time is about 10ms and couldn’t be changed.
57
58 When using the interrupts or high speed counting, the filter time of the related port reduce to minimum automatically. The unrelated ports stay as it was.
59
60 User could also use MOV instruction to change the value of D8020.
61
62 (% class="table-bordered" %)
63 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
64 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
65 |n|(% colspan="16" %)Constant, n=0~~60, the unit is ms
66 | | | | | | | | | | | | | | | | |
67
68 **Program example**
69
70 (% style="text-align:center" %)
71 [[image:7-7 High speed process_html_bcb03d347f659e21.jpg||height="237" width="300" class="img-thumbnail"]]
72
73 When X10 is triggered, the filter time of X0~~X7 is 5ms, when X10 is OFF, The filter time of X0~~ X7 is 15 ms.
74
75 = **6.8.3 MTR instruction** =
76
77 **Instruction description**
78
79 (% class="table-bordered" %)
80 |**Name**|**Function**|**Bit(bits)**|**Pulse type**|**Instruction format**|**Step**
81 |MTR|Multiplexes a bank of inputs into a number of sets of devices. Could only be used once.|16|No|MTR S D,,1,, D,,2,, n|9
82
83 This instruction is only for transistor plc. This instruction allows a selection of 8 consecutive input devices (head address S) to be used multiple times, i.e. each physical input has more than one, separate and quite different (D,,1,,) signal being processed. The result is stored in a matrix-table (head address D,,2,,). “n” is the number of scouldning column in matrix.
84
85 (% class="table-bordered" %)
86 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
87 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
88 |S|√| | | | | | | | | | | | | | |
89 |D1| |√| | | | | | | | | | | | | |
90 |D2| |√|√|√| | | | | | | | | | | |
91 |n|(% colspan="16" %)Constant, n=2~~8
92
93 **Program example**
94
95 (% style="text-align:center" %)
96 [[image:7-7 High speed process_html_ec8c75f5060253a5.jpg||height="54" width="400" class="img-thumbnail"]]
97
98 **The wiring:**
99
100 When output Y30 is ON only those inputs in the first bank are read. These results are then stored; in this example, auxiliary coils M10 to M17. The second step involves Y30 going OFF and Y31coming ON. This time only inputs in the second bank are read. These results are stored in devices M20 to M27. The last step of this example has Y31 going OFF and Y32 coming ON. This then allows all of the inputs in the second bank to be read and stored in devices M20 to M27. The processing of this instruction example would take 20 × 2 = 40 msec.
101
102 A scouldning input with a maximum of 64 points could be achieved using 8-point X output and 8-point transistor Y output. But it is not suitable for high speed input operations because it needs a time of 20 ms,8 line= 160 ms to read each input. Therefore, the ports after X20 are typically used as the scouldning inputs. This instruction is allowed to be used only once in the program.
103
104 (% style="text-align:center" %)
105 [[image:7-7 High speed process_html_d712c907a19ec1b6.jpg||height="458" width="600" class="img-thumbnail"]]
106
107 = **6.8.4 DHSCR instruction** =
108
109 **Instruction description**
110
111 (% class="table-bordered" %)
112 |**Name**|**Function**|**Bit**|**Pulse type**|**Instruction format**|**Step**
113 |DHSCR|Resets the selected output when the specified high speed counter equals the test value|32|No|DHSCR S,,1,, S,,2,, D|13
114
115 The HSCR compares the current value of the selected high speed counter (S,,2,,) against a selected value (S,,1,,). When the counters current value changes to a value equal to S1, the device specified as the destination (D) is reset.
116
117 (% class="table-bordered" %)
118 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
119 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
120 |S,,1,,| | | | |√|√| |√|√|√|√|√|√|√|√|√
121 |S,,2,,| | | | | | | | | | | | |√| | |
122 |D| |√|√|√| | | | | | | | | | | |
123
124 **Program example**
125
126 (% style="text-align:center" %)
127 [[image:7-7 High speed process_html_d4622aff42a2be76.jpg||height="157" width="600" class="img-thumbnail"]]
128
129 In the example above, Y10 would be reset only when C255’s value stepped from 199 to 200 or from 201 to 200. If the current value of C255 was forced to equal 200 by test techniques, output Y10 would NOT reset.
130
131 The operation principle of the HSCR command is similar to that of the HSCS instruction, except that the HSCR output action is just opposite to the HSCS instruction, i.e., when the counter value is equal, the specified output will be reset.
132
133 (% class="box infomessage" %)
134 (((
135 **Note: **There is no limit on the number of DHSZ,DHSCS and DHSCR created, but only 6 DHSZ, DHSCS, and DHSCR can be active at the same time.
136 )))
137
138 = **6.8.5 DHSCS instruction** =
139
140 **Instruction description**
141
142 (% class="table-bordered" %)
143 |**Name**|**Function**|**Bit**|**Pulse type**|**Instruction format**|**Step**
144 |DHSCS|Sets the selected output when the specified high speed counter value equals the test value|32|No|DHSCS S,,1,, S,,2,, D|13
145
146 The HSCS set, compares the current value of the selected high speed counter (S,,2,,) against a selected value (S,,1,,). When the counters current value changes to a value equal to S1 the device specified as the destination (D) is set ON.
147
148 It is recommended that the drive input used for the high speed counter functions; HSCS, HSCR, HSCZ is the special auxiliary RUN contact M8000.
149
150 If more than one high speed counters function is used for a single counter the selected flag devices (D) should be kept within 1 group of 8 devices, i.e. Y0-7, M10-17.
151
152 All high speed counter functions use an interrupt process; hence, all destination devices (D) are updated immediately.
153
154 (% class="table-bordered" %)
155 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
156 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
157 |S,,1,,| | | | |√|√| |√|√|√|√|√|√|√|√|√
158 |S,,2,,| | | | | | | | | | | | |√| | |
159 |D| |√|√|√| | | | | | | | | | | |
160
161 **Program example**
162
163 **Example 1:**
164
165 (% style="text-align:center" %)
166 [[image:7-7 High speed process_html_3aace41414766cc2.jpg||height="156" width="600" class="img-thumbnail"]]
167
168 **Example 2:**
169
170 (% style="text-align:center" %)
171 [[image:7-7 High speed process_html_89438e3da1774961.jpg||height="193" width="300" class="img-thumbnail"]]
172
173 LX3V could use interrupt pointers I010 through I060 (6 points) as destination devices (D). This enables interrupt routines to be triggered directly when the value of the specified high speed counter reaches the value in the HSCS instruction. When (D) is between I010~~I060, the subprogram for interrupting 0~~5 in the high-speed counter needs to be initiated.
174
175 (% class="box infomessage" %)
176 (((
177 **Note: **There is no limit on the number of DHSZ,DHSCS and DHSCR created, but only 6 DHSZ, DHSCS, and DHSCR can be active at the same time.
178 )))
179
180 = **6.8.6 DHSZ instruction** =
181
182 **Instruction description**
183
184 (% class="table-bordered" %)
185 |**Name**|**Function**|**Bit**|**Pulse type**|**Instruction format**|**Step**
186 |DHSZ|The current value of a high speed counter is checked against a specified range|32|No|DHSZ S,,1,, S,,2,, S D|17
187
188 This instruction works in exactly the same way as the standard ZCP. The only difference is that the device being compared is a high speed counter (specified as S). Also, all of the outputs (D) are updated immediately due to the interrupt operation of the DHSZ. It should be remembered that when a device is specified in operand D it is in fact a head address for 3 consecutive devices. Each one is used to represent the status of the current comparison.
189
190 * S,,1,, is the lower limit; S,,1,, must be equal to or less than S2.
191 * S,,2,, is the upper limit.
192 * S must be C235~~C255, because C235~~C255 are 32bit counter, so user must use DHSZ not HSZ.
193 * D is for storing comparison result. When it is Y0~~Y17 or M or S, there is no latency. For other output port, the output will not be executed until program END.
194
195 (% class="table-bordered" %)
196 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
197 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
198 |S,,1,,| | | | |√|√| |√|√|√|√|√|√|√|√|√
199 |S,,2,,| | | | |√|√| |√|√|√|√|√|√|√|√|√
200 |S| | | | | | | | | | | | |√| | |
201 |D| |√|√|√| | | | | | | | | | | |
202
203 **Program example**
204
205 (% style="text-align:center" %)
206 [[image:7-7 High speed process_html_5a7b133dc73dd30f.jpg||height="224" width="500" class="img-thumbnail"]]
207
208 (% class="box infomessage" %)
209 (((
210 **Note: **There is no limit on the number of DHSZ,DHSCS and DHSCR created, but only 6 DHSZ, DHSCS, and DHSCR can be active at the same time.
211 )))
212
213 = **6.8.6 **SPD** instruction** =
214
215 **Instruction description**
216
217 (% class="table-bordered" %)
218 |**Name**|**Function**|**Bit**|**Pulse type**|**Instruction format**|**Step**
219 |SPD|Detects the number of ‘encoder’ pulses in a given time frame. Results could be used to calculate speed|16|No|SPD S,,1,, S,,2,, D|7
220
221 The number of pulses received at S,,1,, are counted and stored in D+1; this is the current count value. The counting takes place over a set time frame specified by S,,2,, in msec. The time remaining on the current ‘timed count’, is displayed in device D+2.
222
223 The number of counted pulses (of S,,1,,) from the last timed count is stored in D.
224
225 (% class="table-bordered" %)
226 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
227 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
228 |S,,1,,|√| | | | | | | | | | | | | | |
229 |S,,2,,| | | | |√|√| |√|√|√|√|√|√|√|√|√
230 |D| | | | | | | | | | | |√|√|√|√|√
231
232 **Program example**
233
234 (% style="text-align:center" %)
235 [[image:7-7 High speed process_html_82860708e693606a.jpg||height="77" width="400" class="img-thumbnail"]]
236
237 X0 is the pulse input port.
238
239 D0 defines the set time frame.
240
241 Current count value, device D10
242
243 Accumulated/ last count value, device D11
244
245 Current time remaining in msec, device D12
246
247 = **6.8.8 PLSY instruction** =
248
249 **Instruction description**
250
251 (% class="table-bordered" %)
252 |**Name**|**Function**|**Bit**|**Pulse type**|**Instruction format**|**Step**
253 |PLSY|(% rowspan="2" %)Outputs a specified number of pulses at a set frequency|16|No|(% rowspan="2" %)PLSY S,,1,, S,,2,, D|7
254 |DPLSY|32|Yes|13
255
256 A specified quantity (S2) of pulses is output through device D at a specified frequency S1. This instruction is used in situations where the quantity of outputs is of primary concern.
257
258 For PLSY, S1’s range is 1~~32767 Hz, for DPLSY, S1’s range is 1~~200000 Hz.
259
260 For PLSY, S2’s range is 1~~32767, for DPLSY, S1’s range is 1~~2147483647. If S2 is 0, it means there is no limitation for the output pulse quantity.
261
262 For LX3V/3VP/3VE, D could be Y0~~Y3. For LX3V (1s) type, D could only be Y0 or Y1.
263
264 (% class="table-bordered" %)
265 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
266 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
267 |S,,1,,| | | | | | | |√|√|√|√|√|√|√|√|√
268 |S,,2,,| | | | | | | |√|√|√|√|√|√|√|√|√
269 |D| |√| | | | | | | | | | | | | |
270
271 **Program example**
272
273 (% style="text-align:center" %)
274 [[image:7-7 High speed process_html_96c6d839f94ba458.jpg||height="61" width="400" class="img-thumbnail"]]
275
276 In the example, when X0 is OFF, the output becomes 0 too, when X0 becomes ON again it will react initially.
277
278 A single pulse is described as having a 50% duty cycle. This means it is ON for 50% of the pulse and OFF for the 50% of the pulse. The actual is controlled by interrupt handling, i.e. the output cycle is not affected by the scould time of the program.
279
280 The pulse completion flag (M8029) is set when the PLSY instruction is done.
281
282 **The related variable in the PLSY:**
283
284 * D8141 (high byte), D8140 (low byte): Y000 the count of output pulse, when the direction is reverse, Y000 decrease. (32-bits)
285 * D8143 (high byte), D8142 (low byte): Y001 the count of output pulse, when the direction is reverse, Y000 decrease. (32-bits)
286 * D8151 (high byte), D8150 (low byte): Y002 the count of output pulse, when the direction is reverse, Y000 decrease.(32-bit)
287 * D8153 (high byte), D8152 (low byte): Y003 the count of output pulse, when the direction is reverse, Y000 decrease.(32-bit)
288 * M8145: Y000 stop output pulse (immediately)
289 * M8146: Y001 stop output pulse (immediately)
290 * M8152: Y002 stop output pulse (immediately)
291 * M8153: Y003 stop output pulse (immediately)
292 * M8147: Y000 monitor in the output pulse(BUSY/READY)
293 * M8148: Y001 monitor in the output pulse(BUSY/READY)
294 * M8149: Y002 monitor in the output pulse(BUSY/READY)
295 * M8150: Y003 monitor in the output pulse(BUSY/READY)
296
297 = **6.8.9 PWM instruction** =
298
299 **Instruction description**
300
301 (% class="table-bordered" %)
302 |**Name**|**Function**|**Bit**|**Pulse type**|**Instruction format**|**Step**
303 |PWM|Generates a pulse train with defined pulse characteristics|16|No|PWM S,,1,, S,,2,, D|7
304
305 Only transistor type PLC could support PWM instruction. S,,1,, defines the width of the pulse, S,,2,, defines the pulse period, and D defines the output port. For LX3V (1S firmware), the output port could be Y0 or Y1, for LX3V (2N firmware), the output port could be Y0~~Y3.
306
307 The output port couldn’t be the same with PLSY or PLSR instruction.
308
309 S,,1,, <= S,,2,,, the setting range of S,,1,, is 0~~32767 ms. S,,2,, ranges from 1 to 32767ms.
310
311 (% class="table-bordered" %)
312 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
313 |**X**|**Y**|**M**|**S**|**K**|**H**|**E**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**V**|**Z**
314 |S,,1,,| | | | |√|√| |√|√|√|√|√|√|√|√|√
315 |S,,2,,| | | | |√|√| |√|√|√|√|√|√|√|√|√
316 |D| |√| | | | | | | | | | | | | |
317
318 **Program example**
319
320 (% style="text-align:center" %)
321 [[image:7-7 High speed process_html_d3d534d5d0b8fb51.jpg||height="197" width="500" class="img-thumbnail"]]
322
323 **Thousand-ratio pattern**
324
325 The thousand-ratio pattern: the thousand-ratio pattern is to divide the periodic parameters evenly equal to 1000. The user sets correspond to the control bit ON for thousand-ratio pattern as follows:
326
327 (% class="table-bordered" %)
328 |**Outputs**|Y0|Y1|Y2|Y3
329 |**Control bits**|M8134|M8135|M8136|M8137
330
331 **[Example]**
332
333 (% style="text-align:center" %)
334 [[image:7-7 High speed process_html_cef6612aa705d4ce.jpg||height="262" width="500" class="img-thumbnail"]]
335
336 Cycle set to 100ms, duty ratio if set to 500, then output to high level is 50ms, low level is 50ms; duty ratio if set to 100, then output to high level is 10ms, low level is 90ms; duty ratio if set to 900, then output high level is 90ms, low level is 10ms;
337
338 **Calculation formula:** t (ms) =T0 (ms) *K/1000
339
340 High level time (ms) = cycle time (ms) * duty ratio/1000
341
342 Low level time (ms) = cycle time (ms) – high level time (ms)
343
344 = **6.8.10 PLSR instruction** =
345
346 **Instruction description**
347
348 (% class="table-bordered" %)
349 |(% style="width:93px" %)**Name**|(% style="width:535px" %)**Function**|**Bit**|**Pulse type**|**Instruction format**|**Step**
350 |(% style="width:93px" %)PLSY|(% rowspan="2" style="width:535px" %)Outputs a specified number of pulses at a set frequency|16|No|(% rowspan="2" %)PLSY S,,1,, S,,2,, S,,3,, D|7
351 |(% style="width:93px" %)DPLSY|32|Yes|17
352
353 Because of the nature of the high speed output, transistor output units should be used with this instruction. Relay outputs will suffer from a greatly reduced life and will cause false outputs to occur due to the mechanical ‘bounce’ of the contacts.
354
355 * S,,1,,: The maximum frequency, the range is 10~~100,000Hz
356 * S,,2,,: A specified quantity of output pulses, 16-bit operation: 110 to 32,767 pulses, 32-bit operation: 110 to 2,147,483,647 pulses. If it was less than 110, PLC couldn’t output pulse;
357 * S,,3,,: The acceleration time, the range is 10~~32,000 (ms).
358 * D: output port, for LX3V/3VP/3VE, D could be Y0~~Y3, for LX3V (1s) type, D could only be Y0 or Y1.
359
360 (% class="table-bordered" %)
361 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
362 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
363 |S,,1,,| | | | |√|√| |√|√|√|√|√|√|√|√|√
364 |S,,2,,| | | | |√|√| |√|√|√|√|√|√|√|√|√
365 |S,,3,,| | | | |√|√| |√|√|√|√|√|√|√|√|√
366 |D| |√| | | | | | | | | | | | | |
367
368 **Program example**
369
370 (% style="text-align:center" %)
371 [[image:7-7 High speed process_html_3b46454b18532a23.jpg||height="103" width="500" class="img-thumbnail"]]
372
373 (% style="text-align:center" %)
374 [[image:7-7 High speed process_html_1f699763d7829b6.jpg||height="310" width="700" class="img-thumbnail"]]
375
376 The special registers corresponding to each output port are listed as follow:
377
378 (% class="table-bordered" %)
379 |(% colspan="2" style="width:149px" %)**Register**|(% style="width:523px" %)**Definition**|**Remarks**
380 |D8140|(% style="width:91px" %)Low byte|(% rowspan="2" style="width:523px" %)Number of total pulses output to Y0 port set in the PLSY or PLSR instruction|(% rowspan="10" %)Applicable instructions: use DMOV K0 D81xx to perform clear operation
381 |D8140|(% style="width:91px" %)High byte
382 |D8142|(% style="width:91px" %)Low byte|(% rowspan="2" style="width:523px" %)Number of total pulses output to Y1 port set in the PLSY or PLSR instruction
383 |D8143|(% style="width:91px" %)High byte
384 |D8150|(% style="width:91px" %)Low byte|(% rowspan="2" style="width:523px" %)Number of total pulses output to Y2 port set in the PLSY or PLSR instruction
385 |D8151|(% style="width:91px" %)High byte
386 |D8152|(% style="width:91px" %)Low byte|(% rowspan="2" style="width:523px" %)Number of total pulses output to Y3 port set in the PLSY or PLSR instruction
387 |D8153|(% style="width:91px" %)High byte
388 |D8136|(% style="width:91px" %)Low byte|(% rowspan="2" style="width:523px" %)Accumulative value of the number of the pulses already output to Y0 and Y1
389 |D8137|(% style="width:91px" %)High byte
390
391 The output frequency range of this instruction is 10 ~~ 100, 000Hz. When it is out of range, it will be automatically converted into the range and then executed. However, the actual output frequency depends on the following formula.
392
393 Output frequency=
394
395 (% style="text-align:center" %)
396 [[image:7-7 High speed process_html_264371750fbe73ba.jpg||height="27" width="400" class="img-thumbnail"]]
397
398 The frequency of the initial and final stages of acceleration should not be lower than the result of the above formula.
399
400 Example: Maximum speed is 50,000, acceleration /deceleration time is 100ms.
401
402 [[image:7-7 High speed process_html_19453a8b227b5316.jpg]] = 500 (Hz)
403
404 When maximum frequency S1 is specified to 50000Hz, the actual output frequency at the early stage of acceleration and at the late stage of deceleration is 500Hz.
405
406 (% style="text-align:center" %)
407 [[image:7-7 High speed process_html_5692a599dd293f8a.jpg||height="242" width="600" class="img-thumbnail"]]
408
409 1. **Note for use**
410
411 * The instruction is executed in an interruption way; therefore, it will not be influenced by the scouldning cycle;
412 * When the instruction power flow is OFF, the deceleration stop is active; when the power flow is changed from OFF→ON, the pulse output process starts over again.
413 * During the pulse output process, changing the operand has no effect on this output, and the modified content will take effect when the instruction is executed next time.
414 * Special auxiliary coil M8029 is turned ON when the specified number of pulses has been completed. The pulse count and completion flag (M8029) are reset when the PLSY instruction is de-energized. If “0" (zero) is specified, the PLSY instruction will continue generating pulses for as long as the instruction is energized.
415 * The process couldn’t be repeated with the output port number of the PWM instruction.
416
417 = **6.8.11 PLSR2 instruction** =
418
419 **1) Instruction description**
420
421 (% class="table-bordered" %)
422 |**Name**|**Function**|**Bit**|**Pulse type**|**Instruction format**|**Step **
423 |PLSR2|Multi-speed pulse output|16|No |PLSR2 S,,1,,D,,1,,D,,2,,|7
424
425 (% class="table-bordered" %)
426 |(% rowspan="2" %)**Operand** |(% colspan="4" %)**Bit device **|(% colspan="12" %)**Word device**
427 |X|Y|M|S|K|H |E|KnX|KnY|KnM |KnS|T |C|D|V|Z
428 |S ,,1,,| | | | | | | | | | | | | |v| |
429 |D,,1,,| |v| | | | | | | | | | | | | |
430 |D,,2,,| |v|v|v| | | | | | | | | | | |
431
432 This instruction is only valid for LX3VP series PLC.
433
434 PLSR2 instruction sets parameters on table list, and generates relative/ absolute position pulse according specified port, frequency, direction and ramp time. so that servo actuator gives the offset on the motion based on the current position. Only transistor output PLC supports this instruction.
435
436 S,,1,,: Register parameter, Dn is the start register of the specified register segment;
437
438 D,,1,, Pulse output port, designated Y0-Y3;
439
440 D,,2,,: The direction or position variable output port, ON: indicates the operating forward; otherwise, run in reverse.
441
442
443 (% style="text-align:center" %)
444 [[image:1620463452720-887.png||height="77" width="400" class="img-thumbnail"]]
445
446
447 (% class="table-bordered" %)
448 |(((
449 **S,,1,,**
450
451 **Register offset**
452 )))|**Content**|**Description**
453 |S,,1,,+0|Table flag|Retention
454 |S,,1,,+1|Table version|Retention
455 |S,,1,,+2|Pulse total number of segments|1-12
456 |S,,1,,+3|Acceleration and deceleration mode|0: First acceleration mode; 1: Later acceleration mode
457 |S,,1,,+4|Acceleration time|50-32000ms
458 |S,,1,,+5|Deceleration time|50-32000ms
459 |S,,1,,+6|Default frequency|10HZ-200KHZ
460 |S,,1,,+7| |
461 |S,,1,,+8|Relative / absolute mode|0: relative; 1: Absolute
462 |S,,1,,+ 9-** **S,,1,,+19|Retention|Retention
463 |S,,1,,+20|First segment pulse frequency|10HZ-200KHZ
464 |S,,1,,+21| |
465 |S,,1,,+22|First segment total number of pulses|No
466 |S,,1,,+23| |
467 |S,,1,,+24|First segment wait condition|(((
468 0: pulse transmission is completed;
469
470 1: waiting time;
471
472 2: wait signal;
473
474 3: Trigger signal. (With [waiting condition] and [Pending Register] with use)
475 )))
476 |S,,1,,+25|First segment Wait register type|(((
477 Waiting condition register type and relationship:
478
479 Pulse transmission completion: None
480
481 Waiting time: = 0: D register; = 1: constant;
482
483 Wait signal: = 0: X register; = 1: M bit register;
484
485 Trigger: = 0: X register; = 1: M bit register.
486 )))
487 |S,,1,,+26|First segment constant value / standby register number|No
488 |S,,1,,+27| |
489 |S,,1,,+28|Retention|Retention
490 |S,,1,,+29|Retention|Retention
491 |...|...|...
492 |S,,1,,+ 10 + n * 10|The N-th pulse frequency|10HZ - 200KHZ
493
494 **2) Programming example**
495
496 The demonstration shown below is parameters settings for 4 segments pulse starting with D0, the acceleration time is 100 ms from lowest frequency to the default frequency(100,000Hz), the deceleration time is 100 ms, it is in absolute mode.
497
498
499 (% style="text-align:center" %)
500 [[image:1620463472811-235.png||height="374" width="700" class="img-thumbnail"]]
501
502 The number of pulses of the frequency of each segment and the wait condition as follows:
503
504 (% class="table-bordered" %)
505 |**Stage**|**Frequency**|**Pulses**|**Mode**|**Condition**
506 |1|10,000|10,000|waiting time|K100
507 |2|20,000|20,000|Waiting for the signal|M1
508 |3|15,000|40,000|Trigger|X1
509 |4|30,000|60,000|No wait condition|K0
510
511 Configured in accordance with parameters:
512
513 (% style="text-align:center" %)
514 [[image:1620463489594-301.png||height="1128" width="700" class="img-thumbnail"]]
515
516 **3) Parameter Description**
517
518 1) ** **S,,1,,+2: pulse for setting the number of stages (word), a data range 1-12, it means support 1-12 segments;
519
520 2) Acceleration and deceleration modes
521
522 S,,1,,+3: to set the acceleration and deceleration patterns (words), is set to 0 before the addition mode is set to 1 after addition mode, wherein:
523
524 a) Early acceleration mode: When a multi-stage pulse is applied and the first stage pulse finished according to first stage frequency, the next stage frequency has been accelerated in advance.
525
526 b) Later acceleration mode: When a multi-stage pulse is applied and the first stage pulse finished according to first stage frequency, the next stage frequency just begin to accelerate.
527
528 For example, now need three stages of pulse, the first pulse frequency is 2000Hz, the number of pulse is 2000, the second pulse frequency is 4000Hz, the number of pulse is 4000, and the third pulse frequency is 6000Hz, the number of pulse is 6000.
529
530 **Early acceleration mode as below:**
531
532 (% style="text-align:center" %)
533 [[image:1620463500954-987.png||height="305" width="500" class="img-thumbnail"]]
534
535 **Later acceleration mode as below:**
536
537 (% style="text-align:center" %)
538 [[image:1620463504313-304.png||height="303" width="500" class="img-thumbnail"]]
539
540 (3) Acceleration time, deceleration time and default frequency
541
542 S,,1,,+14 (single word) is the acceleration time;
543
544 S,,1,,+5 (single word) deceleration time;
545
546 S,,1,,+6 (double word) default frequency;
547
548 The output frequency range of this instruction is 10 ~~ 200, 000Hz. When the maximum speed(acceleration and deceleration) beyond this range,PLC will automatically convert (up or down) to the able range and perform.
549
550 The acceleration time refers to the time from the base frequency to the default frequency, and the deceleration time refers to the time from the default frequency to the base frequency.
551
552
553 (% style="text-align:center" %)
554 [[image:1620463515599-686.png||height="509" width="700" class="img-thumbnail"]]
555
556 (4) Relative, absolute mode
557
558 S1+8 (single word) is used in setting the parameters of pulse configuration for relative mode or absolute mode. When it is set to (relative mode), that means the pulse number and current value register is relative position. Set to 1 (absolute mode), that means pulse number and current value register is absolute position.
559
560 The corresponding relationship between the output port and the current pulse value register is as follows:
561
562 l [Y000] output, the current pulse value register is [D8141 (high byte), D8140 (low byte)] (32 bits)
563
564 l [Y001] output, the current pulse value register is [D8143 (high bytes), D8142 (low bytes)] (32 bits)
565
566 l [Y002] output, the current pulse value register is [D8151 (high bytes), D8150 (low bytes)] (32 bits)
567
568 l [Y003] output, the current pulse value register is [D8153 (high bytes), D8152 (low bytes)] (32 bits)
569
570 **For example**
571
572 Now need three stages of pulse, the first pulse frequency is 2000Hz, the number of pulse is 2000, the second pulse frequency is 4000Hz, the number of pulse is 4000, and the third pulse frequency is 6000Hz, the number of pulse is 6000Hz. 
573
574 The corresponding mode settings are as follows:
575
576 (% class="table-bordered" %)
577 |**Stage**|**Frequency**|**Pulses**|**Mode**|**Condition**
578 |1|2000|2000|No waiting condition|K0
579 |2|4000|4000|No waiting condition|K0
580 |3|6000|6000|No waiting condition|K0
581
582 PLC ladder setting as below:
583
584 (% style="text-align:center" %)
585 [[image:1620463634015-908.png||height="927" width="700" class="img-thumbnail"]]
586
587 Absolute mode setting as below:
588
589 (% class="table-bordered" %)
590 |**Stage**|**Frequency**|**Pulses**|**Mode**|**Condition**
591 |1|2000|2000|No waiting condition|K0
592 |2|4000|4000|No waiting condition|K0
593 |3|6000|6000|No waiting condition|K0
594
595 PLC ladder setting as below:
596
597 (% style="text-align:center" %)
598 [[image:1620463530261-493.png||height="927" width="700" class="img-thumbnail"]]
599
600 **✎Note: **absolute mode, if the current position of the same segment with the next paragraph, it is considered the next paragraph does not exist, at some speed will drop to zero.
601
602 The following table shows the absolute mode, the first segment a second segment of the same pulse position where:
603
604 (% class="table-bordered" %)
605 |**Stage**|**Frequency**|**Pulses**|**Mode**|**Condition**
606 |1|2000|2000|No waiting condition|K0
607 |2|3000|2000|No waiting condition|K0
608 |3|2000|3000|No waiting condition|K0
609
610 Pulse waveform:
611
612
613 (% style="text-align:center" %)
614 [[image:1620463650482-502.png||height="224" width="300" class="img-thumbnail"]]
615
616 (5) Wait condition
617
618 S,,1,,+ 14 + 10 * N (word) is the wait condition paragraph N, S,,1,,+ 15 + 10 * N (word) register type waiting, S,,1,,+ 16 + 10 * N (double word) waiting ID register / constant value. Wait condition = 0 is no wait condition, when latency = 1, 2 = wait for signals, the trigger signal = 3.
619
620 Wait condition and waiting and waiting for the register number register / constant value used in conjunction.
621
622 a) No wait condition:
623
624 S,,1,,+ 14 + 10 * N (word) = 0 is no wait condition. After performing the set pulse number of this paragraph, immediately jump to a specified later burst.
625
626 **Example: **current pulse, the three sections, the first section of 2000Hz pulse frequency, pulse number of 2000; the second segment pulse frequency of 4000Hz, the pulse number of 4000; the third paragraph of the pulse frequency is 6000Hz, number of pulses is 6000, no wait condition.
627
628 (% class="table-bordered" %)
629 |**Stage**|**Frequency**|**Pulses**|**Mode**|**Condition**
630 |1|2000|2000|No waiting condition|K0
631 |2|4000|4000|No waiting condition|K0
632 |3|6000|6000|No waiting condition|K0
633
634 PLC ladder setting as below:
635
636 (% style="text-align:center" %)
637 [[image:1620463660756-329.png||height="914" width="700" class="img-thumbnail"]]
638
639 Pulse waveform:
640
641 (% style="text-align:center" %)
642 [[image:1620463666488-698.png||height="217" width="400" class="img-thumbnail"]]
643
644 b) Wait time
645
646 S,,1,, + 14 + 10 * N (word) = 1, the waiting time. S,,1,, + 15 + 10 * N (word) = 0, D is waiting registers, wait = 1 is constant.
647
648 After the completion of the current segment pulse output start time, when the timer time in place, immediately jump to a specified pulse period; measured time may be a constant or a register designated D, Unit: ms (range 1-65535ms).
649
650 **Example: **current pulse, the three sections, the first stage pulse frequency is 2000Hz, number of pulses is 2000, the waiting time K100 (Unit: MS); second stage pulse frequency of 4000Hz, the number of 4000 pulses, DlOO waiting time; first three sections pulse frequency of 6000Hz, number of pulses is 6000, no wait condition.
651
652 (% class="table-bordered" %)
653 |**Stage**|**Frequency**|**Pulses**|**Mode**|**Condition**
654 |1|2000|2000|Waiting time|K100
655 |2|4000|4000|Waiting time|D100
656 |3|6000|6000|No waiting condition|K0
657
658 PLC ladder setting as below:
659
660 (% style="text-align:center" %)
661 [[image:1620463673319-877.png||height="1162" width="700" class="img-thumbnail"]]
662
663 Pulse waveform:
664
665 (% style="text-align:center" %)
666 [[image:1620463679793-871.png||height="324" width="500" class="img-thumbnail"]]
667
668 c) Wait signal:
669
670 S,,1,,+ 14 + 10 * N (word) = 2 is waiting for a signal. S,,1,, + 15 + 10 * N (word) = 0, the wait signal X, M = 1 is waiting for a signal.
671
672 After the completion of the current transmission burst, begins waiting 'waiting condition "in the signal, when the signal is ON, the transmission of the next burst starts. Signal can be X, M-bit registers.
673
674 **Example:** current pulse, the three sections, the first stage pulse frequency is 2000Hz, number of pulses is 2000, waiting for the signal to M2; second stage pulse frequency of 4000Hz, number of pulses is 4000, the wait signal is an X2; third segment pulse frequency of 6000Hz, number of pulses is 6000, no wait condition.
675
676 (% class="table-bordered" %)
677 |**Stage**|**Frequency**|**Pulses**|**Mode**|**Condition**
678 |1|2000|2000|Waiting for the signal|M2
679 |2|4000|4000|Waiting for the signal|X2
680 |3|6000|6000|No waiting condition|K0
681
682 PLC ladder setting as below:
683
684 (% style="text-align:center" %)
685 [[image:1620463689627-462.png||height="1344" width="700" class="img-thumbnail"]]
686
687 Pulse waveform:
688
689 (% style="text-align:center" %)
690 [[image:1620463696399-746.png||height="443" width="500" class="img-thumbnail"]]
691
692 If the signal is received before sending the next segment immediately after the end of the current period.
693
694 Pulse waveform is as follows:
695
696 (% style="text-align:center" %)
697 [[image:1620463701461-694.png||height="396" width="400" class="img-thumbnail"]]
698
699 d) Trigger signal:
700
701 S,,1,, + 14 + 10 * N (word) = 3 when a trigger signal. S,,1,, + 15 + 10 * N (word) = 0 when the trigger signal X, M = 1 when the trigger signal.
702
703 After the burst transmission start pulse current, if the current number of pulses before transmitting end, the outer portion of the trigger signal operation (ON state), the pulse immediately transmits the next segment. At the end of the current pulse is sent segment, if no trigger signal (OFF state), it will continue to send the next segment pulse (i.e., pulse period will be configured represents a no-wait mode pulsing conditions, but pulse current segment transmission a trigger signal received during will directly deceleration pulse to the next paragraph).
704
705 **Example:** current pulse, the three sections, the first stage pulse frequency is 2000Hz, number of pulses is 2000, the trigger signal is M2; second stage pulse frequency of 4000Hz, number of pulses is 4000, an X2 is a trigger signal; a third segment pulse frequency of 6000Hz, number of pulses is 6000, no wait condition.
706
707 (% class="table-bordered" %)
708 |**Stage**|**Frequency**|**Pulses**|**Mode**|**Condition**
709 |1|2000|2000|Waiting for the signal|M2
710 |2|4000|4000|Waiting for the signal|X2
711 |3|6000|6000|No waiting condition|K0
712
713 PLC ladder setting as below:
714
715 (% style="text-align:center" %)
716 [[image:1620463723045-420.png||height="1142" width="700" class="img-thumbnail"]]
717
718 Pulse waveform:
719
720 (% style="text-align:center" %)
721 [[image:1620463718288-804.png||height="382" width="400" class="img-thumbnail"]]
722
723 If the received signal in the received signal in advance or the acceleration section, the acceleration in the current segment to the next segment pulse frequency directly.
724
725 Pulse waveform:
726
727 (% style="text-align:center" %)
728 [[image:1620463722095-402.png||height="379" width="400" class="img-thumbnail"]]
729
730 **✎Note: **in response to a trigger signal to trigger interrupt.
731
732 (6) The number of pulses is not enough to accelerate to the instruction frequency
733
734 a) Single-stage pulse:
735
736 If the number of pulses is not enough to accelerate to the instruction frequency, pulse waveform is triangular.
737
738 (% class="table-bordered" %)
739 |**Stage**|**Frequency**|**Pulses**|**Mode**|**Condition**
740 |1|6000|400|No waiting condition|K0
741
742 Pulse waveform:
743
744 (% style="text-align:center" %)
745 [[image:1620463729305-104.png||height="295" width="300" class="img-thumbnail"]]
746
747 b) Multi-pulse:
748
749 Before the addition mode, the number of the current segment if the pulse is transmitted, the pulse frequency setting section does not reach the frequency, the pulse frequency "hop" occurs, i.e. a direct jump to the next section of the frequency.
750
751 (% class="table-bordered" %)
752 |**Stage**|**Frequency**|**Pulses**|**Mode**|**Condition**
753 |1|2000|200|No waiting condition|K0
754 |2|4000|4000|No waiting condition|K0
755 |3|6000|6000|No waiting condition|K0
756
757 Pulse waveform:
758
759 (% style="text-align:center" %)
760 [[image:1620463734909-385.png||height="248" width="400" class="img-thumbnail"]]
761
762 After the addition mode, the number of the current segment if the pulse transmission is completed, the pulse frequency does not reach the set frequency segment, it will continue at the current frequency of the transmission pulse period, up until the end of transmission of the pulse.
763
764 (% class="table-bordered" %)
765 |**Stage**|**Frequency**|**Pulses**|**Mode**|**Condition**
766 |1|2000|200|No waiting condition|K0
767 |2|4000|4000|No waiting condition|K0
768 |3|6000|200|No waiting condition|K0
769
770 Pulse waveform:
771
772 (% style="text-align:center" %)
773 [[image:1620463760934-382.png||height="308" width="300" class="img-thumbnail"]]
774
775 **✎Note: **
776 1) During the execution of instructions, even changing the contents of the operation cannot be manifested in the current run, the only effective when the next instruction is executed.
777
778 2) If during instruction execution, the instruction driven contacts becomes OFF, and the deceleration stop completion flag M8029 performed at this time does not operate;
779
780 3) Positioning instruction (ZRN / PLSV / DRVI / DRVA / PLSR2) may be used more than once in the program, but not to the same output port at the same time the output operations.
781
782 4) When the trigger current of the instruction is OFF, when it is triggered again, it must be after the operation bit (Y000:[M8147]; Y001:[M8148]; Y002:[M8149]; Y003:[M8150]) , can trigger again.
783
784 5) When the positioning instruction is triggered again, it must have an OFF time of one cycle or more. If the re-trigger is executed within a shorter time than the above conditions, [Operation Error] will occur when the first instruction is executed (calculated).
785
786 6) A sufficient number of pulses set for acceleration and deceleration.
787
788 = **6.8.12 PTO instruction** =
789
790 **Instruction description**
791
792 (% class="table-bordered" %)
793 |**Name**|**Function**|**Bit**|**Pulse type**|**Instruction format**|**Step**
794 |PTO|(% rowspan="2" %)Pulse envelope output instruction|16|No|(% rowspan="2" %)PTO S,,1,, S,,2,,|5
795 |DPTO|32|No|9
796
797 (% class="table-bordered" %)
798 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
799 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
800 |S,,1,,| | | | | | | | | | | | | |√| |
801 |S,,2,,| |√| | | | | | | | | | | | | |
802
803 Take operator S1 as the starting address, then the data table is as below:
804
805 (% class="table-bordered" %)
806 |**ADDRESS OFFSET**|**SECTION**|**DESCRIPTION**
807 |0|(% rowspan="4" %) |Number of segments: 1 to 255 (0 means no output)
808 |1|Record the number currently being
809 |2|(((
810 The number of executions of the Envelope table (-1: doesn’t execute
811
812 0: always execute ) ( Restart to take effect)
813 )))
814 |.....|Reserved
815 |10|(% rowspan="3" %)#1|Initial frequency (range of frequencies) (0~~200,000)
816 |11|Frequency increment (signed: -20,000~~20,000)
817 |12|Pulse number(1-4,294,967,295)
818 |13|(% rowspan="3" %)#2|Initial frequency(range of frequencies) (0~~200,000)
819 |14|Frequency increment (signed: -20,000~~20,000)
820 |15|Pulse number (1-4,294,967,295)
821 |(continuous)|#3|(continuous)
822
823 When using the 32-bit instruction DPTO, the address offset is 2.
824
825 **Program example**
826
827 (% style="text-align:center" %)
828 [[image:7-7 High speed process_html_dcb9a63e226337ca.jpg||height="64" width="300" class="img-thumbnail"]]
829
830 Use the PTO to control a stepper motor to achieve a simple acceleration, constant speed and deceleration or a complex process consisting of up to 255 pulses, and every waveform is acceleration, constant speed or deceleration operation. Starting and final pulse frequency is 2KHZ, the maximum pulse frequency is 10KHZ, and it requires 4000 pulses to achieve the desired number of revolutions of the motor.
831
832 (% style="text-align:center" %)
833 [[image:7-7 High speed process_html_223ae1db241e8916.jpg||height="295" width="600" class="img-thumbnail"]]
834
835 The example above required to produce a output signal contained three sections:
836
837 * Acceleration (section 1);
838 * Constant speed (section 2);
839 * Deceleration (section 3);
840
841 Frequency increment of each section:
842
843 * Sec 1(acceleration) frequency increment=40
844 * Sec 2(constant speed) frequency increment=0
845 * Sec 3(deceleration) frequency increment= -20
846
847 The corresponding envelope table is as below:
848
849 (% class="table-bordered" %)
850 |**Segment**|**Register address**|**Value**|**Description**
851 |(% rowspan="3" %)Parameter setting|D0|3|Total segments
852 |D1|0|Record the number currently being executed
853 |D2|0|Number of executions of envelope table
854 |(% rowspan="3" %)#1|D10|2khz|Initial frequency
855 |D11|40|Frequency increment
856 |D12|200|Pulse number
857 |(% rowspan="3" %)#2|D13|10khz|Initial frequency
858 |D14|0|Frequency increment
859 |D15|3400|Pulse number
860 |(% rowspan="3" %)#3|D16|10khz|Initial frequency
861 |D17|-20|Frequency increment
862 |D18|400|Pulse number
863
864 **Note for use:**
865
866 1. Take the frequency as the standard, run the command during the operation.
867 1. The range of frequency:0 to 100 kHz
868 1. If the envelope table is beyond the effective range of the device, no pulse will be sent out.
869 1. Frequency increment formula:
870 1. Frequency increment= (final frequency - initial frequency)/ the number of pulse
871 1. The frequency interval of pulse (including inter-segment and segment) couldnot exceed 2000Hz, otherwise it will go wrong (the wrong number is 6780) and the instruction will not be executed.
872 1. If the frequency interval of pulse (including inter-segment and segment) exceeds 2000Hz, then PTO will not be executed:
873
874 * Cyclic transmission mode: the last pulse of the last segment and the first pulse of the first segment are regarded as the neighboring pulse.
875 * Single transmission mode: the last pulse of the last segment and the first pulse of the first segment are not regarded as the neighboring pulse.