|
Description
Using the shift and rotate statements, you can shift or rotate the bits 0 to 32 of an input value by a specific number of bits to the left or right. The table below gives an overview of the shift and rotate statements in STEP 7 V5.5 and V11:
| Shit and rotate statements |
|
STEP 7 V5.5 |
STEP 7 V11 |
| SHR_I |
Shift integer (16-bit) to the right |
SHR* |
Shift to the right |
| SHL_DI |
Shift integer (32-bit) to the left |
SHL* |
Shift left |
| SHL_W |
Shift 16 bits to the left |
* |
Shift left |
| SHR_W |
Shift 16 bits to the right |
* |
Shift to the right |
| SHL_DW |
Shift 32 bits to the left |
* |
Shift left |
| SHR_DW |
Shift 32 bits to the right |
* |
Shift to the right |
| ROL_DW |
Rotate 32 bits to the left |
ROL* |
Rotate left |
| ROR_DW |
Rotate 32 bits to the right |
ROR* |
Rotate right |
* In STEP 7 V11 the statement boxes have a drop-down list box from which you can select the data type (USint, UInt, Word, DWord, Byte, UDint, SInt, Int and DInt) for the statement. Click the statement in the LAD/FDB editor and move the mouse pointer over the field with the three question marks until the "▼" symbol appears. Click the "▼" symbol to open the drop-down list box.
Sample programming with the right shift registers in STEP 7 V5.5 and V11
The two right shift registers in STEP 7 V5.5 and V11 shown below are activated by the positive edge at marker M0.0. The marker word MW40 is shifted by 1 bit to the right and the result is stored in the marker word MW50.

Fig. 01 - "SHR_W": Shift 16 bits to the right in STEP 7 V5.5
Fig. 02 - "SHR": Shift right in STEP 7 V11
Note
More information about shift registers is available in the STEP 7 Online Help. Mark the statement box and press the "F1" key.
|