Siemens PLC cycle right and left shift instruction

Rotate the end to end the shift data storage unit, while connected to the overflow flag SM1.1, SM1.1 is used to store the bit shifted out.

(1) cyclic left shift instruction (ROL)
Enable input is active, the number of non-IN input (byte, word, or double word) Rotate Left N-bit symbols, the result is output to the memory location specified by OUT, the last bit of value out of the overflow flag to send bit SM1.1. When you need to shift value is zero, the zero flag SM1.0 to 1.
(2) cyclic right shift instruction (ROR)
Enable input is active, the number of non-IN input (byte, word, or double word) Rotate Right after the N-bit symbols, and outputs the result to the memory location specified by OUT, the last bit of value out of the overflow flag to send bit SM1.1. When you need to shift value is zero, the zero flag SM1.0 to 1.
(3) The shift number of shifts N≥ data types (B, W, D) when handling
If the operand is a byte, when the shift count when N≥8, then before performing cyclic shift, prior to N modulo 8 operation (N divided by 8 after taking the remainder), the result 0-7 for the actual movement of the bit number.
If the operand is a word, when the shift count N≥16, then before executing the cyclic shift, prior to N modulo 16 operation (after N take the remainder divided by 16), the result is actually moving bits 0-15 .
If the operand is a double word, when the shift count N≥32, then before executing the cyclic shift, the first of 32 operations modulo N (N is divided by 32 after taking the remainder), the result is actually moving bits 0-31 number.
(4) Error conditions that set ENO = 0: The 0006 (indirect addressing error), SM4.3 (run-time).

 

 Loop left and right shift instruction form and function
LAD
STL
RLB OUT, N
RRB OUT, N
RLW OUT, N
RRW OUT, N
RLD OUT, N
RRD OUT, N
Operands and data types
IN: VB, IB, QB, MB, SB, SMB, LB, AC, constant.
OUT: VB, IB, QB, MB, SB, SMB, LB, AC.

Data type: BYTE
IN: VW, IW, QW, MW, SW, SMW, LW, T, C, AIW, AC, constant.
OUT: VW, IW, QW, MW, SW, SMW, LW, T, C, AC.
Data Type: Word
IN: VD, ID, QD, MD, SD, SMD, LD, AC, HC, constant.
OUT: VD, ID, QD, MD, SD, SMD, LD, AC.
Data Type: Double Word
N: VB, IB, QB, MB, SB, SMB, LB, AC, constant; data type: Byte.
Features
ROL: Byte, Word, Rotate Left Double Word N bits; ROR: byte, word, double word Rotate Right N bits.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.