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