2-467
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
Stack and Table Instructions
2
StackPush
The following example is for when Size is UINT#5 and Num is UINT#2.
Use the StackFIFO or StackLIFO instruction (page 2-475) to remove the bottom or top value that was
stored in the stack.
• Use the same data type for In and the elements of InOut[].
• When an element in the array is passed to InOut[], all elements below the passed element are pro-
cessed.
• The value of InOut[] or Num does not change if the value of Size is 0.
• When In is an enumeration, always use a variable for the input parameter to pass to In. A building
error will occur if a constant is passed.
• 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 InOut[] will not change.
• In and InOut[] contain different data types.
• The value of Size is not 0 and Num is greater than or equal to Size.
• The value of Size exceeds the array area of InOut[].
• In is STRING data and it does not end in a NULL character.
• In and InOut[] are STRING data and the number of bytes in In exceeds the size of InOut[].
Additional Information
Precautions for Correct Use
StackPush(INT#3456, abc[1], UINT#5, def);
LD ST
INT#3456
abc[1]
UINT#5
def
abc[1]
def
StackPush
EN ENO
In
InOut
Size
Num
Incremented
Stored
1234
2345
0 :
0
0
InOut[0]=abc[1]
InOut[1]=abc[2]
InOut[2]=abc[3]
InOut[3]=abc[4]
InOut[4]=abc[5]
InOut[0]=abc[1]
InOut[1]=abc[2]
InOut[2]=abc[3]
InOut[3]=abc[4]
InOut[4]=abc[5]
Size=UINT#5
Num=def
UINT#2
In
INT#3456
1234
2345
3456
0
0
Num=def
UINT#3