4

Shift Register Right

Each scan that power flow is received, the Shift Register Right function shifts all the bits in a register to the right (toward the least significant bits). The number of positions to be shifted is provided in the function's second register (R2 in the example above).

The data is copied to the register specified (R3 in the example above). The original data is not altered. In the copied data, the specified number of bits is ªshifted outº on the right, and a corresponding number of zeros is moved in on the left.

Example:

For this example, if the second register (R2) contained the value 3, the bits would be shifted right by 3 positions:

46149

R1

SHR

0 0 0 0

0 0 0 0 1 1 1 1 1 0 1 0

(250)

R3

0 0 0 0 0 0 0 0

0 0 0 1 1 1 1 1

(31)

Entering the Number of Positions to Shift

The best way to enter the number of positions for the shift into the second register is with a Move command in the application program. Alternatively, you could use the programmer to manually place the number into a retentive register (R385 ± R500).

Programming Software Instructions

1.Select Logic (F7)

2.Select SH±REG RIGHT (F5) from the Logic function keys.

3.Enter the register location of the data to be shifted right. Press the Enter key.

4.Enter the register location for the number of bits to shift. Press the Enter key.

5.Enter a register for shifted data to be placed in. Press the Enter key.

Example and HHP Instructions

 

 

 

 

 

 

 

 

 

 

 

 

 

46150

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Ladder Diagram

Hand-held Programmer

 

 

 

 

 

 

I1

 

 

S

 

 

START

F1

I1

 

 

 

 

 

 

 

 

 

 

 

"

 

 

[ R1 H R2! R3]

 

 

 

LOGIC

MoreMENU

R1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

R

 

 

 

F2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

R2

 

 

 

 

 

 

 

 

 

 

 

 

OUT

F1

R3

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

4-42

Micro PLC Programmer's Guide ± April 1994

 

 

GFK-0804B

Page 83
Image 83
GE GFK-0804B manual Shift Register Right, Entering the Number of Positions to Shift