Ny-Series Instructions Reference Manual (W560 - Omron NY532-5400 Reference Manual

Ny-series
Hide thumbs Also See for NY532-5400:
Table of Contents

Advertisement

 ROL
The ROL instruction rotates bits from right to left (from least-significant to most-significant bits).
The following example is for when In is BYTE#16#89 and Num is ULINT#2.
LD
BYTE#16#89
ULINT#2
Bit 7
Bit 0
In
1 0 0 0 1 0 0 1
Shifted 2 bits left.
Most-significant 2 bits of In are inserted into least-significant 2 bits.
 ROR
The ROR instruction rotates bits from left to right (from most-significant to least-significant bits).
The following example is for when In is BYTE#16#89 and Num is ULINT#2.
LD
BYTE#16#89
ULINT#2
Bit 7
1 0 0 0 1 0 0 1
In
Shifted 2 bits right.
Additional Information
The SHL and SHR instructions discard the bits that are shifted out of the register and insert zeros into
the other end of the register.
Precautions for Correct Use
• The data types of In and Out must be the same.
• If Num is 0, an error will not occur and the value of In will be assigned directly to Out.
• If the value of Num exceeds the number of bits specified in In, an error will not occur and the bits will
be rotated by the number of bits specified in Num. For example, if In is WORD data, the value of Out
will be the same regardless of whether the value of Num is USINT#1 or USINT#17.

NY-series Instructions Reference Manual (W560)

ROL
EN
ENO
abc
In
Num
Out=abc
0 0 1 0 0 1 1 0
ROR
EN
ENO
abc
In
Num
Bit 0
0 1 1 0 0 0 1 0
Out=abc
Least-significant 2 bits of In are inserted into most-significant 2 bits.
ST
abc:=ROL(BYTE#16#89, ULINT#2);
ST
abc:=ROR(BYTE#16#89, ULINT#2);
2 Instruction Descriptions
2
2-401

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents