32.11.2.3 Confirming Execution Results - JSUB/JSUBP

Program Example

JSUB

When the positive transition instruction is turned ON, time subtraction will be performed.

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

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