SHR (Shift Right Arithmetic or Shift Right Signed)

Shifts the 32 bits of an integer to the right and replicates the leftmost bit (significant bit) to fill the vacant bits.
lrsf_shr2
lrsf_shr1_cam5
Arguments
IN
IN
DINT
Any integer value
NbS
NbS
DINT
Number of 1 bit shifts (in set [1..31])
SHR
Q
DINT
Right shifted value
no effect if NbS <= 0
the leftmost bit is replicated if NbS >=1
Example
(* FBD Program using "SHR" Function *)
lrsf_shr3_cam5
(* ST Equivalence: *)
result := SHR (register,1); (* register = 2#1100_1101_0011_0101 *) (* result = 2#1110_0110_1001_1010 *)
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal