Nj-Series Instructions Reference Manual (W502 - Omron NJ501-1500 Reference Manual

Machine automation controller nj-series
Hide thumbs Also See for NJ501-1500:
Table of Contents

Advertisement

StackLIFO
The StackLIFO instruction removes the top value from a stack. Value of InOut[Num−1] is assigned to
OutVal. Then, Num is decremented.
The following example is for when Size is UINT#5 and Num is UINT#2.
LD
EN
InOut
abc[1]
OutVal
def
UINT#5
Size
Num
ghi
InOut[0]=abc[1]
InOut[1]=abc[2]
Size=UINT#5
InOut[2]=abc[3]
InOut[3]=abc[4]
InOut[4]=abc[5]
Precautions for Correct Use
• Use the same data type for InOut[] and OutVal.
• When an element in the array is passed to InOut[], all elements below the passed element are pro-
cessed.
• The values in InOut[], Num, and OutVal do not change if the value of Size or Num is 0.
• Return value Out is not used when the instruction is used in ST.
• An error occurs in the following cases. ENO will be FALSE, and OutVal will not change.
• InOut[] and OutVal have different data types.
• The values of Num and Size are not 0 and Num is greater than Size.
• The value of Size exceeds the array area of InOut[].
• InOut[] is a STRING array and any of the elements does not end in a NULL character.
• InOut[] is a STRING array and the number of bytes in the elements exceeds the size of OutVal.
Sample Programming
Refer to the sample programming that is provided for the StackPush instruction (page 2-466).

NJ-series Instructions Reference Manual (W502)

StackLIFO
ENO
abc[1]
def
ghi
UINT#3
Num = ghi
1234
2345
3456
0
Removed.
0
OutVal = def
ST
StackLIFO(abc[1], def, UINT#5, ghi);
Num = ghi
InOut[0]=abc[1]
InOut[1]=abc[2]
InOut[2]=abc[3]
InOut[3]=abc[4]
InOut[4]=abc[5]
2 Instruction Descriptions
Decremented.
UINT#2
1234
2345
3456
0
0
OutVal = def
INT#3456
2
2-477

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Nj501-1300Nj501-1400

Table of Contents