When the execution result is 0, #L_CalcZero turns on.
When the execution results in an error, the error code is stored in #L_CalcErrCode.
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
BCNT
Counts the number of bits that are ON, and saves the number in an integer variable.
When the positive transition instruction turns ON, the BCNT instruction will be executed. When the BCNT instruction is executed, the ON bits in the value 10 (binary 1010) are counted and the result of 2 is saved in the result data. The result data is configured in D1.
When using a normally-open instruction, as long as the instruction variable is ON, the BCNT instruction is always executed.
BCNTP
BCNTP and BCNT instructions differ in when they run. In the BCNTP instruction, when using a normally open instruction, only the upward transition is detected and the BCNT instruction is executed. Even if the normally open instruction variable remains ON, the BCNTP instruction is executed only for one scan.