31.10.7.3 Confirming Execution Results - DEC/DECP

Program Example

DEC

Every time the DEC instruction turns on, 1 is subtracted.

  1. When the positive transition instruction turns ON, the DEC instruction will be executed. When the DEC instruction is executed, 1 is subtracted from D1(integer variable).
    When using a normally open instruction, as long as the instruction is passing power, the DEC instruction is continually run and subtracts 1 from D1.

DECP

  1. When the normally open instruction turns ON, the DECP instruction will be executed. When the DECP instruction is executed, 1 is subtracted from the result data (integer variable) in D1.
    Even when using a normally open instruction, the DECP instruction executes only when it detects an upward transition.
    Therefore, even when the operation is continuously ON, the DECP instruction executes for only one scan and 1 is subtracted from the result data (integer variable).