Wiki source code of 07 Convenient instructions

Last modified by Wecon on 2025/09/03 21:03

Show last authors
1 == **ABSD/BIN 16-bit data absolute method** ==
2
3 **ABSD**
4
5 Create multiple output modes corresponding to the current counter (BIN 16-bit value).
6
7 -[ABSD (S1) (S2) (D) (N)]
8
9 **Content, range and data type**
10
11 |**Parameter**|(% style="width:711px" %) |(% style="width:164px" %)**Range**|(% style="width:228px" %)**Data type**|(% style="width:253px" %)**Data type (label)**
12 |(S1)|(% style="width:711px" %)(((
13 The start device number storing the data table**Content**
14
15 (rising edge point and falling edge point)
16 )))|(% style="width:164px" %)-|(% style="width:228px" %)Signed BIN 16 bit|(% style="width:253px" %)ANY16
17 |(S2)|(% style="width:711px" %)The counter number used for monitoring of the current value compared to the data table|(% style="width:164px" %)-|(% style="width:228px" %)Signed BIN 16 bit|(% style="width:253px" %)ANY16
18 |(D)|(% style="width:711px" %)The number of points of the output start device|(% style="width:164px" %)-|(% style="width:228px" %)Bit|(% style="width:253px" %)ANY16_BOOL
19 |(N)|(% style="width:711px" %)Number of table rows and output bit device points|(% style="width:164px" %)1 to 64|(% style="width:228px" %)Signed BIN 16 bit|(% style="width:253px" %)ANY16
20
21 **Device used**
22
23 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="16" %)**Devices**|(((
24 **Offset modification**
25 )))|(((
26 **Pulse extension**
27 )))
28 |**Y**|**M**|**S**|**SM**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**K**|**H**|**[D]**|**XXP**
29 |(% rowspan="4" %)ABSD|Parameter 1| | | | | |●|●|●|●|●|●|●|●|●| | |●|
30 |Parameter 2| | | | | | | | | | |●| | | | | |●|
31 |Parameter 3|●|●|●|●|●| | | | | | | | | | | |●|
32 |Parameter 4| | | | | |●|●|●|●|●|●|●|●|●|●|●|●|
33
34 **Features**
35
36 Take the turntable to rotate 1 revolution (0 to 360 degrees) to control the output ON/OFF as an example. (1 degree, 1 pulse angle signal)
37
38 Compare the data table of row (N) starting from (S1) (row (N) multiply by 2 points) with the current value of the counter (S2), from (D) to continuous (N) in the course of one revolution The output is ON/OFF control up to the point.
39
40 (% style="text-align:center" %)
41 [[image:07-3 Basic instructions_html_f3445e45f259d300.gif]]
42
43 Use the transfer instruction to write the following data into (S1) to (S1)+2(N)-1 in advance. For example, the rising edge point data stores 16-bit data to even-numbered devices in advance, and the falling edge point data stores 16-bit data to odd-numbered devices in advance.
44
45 |(% colspan="2" %)**Rising edge point**|(% colspan="2" %)**Falling edge point**|(% rowspan="2" %)**Object output**
46 |**-**|**Data value (example)**|**-**|**Data value (example)**
47 |(S1)|40|(S1)+1|140|(D)
48 |(S1)+2|100|(S1) +3|200|(D) +1
49 |(S1) +4|160|(S1) +5|60|(D) +2
50 |(S1) +6|240|(S1) +7|280|(D) +3
51 |...|(% rowspan="2" %)-|...|(% rowspan="2" %)-|...
52 |(S1)+2(N)-2|(S1)+2(N)-1|(D) +N-1
53
54 If the instruction input is set to ON, (D) is the start, (N) point is the output mode as shown below. Each rising edge point and falling edge point can be individually changed by rewriting the data from (S1) to (S1)+2(N)-1.
55
56 (% style="text-align:center" %)
57 [[image:07-3 Basic instructions_html_40a97945575e913d.png]]
58
59 (% class="box infomessage" %)
60 (((
61 ✎**Note: **
62
63 When specifying the number of bit devices in (S1), the device number should be a multiple of 16 (0, 16, 32, 64...), and only K4 should be specified for the number of bits.
64
65 The number of target output points is determined by the value of (N). (1≤(N)≤64)
66
67 Even if the instruction input is turned off, the output does not change.
68 )))
69
70 **Error code**
71
72 |**Error code**|**Content**
73 |4084H|When the value specified in (N) exceeds the range of 1 to 64
74 |4085H|When the device specified in the read application instruction (S1), (S2 )and (N) exceeds the corresponding device range
75 |4086H|When the device specified in the write application instruction (D) exceeds the corresponding device range
76
77 **Example**
78
79 Refer to the example in the function description.
80
81 == **DABSD/BIN 32-bit data absolute method** ==
82
83 **DABSD**
84
85 Create multiple output modes corresponding to the current counter (BIN 32-bit value).
86
87 -[DABSD (S1) (S2) (D) (N)]
88
89 **Content, range and data type**
90
91 |**Parameter**|(% style="width:701px" %)**Content**|(% style="width:163px" %)**Range**|(% style="width:263px" %)**Data type**|(% style="width:229px" %)**Data type (label)**
92 |(S1)|(% style="width:701px" %)(((
93 The start device number storing the data table
94
95 (rising edge point and falling edge point)
96 )))|(% style="width:163px" %)-|(% style="width:263px" %)Signed BIN 32 bit|(% style="width:229px" %)ANY32
97 |(S2)|(% style="width:701px" %)The counter number used for monitoring of the current value compared to the data table|(% style="width:163px" %)-|(% style="width:263px" %)Signed BIN 32 bit|(% style="width:229px" %)ANY32
98 |(D)|(% style="width:701px" %)The number of points of the output start device|(% style="width:163px" %)-|(% style="width:263px" %)Bit|(% style="width:229px" %)ANY16_BOOL
99 |(N)|(% style="width:701px" %)Number of table rows and output bit device points|(% style="width:163px" %)1 to 64|(% style="width:263px" %)Signed BIN 32 bit|(% style="width:229px" %)ANY32
100
101 **Device used**
102
103 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="18" %)**Devices**|**Offset modification**|(((
104 **Pulse extension**
105 )))
106 |**Y**|**M**|**S**|**SM**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**[D]**|**XXP**
107 |(% rowspan="4" %)DABSD|Parameter 1| | | | | |●|●|●|●|●|●|●|●|●|●|●| | |●|
108 |Parameter 2| | | | | | | | | | |●| | | |●|●| | |●|
109 |Parameter 3|●|●|●|●|●| | | | | | | | | | | | | |●|
110 |Parameter 4| | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●|●|
111
112 **Features**
113
114 Take the turntable to rotate 1 revolution (0 to 360 degrees) to control the output ON/OFF as an example. (1 degree, 1 pulse angle signal)
115
116 Compare the data table of row (N) starting from (S1) (row (N) × 4 points) with the current value of the counter (S2), from (D) to continuous (N) in the course of one revolution The output is ON/OFF control up to the point.
117
118 (% style="text-align:center" %)
119 [[image:07-3 Basic instructions_html_a1942137c71d3fd0.gif]]
120
121 Use the transfer instruction to write the following data into (S1), (S1)+1 to (S1)+4(N)-2, (S1)+4(N)-1 in advance. For example, the rising edge point data stores 32-bit data to even-numbered devices in advance, and the falling edge point data stores 32-bit data to odd-numbered devices in advance.
122
123 |(% colspan="2" %)**Rising edge point**|(% colspan="2" %)**Falling edge point**|(% rowspan="2" %)**Object output**
124 |**-**|**Data value (example)**|**-**|**Data value (example)**
125 |(S1)+1, (S1)|40|(S1)+3, (S1)+2|140|(D)
126 |(S1)+5, (S1)+4|100|(S1) +7, (S1) +6|200|(D) +1
127 |(S1) +9, (S1) +8|160|(S1)+11, (S1)+10|60|(D) +2
128 |(S1) +13, (S1) +12|240|(S1) +15, (S1) +14|280|(D) +3
129 |...|(% rowspan="2" %)-|...|(% rowspan="2" %)-|...
130 |(((
131 (S1)+4(N)-3,
132
133 (S1)+4(N)-4
134 )))|(((
135 (S1)+4(N)-1,
136
137 (S1)+4(N)-2
138 )))|(D) +N-1
139
140 If the instruction input is set to ON, (D) is the start, (NN) point is the output mode as shown below. Each rising edge point and falling edge point can be individually changed by rewriting the data from (S1) to (S1)+2(N)-1.
141
142 (% style="text-align:center" %)
143 [[image:07-3 Basic instructions_html_14c5b0b965b99aa8.png]]
144
145 (% class="box infomessage" %)
146 (((
147 ✎**Note: ** The high-speed counter can be specified in the DABSD instruction. When a high-speed counter is specified, the current value of the counter will have a response delay due to the scan cycle in the output mode.
148 )))
149
150 When specifying the number of bit devices in (S1), the device number should be a multiple of 16 (0, 16, 32, 64...), and only K8 should be specified for the number of bits.
151
152 The number of target output points is determined by the value of (N). (1≤(N)≤64)
153
154 Even if the instruction input is turned off, the output does not change.
155
156 **Error code**
157
158 |**Error code**|**Content**
159 |4084H|When the value specified in (N) exceeds the range of 1 to 64
160 |4085H|When the device specified in the read application instruction (S1), (S2 )and (N) exceeds the corresponding device range
161 |4086H|When the device specified in the write application instruction (D) exceeds the corresponding device range
162
163 **Example**
164
165 Refer to the example in the function description.
166
167 == **SER/16-bit data search** ==
168
169 **SER(P)**
170
171 Search the same data and the maximum and minimum values from the data table.
172
173 -[SER (S1) (S2) (D) (N)]
174
175 **Content, range and data type**
176
177 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
178 |(S1)|Search for the start device number of the same data, maximum value, and minimum value|-|Signed BIN 16 bit|ANY16
179 |(S2)|Search for the value of the same data or its storage destination device number|-|Signed BIN 16 bit|ANY16
180 |(D)|Search for the same data, maximum value, minimum value and store the start device number|-|Signed BIN 16 bit|ANY16
181 |(N)|Search the number of same data, maximum and minimum|1 to 256|Signed BIN 16 bit|ANY16
182
183 **Device used**
184
185 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="11" %)**Devices**|(((
186 **Offset modification**
187 )))|(((
188 **Pulse extension**
189 )))
190 |**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**K**|**H**|**[D]**|**XXP**
191 |(% rowspan="3" %)SER|Parameter 1|●|●|●|●|●|●|●|●|●| | |●|●
192 |Parameter 2|●|●|●|●|●|●|●|●|●|● |● |●|●
193 |Parameter 3| |●|●|●|●|●|●|●|●| | |●|●
194 | |Parameter 4|●|●|●|●|●|●|●|●|●|●|●|●|●
195
196 **Features**
197
198 For (S1) as the first (N) data, search for the same data as the BIN 16-bit data of (S2), and store the result in (D) to (D)+4.
199
200 In the case of the same data, the number of the same data, the first/final position, and the maximum and minimum positions of the same data are stored in the device with the first 5 points (D).
201
202 If there is no identical data, the number of identical data, the first/final position, and the maximum and minimum positions of the same data are stored in the device with the first 5 points (D). However, in (D) is the first 3 points of the device (the number of the same data, the first ~\~\ final position), 0 is stored.
203
204 • The structure and data examples of the search result table are as follows. (N=10)
205
206 |(% rowspan="2" %)**The searched device (s1)**|(% rowspan="2" %)(((
207 **The value of the searched data (s1)**
208 )))|(% rowspan="2" %)(((
209 **Comparison data (S2) value**
210 )))|(% rowspan="2" %)**Data location**|(% colspan="3" %)**search results**
211 |**Maximum value (d) +4**|**Consistent (d)**|**Minimum value (d+3)**
212 |(s1)|K100|(% rowspan="10" %)K100|0| |○(First time)|
213 |(s1)+1|K111|1| | |
214 |(s1)+2|K100|2| |○|
215 |(s1) +3|K98|3| | |
216 |(s1) +4|K123|4| | |
217 |(s1) +5|K66|5| | |○
218 |(s1) +6|K100|6| |○ (final)|
219 |(s1) +7|K95|7| | |
220 |(s1) +8|210|8|○| |
221 |(s1) +9|K88|9| | |
222
223 • The search result table based on the above example is shown below.
224
225 |**Device number**|**Content**|**Search result items**
226 |(d)|3|Number of identical data
227 |(d) +1|0|The position of the same data (first time)
228 |(d) +2|6|The position of the same data (last time)
229 |(d) +3|5|The final position of the minimum
230 |(d) +4|8|The final position of maximum
231
232 ✎**Note: ** Perform algebraic size comparison. (-10<2)
233
234 When there are multiple minimum and maximum values in the data, the positions behind each are stored.
235
236 If driven by this instruction , the search result (d) occupies 5 points of (d), (d)+1, (d)+2, (d)+3, (d)+4. Be careful not to overlap with the device used for machine control.
237
238 **Error code**
239
240 |**Error code**|**Content**
241 |4084H|When the value specified in (N) exceeds the range of 0 to 256
242 |4085H|When the device specified in read application instruction (S1), (S2), (D) and (N) exceeds the corresponding device range
243 |4086H|When the device specified in the write application instruction (D) exceeds the corresponding device range
244
245 **Example**
246
247 Refer to the example in the function description.
248
249 == **DSER/32-bit data search** ==
250
251 **DSER(P)**
252
253 Search the same data and the maximum and minimum values from the data table.
254
255 -[DSER (S1) (S2) (D) (N)]
256
257 **Content, range and data type**
258
259 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
260 |(S1)|Search for the start device number of the same data, maximum value, and minimum value|-|Signed BIN 32 bit|ANY32
261 |(S2)|Search for the value of the same data or its storage destination device number|-|Signed BIN 32 bit|ANY32
262 |(D)|Search for the same data, maximum value, minimum value and store the start device number|-|Signed BIN 32 bit|ANY32
263 |(N)|Search the number of same data, maximum and minimum|1 to 128|Signed BIN 32 bit|ANY32
264
265 **Device used**
266
267 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="13" %)**Devices**|(((
268 **Offset modification**
269 )))|(((
270 **Pulse extension**
271 )))
272 |**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**[D]**|**XXP**
273 |(% rowspan="3" %)DSER|Parameter 1|●|●|●|●|●|●|●|●|●|●|●| | |●|●
274 |Parameter 2|●|●|●|●|●|●|●|●|●|●|●|●|●|●|●
275 |Parameter 3| |●|●|●|●|●|●|●|●|●|●| | |●|●
276 | |Parameter 4|●|●|●|●|●|●|●|●|●|●|●|●|●|●|●
277
278 **Features**
279
280 For (S1)+1, (S1) as the initial (N) data, search for the same data as the BIN 32-bit data of (S2)+1, (S2), and store the result in (D)+1, (D) to (D) +9, (D) +8.
281
282 In the case of the same data, the number of the same data, the first/final position and the maximum and minimum values are stored in a 5-point BIN 32-bit data device starting with (D)+1 and (D) position.
283
284 In the case of no identical data, the number of identical data, the first/final position and the maximum and minimum values are stored in the device with (D)+1 and (D) as the starting BIN 32-bit data with 5 points position. However, 0 is stored in the 32-bit 3-point device (the number of the same data, the first~\~\last position) with (D)+1 and (D) as the starting BIN.
285
286 • The structure and data examples of the search result table are as follows. (N=10)
287
288 |(% rowspan="2" %)**The searched device (S1)**|(% rowspan="2" %)**The value of the searched data (S1)**|(% rowspan="2" %)**Comparison data (S2) value**|(% rowspan="2" %)**Data location**|(% colspan="3" %)**search results**
289 |**Maximum value (d) +4**|**Consistent (d)**|**Minimum value (d+3)**
290 |(S1)+1, (S1)|K100|(% rowspan="10" %)K100|0| |○ (First time)|
291 |(S1)+3, (S1)+2|K111|1| | |
292 |(S1)+5, (S1)+4|K100|2| |○|
293 |(S1) +7, (S1) +6|K98|3| | |
294 |(S1) +9, (S1) +8|K123|4| | |
295 |(S1)+11, (S1)+10|K66|5| | |○
296 |(S1) +13, (S1) +12|K100|6| |○ (final)|
297 |(S1) +15, (S1) +14|K95|7| | |
298 |(S1) +17, (S1) +16|210|8|○| |
299 |(S1) +19, (S1) +18|K88|9| | |
300
301 • The search result table based on the above example is shown below.
302
303 |**Device number**|**Content**|**Search result items**
304 |(d)+1, (d)|3|Number of identical data
305 |(d)+3, (d)+2|0|The position of the same data (first time)
306 |(d) +5, (d) +4|6|The position of the same data (last time)
307 |(d) +7, (d) +6|5|The final position of the minimum
308 |(d) +9, (d) +8|8|The final position of maximum
309
310 ✎**Note: ** Perform algebraic size comparison. (-10<2)
311
312 When there are multiple minimum and maximum values in the data, the positions behind each are stored.
313
314 If driven by this instruction , the search result (d) occupies [(d)+1, (d)], [(d)+3, (d)+2,], [(d)+5, (d)+ 4], [(d)+7, (d)+6], [(d)+9, (d)+8] 5 points. Be careful not to overlap with the device used for machine control.
315
316 **Error code**
317
318 |**Error code**|**Content**
319 |4084H|When the value specified in (N) exceeds the range of 0 to 128
320 |4085H|When the device specified in read application instruction (S1), (S2), (D) and (N) exceeds the corresponding device range
321 |4086H|When the device specified in the write application instruction (D) exceeds the corresponding device range
322
323 **Example**
324
325 Refer to the example in the function description.
326
327 == **ALT/Bit device output inversion** ==
328
329 **ALT(P)**
330
331 If the input turns ON, the bit device is inverted (ON→OFF).
332
333 -[ALT (d)]
334
335 **Content, range and data type**
336
337 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
338 |(d)|Alternate output device number|-|Bit|ANY16_BOOL
339
340 **Device used**
341
342 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="5" %)**Devices**|(((
343 **Offset modification**
344 )))|(((
345 **Pulse extension**
346 )))
347 |**Y**|**M**|**S**|**SM**|**D.b**|**[D]**|**XXP**
348 |ALT|Parameter 1|●|●|●|●|●|●|●
349
350 **Features**
351
352 Alternating output (level 1)
353
354 Each time the instruction input changes from OFF→ON, the bit device specified in (d) is turned OFF→ON inverted.
355
356 (% style="text-align:center" %)
357 [[image:07-3 Basic instructions_html_64d6b43aae907fc6.png]]
358
359 (% style="text-align:center" %)
360 [[image:07-3 Basic instructions_html_47cb55e016f3f842.png]]
361
362 Divided frequency output (through alternate output (2 levels))
363
364 Combine multiple ALTP instructions to perform frequency division output.
365
366 (% style="text-align:center" %)
367 [[image:07-3 Basic instructions_html_2bd7efa01abfeb7f.png]]
368
369 (% style="text-align:center" %)
370 [[image:07-3 Basic instructions_html_6ad85407517ccc5d.png]]
371
372 (% class="box infomessage" %)
373 (((
374 ✎**Note:** If you program with the ALT instruction, the action will be reversed every operation cycle. To reverse the action by the instruction ON→OFF, use the ALT instruction (pulse execution type) or set the instruction contact to LDP (pulse execution type).
375 )))
376
377 **Error code**
378
379 |**Error code**|**Content**
380 |4085H|When the device specified in the read application instruction (d) exceeds the corresponding device range
381 |4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
382
383 **Example**
384
385 (1) Start/stop via an input.
386
387 1) After pressing the button X4, start the action of output Y1 and stop the action of Y0.
388
389 2) After pressing the button X4 again, stop the action of output Y1 and start the action of Y0.
390
391 (% style="text-align:center" %)
392 [[image:07-3 Basic instructions_html_5d556de47da4d7b8.png]]
393
394 (1) Flashing action
395
396 1) When input X6 is ON, the contact of timer T2 will act instantaneously every 5 seconds.
397
398 2) The contact of T2 makes the output Y7 alternately ON/OFF every time it is ON.
399
400 (% style="text-align:center" %)
401 [[image:07-3 Basic instructions_html_8f95b199c8d317c0.png]]
402
403 (% style="text-align:center" %)
404 [[image:07-3 Basic instructions_html_1508064e50616736.png]]
405
406 == **INCD/BIN 16-bit data relative method** ==
407
408 **INCD**
409
410 Use a pair of counters to create multiple output modes.
411
412 -[INCD (S1) (S2) (D) (N)]
413
414 **Content, range and data type**
415
416 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
417 |(S1)|The start device number storing the set value|-|Signed BIN 16 bit|ANY16
418 |(S2)|The start number of counter for current value monitoring|-|Signed BIN 16 bit|ANY16
419 |(D)|The start bit device number of output|-|Bit|ANY16_BOOL
420 |(N)|Number of output bit device points|1 to 64|Signed BIN 16 bit|ANY16
421
422 **Device used**
423
424 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="16" %)**Devices**|(((
425 **Offset modification**
426 )))|(((
427 **Pulse extension**
428 )))
429 |**Y**|**M**|**S**|**SM**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**K**|**H**|**[D]**|**XXP**
430 |(% rowspan="4" %)INCD|Parameter 1| | | | | |●|●|●|●|●|●|●|●|●| | |●|
431 |Parameter 2| | | | | | | | | | |●| | | | | |●|
432 |Parameter 3|●|●|●|●|●| | | | | | | | | | | |●|
433 |Parameter 4| | | | | |●|●|●|●|●|●|●|●|●|●|●|●|
434
435 **Features**
436
437 Compare the data table of row (N) starting from (S1) (row (N) × 2 points occupied) with the current value of the counter (S2), reset if they match, and control the output on/off in turn.
438
439 **Example**
440
441 The operation is explained by the following circuit example. (S2) Take up 2 points. C0 and C1 are equivalent to this in the following timing chart.
442
443 (% style="text-align:center" %)
444 [[image:07-3 Basic instructions_html_b25fa01ec61c4289.png||height="114" width="598"]]
445
446 • It is assumed that the following data is written using the transfer instruction in advance.
447
448 |(% colspan="2" %)**Storage device**|(% colspan="2" %)**Output**
449 |**-**|**Data value (example)**|**-**|**Example**
450 |(S1)|D300=20|(D)|M0
451 |(S1)+1|D301=30|(D) +1|M1
452 |(S1)+2|D302=10|(D) +2|M2
453 |(S1) +3|D303=40|(D) +3|M3
454 |...|....|...|...
455 |(S1)+(N)-1|-|(D) +N-1|-
456
457 Timing diagram
458
459 (% style="text-align:center" %)
460 [[image:image-20220609110509-3.png]]
461
462 If the instruction contact turns on, the M0 output turns on.
463
464 The output (M0) is reset when the current value of C0 reaches the comparison value D300, the count value of the process counter C1 is +1, and the current value of the counter C0 is also reset.
465
466 The next output M1 turns ON.
467
468 Compare the current value of C0 with the comparison value D301. When the comparison value is reached, the output M1 is reset, the count value of the process counter C1 is +1, and the current value of the counter C0 is also reset.
469
470 Compare the same to the point (K4) specified in (N). (1≤(N)≤64)
471
472 After the final process specified in (N) is completed, the execution end flag SM229 turns ON for 1 operation cycle. SM229 is the instruction execution end flag used in multiple instructions, so it should be used as a contact after the instruction to execute the end flag dedicated to the instruction.
473
474 Return to the beginning and repeat output.
475
476 ✎**Note:** In (S1), when specifying the device number by specifying the digits of the bit device, the device number should be a multiple of 16 (0, 16, 32, 64...).
477
478 Up to 4 INCD instructions can be driven simultaneously in the program.
479
480 **Error code**
481
482 |**Error code**|**Content**
483 |4084H|When the value specified in (N) exceeds the range of 1 to 64
484 |4085H|When the device specified in read application instruction (S1), (S2), (D) and (N) exceeds the corresponding device range
485 |4086H|When the device specified in the write application instruction (S2) and (D) exceeds the corresponding device range
486 |4089H|The number of instruction drives exceeds the limit.
487
488 **Example**
489
490 Refer to the example in the function description.
491
492 == **RAMP/Control ramp signal** ==
493
494 **RAM(P)**
495
496 Obtain data that changes between the start (initial value) and end (target value) two values specified (N) times.
497
498 -[RAMP (S1) (S2) (D) (N)]
499
500 **Content, range and data type**
501
502 |(% style="text-align:center; vertical-align:middle" %)**Parameter**|(% style="text-align:center; vertical-align:middle" %)**Content**|(% style="text-align:center; vertical-align:middle" %)**Range**|(% style="text-align:center; vertical-align:middle" %)**Data type**|(% style="text-align:center; vertical-align:middle" %)**Data type (label)**
503 |(% style="text-align:center; vertical-align:middle" %)(S1)|(% style="text-align:center; vertical-align:middle" %)The device number that stores the initial value of the set ramp|(% style="text-align:center; vertical-align:middle" %)-|(% style="text-align:center; vertical-align:middle" %)Signed BIN 16 bit|(% style="text-align:center; vertical-align:middle" %)ANY16
504 |(% style="text-align:center; vertical-align:middle" %)(S2)|(% style="text-align:center; vertical-align:middle" %)The device number that stores the set ramp target value|(% style="text-align:center; vertical-align:middle" %)-|(% style="text-align:center; vertical-align:middle" %)Signed BIN 16 bit|(% style="text-align:center; vertical-align:middle" %)ANY16
505 |(% style="text-align:center; vertical-align:middle" %)(D)|(% style="text-align:center; vertical-align:middle" %)The device number that stores the current value data of ramp|(% style="text-align:center; vertical-align:middle" %)-|(% style="text-align:center; vertical-align:middle" %)Signed BIN 16 bit|(% style="text-align:center; vertical-align:middle" %)ANY16
506 |(% style="text-align:center; vertical-align:middle" %)(N)|(% style="text-align:center; vertical-align:middle" %)Ramp transition time (scan period)|(% style="text-align:center; vertical-align:middle" %)1-32767|(% style="text-align:center; vertical-align:middle" %)Signed BIN 16 bit|(% style="text-align:center; vertical-align:middle" %)ANY16
507
508 **Device used**
509
510 |(% rowspan="2" style="text-align:center; vertical-align:middle" %)**Instruction**|(% rowspan="2" style="text-align:center; vertical-align:middle" %)**Parameter**|(% colspan="11" style="text-align:center; vertical-align:middle" %)**Devices**|(% style="text-align:center; vertical-align:middle" %)(((
511 **Offset modification**
512 )))|(% style="text-align:center; vertical-align:middle" %)(((
513 **Pulse extension**
514 )))
515 |(% style="text-align:center; vertical-align:middle" %)**KnX**|(% style="text-align:center; vertical-align:middle" %)**KnY**|(% style="text-align:center; vertical-align:middle" %)**KnM**|(% style="text-align:center; vertical-align:middle" %)**KnS**|(% style="text-align:center; vertical-align:middle" %)**T**|(% style="text-align:center; vertical-align:middle" %)**C**|(% style="text-align:center; vertical-align:middle" %)**D**|(% style="text-align:center; vertical-align:middle" %)**R**|(% style="text-align:center; vertical-align:middle" %)**SD**|(% style="text-align:center; vertical-align:middle" %)**K**|(% style="text-align:center; vertical-align:middle" %)**H**|(% style="text-align:center; vertical-align:middle" %)**[D]**|(% style="text-align:center; vertical-align:middle" %)**XXP**
516 |(% rowspan="4" style="text-align:center; vertical-align:middle" %)RAMP|(% style="text-align:center; vertical-align:middle" %)Parameter 1|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %) |(% style="text-align:center; vertical-align:middle" %) |(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)
517 |(% style="text-align:center; vertical-align:middle" %)Parameter 2|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %) |(% style="text-align:center; vertical-align:middle" %) |(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)
518 |(% style="text-align:center; vertical-align:middle" %)Parameter 3|(% style="text-align:center; vertical-align:middle" %) |(% style="text-align:center; vertical-align:middle" %) |(% style="text-align:center; vertical-align:middle" %) |(% style="text-align:center; vertical-align:middle" %) |(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %) |(% style="text-align:center; vertical-align:middle" %) |(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)
519 |(% style="text-align:center; vertical-align:middle" %)Parameter 4|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)●|(% style="text-align:center; vertical-align:middle" %)
520
521 **Features**
522
523 Specify the start value (S1) and the value to end (S2) in advance. If the instruction input is turned ON, the value divided by the number of times specified in (N) will be added to (S1) in sequence in each operation cycle The value of is stored in (D). This instruction and analog output can be combined to output soft start/stop instructions.
524
525 (% style="text-align:center" %)
526 [[image:07-3 Basic instructions_html_1b8169d8b0bd8e2a.gif]]
527
528 (D)+1 stores the number of scans (0→N times).
529
530 The time from the start to the end value requires operation cycle×(N) scan.
531
532 If the input instruction is turned OFF during operation, it will be in the execution interrupt state ((D): current value data retention. (D)+1 scan times clear), if it is turned ON again, (D) will be cleared (S1) Restart the action.
533
534 After the transition is completed, the instruction execution completed flag SM229 will act, and the value of (D) will return to the value of (S1).
535
536 (% style="text-align:center" %)
537 [[image:07-3 Basic instructions_html_fbf2fef521f03150.gif]]
538
539 In the case of obtaining the calculation result at a certain time interval (constant scan mode), write the specified scan time to SD120 (a value slightly longer than the actual scan time), and turn on SM120. For example, when the value is specified as 20 ms and N=100 times, the value of (D) changes from (S1) to (S2) in 2 seconds.
540
541 The value of the constant scan mode can also be set by the parameter setting of the engineering tool (the constant scan execution interval setting of the CPU parameter).
542
543 According to the ON/OFF action of the mode flag SM226, the content of (D) is changed as shown below.
544
545 (% style="text-align:center" %)
546 [[image:image-20220609111455-4.png]]
547
548 ✎**Note: ** When the power failure retention device (retention area) is specified in (D), the instruction input remains ON. When the CPU module is set to RUN (start), clear (D) in advance.
549
550 **Error code**
551
552 |(% style="text-align:center; vertical-align:middle" %)**Error code**|(% style="text-align:center; vertical-align:middle" %)**Content**
553 |(% style="text-align:center; vertical-align:middle" %)4084H|(% style="text-align:center; vertical-align:middle" %)When the value specified in (N) exceeds the specified range of 1 to 32767
554 |(% style="text-align:center; vertical-align:middle" %)4085H|(% style="text-align:center; vertical-align:middle" %)When the device specified in read application instruction (S1), (S2), (D) and (N) exceeds the corresponding device range
555 |(% style="text-align:center; vertical-align:middle" %)4086H|(% style="text-align:center; vertical-align:middle" %)When the device specified in the write application instruction (D) exceeds the corresponding device range
556
557 **Example**
558
559 (% style="text-align:center" %)
560 [[image:07-3 Basic instructions_html_e073826c2adb9e18.png||height="202" width="526"]]
561
562 As in the above procedure, turn SM120 ON, and the program will run with a constant scan cycle (the value in SD120 is 10ms). When M0=ON, it changes from 10 to 100 within 100×10ms.
563
564 == **ROTC/Rotary table proximity control** ==
565
566 **ROTC**
567
568 In order to take out the items on the rotating table, take out the window according to the requirements, and make the rotating table rotate nearby.
569
570 -[ROTC (S) (N1) (N2) (D)]
571
572 **Content, range and data type**
573
574 (% style="width:1482px" %)
575 |**Parameter**|(% colspan="2" style="width:1056px" %)**Content**|(% style="width:113px" %)**Range**|**Data type**|(% style="width:96px" %)**Data type (label)**
576 |(% rowspan="3" %)(S)|(% rowspan="3" %)The specified register of the calling condition (pre-set according to the transfer instruction)|(% style="width:280px" %)(s)+0: Register for counting|(% rowspan="3" style="width:113px" %)-|(% rowspan="3" %)Signed BIN 16 bit|(% rowspan="3" style="width:96px" %)ANY16
577 |(% style="width:280px" %)(s)+1: Call the window number setting
578 |(% style="width:280px" %)(s)+2: Call the item number setting
579 |(N1)|(% colspan="2" style="width:1056px" %)Number of divisions|(% style="width:113px" %)2 to 32767|Signed BIN 16 bit|(% style="width:96px" %)ANY16
580 |(N2)|(% colspan="2" style="width:1056px" %)Singular in low speed zone|(% style="width:113px" %)0 to 32767|Signed BIN 16 bit|(% style="width:96px" %)ANY16
581 |(% rowspan="8" %)(D)|(% rowspan="8" %)The specified bit of the calling condition (constitutes an internal contact circuit driven in advance from the input signal (X))|(% style="width:280px" %)(d): phase A signal|(% rowspan="8" style="width:113px" %)-|(% rowspan="8" %)Signed BIN 16 bit|(% rowspan="8" style="width:96px" %)ANY16
582 |(% style="width:280px" %)(d)+1: phase B signal
583 |(% style="width:280px" %)(d)+2: zero point detection signal
584 |(% style="width:280px" %)(d)+3: high-speed forward rotation
585 |(% style="width:280px" %)(d)+4: low speed forward rotation
586 |(% style="width:280px" %)(d)+5: stop
587 |(% style="width:280px" %)(d)+6: low speed reverse rotation
588 |(% style="width:280px" %)(d)+7: high-speed reverse rotation
589
590 **Device used**
591
592 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="16" %)**Devices**|(((
593 **Offset modification**
594 )))|(((
595 **Pulse extension**
596 )))
597 |**Y**|**M**|**S**|**SM**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**K**|**H**|**[D]**|**XXP**
598 |(% rowspan="4" %)ROTC|Parameter 1| | | | | | | | | | | |●|●|●| | |●|
599 |Parameter 2| | | | | |●|●|●|●|●|●|●|●|●|●|●|●|
600 |Parameter 3| | | | | |●|●|●|●|●|●|●|●|●|●|●|●|
601 |Parameter 4|●|●|●|●|●| | | | | | | | | | | |●|
602
603 **Features**
604
605 In order to take out the items on the rotating table divided into N1 (=10) as shown in the figure below, take out the inserted window as required, and rotate the rotating table nearby under the condition of N2 or (S), (D) . If the following operating conditions are specified, (D)+3 to (D)+7 can be used for forward/reverse, high-speed/low-speed/stop output.
606
607 (% style="text-align:center" %)
608 [[image:07-3 Basic instructions_html_925a71dc503c1b56.gif]]
609
610 Set up the switch X2 that is used to detect the two-phase shape (X0, X1) of the forward/reverse rotation of the rotary table and window 0. Replace X0 to X2 with (d) to (d) +2 internal contacts. The start device number specified in X or (d) can be arbitrary.
611
612 (% style="text-align:center" %)
613 [[image:07-3 Basic instructions_html_ead11fbdee314230.png||height="237" width="750"]]
614
615 (S) is a counter, which counts how many items come to window 0.
616
617 (S)+1 set the number of the window to be called.
618
619 (S)+2 sets the number of the recalled item.
620
621 Specify the number of divisions (N1) and low-speed operation section (N2) of the rotary table.
622
623 ✎**Note: ** If the instruction input is turned ON to drive the instruction, the result of (D)+3 to (D)+7 will be automatically obtained. If the instruction input is turned off, (D)+3 to (D)+7 will turn off.
624
625 As an example, when the rotation detection signal ((D) to (D)+2) is set to 10 actions within 1 division interval, the division number setting, calling window number setting, and article number setting should all be 10 Times the value. In this way, the setting value of the low-speed section can be set to the middle value of the number of divisions, etc.
626
627 When the instruction input is ON and the 0 point detection signal (M2) is turned ON, the content of the counting register (S) is cleared to 0. It is necessary to perform this clear operation in advance before starting operation.
628
629 ROTC instructions can drive up to 4.
630
631 **Error code**
632
633 |**Error code**|**Content**
634 |(% rowspan="5" %)4084H|When the value specified in (N1) exceeds the range of 2 to 32767
635 |When the value specified in (N2) exceeds the range of 0 to 32767
636 |When the values specified in (N1) and (N2) meet the condition of (N1)<(N2)
637 |When one of (S), (S)+1 and (S)+2 is negative.
638 |When one of (S), (S)+1 and (S)+2 is (N1) or more.
639 |4085H|When the device specified in read application instruction (S1), (N1), (N2) and (D) exceeds the corresponding device range
640 |4086H|When the device specified in the write application instruction (S2) and (D) exceeds the corresponding device range
641 |4089H|The number of instruction drives exceeds the limit.
642
643 **Example**
644
645 **&nbsp; &nbsp;&nbsp;**
646
647 |**Variable**|**Features**|**Instructions**
648 |D200|Used as a counting register|(% rowspan="3" %)The 3 units are pre-set by the user program
649 |D201|Call window number setting
650 |D202|Call work piece number setting
651
652 |M0|Phase A signal|(% rowspan="3" %)[[image:07-3 Basic instructions_html_b05232b20c72516e.png]] The user program executes before each scan of this statement:
653 |M1|Phase B signal
654 |M2|Zero point detection signal
655 |M3|High speed forward rotate|(% rowspan="5" %)(((
656 When X0 is ON, the result of M3 to M7 could be automatically obtained.
657
658 When X0 is OFF, M3 to M7 are all OFF.
659 )))
660 |M4|Low speed forward rotate
661 |M5|Stop
662 |M6|Low speed reverse rotate
663 |M7|High spped reverse rotate
664
665 == **STMR/Special function timer** ==
666
667 **STMR**
668
669 Use the 4 points starting from the device specified in (D) to perform 4 types of timer output.
670
671 -[STMR (S1) (S2) (D)]
672
673 **Content, range and data type**
674
675 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
676 |(S1)|Timer number used: T0 to T511 (100ms timer)|-|Device Name|ANY16
677 |(S2)|Timer setting value|1-32767|Signed BIN 16 bit|ANY16
678 |(D)|The start bit number of the output (occupies 4 points)|-|Bit|ANYBIT_ARRAY
679
680 **Device used**
681
682 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="17" %)**Devices**|(((
683 **Offset modification**
684 )))|(((
685 **Pulse extension**
686 )))
687 |**Y**|**M**|**S**|**SM**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|(% style="width:35px" %)**K**|**H**|**E**|**[D]**|**XXP**
688 |(% rowspan="3" %)STMR|Parameter 1| | | | | | | | | |●| | | | |(% style="width:35px" %) | | |●|
689 |Parameter 2| | | | | |●|●|●|●|●|●|●|●|●|(% style="width:35px" %)●|●| |●|
690 |Parameter 3|●|●|●|●|●| | | | | | | | | |(% style="width:35px" %) | | |●|
691
692 **Features**
693
694 Use the 4 points starting from the device specified in (d) to perform 4 types of timer output.
695
696 [[image:07-3 Basic instructions_html_1b67e302600b7119.png]]
697
698 1. STMR instruction instruction
699 1. The setting value specified in (S2)
700
701 (% style="text-align:center" %)
702 [[image:07-3 Basic instructions_html_d12632244cab61fa.png]]
703
704 The blink will be in (d)+3 normally closed contact through the following program which turns on/off the STMR instruction (T10 is allocated in (s1), K100 is allocated in (s2), and M0 is allocated in (d)) Output to (d)+1, (d)+2.
705
706 (% style="text-align:center" %)
707 [[image:07-3 Basic instructions_html_8d0e8c4155b28ac6.png||height="69" width="565"]]
708
709
710 (% style="text-align:center" %)
711 [[image:07-3 Basic instructions_html_4073e5b7f594eb20.gif||height="177" width="761"]]
712
713 The setting value of (S2) can be specified in the range of 1 to 32767 (1 to 3276.7 seconds).
714
715 ✎**Note: ** The timer number specified by this instruction cannot be reused with other general circuits (OUT instructions, etc.). In the case of repetition, the timer action cannot be executed correctly.
716
717 The timer specified in (S1) is regarded as a 100ms timer, starting from the rising edge of the instruction contact.
718
719 Occupy the device specified in 4 points (D) at the beginning. Be careful not to overlap with the device used for machine control.
720
721 When the instruction contact is turned off, (D), (D)+1, (D)+3 will turn off after the set time. (D) +2 and timer (S1) are reset immediately.
722
723 **Error code**
724
725 |**Error code**|**Content**
726 |4084H|When the value specified in (S2) is less or equal to 0
727 |4085H|When the device specified in the read application instruction (S2) and (d) exceeds the corresponding device range
728
729 **Example**
730
731 (% style="text-align:center" %)
732 [[image:07-3 Basic instructions_html_ed1c3a4c8c2a95a4.png]]
733
734 (((
735 Y0: When X10 changes from Off→On, Y0=On, when X10 changes from On→Off, Y0=Off after a delay of 10 seconds.
736
737 Y1: When X10 changes from On→Off, make Y1=On output once for 10 seconds.
738
739 Y3: When X10 changes from Off to On, Y3=On after 10 seconds of delay. When X10 changes from On to Off, Y3=Off after 10 seconds of delay.
740
741 Y2: When X10 changes from Off to On, output Y2=On once for 10 seconds.
742
743 (% style="text-align:center" %)
744 [[image:07-3 Basic instructions_html_92921cb32ad3702e.png]]
745 )))
746
747 If the component (d)+3 is introduced into the instruction stream, the oscillator output can be easily realized (this function can also be realized by the ALT instruction), as shown in the following figure:
748
749 (% style="text-align:center" %)
750 [[image:07-3 Basic instructions_html_5fc432cd39b880d1.png||height="96" width="416"]]
751
752 (% style="text-align:center" %)
753 [[image:07-3 Basic instructions_html_9eb78bb9348313e9.png]]
754
755 == **TTMR/Demonstration timer** ==
756
757 **TTMR**
758
759 Test the time when the TTMR instruction is ON. It is used when adjusting the timer setting time with buttons.
760
761 -[TTMR (D) (S)]
762
763 **Content, range and data type**
764
765 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
766 |(D)|Device for storing teaching data|-|Signed BIN 16 bit|ANY16
767 |(S)|Multiplying ratio of teaching data|0-2|Signed BIN 16 bit|ANY16
768
769 **Device used**
770
771 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="12" %)**Devices**|(((
772 **Offset modification**
773 )))|(((
774 **Pulse extension**
775 )))
776 |**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**K**|**H**|**E**|**[D]**|**XXP**
777 |(% rowspan="2" %)TTMR|Parameter 1| | | | |●|●|●|●|●| | | |●|
778 |Parameter 2|●|●|●|●|●|●|●|●|●|●|●| |●|
779
780 **Features**
781
782 Measure the pressing time of the execution instruction (button) in seconds, multiply it by the magnification (10^^S^^) specified in (s) and store it in the device specified in (d).
783
784 (% style="text-align:center" %)
785 [[image:07-3 Basic instructions_html_daaee135f53637e2.png]]
786
787 For the time stored in (d), when the hold time is[[image:/bin/download/PLC%20Editor2/07%20Basic%20instructions/07%20999/WebHome/07-3%20Basic%20instructions_html_8e930bf19df17d95.gif?rev=1.1||alt="07-3 Basic instructions_html_8e930bf19df17d95.gif"]],,[[image:07-3 Basic instructions_html_8e930bf19df17d95.gif]] ,,(unit: second), the actual value of (d) is as follows according to the magnification specified in (s).
788
789 |**(s)**|**Magnification**|**(D)**
790 |K0|[[image:07-3 Basic instructions_html_8e930bf19df17d95.gif]]|(D) ×1
791 |K1|[[image:07-3 Basic instructions_html_5333cfa3fe2c0673.gif]]|(D)×10
792 |K2|[[image:07-3 Basic instructions_html_4d4f3e62d3034598.gif]]|(D) ×100
793
794 |**(s)**|**(d)**|**(d)+1 (unit: 100 milliseconds)**
795 |K0 (unit: second)|[[image:07-3 Basic instructions_html_7138658e8b0315fd.gif]]|(d)+1 =(d)×10
796 |K1 (unit: 100 milliseconds)|[[image:07-3 Basic instructions_html_a180fcbcde4a1136.gif]]|(d)+1 =(d)
797 |K2 (unit: 10 milliseconds)|[[image:07-3 Basic instructions_html_bbc3d64c804018a8.gif]]|(d)+1 =(d)/10
798
799 (% class="box infomessage" %)
800 (((
801 ✎**Note: **If the instruction contact turns from ON→OFF, the current value of the hold time (d)+1 is cleared, and the teaching time (d) does not change.
802 )))
803
804 Occupy the device specified in the 2 teaching time (d) at the beginning. Be careful not to overlap with the device used for machine control.
805
806 **Error code**
807
808 |**Error code**|**Content**
809 |4084H|When the value specified in (N) exceeds the range of 0 to 2
810 |4085H|When the device specified in read application instruction (D) and (S) exceeds the corresponding device range
811 |4086H|When the device specified in the write application instruction (D) exceeds the corresponding device range
812
813 **Example**
814
815 Example 1
816
817 (% style="text-align:center" %)
818 [[image:07-3 Basic instructions_html_866f6d40473a09f9.png||height="81" width="429"]]
819
820 When X0 is closed, D10=D11; when X0 is opened, the value of D10 remains unchanged, while D11 becomes 0.
821
822 (% style="text-align:center" %)
823 [[image:07-3 Basic instructions_html_25bff2a7e21b8696.png]]
824
825 Example 2
826
827 (((
828 Use the TTMR instruction to write 10 sets of setting time, write the setting value into D10 to D19 in advance, reorganize the timer bit 100ms type timer, so 1/10 of the teaching data is the actual operating time (seconds)
829
830 Connect the 1-digit DIP switch to X10 to X13, use the BIN command to convert the setting value of the DIP switch into BIN value and store it in Z0
831
832 X0 is On, store the time (seconds) in D100
833
834 M100 demonstrates a scan cycle pulse generated by the release of the timer button X0
835
836 Use the setting number of the DIP switch as an indirect specified pointer, and then transfer the content of D100 to D10Z0 (D10 to D19)
837
838 (% style="text-align:center" %)
839 [[image:企业微信截图_16691916524162.png]]
840 )))
841
842 == **TRH/Conversion of wet and dry bulb temperature and humidity** ==
843
844 **TRH**
845
846 This instruction completes the conversion of dry bulb temperature, wet bulb temperature and corresponding humidity.
847
848 -[TRH (d1) (s) (d2) (N)]
849
850 **Content, range and data type**
851
852 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
853 |(d1)|humidity|0 to 100|Single precision floating point|ANYREAL_32
854 |(s)|Dry bulb temperature|-|Single precision floating point|ANYREAL_32
855 |(d2)|Wet bulb temperature|-|Single precision floating point|ANYREAL_32
856 |(N)|mode|0 to 1|Signed BIN 32 bit|ANY32
857
858 **Device used**
859
860 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="11" %)**Devices**|(((
861 **Offset**
862
863 **modification**
864 )))|(((
865 **Pulse**
866
867 **extension**
868 )))
869 |**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**K**|**H**|**[D]**|**XXP**
870 |(% rowspan="4" %)TRH|Parameter 1| | | | |●|●|●|●|●| | |●|
871 |Parameter 2| | | | |●|●|●|●|●| | |●|
872 |Parameter 3| | | | |●|●|●|●|●| | |●|
873 |Parameter 4|●|●|●|●|●|●|●|●|●|●|●|●|
874
875 **Features**
876
877 (N)There are two modes to choose from:
878
879 Mode 0: Calculate the corresponding humidity by wet bulb temperature and dry bulb temperature.
880
881 Mode 1: Calculate the corresponding wet bulb temperature by dry bulb temperature and humidity.
882
883 The conversion process formula is as follows:
884
885 Assuming that the wet bulb temperature is A, the dry bulb temperature is B, and the corresponding current humidity is C, the three meet the following conditions:
886
887
888 (% style="text-align:center" %)
889 [[image:企业微信截图_16691908453440.png]]
890
891
892 (% style="text-align:center" %)
893 [[image:企业微信截图_16691908518218.png]]
894
895
896 (% style="text-align:center" %)
897 [[image:企业微信截图_16691908544507.png]]
898
899
900 (% style="text-align:center" %)
901 [[image:企业微信截图_16691908572763.png]]
902
903 **✎Note:**
904
905 ● The wet bulb temperature is not greater than the dry bulb temperature. When the two are the same, the humidity reaches the maximum 100%.
906
907 ● The unit of dry and wet bulb temperature is (℃).
908
909 ● The general value range of dry bulb is between 0 to 100℃, the command does not judge its range, so pay special attention when using this command.
910
911 **Error code**
912
913 |**Error code**|**Content**
914 |(% rowspan="4" %)4084H|The value specified in (N) is out of the following range. 0 to 1
915 |The value specified in (d1) is out of the following range. 0 to 100
916 |A negative value is specified in (s).
917 |A negative value is specified in (d2).
918 |4085H|The output result of (d1)(s)(d2)(N) in the read application instruction exceeds the device range
919 |4086H|The output result of (d1)(d2) in the writing application instruction exceeds the device range
920
921 Dry and wet bulb humidity comparison table
922
923 (% style="text-align:center" %)
924 [[image:image-20221123154328-1.png]]
925
926 **Example**
927
928 (% style="text-align:center" %)
929 [[image:image-20221123154337-2.png]]
930
931 == **MOVAVG/BIN 32-bit moving average filtering instructions** ==
932
933 **MOVAVG**
934
935 (s1) is the data to be filtered, (s2) is the set sliding average window size, (d1) saves the process data in the instruction calculation in (s2+1) double-word devices after specifying the initial device, (d2 ) is the calculation end flag, (d3) saves the filtered result.
936 PLC Editor2 version that supports this instruction: 2.3.1 and above
937
938 -[MOVAVG (s1) (s2) (d1) (d2) (d3)]
939
940 **Content, range and data type**
941
942 |**Parameter**|**Contect**|**Range**|**Data type**|**Data type (label)**
943 |(s1)|The starting device number of the data to be filtered is stored|0、2^^-126^^≤~|(s)~|<2^^128^^|Single precision floating point|ANYREAL_32
944 |(s2)|The sliding average window size or the initial device number of the sliding average window is stored|1~~4294967295|Un-signed BIN 32 bit|ANY32
945 |(d1)|The storage instruction calculates the starting device number of the process data storage queue (consecutively occupies (s2+1) double-word devices)|-|Signed BIN 32 bit|ANY32_ARRAY
946 |(d2)|Instruction calculation end flag bit|-|Bit|ANYBIT
947 |(d3)|The starting device number of the filtered result is stored|-|Single precision floating point|ANYREAL_32
948
949 **Device used**
950
951 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|(((
952 **Offset**
953
954 **modification**
955 )))|(((
956 **Pulse**
957
958 **extension**
959 )))
960 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
961 |(% rowspan="5" %)MOVAVG|Parameter 1| | | | | | | | | | | | | | | | |●|●| |●| | | | |●|
962 |Parameter 2| | | | | | | | | | | | | | | | |●|●| | | |●|●| |●|
963 |Parameter 3| | | | | | | | | | | | | | | | |●|●| |●| | | | |●|
964 |Parameter 4| |●|●|●| | | | | |●| | | | | | | | | | | | | | | |
965 |Parameter 5| | | | | | | | | | | | | | | | |●|●| |●| | | | |●|
966
967 **Features**
968
969 Each time this instruction is executed, the input value (s1) will be saved to the calculation process data storage queue specified by (d1+2) starting device, where (d1) specifies the double-word device to store the current write process data queue index. The number of sliding average windows used to calculate the average value is specified in (s2). When the number of input values in the process save data queue reaches the number of sliding averages in (s2), the average calculation is started, and the value specified in (d2) The calculation end flag bit is ON. Save the average value of the data queue in the process to the initial soft component specified by (d3) as the operation result.
970
971 **✎Note:**
972
973 The larger the setting value in (s2), the greater the hysteresis of the output result in (d3)
974
975 When the contact before the MOVAVG instruction is closed, the calculation end flag is automatically reset, and the written index
976
977 (% style="text-align:center" %)
978 [[image:图片22.png]]
979
980 Moving average is suitable for smoothing high-frequency oscillating signals. The picture above shows the effect of the sliding average command. The blue marked high-frequency oscillation signal can be used for sliding average to obtain the yellow marked curve.
981
982 **Error code**
983
984 |**Error code**|**Content**
985 |4084H|The input value of (s1)(s2) in the read application instruction exceeds the data range
986 |4085H|The input value of (s1)(s2) in the read application instruction exceeds the device range
987 |4086H|The input value of (d1)(d2)(d3) in the write application instruction exceeds the device range
988
989 **Example**
990 This instruction can be used in conjunction with the BD expansion module. When the channel value of the BD expansion module displayed in R0 is unstable, the channel value can be filtered through the following ladder diagram
991
992 (% style="text-align:center" %)
993 [[image:图片23.png]]
994
995 ① M18 is set to ON, and the digital quantity stored in R0 is converted into a floating-point input value;
996
997 ② Specify the sliding average window size in R200;
998
999 ③ D200~~D201 record the position index in the current write cache queue, according to the number of sliding average windows specified in R200, fill the input value in R0 into the process data cache queue with D202 as the starting device;
1000
1001 ④ When the number of written values reaches the number specified in R200, the S50 calculation end flag will be ON, and the calculated average value will be written into the soft component specified by D402.
1002
1003 == **FOLAG/BIN 32-bit first order lag filter instruction** ==
1004
1005 **FOLAG**
1006
1007 Performing first-order lag filtering on the digital signal input by (s1), and output result is stored in (d), and the filter coefficient is adjusted by (s2), and the range is (0~~1).
1008 PLC Editor2 version that supports this instruction: 2.3.1 and above
1009
1010 -[FOLAG (s1) (s2) (d) ]
1011
1012 **Content, range and data type**
1013
1014 |**Parameter**|**Contect**|**Range**|**Data type**|**Data type (label)**
1015 |(s1)|The starting device number of the data to be filtered is stored|0、2^^-126^^≤~|(s)~|<2^^128^^|Single precision floating point|ANYREAL_32
1016 |(s2)|Lag filter coefficient or the initial device number where the lag filter coefficient is stored|0~~1|Single precision floating point|ANYREAL_32
1017 |(d)|The starting device number of the filtered result is stored|-|Single precision floating point|ANYREAL_32
1018
1019 **Device used**
1020
1021 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|(((
1022 **Offset**
1023
1024 **modification**
1025 )))|(((
1026 **Pulse**
1027
1028 **extension**
1029 )))
1030 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
1031 |(% rowspan="3" %)FOLAG|Parameter 1| | | | | | | | | | | | | | | | |●|●| |●| | | | |●|
1032 |Parameter 2| | | | | | | | | | | | | | | | |●|●| | | | | |●|●|
1033 |Parameter 3| | | | | | | | | | | | | | | | |●|●| |●| | | | |●|
1034
1035 **Features**
1036
1037 First order lag filter formula:
1038 Current filtering result (d) = filtering coefficient (s2) * current input value (s1) + (1 - filtering coefficient (s2)) * last filtering result (d).
1039 Assume that the last filtering result is 10, and the input value this time is 20, resulting in a sudden change of 10. If the first-order lag filter is used, the filter coefficient is assumed to be a = 0.05, and the filtering value this time = 0.05 * 20 + 0.95 * 10 = 10.5, which makes the sudden change less serious, and has a good effect in filtering out pulse interference. The first-order lag filter will make the obtained data waveform smoother than the original waveform. At the same time, the smaller the filter coefficient, the better the hysteresis bigger.
1040
1041 (% class="box infomessage" %)
1042 (((
1043 **✎Note:** After the first-order filtering command is enabled, the filtering result is stored in (d) to calculate the next filtering result, and it is not recommended to modify it manually.
1044 )))
1045
1046 **Error code**
1047
1048 |**Error code**|**Content**
1049 |4081H|The calculated data stored in (d) overflows
1050 |4084H|The input value of (s1)(s2)(d) in the read application instruction exceeds the data range
1051 |4085H|The input value of (s1)(s2)(d) in the read application instruction exceeds the device range
1052
1053 **Example**
1054
1055 (% style="text-align:center" %)
1056 [[image:图片24.png]]
1057
1058 ①Set M0 to ON, convert the numerical value in R0 into a floating point number and store it in R10 as the filter input value;
1059
1060 ②Set the lag filter coefficient to 0.05 and store it in D100;③After the FOLAG instruction is executed, the filtered output value is stored in R20.
1061
1062 (% class="box infomessage" %)
1063 (((
1064 **✎Note:**
1065 ① Filter coefficient range: 0~~1, if it exceeds the range, an error will be reported.
1066
1067 ②When filtering, the filtered output value in R20 is used to calculate the next output value, and manual modification is not recommended
1068 )))
1069
1070 == **RCD/BIN 16-bit data logging instruction** ==
1071
1072 **RCD(P)**
1073
1074 Store (s2) data of the start device specified in (s1), and automatically store the data in the start device specified by (s3) according to the storage number calculated in (d). Every time the instruction is enabled, ( d) It will automatically add 1, (s4) specify the maximum number that can be stored.
1075 PLC Editor2 version that supports this instruction: 2.3.1 and above
1076
1077 -[RCD (s1) (s2) (s3) (s4) (d) ]
1078
1079 **Content, range and data type**
1080
1081 |**Parameter**|**Contect**|**Range**|**Data type**|**Data type (label)**
1082 |(s1)|Store the starting device number of the data to be recorded (occupies (s2) word devices)|-|BIN16 bit|ANY16
1083 |(s2)|The number of devices that need to be recorded or the device number that stores the number of devices that need to be recorded|1 to 65535|Unsigned BIN16 bit|ANY16
1084 |(s3)|The starting device number of data record storage (occupying (s4) words of device)|-|BIN16 bit|ANY16
1085 |(s4)|The number of devices allowed to be occupied by the data record or the number of the device that stores the number of devices allowed to be occupied by the data record|1 to 65535|Unsigned BIN16 bit|ANY16
1086 |(d)|The device number that stores the current recording times|1 to 65535|Unsigned BIN16 bit|ANY16
1087
1088 **Device used**
1089
1090 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|(((
1091 **Offset**
1092
1093 **modification**
1094 )))|**Dword expansion**|(((
1095 **Pulse**
1096
1097 **extension**
1098 )))
1099 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**| |**XXP**
1100 |(% rowspan="5" %)RCD|Parameter 1| | | | | | | | | | | | | | | | |●|●| | | | | | |●| |●
1101 |Parameter 2| | | | | | | | | | | | | | | | |●|●| | | |●|●| |●| |●
1102 |Parameter 3| | | | | | | | | | | | | | | | |●|●| | | | | | |●| |●
1103 |Parameter 4| | | | | | | | | | | | | | | | |●|●| | | |●|●| |●| |●
1104 |Parameter 5| | | | | | | | | | | | | | | | |●|●| | | | | | |●| |●
1105
1106 **Features**
1107
1108 ①When SM233 is ON, the loop recording function is turned on, and when the recorded data exceeds the number of devices allowed to be occupied by the setting in (s4), the recording starts from the specified device in (s3);
1109
1110 ②When SM233 is OFF, the recorded data cannot exceed the allowed number of occupied devices set in (s4).
1111
1112 **Error code**
1113
1114 |**Error code**|**Content**
1115 |4084H|The data in the read application instruction (s2), (s4) exceeds the specified range (s2=0, s4=0, s2>s4)
1116 |4085H|When the device specified in the read application instruction (s1), (s2), (s4), and (d) exceeds the range of the corresponding device
1117 |4086H|When the device occupied by the write application instruction (s3), (d) exceed the range of the corresponding device
1118 |4096H|When the device in the read application instruction (s1) and (s3) are multiplexed
1119
1120 **Example**
1121
1122 (% style="text-align:center" %)
1123 [[image:图片25.png]]
1124
1125 ①Set M0 to ON, set the number of devices to be recorded in D50 to 10, then the number of devices to be recorded is D0~~D9;
1126
1127 ②In D51, set the record data allowed to occupy the number of device to 100, then the record data allowed to store the device as R100~~R199;
1128
1129 ③Every time a rising edge is detected, record the data in D0~~D9 to the device starting from R100, and the writing position is offset according to the current recording times;
1130
1131 ④ If SM233 is OFF, the data will be recorded within the range of the currently allowed occupied device; if SM233 is ON, then circular recording will be performed, and the recording times in D300 will be increased by 1 for each recording.