12 Clock operation
TADD/The addition of clock data
TADD(P)
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) .
-[TADD (s1) (s2) (d)]
Content, range and data type
Parameter | Content | Range | Data type | Data type (label) |
(s1) | The device start number that stores the added time data | - | Signed BIN 16 bit | ANY16_ARRAY (number of elements: 3) |
(s2) | The device start number that stores the addition operation time (time) data | - | Signed BIN 16 bit | ANY16_ARRAY (number of elements: 3) |
(d) | The device start number that stores the time (time) data of the addition operation result | - | Signed BIN 16 bit | ANY16_ARRAY (number of elements: 3) |
Device used
Instruction | Parameter | Devices | Offset modification | Pulse extension | ||||
T | C | D | R | SD | [D] | XXP | ||
TADD | Parameter 1 | ● | ● | ● | ● | ● | ● | ● |
Parameter 2 | ● | ● | ● | ● | ● | ● | ● | |
Parameter 3 | ● | ● | ● | ● | ● | ● | ● |
Features
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.
Example
When 6:32:40 and 7:48:10 are added together
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.
When the calculation result is 0 (0 hour, 0 minute, 0 second), the zero flag turns on.
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.
Related device are as follows:
Devices | Name | Content |
SM151 | Carry | It is ON when the result of the TADD(P) instruction exceeds the maximum clock data value of 23:59:59 |
SM153 | Zero | It is ON when the result of the TADD(P) instruction is 0:00:00 |
Error code
Error code | Content |
4085H | When reading the specified device range exceeds the corresponding device range |
4086H | When writing the specified device range exceeds the corresponding device range |
4084H | When the values specified in (s1) and (s2) are other than 0 to 23 When the values specified in (s1)+1, (s2)+1, (s1)+2 and (s2)+2 are other than 0 to 59 |
Example
Set D0 time to 16:30:00 and D10 time to 4:30:0
After the coil is turned on, the D20 time is 21:0:0
TSUB/The subtraction of clock data
TSUB(P)
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 .
-[TSUB (s1) (s2) (d)]
Content, range and data type
Parameter | Content | Range | Data type | Data type (label) |
(s1) | The device start number that stores the subtracted time data | - | Signed BIN 16 bit | ANY16_ARRAY (number of elements: 3) |
(s2) | The device start number that stores the subtraction operation time (time) data | - | Signed BIN 16 bit | ANY16_ARRAY (number of elements: 3) |
(d) | The device start number that stores the time (time) data of the subtraction result | - | Signed BIN 16 bit | ANY16_ARRAY (number of elements: 3) |
Device used
Instruction | Parameter | Devices | Offset modification | Pulse extension | ||||
T | C | D | R | SD | [D] | XXP | ||
TSUB | Parameter 1 | ● | ● | ● | ● | ● | ● | ● |
Parameter 2 | ● | ● | ● | ● | ● | ● | ● | |
Parameter 3 | ● | ● | ● | ● | ● | ● | ● |
Features
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.
Example
When subtracting 10:40:20 and 3:50:10
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.
When the calculation result is 0 (0 hour, 0 minute, 0 second), the zero flag turns on.
Related device are as follows:
Devices | Name | Content |
SM152 | Borrow | It is ON when the result of the TSUB(P) instruction is less than 0:00:00 |
SM153 | Zero | It is ON when the result of the TSUB(P) instruction is at the time of 0:00:00:00 |
✎Note:
• The devices specified in (s1), (s2), and (d) occupy 3 points respectively. Be careful not to overlap with the device used for machine control.
• 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.
Error code
Error code | Content |
4085H | When reading the specified device range exceeds the corresponding device range |
4086H | When writing the specified device range exceeds the corresponding device range |
4084H | When the values specified in (s1) and (s2) are other than 0 to 23 When the values specified in (s1)+1, (s2)+1, (s1)+2 and (s2)+2 are other than 0 to 59 |
Example
Set D0 time to 16:30:00 and D10 time to 4:30:0
After the coil is turned on, the D20 time is 12:00:00
TRD/Clock data reading
TRD(P)
Read the clock data of the built-in real-time clock of the CPU module.
-[TRD (d)]
Content, range and data type
Parameter | Content | Range | Data type | Data type (label) |
(d) | Read destination and start device number of clock data | - | Signed BIN 16 bit | ANY16_ARRAY (number of elements: 7) |
Device used
Instruction | Parameter | Devices | Offset modification | Pulse extension | |||
T | C | D | R | [D] | XXP | ||
TRD | Parameter 1 | ● | ● | ● | ● | ● | ● |
Features
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.
Parameter | Element | Project | Clock data | Element | Project | |
Special register | SD105 | Year (Gregorian) | 2000 to 2099 | → | (d) | Year (Gregorian) |
SD104 | Month | 1 to 12 | → | (d)+1 | Month | |
SD103 | Day | 1 to 31 | → | (d)+2 | Day | |
SD102 | Hour | 0 to 23 | → | (d)+3 | Hour | |
SD101 | Minute | 0 to 59 | → | (d)+4 | Minute | |
SD100 | Seconds | 0 to 59 | → | (d)+5 | Seconds | |
SD106 | Week | 0 (Sun) to 6 (Sat) | → | (d)+6 | Week |
• The related devices are shown below. The clock data of these special registers are updated through END processing.
Devices | Content |
SD100 | The second data of the clock data is stored in BIN code. |
SD101 | The sub-data of the clock data is stored in BIN code. |
SD102 | Time data of clock data is stored in BIN code. |
SD103 | The daily data of the clock data is stored in BIN code. |
SD104 | The monthly data of the clock data is stored in BIN code. |
SD105 | The year data of the clock data is stored in a 4-digit BIN code of the Gregorian calendar. |
SD106 | The week data of the clock data is stored in BIN code. (0: day, 1: one, ..., 6: six) are stored in BIN code. |
✎Note:
• The device specified in (d) occupies 7 points. Be careful not to overlap with the device used for machine control.
Error code
Error code | Content |
4086H | When reading the specified device range exceeds the corresponding device range |
Example
After the M0 coil is turned on, the current date and time are read as 2020-2-19 13:10:38 Wednesday
TWR/Clock data writing
TWR(P)
Write the clock data of the built-in real-time clock of the CPU module.
-[TWR (s)]
Content, range and data type
Parameter | Content | Range | Data type | Data type (label) |
(s) | Clock data write source, start device number | - | Signed BIN 16 bit | ANY16_ARRAY (number of elements: 7) |
Device used
Instruction | Parameter | Devices | Offset modification | Pulse extension | |||
T | C | D | R | [D] | XXP | ||
TWR | Parameter 1 | ● | ● | ● | ● | ● | ● |
Features
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.
Set data at all times | Special register | ||||
Element | Project | Clock data | Element | Project | |
(s) | Year (Gregorian) | 2000 to 2099 or 0 to 99 | → | SD105 | Year (Gregorian) |
(s)+1 | Month | 1 to 12 | → | SD104 | Month |
(s)+2 | Day | 1 to 31 | → | SD103 | Day |
(s)+3 | Hour | 0 to 23 | → | SD102 | Hour |
(s)+4 | Minute | 0 to 59 | → | SD101 | Minute |
(s)+5 | Seconds | 0 to 59 | → | SD100 | Seconds |
(s)+6 | Week | 0 (Sun) to 6 (Sat) | → | SD106 | Week |
• 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.
• If the year in (s) is in the range of 0 to 99, it will be automatically treated as 2000 to 2099.
• When a value indicating an impossible time is set, the clock data will not be updated. Set the correct clock data and write again.
• The day of the week (SD100) is automatically corrected.
• The related devices are shown below.
Devices | Content |
SD100 | The second data of the clock data is stored in BIN code. |
SD101 | The sub-data of the clock data is stored in BIN code. |
SD102 | Time data of clock data is stored in BIN code. |
SD103 | The daily data of the clock data is stored in BIN code. |
SD104 | The monthly data of the clock data is stored in BIN code. |
SD105 | The year data of the clock data is stored in a 4-digit BIN code of the Gregorian calendar. |
SD106 | The week data of the clock data is stored in BIN code. (0: day, 1: one, ..., 6: six) are stored in BIN code. |
✎Note:
The device specified in (s) occupies 7 points. Be careful not to overlap with the device used for machine control.
Error code
Error code | Content |
4085H | When reading the specified device range exceeds the corresponding device range |
Example
Set D0 date and time to 2020-2-19 12:36:00 in advance
At the moment when the time 12:36:00 arrives, turn on the M0 coil and write the time.
HTOS/16-bit data conversion of time data (hour, minute, second → second)
HTOS(P)
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).
-[HTOS (s) (d)]
Content, range and data type
Parameter | Content | Range | Data type | Data type (label) |
(s) | The device start number that stores the data of the subtracted time | - | Signed BIN 16 bit | ANY16_ARRAY (number of elements: 3) |
(d) | The device start number that stores the converted clock data | - | Signed BIN 16 bit | ANY16 |
Device used
Instruction | Parameter | Devices | Offset modification | Pulse extension | ||||||||
KnX | KnY | KnM | KnS | T | C | D | R | SD | [D] | XXP | ||
HTOS | Parameter 1 | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
Parameter 2 | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
Features
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).
Example
When 4 hours, 29 minutes and 31 seconds are specified in (s)
Error code
Error code | Content |
4085H | When reading the specified device range exceeds the corresponding device range |
4086H | When writing the specified device range exceeds the corresponding device range |
4084H | When the calculation result is not in the range of 0 to 32767 When the value specified in (s) is not in the range of 0 to 9 When the value specified in (s)+1 and (s)+2 is not in the range of 0 to 59 |
Example
D0 time is set to 5:36:53
The time of D10 after the M0 coil is turned on is as below.
DHTOS/32-bit data conversion of time data (hour, minute, second → second)
DHTOS(P)
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).
-[DHTOS (s) (d)]
Content, range and data type
Parameter | Content | Range | Data type | Data type (label) |
(s) | The device start number that stores the data of the subtracted time | - | Signed BIN 16 bit | ANY16_ARRAY (number of elements: 3) |
(d) | The device start number that stores the converted clock data | - | Signed BIN 32 bit | ANY32 |
Device used
Instruction | Parameter | Devices | Offset modification | Pulse extension | ||||||||
KnX | KnY | KnM | KnS | T | C | D | R | SD | [D] | XXP | ||
DHTOS | Parameter 1 | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
Parameter 2 | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
Features
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).
Example
When 35 hours, 10 minutes and 58 seconds are specified in (s)
Error code
Error code | Content |
4085H | When reading the specified device range exceeds the corresponding device range |
4086H | When writing the specified device range exceeds the corresponding device range |
4084H | When the calculation result is not in the range of 0 to 32767 When the value specified in (s)+1 and (s)+2 is not in the range of 0 to 59 |
Example
D0 time is set to 15:33:24
The second of D10 after the M0 coil is turned on is
HOUR/Hour measuring 16-bit
HOUR(P)
The time for the input contact to be ON is measured in units of one hour.C
-[HOUR (s) (d1) (d2)]
Content, range and data type
Parameter | Content | Range | Data type | Data type (label) |
(s) | The time when the alarm (d2) is turned ON (set by one hour) | K0 to K32767 | Signed BIN 16 bit | ANY16 |
(d1) | Device that stores the current value of measurement (specified data register for power failure retention) | - | Unsigned BIN 16 bit | ANY16_ARRAY (Number of elements: 2) |
(d2) | Device that turns ON when the time limit expires (alarm output) | - | Bit | ANY_BOOL |
Device used
Instruction | Parameter | Devices | Offset modification | Pulse extension | ||||||||||||||||
Y | M | S | SM | D.b | KnX | KnY | KnM | KnS | T | C | D | R | SD | K | H | E | [D] | XXP | ||
HOUR | Parameter 1 | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ||||||
Parameter 2 | ● | ● | ● | ● | ● | |||||||||||||||
Parameter 3 | ● | ● | ● | ● | ● | ● | ● |
Features
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 .
• In (s), set the time until the alarm (d2) turns ON in units of 1 hour.
• (d1) stores the current measured value in units of 1 hour.
• If the median value of (d1) exceeds 32767, it will be modified to 32767.
• (d1)+1 stores the current measured value (in units of 1 second) that is less than 1 hour.
• (d2) turns on when the current value (d1) exceeds the time specified in (s).
• 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.
• After the alarm output specified in (d2) turns ON, measurement will continue.
• 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.
✎Note:
• The device specified in (d1) occupies 2 points. Be careful not to overlap with the device used for machine control.
• After the instruction stops running, the measurement stops and the output continues to be maintained.
Error code
Error code | Content |
4085H | When reading the specified device range exceeds the corresponding device range |
4086H | When writing the specified device range exceeds the corresponding device range |
4084H | When the value of (s) is negative |
Example
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.
DHOUR/Hour measuring 32 bits
DHOUR(P)
The time for the input contact to be ON is measured in units of one hour.
-[DHOUR (s) (d1) (d2)]
Content, range and data type
Parameter | Content | Range | Data type | Data type (label) |
(s) | The time when the alarm (d2) is turned ON (set by one hour) | 0 to 2147483647 | Signed BIN 32 bit | ANY32 |
(d1) | Device that stores the current value of measurement (specified data register for power failure retention) | - | Unsigned BIN 32 bit | ANY32_ARRAY (Number of elements: 2) |
(d2) | Device that turns ON when the time limit expires (alarm output) | - | Bit | ANY_BOOL |
Device used
Instruction | Parameter | Devices | Offset modification | Pulse extension | |||||||||||||||||
Y | M | S | SM | D.b | KnX | KnY | KnM | KnS | T | C | D | R | SD | LC | HSC | K | H | [D] | XXP | ||
DHOUR | Parameter 1 | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | |||||
Parameter 2 | ● | ● | ● | ● | ● | ||||||||||||||||
Parameter 3 | ● | ● | ● | ● | ● | ● | ● |
Features
• 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.
• In (s)+1, (s), set the time until the alarm (d2) turns ON in units of 1 hour.
• (D1)+1 and (d1) store the current value measured in units of 1 hour. ((d1)+1: high bit, (d1): low bit)
• If the median of (d1)+1 and (d1) exceeds 2147483647, it will be modified to 2147483647.
• (D1)+2 stores the current value (in units of 1 second) of the measurement that is less than 1 hour.
• (D2) turns on when the current value (d1)+1, (d1) exceeds the time specified in (s).
• 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.
• After the alarm output specified in (d2) turns on, the measurement will continue.
• 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.
✎Note:
• The device specified in (d1) occupies 3 points. Be careful not to overlap with the device used for machine control.
• After the instruction stops running, the measurement stops and the output continues to be maintained.
Error code
Error code | Content |
4085H | When reading the specified device range exceeds the corresponding device range |
4086H | When writing the specified device range exceeds the corresponding device range |
4084H | When the value of (s) is negative |
Example
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.
STOH/16-bit data conversion of time data (second → hour, minute, second)
STOH(P)
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.
-[STOH (s) (d)]
Content, range and data type
Parameter | Content | Range | Data type | Data type (label) |
(s) | The device start number that stores the clock data before conversion | 0 to 32767 | Signed BIN 16 bit | ANY16 |
(d) | The device start number that stores the converted clock data | - | Signed BIN 16 bit | ANY16_ARRAY (number of elements: 3) |
Device used
Instruction | Parameter | Devices | Offset modification | Pulse extension | ||||||||
KnX | KnY | KnM | KnS | T | C | D | R | SD | [D] | XXP | ||
STOH | Parameter 1 | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
Parameter 2 | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
Features
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.
Example
When 29,011 seconds are specified in (s)
Error code
Error code | Content |
4085H | When reading the specified device range exceeds the corresponding device range |
4086H | When writing the specified device range exceeds the corresponding device range |
4084H | When the value of (s) exceeds the range |
Example
Set D0 seconds to 12537
The hour, minute and second of D10 after the M0 coil is turned on are
DSTOH/32-bit data conversion of time data (second → hour, minute, second)
DSTOH(P)
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.
-[DSTOH (s) (d)]
Content, range and data type
Parameter | Content | Range | Data type | Data type (label) |
(s) | The device start number that stores the clock data before conversion | 0 to 117964799 | Signed BIN 32 bit | ANY32 |
(d) | The device start number that stores the converted clock data | - | Signed BIN 16 bit | ANY16_ARRAY (number of elements: 3) |
Device used
Instruction | Parameter | Devices | Offset modification | Pulse extension | ||||||||
KnX | KnY | KnM | KnS | T | C | D | R | SD | [D] | XXP | ||
DSTOH | Parameter 1 | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
Parameter 2 | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
Features
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.
Example
When 45,325 seconds is specified in (s)
Error code
Error code | Content |
4085H | When reading the specified device range exceeds the corresponding device range |
4086H | When writing the specified device range exceeds the corresponding device range |
4084H | When the value of (s) exceeds the range |
Example
Set D0 seconds to 2152537
The hour, minute and second of D10 after the M0 coil is turned on are
TCMP/Clock data comparison
TCMP(P)
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.
-[TCMP (s1) (s2) (s3) (s4) (d)]
Content, range and data type
Parameter | Content | Range | Data type | Data type (label) |
(s1) | Specify the "hour" of the comparison base time. | 0 to 23 | Signed BIN 16 bit | ANY16 |
(s2) | Specify the "minute" of the comparison base time. | 0 to 59 | Signed BIN 16 bit | ANY16 |
(s3) | Specify the "second" of the comparison base time. | 0 to 59 | Signed BIN 16 bit | ANY16 |
(s4) | Specify the "hour" of the time data (hour, minute, second). | - | Signed BIN 16 bit | ANY16_ARRAY |
(d) | The bit device is turned ON/OFF according to the comparison result. | - | Bit | ANYBIT_ARRAY |
Device used
Instruction | Parameter | Devices | Offset modification | Pulse extension | ||||||||||||||||
Y | M | S | SM | D.b | KnX | KnY | KnM | KnS | T | C | D | R | SD | K | H | E | [D] | XXP | ||
TCMP | Parameter 1 | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ||||||
Parameter 2 | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | |||||||
Parameter 3 | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | |||||||
Parameter 4 | ● | ● | ● | ● | ● | ● | ● | |||||||||||||
Parameter 5 | ● | ● | ● | ● | ● | ● | ● |
Features
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.
✎Note:
The device specified in (s4) and (d) occupies 3 points. Be careful not to overlap with the device used for machine control.
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.
Error code
Error code | Content |
4085H | When reading the specified device range exceeds the corresponding device range |
4086H | When writing the specified device range exceeds the corresponding device range |
4084H | When the value specified in (s) and (s4) is not in the range of 0 to 23 When the value specified in (s2),(s3) (s4)+1 and (s4)+2 is not in the range of 0 to 59 |
Example
Set D10 to 1, D11 to 30, D12 to 0
When M0 is turned on, the time that D23 will come is 0:31:27
M10 is turned ON
TZCP/Clock data bandwidth comparison
TZCP(P)
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.
-[TZCP (s1) (s2) (s3) (d)]
Content, range and data type
Parameter | Content | Range | Data type | Data type (label) |
(s1) | Specify the "hour" of the lower limit time (hour, minute, second) | - | Signed BIN 16 bit | ANY16_ARRAY (number of elements: 3) |
(s2) | Specify the "hour" of the lower limit time (hour, minute, second) | - | Signed BIN 16 bit | ANY16_ARRAY (number of elements: 3) |
(s3) | Specify "hour" of time data (hour, minute, second) | - | Signed BIN 16 bit | ANY16_ARRAY (number of elements: 3) |
(d) | The bit device is turned ON/OFF according to the comparison result. | - | Bit | ANY16_ARRAY (number of elements: 3) |
Device used
Instruction | Parameter | Devices | Offset modification | Pulse extension | |||||||||
Y | M | S | SM | D.b | T | C | D | R | SD | [D] | XXP | ||
TZCP | Parameter 1 | ● | ● | ● | ● | ● | ● | ● | |||||
Parameter 2 | ● | ● | ● | ● | ● | ● | ● | ||||||
Parameter 3 | ● | ● | ● | ● | ● | ● | ● | ||||||
Parameter 4 | ● | ● | ● | ● | ● | ● | ● |
Features
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.
✎Note:
• The devices specified in (s1), (s2), (s3), (d) occupy 3 points. Be careful not to overlap with the device used for machine control.
• 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.
• When (s1)> (s2), two of (d), (d)+1, (d)+2 are ON/OFF.
Error code
Error code | Content |
4085H | When reading the specified device range exceeds the corresponding device range |
4086H | When writing the specified device range exceeds the corresponding device range |
4084H | When the value specified in (s1), (s2) and (s3) is not in the range of 0 to 23 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 |
Example
Set D0 time to 16:30:00 and D10 time to 4:30:0
After the coil is turned on, the reading time to D20 time is 8:30:00
M0/M12 is ON
TON/BIN 16-bit Turn-on delay timer
TON(P)
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).
PLC Editor2 version that supports this instruction: 2.3.1 and above.
-[TON (s1) (s2) (s3)]
Content, scope, data type
parameter | Content | range | type of data | Data type (label) |
(s1) | T device | 0~511 | Signed BIN 16 bit | ANY16_S |
(s2) | Expected time | 0~32767 | Signed BIN 16 bit | ANY16_S |
(s3) | Time base(resolution) | 1/10/100/1000/10000 | Signed BIN 16 bit | ANY16_S |
Device used
instruction | parameter | Devices | Offset modification | Pulse extension | |||||||||||||||||||||||
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 | ||
TON | Parameter 1 | ● | |||||||||||||||||||||||||
Parameter 2 | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | |||||||||||||||||
Parameter 3 | ● | ● |
Timing Chart
Features
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".
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.
S3 time base | Actual value |
1 | 100us |
10 | 1ms |
100 | 10ms |
1000 | 100ms |
10000 | 1s |
Precautions
• 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).
Error code
Error code | Content |
4084H | Input data in (s2) (s3) is outside the specified range. |
4085H | Device tpye in (s1) (s2) (s3) is outside the specified range. |
4086H | Device tpye in (s1) is outside the specified range. |
Example
T1 is used for storing time, setting the expected time as K10 and the time base as K10000.
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.
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.
TONR/BIN 16-bit Hold-type turn-on delay timer
TONR(P)
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).
PLC Editor2 version that supports this instruction: 2.3.1 and above.
-[TONR (s1) (s2) (s3)]
Content, scope, data type
parameter | Content | range | type of data | Data type (label) |
(s1) | T device | 0~511 | Signed BIN 16 bit | ANY16_S |
(s2) | Expected time | 0~32767 | Signed BIN 16 bit | ANY16_S |
(s3) | Time base(resolution) | 1/10/100/1000/10000 | Signed BIN 16 bit | ANY16_S |
Device used
instruction | parameter | Devices | Offset modification | Pulse extension | |||||||||||||||||||||||
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 | ||
TON | Parameter 1 | ● | |||||||||||||||||||||||||
Parameter 2 | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | |||||||||||||||||
Parameter 3 | ● | ● |
Timing Chart
Features
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".
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.
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.
S3 time base | Actual value |
1 | 100us |
10 | 1ms |
100 | 10ms |
1000 | 100ms |
10000 | 1s |
Precautions
• 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).
Error code
Error code | Content |
4084H | Input data in (s2) (s3) is outside the specified range. |
4085H | Device tpye in (s1) (s2) (s3) is outside the specified range. |
4086H | Device tpye in (s1) is outside the specified range. |
Example
T1 is used for storing time, setting the expected time as K10 and the time base as K10000.
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.
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.
TOF/BIN 16-bit Turn-off delay timer
TOF(P)
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).
PLC Editor2 version that supports this instruction: 2.3.1 and above.
-[TOF (s1) (s2) (s3)]
Content, scope, data type
parameter | Content | range | type of data | Data type (label) |
(s1) | T device | 0~511 | Signed BIN 16 bit | ANY16_S |
(s2) | Expected time | 0~32767 | Signed BIN 16 bit | ANY16_S |
(s3) | Time base(resolution) | 1/10/100/1000/10000 | Signed BIN 16 bit | ANY16_S |
Device used
instruction | parameter | Devices | Offset modification | Pulse extension | |||||||||||||||||||||||
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 | ||
TON | Parameter 1 | ● | |||||||||||||||||||||||||
Parameter 2 | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | |||||||||||||||||
Parameter 3 | ● | ● |
Timing Chart
Features
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.
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.
3) For the TOF timer to start timing, the enable input must perform an on-off transition.
S3 time base | Actual value |
1 | 100us |
10 | 1ms |
100 | 10ms |
1000 | 100ms |
10000 | 1s |
Precautions
• 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).
Error code
Error code | Content |
4084H | Input data in (s2) (s3) is outside the specified range. |
4085H | Device tpye in (s1) (s2) (s3) is outside the specified range. |
4086H | Device tpye in (s1) is outside the specified range. |
Example
T1 is used for storing time, setting the expected time as K10 and the time base as K10000.
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.
If the (M8) contact ON again during (T1) timing, the (T1) value clears to 0 and the timing ends
TP/BIN 16-bit Start pulse timer
TP(P)
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.
PLC Editor2 version that supports this instruction: 2.3.1 and above.
-[TP (s1) (s2) (s3)]
Content, scope, data type
parameter | Content | range | type of data | Data type (label) |
(s1) | T device | 0~511 | Signed BIN 16 bit | ANY16_S |
(s2) | Expected time | 0~32767 | Signed BIN 16 bit | ANY16_S |
(s3) | Time base(resolution) | 1/10/100/1000/10000 | Signed BIN 16 bit | ANY16_S |
Device used
instruction | parameter | Devices | Offset modification | Pulse extension | |||||||||||||||||||||||
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 | ||
TON | Parameter 1 | ● | |||||||||||||||||||||||||
Parameter 2 | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | |||||||||||||||||
Parameter 3 | ● | ● |
Timing Chart
Features
Timer that outputs TRUE only for the set time after startup
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.
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.
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).
S3 time base | Actual value |
1 | 100us |
10 | 1ms |
100 | 10ms |
1000 | 100ms |
10000 | 1s |
Precautions
• 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).
Error code
Error code | Content |
4084H | Input data in (s2) (s3) is outside the specified range. |
4085H | Device tpye in (s1) (s2) (s3) is outside the specified range. |
4086H | Device tpye in (s1) is outside the specified range. |
Example
T1 is used for storing time, setting the expected time as K5 and the time base as K10000.
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.
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.
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.