Delta Electronics — 6.10.2 Explanation of Rotation Instructions

AS Series Programming Manual Symbol S : Matrix source D : Operation result n : Length of the array Explanation _6 1. This instruction rotates the values of n rows of bits in S to the right or to the left. When SM616 is OFF, the instruction rotates the values of the bits to the left. When SM616 is ON, the instruction rotates the values of the bits to the right. The instruction fills the vacancy resulting from the rotation with the value of the bit rotated last, and stores the operation result in D . The value of the bit rotated last not only fills the vacancy, but also is transmitted to the carry flag SM614. 2. For 16-bit instructions, the value of n must be between 1–16.

For 32-bit instructions, the value of n must be between 1–32. When n is less than 0, the instruction is not executed. When n exceeds the range, the instruction is executed with n at the maximum value (32) of the range. 3. In general, the MBRP pulse instruction is used. Example 1: and stores the operation result in the 16-bit registers D20–D22. The value of the bit marked ※ is transmitted to the carry When X0.0 is ON and SM616 is OFF, the instruction rotates the values of the bits in the 16-bit registers D0–D2 to the left, flag SM614.

6-264 API Instruction code Operand Function 0904 MBR P S, D, n Rotating bits in a group to the right or the left in a matrix Device X Y M S T C HC D FR SM SR E K 16# “$” F S       D     n         BOOL WORD DWORD LWORD UINT INT DINT LINT REAL LREAL TMR CNT STRING Data type S    D    n    Pulse instruction 16-bit instruction 32-bit instruction AS AS -