How do you program a shift register with the LAD/FBD statements in STEP 7 V5.5 and STEP 7 (TIA-Portal)?
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 STEP 7 (TIA-Portal):
|Shit and rotate statements|
STEP 7 V5.5
|STEP 7 (TIA-Portal)|
|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|
Sample programming with the right shift registers in STEP 7 V5.5 and STEP 7 (TIA-Portal)
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 (TIA-Portal)
More information about shift registers is available in the STEP 7 Online Help. Mark the statement box and press the "F1" key.
The screens in this FAQ response were created with STEP 7 V5.5 and STEP 7 (TIA Portal) V12.