12 Clock operation

Last modified by Mora Zhou on 2023/11/21 17:27

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

ParameterContentRangeData typeData 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

InstructionParameterDevices

Offset modification

Pulse extension

TCDRSD[D]XXP
TADDParameter 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.

07-5 Basic instructions_html_37222a6e282347f9.png

Example

When 6:32:40 and 7:48:10 are added together

07-5 Basic instructions_html_90138670198ab422.png

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.

07-5 Basic instructions_html_bac419ce2dc0dc2.png

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:

DevicesNameContent
SM151CarryIt is ON when the result of the TADD(P) instruction exceeds the maximum clock data value of 23:59:59
SM153ZeroIt is ON when the result of the TADD(P) instruction is 0:00:00

Note: The devices specified in (s1), (s2), (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 codeContent
4085HWhen reading the specified device range exceeds the corresponding device range
4086HWhen 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

07-5 Basic instructions_html_4f75eedee7172bbb.png

Set D0 time to 16:30:00 and D10 time to 4:30:0

07-5 Basic instructions_html_c64e0faf2af172f8.png

07-5 Basic instructions_html_66e3a2eadeb2ecbb.png

After the coil is turned on, the D20 time is 21:0:0

07-5 Basic instructions_html_a9b235835aa41200.png

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

ParameterContentRangeData typeData 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

InstructionParameterDevices

Offset modification

Pulse extension

TCDRSD[D]XXP
TSUBParameter 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.

07-5 Basic instructions_html_5a93455e4cd8a27.png

Example

When subtracting 10:40:20 and 3:50:10

07-5 Basic instructions_html_2473f03fc493780c.png

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.

07-5 Basic instructions_html_24b998b4c3c4ec73.png

When the calculation result is 0 (0 hour, 0 minute, 0 second), the zero flag turns on.

Related device are as follows:

DevicesNameContent
SM152BorrowIt is ON when the result of the TSUB(P) instruction is less than 0:00:00
SM153ZeroIt 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 codeContent
4085HWhen reading the specified device range exceeds the corresponding device range
4086HWhen 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

07-5 Basic instructions_html_e3a5d4793d3ccd2d.png

Set D0 time to 16:30:00 and D10 time to 4:30:0

07-5 Basic instructions_html_c64e0faf2af172f8.png

07-5 Basic instructions_html_66e3a2eadeb2ecbb.png

After the coil is turned on, the D20 time is 12:00:00

07-5 Basic instructions_html_8f93ea19ba10652b.png

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

ParameterContentRangeData typeData type (label)
(d)Read destination and start device number of clock data-Signed BIN 16 bit

ANY16_ARRAY

(number of elements: 7)

Device used

InstructionParameterDevices

Offset modification

Pulse extension

TCDR[D]XXP
TRDParameter 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.

ParameterElementProjectClock data ElementProject
Special registerSD105Year (Gregorian)2000 to 2099(d)Year (Gregorian)
SD104Month1 to 12(d)+1Month
SD103Day1 to 31(d)+2Day
SD102Hour0 to 23(d)+3Hour
SD101Minute0 to 59(d)+4Minute
SD100Seconds0 to 59(d)+5Seconds
SD106Week0 (Sun) to 6 (Sat)(d)+6Week

• The related devices are shown below. The clock data of these special registers are updated through END processing.

DevicesContent
SD100The second data of the clock data is stored in BIN code.
SD101The sub-data of the clock data is stored in BIN code.
SD102Time data of clock data is stored in BIN code.
SD103The daily data of the clock data is stored in BIN code.
SD104The monthly data of the clock data is stored in BIN code.
SD105The year data of the clock data is stored in a 4-digit BIN code of the Gregorian calendar.
SD106The 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 codeContent
4086HWhen reading the specified device range exceeds the corresponding device range

Example

07-5 Basic instructions_html_b81c1991fec5b4b1.png

After the M0 coil is turned on, the current date and time are read as 2020-2-19 13:10:38 Wednesday

07-5 Basic instructions_html_fe82ecd18ebfd787.png

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

ParameterContentRangeData typeData type (label)
(s)Clock data write source, start device number-Signed BIN 16 bitANY16_ARRAY (number of elements: 7)

Device used

InstructionParameterDevices

Offset modification

Pulse extension

TCDR[D]XXP
TWRParameter 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
ElementProjectClock dataElementProject
(s)Year (Gregorian)2000 to 2099 or 0 to 99SD105Year (Gregorian)
(s)+1Month1 to 12SD104Month
(s)+2Day1 to 31SD103Day
(s)+3Hour0 to 23SD102Hour
(s)+4Minute0 to 59SD101Minute
(s)+5Seconds0 to 59SD100Seconds
(s)+6Week0 (Sun) to 6 (Sat)SD106Week

• 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.

DevicesContent
SD100The second data of the clock data is stored in BIN code.
SD101The sub-data of the clock data is stored in BIN code.
SD102Time data of clock data is stored in BIN code.
SD103The daily data of the clock data is stored in BIN code.
SD104The monthly data of the clock data is stored in BIN code.
SD105The year data of the clock data is stored in a 4-digit BIN code of the Gregorian calendar.
SD106The 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 codeContent
4085HWhen 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

07-5 Basic instructions_html_994c66d1a4cbd45f.png

At the moment when the time 12:36:00 arrives, turn on the M0 coil and write the time.

07-5 Basic instructions_html_bf3e906ee5265598.png

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

ParameterContentRangeData typeData type (label)
(s)The device start number that stores the data of the subtracted time-Signed BIN 16 bitANY16_ARRAY (number of elements: 3)
(d)The device start number that stores the converted clock data-Signed BIN 16 bitANY16

Device used

InstructionParameterDevicesOffset modification

Pulse extension

KnXKnYKnMKnSTCDRSD[D]XXP
HTOSParameter 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).

07-5 Basic instructions_html_a84b7741fd5bef2f.png

Example

When 4 hours, 29 minutes and 31 seconds are specified in (s)

07-5 Basic instructions_html_5effb7bc9b8e5cf7.png

Error code

Error codeContent
4085HWhen reading the specified device range exceeds the corresponding device range
4086HWhen 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

07-5 Basic instructions_html_e23e38c4ba4c34bb.png

D0 time is set to 5:36:53

07-5 Basic instructions_html_2866a121e5ca5713.png

The time of D10 after the M0 coil is turned on is as below.

07-5 Basic instructions_html_1dd6c5de05890797.png

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

ParameterContentRangeData typeData type (label)
(s)The device start number that stores the data of the subtracted time-Signed BIN 16 bitANY16_ARRAY (number of elements: 3)
(d)The device start number that stores the converted clock data-Signed BIN 32 bitANY32

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSD[D]XXP
DHTOSParameter 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).

07-5 Basic instructions_html_f4be08508575ea01.png

Example

When 35 hours, 10 minutes and 58 seconds are specified in (s)

07-5 Basic instructions_html_5b9ad230ed5e1fd0.png

Error code

Error codeContent
4085HWhen reading the specified device range exceeds the corresponding device range
4086HWhen 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

07-5 Basic instructions_html_ae8ab4379e8bdb91.png

D0 time is set to 15:33:24

07-5 Basic instructions_html_57a15d9e1045e93e.png

The second of D10 after the M0 coil is turned on is

07-5 Basic instructions_html_194e906b1dc12078.png

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

ParameterContentRangeData typeData type (label)
(s)

The time when the alarm (d2) is turned ON

(set by one hour)

K0 to K32767Signed BIN 16 bitANY16
(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)-BitANY_BOOL

Device used

InstructionParameterDevices

Offset modification

Pulse extension

YMSSMD.bKnXKnYKnMKnSTCDRSDKHE[D]XXP
HOURParameter 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 codeContent
4085HWhen reading the specified device range exceeds the corresponding device range
4086HWhen writing the specified device range exceeds the corresponding device range
4084HWhen the value of (s) is negative

Example

07-5 Basic instructions_html_7570f8c392470a9f.png

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

ParameterContentRangeData typeData type (label)
(s)

The time when the alarm (d2) is turned ON (set by one hour)

0 to 2147483647Signed BIN 32 bitANY32
(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)-BitANY_BOOL

Device used

InstructionParameterDevices

Offset modification

Pulse extension

YMSSMD.bKnXKnYKnMKnSTCDRSDLCHSCKH[D]XXP
DHOURParameter 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 codeContent
4085HWhen reading the specified device range exceeds the corresponding device range
4086HWhen writing the specified device range exceeds the corresponding device range
4084HWhen the value of (s) is negative

Example

07-5 Basic instructions_html_3f1ef5ecc835de30.png

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

ParameterContentRangeData typeData type (label)
(s)The device start number that stores the clock data before conversion0 to 32767Signed BIN 16 bitANY16
(d)The device start number that stores the converted clock data-Signed BIN 16 bit

ANY16_ARRAY (number of elements: 3)

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSD[D]XXP
STOHParameter 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.

07-5 Basic instructions_html_1f5f3f1d80af2a34.png

Example

When 29,011 seconds are specified in (s)

07-5 Basic instructions_html_682516cbf773f515.png

Error code

Error codeContent
4085HWhen reading the specified device range exceeds the corresponding device range
4086HWhen writing the specified device range exceeds the corresponding device range
4084HWhen the value of (s) exceeds the range

Example

07-5 Basic instructions_html_e783349d57adf7d2.png

Set D0 seconds to 12537

The hour, minute and second of D10 after the M0 coil is turned on are

07-5 Basic instructions_html_d3c33949e8684891.png

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

ParameterContentRangeData typeData     type (label)
(s)The device start number that stores the clock data before conversion0 to 117964799Signed BIN 32 bitANY32
(d)The device start number that stores the converted clock data-Signed BIN 16 bit

ANY16_ARRAY (number of elements: 3)

Device used

InstructionParameterDevices

Offset modification

Pulse extension

KnXKnYKnMKnSTCDRSD[D]XXP
DSTOHParameter 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.

07-5 Basic instructions_html_cbf13fc3d10fbe61.png

Example

When 45,325 seconds is specified in (s)

07-5 Basic instructions_html_d6045506b13275a0.png

Error code

Error codeContent
4085HWhen reading the specified device range exceeds the corresponding device range
4086HWhen writing the specified device range exceeds the corresponding device range
4084HWhen the value of (s) exceeds the range

Example

07-5 Basic instructions_html_e7dd49d953db6da4.png

Set D0 seconds to 2152537

The hour, minute and second of D10 after the M0 coil is turned on are

07-5 Basic instructions_html_10d57bde1ac0a218.png

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

ParameterContentRangeData typeData type (label)
(s1)Specify the "hour" of the comparison base time.0 to 23Signed BIN 16 bitANY16
(s2)Specify the "minute" of the comparison base time.0 to 59Signed BIN 16 bitANY16
(s3)Specify the "second" of the comparison base time.0 to 59Signed BIN 16 bitANY16
(s4)Specify the "hour" of the time data (hour, minute, second).-Signed BIN 16 bitANY16_ARRAY
(d)The bit device is turned ON/OFF according to the comparison result.-BitANYBIT_ARRAY

Device used

InstructionParameterDevices

Offset modification

Pulse extension

YMSSMD.bKnXKnYKnMKnSTCDRSDKHE[D]XXP
TCMPParameter 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.

07-5 Basic instructions_html_5df7ad3057fada12.png

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 codeContent
4085HWhen reading the specified device range exceeds the corresponding device range
4086HWhen 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

07-5 Basic instructions_html_fcc16317cf7c0700.png

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

07-5 Basic instructions_html_de97dd7a612b2323.png

M10 is turned ON

07-5 Basic instructions_html_56e2d606adc09fd.png

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

ParameterContentRangeData typeData 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

InstructionParameterDevicesOffset modification

Pulse extension

YMSSMD.bTCDRSD[D]XXP
TZCPParameter 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.

07-5 Basic instructions_html_844291270080313d.png

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 codeContent
4085HWhen reading the specified device range exceeds the corresponding device range
4086HWhen 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

07-5 Basic instructions_html_30027a2387c26c2e.png

Set D0 time to 16:30:00 and D10 time to 4:30:0

07-5 Basic instructions_html_c64e0faf2af172f8.png

07-5 Basic instructions_html_66e3a2eadeb2ecbb.png

After the coil is turned on, the reading time to D20 time is 8:30:00

07-5 Basic instructions_html_75c44dad07eaf80a.png

M0/M12 is ON

07-5 Basic instructions_html_f512f36261705953.png

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

parameterContentrangetype of dataData type (label)
(s1)T device0~511Signed BIN 16 bitANY16_S
(s2)Expected time0~32767Signed BIN 16 bitANY16_S
(s3)Time base(resolution)1/10/100/1000/10000Signed BIN 16 bitANY16_S

Device used

instructionparameterDevicesOffset modificationPulse extension
XYMSSMT(bit)C(bit)LC(bit)HSC(bit)D.bKnXKnYKnMKnSTCDRSDLCHSCKHE[D]XXP
TONParameter 1                         
Parameter 2                
Parameter 3                        

Timing Chart

图片3.png

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 baseActual value
1100us
101ms
10010ms
1000100ms
100001s

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 codeContent
4084HInput data in (s2) (s3) is outside the specified range.
4085HDevice tpye in (s1) (s2) (s3) is outside the specified range.
4086HDevice tpye in (s1) is outside the specified range.

Example

图片4.png

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

parameterContentrangetype of dataData type (label)
(s1)T device0~511Signed BIN 16 bitANY16_S
(s2)Expected time0~32767Signed BIN 16 bitANY16_S
(s3)Time base(resolution)1/10/100/1000/10000Signed BIN 16 bitANY16_S

Device used

instructionparameterDevicesOffset modificationPulse extension
XYMSSMT(bit)C(bit)LC(bit)HSC(bit)D.bKnXKnYKnMKnSTCDRSDLCHSCKHE[D]XXP
TONParameter 1                         
Parameter 2                
Parameter 3                        

Timing Chart

图片2.png

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 baseActual value
1100us
101ms
10010ms
1000100ms
100001s

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 codeContent
4084HInput data in (s2) (s3) is outside the specified range.
4085HDevice tpye in (s1) (s2) (s3) is outside the specified range.
4086HDevice tpye in (s1) is outside the specified range.

Example

图片1.png

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

parameterContentrangetype of dataData type (label)
(s1)T device0~511Signed BIN 16 bitANY16_S
(s2)Expected time0~32767Signed BIN 16 bitANY16_S
(s3)Time base(resolution)1/10/100/1000/10000Signed BIN 16 bitANY16_S

Device used

instructionparameterDevicesOffset modificationPulse extension
XYMSSMT(bit)C(bit)LC(bit)HSC(bit)D.bKnXKnYKnMKnSTCDRSDLCHSCKHE[D]XXP
TONParameter 1                         
Parameter 2                
Parameter 3                        

Timing Chart

图片5.png

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 baseActual value
1100us
101ms
10010ms
1000100ms
100001s

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 codeContent
4084HInput data in (s2) (s3) is outside the specified range.
4085HDevice tpye in (s1) (s2) (s3) is outside the specified range.
4086HDevice tpye in (s1) is outside the specified range.

Example

图片6.png

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

parameterContentrangetype of dataData type (label)
(s1)T device0~511Signed BIN 16 bitANY16_S
(s2)Expected time0~32767Signed BIN 16 bitANY16_S
(s3)Time base(resolution)1/10/100/1000/10000Signed BIN 16 bitANY16_S

Device used

instructionparameterDevicesOffset modificationPulse extension
XYMSSMT(bit)C(bit)LC(bit)HSC(bit)D.bKnXKnYKnMKnSTCDRSDLCHSCKHE[D]XXP
TONParameter 1                         
Parameter 2                
Parameter 3                        

Timing Chart

图片7.png

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 baseActual value
1100us
101ms
10010ms
1000100ms
100001s

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 codeContent
4084HInput data in (s2) (s3) is outside the specified range.
4085HDevice tpye in (s1) (s2) (s3) is outside the specified range.
4086HDevice tpye in (s1) is outside the specified range.

Example

图片8.png

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.