F102_DSHR

Redundant instruction

NOTE

This is a redundant instruction. It is replaced by: SHR

The function shifts the value at output d to the right. The number of bits at output d to be shifted to the right is specified by the value assigned at input n. This shift can lie between 0 and 255 (only the lower value byte of n is effective). Bits cleared because of the shift become 0. When input n = 0, no shift takes place. A shifting distance larger than 32 does not make sense, since when n = 32 the value at output d is already filled with zeros. The bit at position n - 1 (the last bit shifted out to the right) is simultaneously stored in the system variable sys_bIsCarry (carry flag) so that it can be evaluated accordingly. When n = 0 the content of the carry flag does not change.

  1.  (1) Data
  2.  (2) [n bits]
  3.  (3) The data in the nth bit is transferred to R9009 (carry flag)
  4.  (4) The [n bits] are filled with 0s

Parameters

Input

n (INT)

Number of bits to be shifted (range: 16#0 to 16#FF)

Output

d (DWORD, DINT, UDINT, DATE, TOD, DT)

32-bit area to be shifted to the right

Error flags

sys_bIsCarry (turns to TRUE for one scan)

if the bit at position n-1 has the value 1.

Related topics:

Modified on: 2019-01-24Feedback on this pagePanasonic hotline