31.14.2.6 System Variables Indicating Execution Results - SHR/SHRP

Program Example

SHR

Determines whether the least significant bit is ON or OFF.

  1. When the variable of the positive transition instruction turns ON, the SHR instruction is run. When the SHR instruction is executed, the 1 bit to the right is stored in D1.

  2. When 1 bit is shifted to the right, you can check the previous value of the least significant bit in Data_1 by using the #L_CalcCarry system variable.

    • When using a normally open instruction, the SHR instruction is always executed as long as the normally open bit is ON.

SHRP

When to run the instruction is different between SHRP and SHR instructions. In the SHRP instruction, even when using a normally open instruction, only the upward transition of the bit is detected, and the SHRP instruction is executed. Even if the bit of the normally open instruction remains ON, the SHRP instruction is executed only for one scan.