Wiki source code of 12 Clock operation

Version 21.1 by Bob on 2022/11/23 16:25

Show last authors
1 == ==
2
3 == **TADD/The addition of clock data** ==
4
5 **TADD(P)**
6
7 Add the time data stored after the device number specified in (s1) and the time data stored after the device number specified in (s2), and store the result of the addition operation after the device number specified in (d) .
8
9 -[TADD (s1) (s2) (d)]
10
11 **Content, range and data type**
12
13 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
14 |(s1)|The device start number that stores the added time data|-|Signed BIN 16 bit|(((
15 ANY16_ARRAY
16
17 (number of elements: 3)
18 )))
19 |(s2)|The device start number that stores the addition operation time (time) data|-|Signed BIN 16 bit|(((
20 ANY16_ARRAY
21
22 (number of elements: 3)
23 )))
24 |(d)|The device start number that stores the time (time) data of the addition operation result|-|Signed BIN 16 bit|(((
25 ANY16_ARRAY
26
27 (number of elements: 3)
28 )))
29
30 **Device used**
31
32 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="5" %)**Devices**|(((
33 **Offset modification**
34 )))|(((
35 **Pulse extension**
36 )))
37 |**T**|**C**|**D**|**R**|**SD**|**[D]**|**XXP**
38 |(% rowspan="3" %)TADD|Parameter 1|●|●|●|●|●|●|●
39 |Parameter 2|●|●|●|●|●|●|●
40 |Parameter 3|●|●|●|●|●|●|●
41
42 **Features**
43
44 Add the time data specified in (s1) and the time data specified in (s2), and store the result of the addition in the device number specified in (d) or later.
45
46 (% style="text-align:center" %)
47 [[image:07-5 Basic instructions_html_37222a6e282347f9.png||height="79" width="750"]]
48
49 **Example**
50
51 When 6:32:40 and 7:48:10 are added together
52
53 (% style="text-align:center" %)
54 [[image:07-5 Basic instructions_html_90138670198ab422.png||height="94" width="750"]]
55
56 When the calculation result time exceeds 24 o'clock, the carry flag turns ON, and the value after 24 hours is subtracted becomes the calculation result. For example, when 14:20:30 and 20:20:20 are added, the result is not 34:40:50, but 10:40:50.
57
58 (% style="text-align:center" %)
59 [[image:07-5 Basic instructions_html_bac419ce2dc0dc2.png||height="91" width="750"]]
60
61 When the calculation result is 0 (0 hour, 0 minute, 0 second), the zero flag turns on.
62
63 When 23:59:59 and 1 second are added, the result of the calculation is 0:00:00, and the carry flag and zero flag are turned on.
64
65 Related device are as follows:
66
67 |**Devices**|**Name**|**Content**
68 |SM151|Carry|It is ON when the result of the TADD(P) instruction exceeds the maximum clock data value of 23:59:59
69 |SM153|Zero|It is ON when the result of the TADD(P) instruction is 0:00:00
70
71 ✎**Note:**
72
73 The devices specified in (s1), (s2), (d) occupy 3 points respectively. Be careful not to overlap with the device used for machine control.
74
75 When using the clock data time (hour, minute, second) of the built-in real-time clock of the CPU module, use the TRD(P) instruction to read the value of the special register and assign the word device to each operand.
76
77 **Error code**
78
79 |**Error code**|**Content**
80 |4085H|When reading the specified device range exceeds the corresponding device range
81 |4086H|When writing the specified device range exceeds the corresponding device range
82 |4084H|(((
83 When the values specified in (s1) and (s2) are other than 0 to 23
84
85 When the values specified in (s1)+1, (s2)+1, (s1)+2 and (s2)+2 are other than 0 to 59
86 )))
87
88 **Example**
89
90 (% style="text-align:center" %)
91 [[image:07-5 Basic instructions_html_4f75eedee7172bbb.png||height="35" width="349"]]
92
93 Set D0 time to 16:30:00 and D10 time to 4:30:0
94
95 (% style="text-align:center" %)
96 [[image:07-5 Basic instructions_html_c64e0faf2af172f8.png]]
97
98 (% style="text-align:center" %)
99 [[image:07-5 Basic instructions_html_66e3a2eadeb2ecbb.png]]
100
101 After the coil is turned on, the D20 time is 21:0:0
102
103 (% style="text-align:center" %)
104 [[image:07-5 Basic instructions_html_a9b235835aa41200.png]]
105
106 == **TSUB/The subtraction of clock data** ==
107
108 **TSUB(P)**
109
110 Subtract the time data stored after the device number specified in (s1) and the time data stored after the device number specified in (s2), and store the subtraction result in the device number specified in (d) or later .
111
112 -[TSUB (s1) (s2) (d)]
113
114 **Content, range and data type**
115
116 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
117 |(s1)|The device start number that stores the subtracted time data|-|Signed BIN 16 bit|(((
118 ANY16_ARRAY
119
120 (number of elements: 3)
121 )))
122 |(s2)|The device start number that stores the subtraction operation time (time) data|-|Signed BIN 16 bit|(((
123 ANY16_ARRAY
124
125 (number of elements: 3)
126 )))
127 |(d)|The device start number that stores the time (time) data of the subtraction result|-|Signed BIN 16 bit|(((
128 ANY16_ARRAY
129
130 (number of elements: 3)
131 )))
132
133 **Device used**
134
135 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="5" %)**Devices**|(((
136 **Offset modification**
137 )))|(((
138 **Pulse extension**
139 )))
140 |**T**|**C**|**D**|**R**|**SD**|**[D]**|**XXP**
141 |(% rowspan="3" %)TSUB|Parameter 1|●|●|●|●|●|●|●
142 |Parameter 2|●|●|●|●|●|●|●
143 |Parameter 3|●|●|●|●|●|●|●
144
145 **Features**
146
147 Subtract the time data specified in (s1) and the time data specified in (s2), and store the subtraction result in the device number specified in (d) or later.
148
149 (% style="text-align:center" %)
150 [[image:07-5 Basic instructions_html_5a93455e4cd8a27.png]]
151
152 **Example**
153
154 When subtracting 10:40:20 and 3:50:10
155
156 (% style="text-align:center" %)
157 [[image:07-5 Basic instructions_html_2473f03fc493780c.png]]
158
159 When the calculation result time is a negative number, the borrow flag turns on and the data +24 is the calculation result. For example, in the case of subtracting 4:50:32 and 10:42:12, the result is not -6:8:20, but 18:8:20.
160
161 (% style="text-align:center" %)
162 [[image:07-5 Basic instructions_html_24b998b4c3c4ec73.png]]
163
164 When the calculation result is 0 (0 hour, 0 minute, 0 second), the zero flag turns on.
165
166 Related device are as follows:
167
168 |**Devices**|**Name**|**Content**
169 |SM152|Borrow|It is ON when the result of the TSUB(P) instruction is less than 0:00:00
170 |SM153|Zero|It is ON when the result of the TSUB(P) instruction is at the time of 0:00:00:00
171
172 ✎**Note:**
173
174 • The devices specified in (s1), (s2), and (d) occupy 3 points respectively. Be careful not to overlap with the device used for machine control.
175
176 • When using the clock data time (hour, minute, second) of the built-in real-time clock of the CPU module, use the TRD(P) instruction to read the value of the special register and assign the word device to each operand.
177
178 **Error code**
179
180 |**Error code**|**Content**
181 |4085H|When reading the specified device range exceeds the corresponding device range
182 |4086H|When writing the specified device range exceeds the corresponding device range
183 |4084H|(((
184 When the values specified in (s1) and (s2) are other than 0 to 23
185
186 When the values specified in (s1)+1, (s2)+1, (s1)+2 and (s2)+2 are other than 0 to 59
187 )))
188
189 **Example**
190
191 (% style="text-align:center" %)
192 [[image:07-5 Basic instructions_html_e3a5d4793d3ccd2d.png||height="36" width="372"]]
193
194 Set D0 time to 16:30:00 and D10 time to 4:30:0
195
196 (% style="text-align:center" %)
197 [[image:07-5 Basic instructions_html_c64e0faf2af172f8.png]]
198
199 (% style="text-align:center" %)
200 [[image:07-5 Basic instructions_html_66e3a2eadeb2ecbb.png]]
201
202 After the coil is turned on, the D20 time is 12:00:00
203
204 (% style="text-align:center" %)
205 [[image:07-5 Basic instructions_html_8f93ea19ba10652b.png]]
206
207 == **TRD/Clock data reading** ==
208
209 **TRD(P)**
210
211 Read the clock data of the built-in real-time clock of the CPU module.
212
213 -[TRD (d)]
214
215 **Content, range and data type**
216
217 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
218 |(d)|Read destination and start device number of clock data|-|Signed BIN 16 bit|(((
219 ANY16_ARRAY
220
221 (number of elements: 7)
222 )))
223
224 **Device used**
225
226 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="4" %)**Devices**|(((
227 **Offset modification**
228 )))|(((
229 **Pulse extension**
230 )))
231 |**T**|**C**|**D**|**R**|**[D]**|**XXP**
232 |TRD|Parameter 1|●|●|●|●|●|●
233
234 **Features**
235
236 Read the clock data (SD100 to SD106) of the real-time clock built into the CPU module into (d) to (d)+6 in the following format.
237
238 |**Parameter**|**Element**|**Project**|**Clock data**| |**Element**|**Project**
239 |(% rowspan="7" %)Special register|SD105|Year (Gregorian)|2000 to 2099|→|(d)|Year (Gregorian)
240 |SD104|Month|1 to 12|→|(d)+1|Month
241 |SD103|Day|1 to 31|→|(d)+2|Day
242 |SD102|Hour|0 to 23|→|(d)+3|Hour
243 |SD101|Minute|0 to 59|→|(d)+4|Minute
244 |SD100|Seconds|0 to 59|→|(d)+5|Seconds
245 |SD106|Week|0 (Sun) to 6 (Sat)|→|(d)+6|Week
246
247 • The related devices are shown below. The clock data of these special registers are updated through END processing.
248
249 |**Devices**|**Content**
250 |SD100|The second data of the clock data is stored in BIN code.
251 |SD101|The sub-data of the clock data is stored in BIN code.
252 |SD102|Time data of clock data is stored in BIN code.
253 |SD103|The daily data of the clock data is stored in BIN code.
254 |SD104|The monthly data of the clock data is stored in BIN code.
255 |SD105|The year data of the clock data is stored in a 4-digit BIN code of the Gregorian calendar.
256 |SD106|The week data of the clock data is stored in BIN code. (0: day, 1: one, ..., 6: six) are stored in BIN code.
257
258 ✎**Note:**
259
260 • The device specified in (d) occupies 7 points. Be careful not to overlap with the device used for machine control.
261
262 **Error code**
263
264 |**Error code**|**Content**
265 |4086H|When reading the specified device range exceeds the corresponding device range
266
267 **Example**
268
269 (% style="text-align:center" %)
270 [[image:07-5 Basic instructions_html_b81c1991fec5b4b1.png||height="68" width="250"]]
271
272 After the M0 coil is turned on, the current date and time are read as 2020-2-19 13:10:38 Wednesday
273
274 (% style="text-align:center" %)
275 [[image:07-5 Basic instructions_html_fe82ecd18ebfd787.png||height="48" width="602"]]
276
277 == **TWR/Clock data writing** ==
278
279 **TWR(P)**
280
281 Write the clock data of the built-in real-time clock of the CPU module.
282
283 -[TWR (s)]
284
285 **Content, range and data type**
286
287 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
288 |(s)|Clock data write source, start device number|-|Signed BIN 16 bit|ANY16_ARRAY (number of elements: 7)
289
290 **Device used**
291
292 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="4" %)**Devices**|(((
293 **Offset modification**
294 )))|(((
295 **Pulse extension**
296 )))
297 |**T**|**C**|**D**|**R**|**[D]**|**XXP**
298 |TWR|Parameter 1|●|●|●|●|●|●
299
300 **Features**
301
302 Write the set clock data (s) to (s)+6 to the clock data (SD100 to SD106) of the real-time clock built into the CPU module.
303
304 |(% colspan="3" %)**Set data at all times**|(% rowspan="2" %) |(% colspan="2" %)**Special register**
305 |**Element**|**Project**|**Clock data**|**Element**|**Project**
306 |(s)|Year (Gregorian)|2000 to 2099 or 0 to 99|→|SD105|Year (Gregorian)
307 |(s)+1|Month|1 to 12|→|SD104|Month
308 |(s)+2|Day|1 to 31|→|SD103|Day
309 |(s)+3|Hour|0 to 23|→|SD102|Hour
310 |(s)+4|Minute|0 to 59|→|SD101|Minute
311 |(s)+5|Seconds|0 to 59|→|SD100|Seconds
312 |(s)+6|Week|0 (Sun) to 6 (Sat)|→|SD106|Week
313
314 • If the TWR(P) instruction is executed, the clock data of the real-time clock is changed immediately. Therefore, the clock data after a few minutes should be transferred to the set clock data (s) to (s)+6 in advance, and the instruction will be executed when the correct time is reached.
315
316 • If the year in (s) is in the range of 0 to 99, it will be automatically treated as 2000 to 2099.
317
318 • When a value indicating an impossible time is set, the clock data will not be updated. Set the correct clock data and write again.
319
320 • The day of the week (SD100) is automatically corrected.
321
322 • The related devices are shown below.
323
324 |**Devices**|**Content**
325 |SD100|The second data of the clock data is stored in BIN code.
326 |SD101|The sub-data of the clock data is stored in BIN code.
327 |SD102|Time data of clock data is stored in BIN code.
328 |SD103|The daily data of the clock data is stored in BIN code.
329 |SD104|The monthly data of the clock data is stored in BIN code.
330 |SD105|The year data of the clock data is stored in a 4-digit BIN code of the Gregorian calendar.
331 |SD106|The week data of the clock data is stored in BIN code. (0: day, 1: one, ..., 6: six) are stored in BIN code.
332
333 ✎**Note:**
334
335 The device specified in (s) occupies 7 points. Be careful not to overlap with the device used for machine control.
336
337 **Error code**
338
339 |**Error code**|**Content**
340 |4085H|When reading the specified device range exceeds the corresponding device range
341
342 **Example**
343
344 Set D0 date and time to 2020-2-19 12:36:00 in advance
345
346 (% style="text-align:center" %)
347 [[image:07-5 Basic instructions_html_994c66d1a4cbd45f.png||height="57" width="305"]]
348
349 At the moment when the time 12:36:00 arrives, turn on the M0 coil and write the time.
350
351 (% style="text-align:center" %)
352 [[image:07-5 Basic instructions_html_bf3e906ee5265598.png||height="42" width="586"]]
353
354 == **HTOS/16-bit data conversion of time data (hour, minute, second → second)** ==
355
356 **HTOS(P)**
357
358 Convert the time data stored after the device number specified in (s) into seconds and store the conversion result as BIN 16-bit data in the device specified in (d).
359
360 -[HTOS (s) (d)]
361
362 **Content, range and data type**
363
364 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
365 |(s)|The device start number that stores the data of the subtracted time|-|Signed BIN 16 bit|ANY16_ARRAY (number of elements: 3)
366 |(d)|The device start number that stores the converted clock data|-|Signed BIN 16 bit|ANY16
367
368 **Device used**
369
370 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="9" %)**Devices**|**Offset modification**|(((
371 **Pulse extension**
372 )))
373 |**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**[D]**|**XXP**
374 |(% rowspan="2" %)HTOS|Parameter 1|●|●|●|●|●|●|●|●|●|●|●
375 |Parameter 2| |●|●|●|●|●|●|●|●|●|●
376
377 **Features**
378
379 Convert the time data stored after the device number specified in (s) into seconds and store the conversion result in the device specified in (d).
380
381 (% style="text-align:center" %)
382 [[image:07-5 Basic instructions_html_a84b7741fd5bef2f.png||height="130" width="550"]]
383
384 **Example**
385
386 When 4 hours, 29 minutes and 31 seconds are specified in (s)
387
388 (% style="text-align:center" %)
389 [[image:07-5 Basic instructions_html_5effb7bc9b8e5cf7.png||height="162" width="550"]]
390
391 **Error code**
392
393 |**Error code**|**Content**
394 |4085H|When reading the specified device range exceeds the corresponding device range
395 |4086H|When writing the specified device range exceeds the corresponding device range
396 |4084H|(((
397 When the calculation result is not in the range of 0 to 32767
398
399 When the value specified in (s) is not in the range of 0 to 9
400
401 When the value specified in (s)+1 and (s)+2 is not in the range of 0 to 59
402 )))
403
404 **Example**
405
406 (% style="text-align:center" %)
407 [[image:07-5 Basic instructions_html_e23e38c4ba4c34bb.png||height="43" width="338"]]
408
409 D0 time is set to 5:36:53
410
411 (% style="text-align:center" %)
412 [[image:07-5 Basic instructions_html_2866a121e5ca5713.png]]
413
414 The time of D10 after the M0 coil is turned on is as below.
415
416 (% style="text-align:center" %)
417 [[image:07-5 Basic instructions_html_1dd6c5de05890797.png]]
418
419 == **DHTOS/32-bit data conversion of time data (hour, minute, second → second)** ==
420
421 **DHTOS(P)**
422
423 Convert the time data stored after the device number specified in (s) into seconds and store the conversion result as BIN 32-bit data in the device specified in (d).
424
425 -[DHTOS (s) (d)]
426
427 **Content, range and data type**
428
429 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
430 |(s)|The device start number that stores the data of the subtracted time|-|Signed BIN 16 bit|ANY16_ARRAY (number of elements: 3)
431 |(d)|The device start number that stores the converted clock data|-|Signed BIN 32 bit|ANY32
432
433 **Device used**
434
435 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="9" %)**Devices**|(((
436 **Offset modification**
437 )))|(((
438 **Pulse extension**
439 )))
440 |**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**[D]**|**XXP**
441 |(% rowspan="2" %)DHTOS|Parameter 1|●|●|●|●|●|●|●|●|●|●|●
442 |Parameter 2| |●|●|●|●|●|●|●|●|●|●
443
444 **Features**
445
446 Convert the time data stored after the device number specified in (s) into seconds and store the conversion result in the device specified in (d).
447
448 (% style="text-align:center" %)
449 [[image:07-5 Basic instructions_html_f4be08508575ea01.png||height="99" width="550"]]
450
451 **Example**
452
453 When 35 hours, 10 minutes and 58 seconds are specified in (s)
454
455 (% style="text-align:center" %)
456 [[image:07-5 Basic instructions_html_5b9ad230ed5e1fd0.png||height="125" width="550"]]
457
458 **Error code**
459
460 |**Error code**|**Content**
461 |4085H|When reading the specified device range exceeds the corresponding device range
462 |4086H|When writing the specified device range exceeds the corresponding device range
463 |4084H|(((
464 When the calculation result is not in the range of 0 to 32767
465
466 When the value specified in (s)+1 and (s)+2 is not in the range of 0 to 59
467 )))
468
469 **Example**
470
471 (% style="text-align:center" %)
472 [[image:07-5 Basic instructions_html_ae8ab4379e8bdb91.png||height="45" width="263"]]
473
474 D0 time is set to 15:33:24
475
476 (% style="text-align:center" %)
477 [[image:07-5 Basic instructions_html_57a15d9e1045e93e.png||height="41" width="313"]]
478
479 The second of D10 after the M0 coil is turned on is
480
481 (% style="text-align:center" %)
482 [[image:07-5 Basic instructions_html_194e906b1dc12078.png||height="64" width="365"]]
483
484 **HOUR/Hour measuring 16-bit**
485
486 **HOUR(P)**
487
488 The time for the input contact to be ON is measured in units of one hour.C
489
490 -[HOUR (s) (d1) (d2)]
491
492 **Content, range and data type**
493
494 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
495 |(s)|(((
496 The time when the alarm (d2) is turned ON
497
498 (set by one hour)
499 )))|K0 to K32767|Signed BIN 16 bit|ANY16
500 |(d1)|Device that stores the current value of measurement (specified data register for power failure retention)|-|Unsigned BIN 16 bit|(((
501 ANY16_ARRAY
502
503 (Number of elements: 2)
504 )))
505 |(d2)|Device that turns ON when the time limit expires (alarm output)|-|Bit|ANY_BOOL
506
507 **Device used**
508
509 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="17" %)**Devices**|(((
510 **Offset modification**
511 )))|(((
512 **Pulse extension**
513 )))
514 |**Y**|**M**|**S**|**SM**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**K**|**H**|**E**|**[D]**|**XXP**
515 |(% rowspan="3" %)HOUR|Parameter 1| | | | | |●|●|●|●|●|●|●|●|●|●|●| |●|●
516 |Parameter 2| | | | | | | | | | | |●|●|●| | | |●|●
517 |Parameter 3|●|●|●|●|●| | | | | | | | | | | | |●|●
518
519 **Features**
520
521 The input contact ON time is measured in units of 1 hour. When the cumulative ON time exceeds the time (BIN 16-bit data) specified in (s), the device specified in (d2) is turned on .
522
523 • In (s), set the time until the alarm (d2) turns ON in units of 1 hour.
524
525 • (d1) stores the current measured value in units of 1 hour.
526
527 • If the median value of (d1) exceeds 32767, it will be modified to 32767.
528
529 • (d1)+1 stores the current measured value (in units of 1 second) that is less than 1 hour.
530
531 • (d2) turns on when the current value (d1) exceeds the time specified in (s).
532
533 • In order to continue to use the current value data even after the power of the CPU module is turned off, specify the data register for power failure retention to (d1). If you use general-purpose data registers, the current value data will be cleared by powering off the CPU module and STOP→RUN operations.
534
535 • After the alarm output specified in (d2) turns ON, measurement will continue.
536
537 • The measurement stops when the current value reaches the 16-bit maximum. To continue the measurement, clear the current value of (d1) to (d1)+1.
538
539 ✎**Note:**
540
541 • The device specified in (d1) occupies 2 points. Be careful not to overlap with the device used for machine control.
542
543 • After the instruction stops running, the measurement stops and the output continues to be maintained.
544
545 **Error code**
546
547 |**Error code**|**Content**
548 |4085H|When reading the specified device range exceeds the corresponding device range
549 |4086H|When writing the specified device range exceeds the corresponding device range
550 |4084H|When the value of (s) is negative
551
552 **Example**
553
554 (% style="text-align:center" %)
555 [[image:07-5 Basic instructions_html_7570f8c392470a9f.png||height="45" width="320"]]
556
557 When M0 = ON, the duration of the state is accumulated, the time is recorded in D0, and the seconds less than 1 hour are recorded in D1. When the accumulated time of D0 reaches 98 hours, the Y0 output state is ON. When the timing conditions are met, after reaching the specified value (K98), the accumulated timing will continue and the reading will continue to increase; the current time value D0 reaches the maximum value of 32767 hours and D1 reaches 3599 seconds, the timing measurement will stop. The current time values D0 and D1 are cleared to 0.
558
559 == **DHOUR/Hour measuring 32 bits** ==
560
561 **DHOUR(P)**
562
563 The time for the input contact to be ON is measured in units of one hour.
564
565 -[DHOUR (s) (d1) (d2)]
566
567 **Content, range and data type**
568
569 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
570 |(s)|(((
571 The time when the alarm (d2) is turned ON (set by one hour)
572 )))|0 to 2147483647|Signed BIN 32 bit|ANY32
573 |(d1)|Device that stores the current value of measurement (specified data register for power failure retention)|-|Unsigned BIN 32 bit|(((
574 ANY32_ARRAY
575
576 (Number of elements: 2)
577 )))
578 |(d2)|Device that turns ON when the time limit expires (alarm output)|-|Bit|ANY_BOOL
579
580 **Device used**
581
582 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="18" %)**Devices**|(((
583 **Offset modification**
584 )))|(((
585 **Pulse extension**
586 )))
587 |**Y**|**M**|**S**|**SM**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**[D]**|**XXP**
588 |(% rowspan="3" %)DHOUR|Parameter 1| | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●|●|●
589 |Parameter 2| | | | | | | | | | | |●|●|●| | | | |●|●
590 |Parameter 3|●|●|●|●|●| | | | | | | | | | | | | |●|●
591
592 **Features**
593
594 • The input contact ON time is measured in units of 1 hour. When the cumulative ON time exceeds the time (BIN 32-bit data) specified in (s), the device specified in (d2) is set to ON.
595
596 • In (s)+1, (s), set the time until the alarm (d2) turns ON in units of 1 hour.
597
598 • (D1)+1 and (d1) store the current value measured in units of 1 hour. ((d1)+1: high bit, (d1): low bit)
599
600 • If the median of (d1)+1 and (d1) exceeds 2147483647, it will be modified to 2147483647.
601
602 • (D1)+2 stores the current value (in units of 1 second) of the measurement that is less than 1 hour.
603
604 • (D2) turns on when the current value (d1)+1, (d1) exceeds the time specified in (s).
605
606 • In order to continue to use the current value data even after the power of the CPU module is turned off, specify the data register for power failure retention to (d1). If you use general-purpose data registers, the current value data will be cleared by powering off the CPU module and STOP→RUN operations.
607
608 • After the alarm output specified in (d2) turns on, the measurement will continue.
609
610 • The measurement stops when the current value reaches the 32-bit maximum. To continue the measurement, clear the current value of (d1) to (d1)+2.
611
612 ✎**Note:**
613
614 • The device specified in (d1) occupies 3 points. Be careful not to overlap with the device used for machine control.
615
616 • After the instruction stops running, the measurement stops and the output continues to be maintained.
617
618 **Error code**
619
620 |**Error code**|**Content**
621 |4085H|When reading the specified device range exceeds the corresponding device range
622 |4086H|When writing the specified device range exceeds the corresponding device range
623 |4084H|When the value of (s) is negative
624
625 **Example**
626
627 (% style="text-align:center" %)
628 [[image:07-5 Basic instructions_html_3f1ef5ecc835de30.png||height="43" width="448"]]
629
630 When M0=ON, the duration of this state is accumulated, the time is recorded in D1, D0, and the seconds less than 1 hour are recorded in D2. When the accumulated time of D1, D0 reaches 1000 hours, the Y0 output state is ON. When the timing conditions are met, after reaching the specified value (K1000), the accumulated timing will continue, and the reading will continue to increase; the current time values D1 and D0 reach the maximum value of 2147483647 hours, and when D2 reaches 3599 seconds, the timing measurement will stop and the timing should be restarted. The current time values D0, D1, and D2 must be cleared to 0.
631
632 == **STOH/16-bit data conversion of time data (second → hour, minute, second)** ==
633
634 **STOH(P)**
635
636 Convert the second 16-bit data stored in the device number specified in (s) into hour, minute, and second, and store the conversion result in the device specified in (d) and later.
637
638 -[STOH (s) (d)]
639
640 **Content, range and data type**
641
642 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
643 |(s)|The device start number that stores the clock data before conversion|0 to 32767|Signed BIN 16 bit|ANY16
644 |(d)|The device start number that stores the converted clock data|-|Signed BIN 16 bit|(((
645 ANY16_ARRAY (number of elements: 3)
646 )))
647
648 **Device used**
649
650 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="9" %)**Devices**|(((
651 **Offset modification**
652 )))|(((
653 **Pulse extension**
654 )))
655 |**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**[D]**|**XXP**
656 |(% rowspan="2" %)STOH|Parameter 1|●|●|●|●|●|●|●|●|●|●|●
657 |Parameter 2| |●|●|●|●|●|●|●|●|●|●
658
659 **Features**
660
661 Convert the second data stored after the device number specified in (s) into hour, minute, and second, and store the conversion result in the device specified in (d) and later.
662
663 (% style="text-align:center" %)
664 [[image:07-5 Basic instructions_html_1f5f3f1d80af2a34.png||height="110" width="550"]]
665
666 **Example**
667
668 When 29,011 seconds are specified in (s)
669
670 (% style="text-align:center" %)
671 [[image:07-5 Basic instructions_html_682516cbf773f515.png||height="163" width="550"]]
672
673 **Error code**
674
675 |**Error code**|**Content**
676 |4085H|When reading the specified device range exceeds the corresponding device range
677 |4086H|When writing the specified device range exceeds the corresponding device range
678 |4084H|When the value of (s) exceeds the range
679
680 **Example**
681
682 (% style="text-align:center" %)
683 [[image:07-5 Basic instructions_html_e783349d57adf7d2.png||height="47" width="350"]]
684
685 Set D0 seconds to 12537
686
687 The hour, minute and second of D10 after the M0 coil is turned on are
688
689 (% style="text-align:center" %)
690 [[image:07-5 Basic instructions_html_d3c33949e8684891.png||height="52" width="645"]]
691
692 == **DSTOH/32-bit data conversion of time data (second → hour, minute, second)** ==
693
694 **DSTOH(P)**
695
696 Convert the second 32-bit data of second stored in the device number specified in (s) into hour, minute, and second, and store the conversion result in the device specified in (d) and later.
697
698 -[DSTOH (s) (d)]
699
700 **Content, range and data type**
701
702 |**Parameter**|**Content**|**Range**|**Data type**|**Data     type (label)**
703 |(s)|The device start number that stores the clock data before conversion|0 to 117964799|Signed BIN 32 bit|ANY32
704 |(d)|The device start number that stores the converted clock data|-|Signed BIN 16 bit|(((
705 ANY16_ARRAY (number of elements: 3)
706 )))
707
708 **Device used**
709
710 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="9" %)**Devices**|(((
711 **Offset modification**
712 )))|(((
713 **Pulse extension**
714 )))
715 |**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**[D]**|**XXP**
716 |(% rowspan="2" %)DSTOH|Parameter 1|●|●|●|●|●|●|●|●|●|●|●
717 |Parameter 2| |●|●|●|●|●|●|●|●|●|●
718
719 **Features**
720
721 Convert the second data stored after the device number specified in (s) into hour, minute, and second, and store the conversion result in the device specified in (d) and later.
722
723 (% style="text-align:center" %)
724 [[image:07-5 Basic instructions_html_cbf13fc3d10fbe61.png||height="99" width="600"]]
725
726 **Example**
727
728 When 45,325 seconds is specified in (s)
729
730 (% style="text-align:center" %)
731 [[image:07-5 Basic instructions_html_d6045506b13275a0.png||height="135" width="600"]]
732
733 **Error code**
734
735 |**Error code**|**Content**
736 |4085H|When reading the specified device range exceeds the corresponding device range
737 |4086H|When writing the specified device range exceeds the corresponding device range
738 |4084H|When the value of (s) exceeds the range
739
740 **Example**
741
742 (% style="text-align:center" %)
743 [[image:07-5 Basic instructions_html_e7dd49d953db6da4.png||height="39" width="316"]]
744
745 Set D0 seconds to 2152537
746
747 The hour, minute and second of D10 after the M0 coil is turned on are
748
749 (% style="text-align:center" %)
750 [[image:07-5 Basic instructions_html_10d57bde1ac0a218.png||height="52" width="661"]]
751
752 == **TCMP/Clock data comparison** ==
753
754 **TCMP(P)**
755
756 Compare the comparison time specified in (s1), (s2), (s3) with the time data specified in (s4), and turn the bit device specified in (d) ON/OFF according to their size match.
757
758 -[TCMP (s1) (s2) (s3) (s4) (d)]
759
760 **Content, range and data type**
761
762 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
763 |(s1)|Specify the "hour" of the comparison base time.|0 to 23|Signed BIN 16 bit|ANY16
764 |(s2)|Specify the "minute" of the comparison base time.|0 to 59|Signed BIN 16 bit|ANY16
765 |(s3)|Specify the "second" of the comparison base time.|0 to 59|Signed BIN 16 bit|ANY16
766 |(s4)|Specify the "hour" of the time data (hour, minute, second).|-|Signed BIN 16 bit|ANY16_ARRAY
767 |(d)|The bit device is turned ON/OFF according to the comparison result.|-|Bit|ANYBIT_ARRAY
768
769 **Device used**
770
771 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="17" %)**Devices**|(((
772 **Offset modification**
773 )))|(((
774 **Pulse extension**
775 )))
776 |**Y**|**M**|**S**|**SM**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**K**|**H**|**E**|**[D]**|**XXP**
777 |(% rowspan="5" %)TCMP|Parameter 1| | | | | |●|●|●|●|●|●|●|●|●|●|●| |●|●
778 |Parameter 2| | | | | |●|●|●|●|●|●|●|●|●|●|●| |●|●
779 |Parameter 3| | | | | |●|●|●|●|●|●|●|●|●|●|●| |●|●
780 |Parameter 4| | | | | | | | | |●|●|●|●|●| | | |●|●
781 |Parameter 5|●|●|●|●|●| | | | | | | | | | | | |●|●
782
783 **Features**
784
785 Compare the time of the reference time (hour, minute, second) [(s1), (s2), (s3)] with the time data (hour, minute, second) [(s4), (s4)+1, (s4) +2] Compare the size and turn on/off the 3 points from (d) according to the result of the same size.
786
787 (% style="text-align:center" %)
788 [[image:07-5 Basic instructions_html_5df7ad3057fada12.png||height="385" width="750"]]
789
790 ✎**Note:**
791
792 The device specified in (s4) and (d) occupies 3 points. Be careful not to overlap with the device used for machine control.
793
794 When using the clock data time (hour, minute, second) of the built-in real-time clock of the CPU module, use the TRD(P) instruction to read the value of the special register and assign the word device to each operand.
795
796 **Error code**
797
798 |**Error code**|**Content**
799 |4085H|When reading the specified device range exceeds the corresponding device range
800 |4086H|When writing the specified device range exceeds the corresponding device range
801 |4084H|(((
802 When the value specified in (s) and (s4) is not in the range of 0 to 23
803
804 When the value specified in (s2),(s3) (s4)+1 and (s4)+2 is not in the range of 0 to 59
805 )))
806
807 **Example**
808
809 (% style="text-align:center" %)
810 [[image:07-5 Basic instructions_html_fcc16317cf7c0700.png||height="68" width="359"]]
811
812 Set D10 to 1, D11 to 30, D12 to 0
813
814 When M0 is turned on, the time that D23 will come is 0:31:27
815
816 (% style="text-align:center" %)
817 [[image:07-5 Basic instructions_html_de97dd7a612b2323.png||height="50" width="653"]]
818
819 M10 is turned ON
820
821 (% style="text-align:center" %)
822 [[image:07-5 Basic instructions_html_56e2d606adc09fd.png||height="52" width="239"]]
823
824 == **TZCP/Clock data bandwidth comparison** ==
825
826 **TZCP(P)**
827
828 Compare the comparison time of the high and low points specified in (s1) and (s2) with the time data specified in (s3), and turn the bit device specified in (d) ON/OFF according to its size and bandwidth.
829
830 -[TZCP (s1) (s2) (s3) (d)]
831
832 **Content, range and data type**
833
834 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
835 |(s1)|Specify the "hour" of the lower limit time (hour, minute, second)|-|Signed BIN 16 bit|(((
836 ANY16_ARRAY (number of elements: 3)
837 )))
838 |(s2)|Specify the "hour" of the lower limit time (hour, minute, second)|-|Signed BIN 16 bit|(((
839 ANY16_ARRAY (number of elements: 3)
840 )))
841 |(s3)|Specify "hour" of time data (hour, minute, second)|-|Signed BIN 16 bit|(((
842 ANY16_ARRAY (number of elements: 3)
843 )))
844 |(d)|The bit device is turned ON/OFF according to the comparison result.|-|Bit|(((
845 ANY16_ARRAY (number of elements: 3)
846 )))
847
848 **Device used**
849
850 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="10" %)**Devices**|**Offset modification**|(((
851 **Pulse extension**
852 )))
853 |**Y**|**M**|**S**|**SM**|**D.b**|**T**|**C**|**D**|**R**|**SD**|**[D]**|**XXP**
854 |(% rowspan="4" %)TZCP|Parameter 1| | | | | |●|●|●|●|●|●|●
855 |Parameter 2| | | | | |●|●|●|●|●|●|●
856 |Parameter 3| | | | | |●|●|●|●|●|●|●
857 |Parameter 4|●|●|●|●|●| | | | | |●|●
858
859 **Features**
860
861 Compare the comparison time of the high and low points specified in (s1) and (s2) with the time data specified in (s3), and turn the bit device specified in (d) ON/OFF according to its size and bandwidth.
862
863 (% style="text-align:center" %)
864 [[image:07-5 Basic instructions_html_844291270080313d.png||height="339" width="750"]]
865
866 ✎**Note:**
867
868 • The devices specified in (s1), (s2), (s3), (d) occupy 3 points. Be careful not to overlap with the device used for machine control.
869
870 • When using the clock data time (hour, minute, second) of the built-in real-time clock of the CPU module, use the TRD(P) instruction to read the value of the special register and assign the word device to each operand.
871
872 • When (s1)> (s2), two of (d), (d)+1, (d)+2 are ON/OFF.
873
874 **Error code**
875
876 |**Error code**|**Content**
877 |4085H|When reading the specified device range exceeds the corresponding device range
878 |4086H|When writing the specified device range exceeds the corresponding device range
879 |4084H|(((
880 When the value specified in (s1), (s2) and (s3) is not in the range of 0 to 23
881
882 When the value specified in (s1)+1, (s2)+1, (s3)+1, (s1)+2, (s2)+2 and (s3)+2 is not in the range of 0 to 59
883 )))
884
885 **Example**
886
887 (% style="text-align:center" %)
888 [[image:07-5 Basic instructions_html_30027a2387c26c2e.png||height="46" width="439"]]
889
890 Set D0 time to 16:30:00 and D10 time to 4:30:0
891
892 (% style="text-align:center" %)
893 [[image:07-5 Basic instructions_html_c64e0faf2af172f8.png||height="49" width="626"]]
894
895 (% style="text-align:center" %)
896 [[image:07-5 Basic instructions_html_66e3a2eadeb2ecbb.png||height="50" width="625"]]
897
898 After the coil is turned on, the reading time to D20 time is 8:30:00
899
900 (% style="text-align:center" %)
901 [[image:07-5 Basic instructions_html_75c44dad07eaf80a.png||height="49" width="625"]]
902
903 M0/M12 is ON
904
905 (% style="text-align:center" %)
906 [[image:07-5 Basic instructions_html_f512f36261705953.png||height="48" width="218"]]
907
908
909 == **TON/BIN 16-bit Turn-on delay timer** ==
910
911 **TON(P)**
912
913 Specify the T timer device in (s1), the expected time in (s2), and the time base (resolution) in (s3). And the result of the measured individual time interval operation is stored in the device specified in (s1).
914
915 PLC Editor2 version that supports this instruction: 2.3.1 and above.
916
917 -[TON (s1) (s2) (s3)]
918
919 **Content, scope, data type**
920
921 |**parameter**|**Content**|**range**|**type of data**|**Data type (label)**
922 |(s1)|T device|0~~511|Signed BIN 16 bit|ANY16_S
923 |(s2)|Expected time|0~~32767|Signed BIN 16 bit|ANY16_S
924 |(s3)|Time base(resolution)|1/10/100/1000/10000|Signed BIN 16 bit|ANY16_S
925
926 **Device used**
927
928 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**parameter**|(% colspan="24" %)**Devices**|**Offset modification**|**Pulse extension**
929 |**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**
930 |(% rowspan="3" %)TON|Parameter 1| | | | | | | | | | | | | | |●| | | | | | | | | | |
931 |Parameter 2| | | | | | | | | | |●|●|●|●| |●|●|●|●| | |●|●| | |
932 |Parameter 3| | | | | | | | | | | | | | | | | | | | | |●|●| | |
933
934 **Timing Chart**
935
936 (% style="text-align:center" %)
937 [[image:企业微信截图_16691725418532.png]]
938
939 **Features**
940
941 1) When the timer starts timing, the instruction after the timer starts to run when the timing time is greater than the time value of "the product of S2 and S3".
942
943 2) When the timer value is greater than 0 and less than the time value of "the product of S2 and S3", the timer will stop whenever the contact is disconnected, and when the contact is connected, the timer will start timing again.
944
945
946 |**S3 time base**|**Actual value**
947 |1|100us
948 |10|1ms
949 |100|10ms
950 |1000|100ms
951 |10000|1s
952
953 **Precautions**
954
955 • Avoid timer number conflict: the same timer number cannot be used for TON, TONR, TOF, TP, OUT_T timers at the same time. For example, TON T32 and TOF T32 cannot be used at the same time (it may cause data confusion and not achieve the effect of the corresponding instruction function).
956
957 **Error code**
958
959 |**Error code**|**Content**
960 |4084H|Input data in (s2) (s3) is outside the specified range.
961 |4085H|Device tpye in (s1) (s2) (s3) is outside the specified range.
962 |4086H|Device tpye in (s1) is outside the specified range.
963
964 **Example**
965
966 (% style="text-align:center" %)
967 [[image:企业微信截图_16691729278938.png]]
968
969 T1 is used for storing time, setting the expected time as K10 and the time base as K10000.
970
971 After set on (M8) contact and waiting for the value in the turn-on delay timer (T1) to reach the estimated time of 10s, the contact of (T1) on and output Y0.
972
973 If the (M8) contact is off in the process of turn-on delay timer (T1) timing, the turn-on delay timer (T1) value is cleared to 0 and the timing ends.
974
975 == **TONR/BIN 16-bit Hold-type turn-on delay timer** ==
976
977 **TONR(P)**
978
979 Specify the T timer device in (s1), the expected time in (s2), and the time base (resolution) in (s3). And store the time values of the accumulated multiple timing intervals into the device specified in (s1).
980
981 PLC Editor2 version that supports this instruction: 2.3.1 and above.
982
983 -[TONR (s1) (s2) (s3)]
984
985 **Content, scope, data type**
986
987 |**parameter**|**Content**|**range**|**type of data**|**Data type (label)**
988 |(s1)|T device|0~~511|Signed BIN 16 bit|ANY16_S
989 |(s2)|Expected time|0~~32767|Signed BIN 16 bit|ANY16_S
990 |(s3)|Time base(resolution)|1/10/100/1000/10000|Signed BIN 16 bit|ANY16_S
991
992 **Device used**
993
994 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**parameter**|(% colspan="24" %)**Devices**|**Offset modification**|**Pulse extension**
995 |**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**
996 |(% rowspan="3" %)TON|Parameter 1| | | | | | | | | | | | | | |●| | | | | | | | | | |
997 |Parameter 2| | | | | | | | | | |●|●|●|●| |●|●|●|●| | |●|●| | |
998 |Parameter 3| | | | | | | | | | | | | | | | | | | | | |●|●| | |
999
1000 **Timing Chart**
1001
1002 (% style="text-align:center" %)
1003 [[image:企业微信截图_16691733488965.png]]
1004
1005 **Features**
1006
1007 1) When the timer starts timing, the instruction after the timer starts to run when the timing time is greater than the time value of "the product of S2 and S3".
1008
1009 2) When the coil in front of the timer is off, the TONR timer saves the current value. When the coil is on, the TONR timer continues to timing.
1010
1011 3) The current value of TONR can be cleared using the reset command. After the preset time is reached, TONR maintains the current value of the timer.
1012
1013
1014 |**S3 time base**|**Actual value**
1015 |1|100us
1016 |10|1ms
1017 |100|10ms
1018 |1000|100ms
1019 |10000|1s
1020
1021 **Precautions**
1022
1023 • Avoid timer number conflict: the same timer number cannot be used for TON, TONR, TOF, TP, OUT_T timers at the same time. For example, TON T32 and TOF T32 cannot be used at the same time (it may cause data confusion and not achieve the effect of the corresponding instruction function).
1024
1025 **Error code**
1026
1027 |**Error code**|**Content**
1028 |4084H|Input data in (s2) (s3) is outside the specified range.
1029 |4085H|Device tpye in (s1) (s2) (s3) is outside the specified range.
1030 |4086H|Device tpye in (s1) is outside the specified range.
1031
1032 **Example**
1033
1034 (% style="text-align:center" %)
1035 [[image:企业微信截图_16691733566206.png]]
1036
1037 T1 is used for storing time, setting the expected time as K10 and the time base as K10000.
1038
1039 When the (M8) contact off and on again during timing. (T1) maintains the value at the last disconnection and continues timing until the estimated time of 10s. After the estimated time is reached, the (T1) contact on and output Y0. If the (M8) contact off in this time, the (T1) contact is still ON but Y0 is off.
1040
1041 When (M0) contact turn ON, the (T1) timer value is cleared to 0 with the RST reset command, the (T1) contact is off, and the Y0 OFF.
1042
1043 == **TOF/BIN 16-bit Turn-off delay timer** ==
1044
1045 **TOF(P)**
1046
1047 Specify the T timer device in (s1), the expected time in (s2), and the time base (resolution) in (s3). And store the time values of the accumulated multiple timing intervals into the device specified in (s1).
1048
1049 PLC Editor2 version that supports this instruction: 2.3.1 and above.
1050
1051 -[TOF (s1) (s2) (s3)]
1052
1053 **Content, scope, data type**
1054
1055 |**parameter**|**Content**|**range**|**type of data**|**Data type (label)**
1056 |(s1)|T device|0~~511|Signed BIN 16 bit|ANY16_S
1057 |(s2)|Expected time|0~~32767|Signed BIN 16 bit|ANY16_S
1058 |(s3)|Time base(resolution)|1/10/100/1000/10000|Signed BIN 16 bit|ANY16_S
1059
1060 **Device used**
1061
1062 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**parameter**|(% colspan="24" %)**Devices**|**Offset modification**|**Pulse extension**
1063 |**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**
1064 |(% rowspan="3" %)TON|Parameter 1| | | | | | | | | | | | | | |●| | | | | | | | | | |
1065 |Parameter 2| | | | | | | | | | |●|●|●|●| |●|●|●|●| | |●|●| | |
1066 |Parameter 3| | | | | | | | | | | | | | | | | | | | | |●|●| | |
1067
1068 **Timing Chart**
1069
1070 (% style="text-align:center" %)
1071 [[image:企业微信截图_16691735325382.png]]
1072
1073 **Features**
1074
1075 1) After the input is disconnected, the output is delayed for a fixed time before stopping. The timer bit turns on immediately when the input is started and the current value is set to 0. When the input is disconnected, timing starts until the current time is equal to the preset time, then timing stops.
1076
1077 2) When the preset value is reached, the timer bit is disconnected and the current value stops incrementing; If the input is turned on again before the TOF reaches the preset value, the timer bit remains on.
1078
1079 3) For the TOF timer to start timing, the enable input must perform an on-off transition.
1080
1081
1082 |**S3 time base**|**Actual value**
1083 |1|100us
1084 |10|1ms
1085 |100|10ms
1086 |1000|100ms
1087 |10000|1s
1088
1089 **Precautions**
1090
1091 • Avoid timer number conflict: the same timer number cannot be used for TON, TONR, TOF, TP, OUT_T timers at the same time. For example, TON T32 and TOF T32 cannot be used at the same time (it may cause data confusion and not achieve the effect of the corresponding instruction function).
1092
1093 **Error code**
1094
1095 |**Error code**|**Content**
1096 |4084H|Input data in (s2) (s3) is outside the specified range.
1097 |4085H|Device tpye in (s1) (s2) (s3) is outside the specified range.
1098 |4086H|Device tpye in (s1) is outside the specified range.
1099
1100 **Example**
1101
1102 (% style="text-align:center" %)
1103 [[image:企业微信截图_16691735281572.png]]
1104
1105 T1 is used for storing time, setting the expected time as K10 and the time base as K10000.
1106
1107 Make the (M8) contact ON and oFF, When (M8) ON, (T1) contact is ON and Y0 is ON. when (M8) OFF, (Y0) is OFF and (T1) starts timing. When the estimated time of 5s is reached, the (T1) contact is also 0FF.
1108
1109 If the (M8) contact ON again during (T1) timing, the (T1) value clears to 0 and the timing ends
1110
1111 == **TP/BIN 16-bit Start pulse timer** ==
1112
1113 **TP(P)**
1114
1115 Specify the T timer device in (s1), the expected time in (s2), and the time base (resolution) in (s3). And output TRUE in the set time of "(s2)*(s3)" product.
1116
1117 PLC Editor2 version that supports this instruction: 2.3.1 and above.
1118
1119 -[TP (s1) (s2) (s3)]
1120
1121 **Content, scope, data type**
1122
1123 |**parameter**|**Content**|**range**|**type of data**|**Data type (label)**
1124 |(s1)|T device|0~~511|Signed BIN 16 bit|ANY16_S
1125 |(s2)|Expected time|0~~32767|Signed BIN 16 bit|ANY16_S
1126 |(s3)|Time base(resolution)|1/10/100/1000/10000|Signed BIN 16 bit|ANY16_S
1127
1128 **Device used**
1129
1130 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**parameter**|(% colspan="24" %)**Devices**|**Offset modification**|**Pulse extension**
1131 |**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**
1132 |(% rowspan="3" %)TON|Parameter 1| | | | | | | | | | | | | | |●| | | | | | | | | | |
1133 |Parameter 2| | | | | | | | | | |●|●|●|●| |●|●|●|●| | |●|●| | |
1134 |Parameter 3| | | | | | | | | | | | | | | | | | | | | |●|●| | |
1135
1136 **Timing Chart**
1137
1138 (% style="text-align:center" %)
1139 [[image:企业微信截图_16691747709508.png]]
1140
1141 **Features**
1142
1143 Timer that outputs TRUE only for the set time after startup
1144
1145 1) When the enable input is turned on, timer (s1) is started and timer (s1) bit is immediately turned on. Timer (s1) stops as time increases and reaches the expected time.
1146
1147 2) After timer (s1) reaches the predetermined time (s2), timer (s1) bit is disconnected. At this time, timer (s1) stops increasing. If the enable input becomes FALSE, timer (s1) will reset. The expected time (s2) becomes 0.
1148
1149 3) After starting, if the enable input becomes FALSE before the timer (s1) reaches the expected time (s2), the timer will be reset after reaching the expected time (s2).
1150
1151
1152 |**S3 time base**|**Actual value**
1153 |1|100us
1154 |10|1ms
1155 |100|10ms
1156 |1000|100ms
1157 |10000|1s
1158
1159 **Precautions**
1160
1161 • Avoid timer number conflict: the same timer number cannot be used for TON, TONR, TOF, TP, OUT_T timers at the same time. For example, TON T32 and TOF T32 cannot be used at the same time (it may cause data confusion and not achieve the effect of the corresponding instruction function).
1162
1163 **Error code**
1164
1165 |**Error code**|**Content**
1166 |4084H|Input data in (s2) (s3) is outside the specified range.
1167 |4085H|Device tpye in (s1) (s2) (s3) is outside the specified range.
1168 |4086H|Device tpye in (s1) is outside the specified range.
1169
1170 **Example**
1171
1172 (% style="text-align:center" %)
1173 [[image:企业微信截图_1669174775341.png]]
1174
1175
1176 T1 is used for storing time, setting the expected time as K5 and the time base as K10000.
1177
1178 When the enable input (M8) is on, the timer (T1) is started and the timer (T1) bit turns on immediately. Timer (T1) stops as time increases and reaches the expected time.
1179
1180 After timer (T1) reaches a predetermined time of 5s, timer (T1) bit is disconnected. At this time, timer (T1) stops increasing. If the enable input (M8) becomes FALSE, timer (T1) will reset. The expected time becomes 0.
1181
1182 After startup, if the enable input (M8) becomes FALSE before the timer (T1) reaches the estimated time of 5s, the timer will be reset after reaching the estimated time of 5s.