If the result does not reach 00:00:00 (hours, minutes, seconds) after the instruction, digits will overflow. The #L_CalcCarry for the system variable (bit) turns on.
If the operation result is 00:00' 00", the system variable #L_CalcZero turns ON.
When checking the result using system variables, make sure the check takes place after the instruction has been executed. When checking the state after multiple instructions have been executed, system variables will store the result only of the last processed instruction.
Program Example
JSUB
When the positive transition instruction is turned ON, time subtraction will be performed.
When the positive transition instruction turns ON, the JSUB instruction will be executed. When the JSUB instruction is executed, Data_2 (time variable) in operand S2 is subtracted from Data_1 (time variable) in operand S1, and the result of the subtraction is stored in operand D1. When using a normally open instruction, on every scan the JSUB instruction receives power, it runs the date/time calculation.
Example
For example, when Data_1 in operand S1 is 12:10:45, and Data_2 in operand S2 is 6:55:20, if a JSUB instruction is executed, the result is 5:15:25, and 5:15:25 is stored in operand D1.
JSUBP
When the normally open instruction turns ON, the JSUBP instruction will be executed. When the JSUBP instruction is executed, Data_2 (time variable) in operand S2 is subtracted from Data_1 (time variable) in operand S1, and the result of the subtraction is stored in operand D1. Even when using a normally open instruction, the JSUBP instruction executes only when it detects an upward transition.
Therefore, even when the variable of the NO instruction is always ON, the JSUBP instruction is executed only for one scan.