beautypg.com

Operation – bit shift left, Operation – bit shift right – Rockwell Automation 1747-PT1, D1747NP002 Hand-Held Terminal User Manual

Page 316

background image

Instructions

Chapter 23
Bit Shift, FIFO, and LIFO

23–4

Operation – Bit Shift Left

When the rung goes from false–to–true, the enable bit (EN bit 15) is set and
the data block is shifted to the left (to a higher bit number) one bit position.
The specified bit at the Bit Address (source) is shifted into the first bit
position. The last bit is shifted out of the array and stored in the unload bit
(UL bit 10) in the status byte of the control element. The shift is completed
in one scan.

For wraparound operation, set the Bit Address equal to the address of the last
bit of the array or to the UL bit, whichever applies.

The figure below illustrates how the Bit Shift Left instruction functions.

(EN)

(DN)

BSL

BIT SHIFT LEFT
File

#B3:1

Control

R6:53

Bit Address

I:22/12

Length

58

19 18 17 16

35 34 33

51 50 49 48

67 66 65 64

32

23 22 21 20

39 38 37

55 54 53 52

71 70 69 68

36

27 26 25 24

43 42 41

59 58 57 56

73 72

40

31 30 29 28

47 46 45

63 62 61 60

44

DO NOT USE

58
bit
array
#B3:1

Bit Address
(source) I:22/12

Unload Bit R6:53/10

Data block is shifted one bit at
a time from bit 16 to bit 73.

Operation – Bit Shift Right

When the rung goes from false–to–true, the enable bit (EN bit 15) is set and
the data block is shifted to the right (to a lower bit number) one bit position.
The specified bit at the Bit Address (source) is shifted into the last bit
position. The first bit is shifted out of the array and stored in the unload bit
(UL bit 10) in the status byte of the control element. The shift is completed
in one scan.

For wraparound operation, set the Bit Address equal to the address of the
first bit of the array or to the UL bit, whichever applies.

The figure below illustrates how the Bit Shift Right instruction functions.

(EN)

(DN)

BSR

BIT SHIFT RIGHT
File

#B3:2

Control

R6:54

Bit Address

I:23/06

Length

38

35 34 33

51 50 49 48

67 66 65 64

32

39 38 37

55 54 53 52

69 68

36

43 42 41

59 58 57 56

40

47 46 45

63 62 61 60

44

DO NOT USE

38
bit
array
#B3:2

Bit Address
(source) I:23/06

Unload Bit R6:54/10

Data block is shifted one bit at
a time from bit 69 to bit 32.