4

Shift Register Left

Each scan, the Shift Register Left function shifts all the bits in a register to the left (that is, toward the most significant bit). 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 left, and a corresponding number of zeros is moved in on the right.

Example

For this example, if the second register (R2) contained the value 1, the bits would be shifted left by 1 position:

46151

R1

SHL

R3

0

0

0

0

0

0

0

0

1

1

1

1

1

0

1

0

(250)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

0

0

0

0

0

0

1

1

1

1

1

0

1

0

0

(500)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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.

Programming Software Instructions

1.Select Logic (F7)

2.Select SH±REG LEFT (F6) from the Logic function keys.

3.Enter the register location of the data to be shifted left. 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

 

 

 

 

 

 

 

 

 

 

 

 

46152

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Ladder Diagram

 

Hand-held Programmer

 

 

 

 

 

 

I1

 

 

S

 

START

F1

I1

 

 

 

 

 

 

 

 

 

 

 

"

 

 

[ R1 H R2! R3]

 

 

LOGIC

MoreMENU

R1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

L

 

 

F3

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

R2

 

 

 

 

 

 

 

 

 

 

 

OUT

F1

R3

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

GFK-0804B

Chapter 4 The Micro PLC Instruction Set

 

 

 

4-43

Page 84
Image 84
GE GFK-0804B manual Shift Register Left