31.10.2.5 Confirming Execution Results - SUB/SUBP

Program Example

SUB

Subtracts two constants from another and stores the result in the integer variable.

  1. When the positive transition instruction turns ON, the SUB instruction will be executed. When the SUB instruction is executed, the result value of 10, obtained from 25 - 15 = 10, is stored in D1.
    When using a normally open instruction, as long as the variable is ON, the SUB instruction is always executed.

SUBP

  1. When the normally open instruction turns ON, the SUBP instruction will be executed. When the SUBP instruction is executed, the result value of 10, obtained from 25 - 15 = 10, is stored in D1.
    Even when using a normally open instruction, the SUBP instruction executes only when it detects an upward transition.
    Therefore, even when the normally open instruction is always ON, the SUBP instruction is executed only for one scan.