EasyManua.ls Logo

Omron NJ501-1500

Omron NJ501-1500
990 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
2-363
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
Shift Instructions
2
NSHLC and NSHRC
These instructions shift Size array elements in shift register array InOut[] by the number of bits specified
in Num. The shift register starts at InOut[0]. The last bit that is shifted out of the register is output to the
Carry (CY) Flag. Zeros are inserted for the bits at the other end.
z NSHLC
The NSHLC instruction shifts bits from the lower elements in the array to the higher elements and from
the least-significant bits to the most-significant bits.
z NSHRC
The NSHRC instruction shifts bits from the higher elements in the array to the lower elements and from
the most-significant bits to the least-significant bits.
The following example shows the NSHLC instruction when InOut[] is a BYTE array, Size is USINT#80
and Num is USINT#3.
The shift operation is not performed if the value of Num is 0.
If the value of Num is larger than Size, Size bits from bit 0 of InOut[0] are changed to FALSE. The
value of the Carry Flag (CY) changes to FALSE.
Return value Out is not used when the instruction is used in ST.
An error occurs in the following case. ENO will be FALSE, and InOut[] will not change.
The value of Size exceeds the array area of InOut[].
Function
Related System-defined Variables
Name Meaning Data type Description
P_CY Carry (CY) Flag BOOL Value stored in Carry Flag
Precautions for Correct Use
NSHLC(abc[1], USINT#80, USINT#3);
LD ST
abc[1] abc[1]
USINT#80
USINT#3
NSHLC
EN ENO
InOut
Size
Num
Discarded.
Last bit shifted out of register is stored in CY Flag.
InOut[0]
=abc[1]
Size = USINT#80 bits
InOut[1]
=abc[2]
InOut[1]
=abc[2]
InOut[8]
=abc[9]
InOut[8]
=abc[9]
InOut[9]
=abc[10]
InOut[9]
=abc[10]
InOut[0]
=abc[1]
CY
1 0 1
1 0 1
0 0 1
0 0 1
0 0 0
1
0 1 1
Num = USINT#3 (Shift 3 bits.)
FALSE inserted for Num = USINT#3 (3 bits).
Bit 0
Bit 7

Table of Contents

Related product manuals