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.


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 *)

(* ST Equivalence: *)
result := SHR (register,1); (* register = 2#1100_1101_0011_0101 *) (* result = 2#1110_0110_1001_1010 *)
Provide Feedback