If an overflow occurs as a result of the instruction, the system variable (bit) #L_CalcCarry turns on.
When the execution result is 0, 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
DEC
Every time the DEC instruction turns on, 1 is subtracted.
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
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).