Entry type: FAQ, Entry ID: 17811407, Entry date: 11/18/2013
(1)
Rate

How do you program a shift register with the LAD/FBD statements in STEP 7 V5.5 and STEP 7 (TIA-Portal)?

  • Entry
  • Associated product(s)

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 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
* 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 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)

Note
More information about shift registers is available in the STEP 7 Online Help. Mark the statement box and press the "F1" key.

Creation environment
The screens in this FAQ response were created with STEP 7 V5.5 and STEP 7 (TIA Portal) V12.

Error details
Detailed error description
Help us to improve Online Support.
The page requested cannot be displayed. Please contact the webmaster.
Contact to webmaster