Siemens S7-200 PLC left shift, right shift instruction programming - Database & Sql Blog Articles

Programmable Package SG-8018CA(SG7050C) 0.67M~170M
Brand AVX TPSE226M035R0125 Low impedance tantalum capacitor AVX 22
LPDDR4-200-16Gb

1. Left and Right Shift Instructions

The ladder programming format for the left and right shift instructions in S7-200 is shown in Figure 10-5.1. The SHL instruction in the ladder diagram represents the shift operation, where:

  • SHL: 'SH' is the shift marker, 'L' indicates a left shift (R for right shift).
  • B: Byte instruction (W for 16-bit word, WD for 32-bit double word).
  • IN: The memory address of the data to be shifted.
  • OUT: The result memory address after shifting.

Digital camera

The S7-200 shift commands have several key features:

  • The shift process involves two steps: first, move the data to the result memory using the MOV instruction (as shown in Figure 10-5.1b). If you only need to shift the original data without storing it elsewhere, this step can be skipped (see Figure 10-5.1a).
  • After moving, the data is shifted within the result memory.
  • When data is shifted out, the empty positions are automatically filled with zeros.
  • The last bit that was shifted out is stored in the system flag register SM1.1.
  • The number of bits to shift (N) must not exceed the size of the data being shifted (e.g., 8 bits for byte, 16 for word, 32 for double word). If N exceeds the data length, the remaining bits should be handled accordingly. For example, shifting 12 bits of a byte will actually shift 4 bits (since 12 % 8 = 4). If N is 0, no shift occurs, and SM1.0 is set to 1.

2. Rotate Left and Rotate Right Instructions

The ladder programming format for the cyclic left and right shift instructions of the S7-200 is shown in Figure 10-5.2.

Digital camera

The ROL instruction in the ladder diagram stands for rotate left, where:

  • ROL: 'RO' is the rotation marker, 'L' means left rotation (R for right rotation).
  • B: Byte instruction (W for 16-bit word, WD for 32-bit double word).
  • IN: Memory address to be rotated.
  • OUT: Result memory address after rotation.

The S7-200 allows data to be rotated back into the vacant space from the opposite end, creating a continuous loop. Other characteristics are similar to the standard left and right shift commands.

3. Shift Register Instruction

The shift register instruction is used to step-by-step shift binary bit signals (DATA) from the outside of the register into the register in a specified direction. The ladder programming format for the S7-200 shift register is shown in Figure 10-5.3.

Digital camera

The SHRB instruction in the ladder diagram includes the following parameters:

  • DATA: Input signal representing the binary bit status.
  • S_BIT: The lowest bit address of the shift register.
  • N: The length of the shift register and the direction. A positive value shifts left, with data entering from the lowest bit. A negative value shifts right, with data entering from the highest bit.

To ensure that only one bit is shifted each time the "enable" signal is triggered, it's recommended to use an edge detection instruction on the enable input.

Single Phase Input Vfd

Three Phase Vfd,Ac Single Phase Gasoline Generator,220V Vfd,Ac Inverter

WuXi Spread Electrical Co.,LTD , https://www.vfdspread.com