2 Instruction Descriptions
2-476
NJ-series Instructions Reference Manual (W502)
The instruction assumes that there are number of stored elements Num elements stored in stack array
InOut[]. The instruction removes a value from the stack and assigns it to output value OutVal. For num-
ber of stack elements Size, specify the number of elements in InOut[] to use as a stack.
z StackFIFO
The StackFIFO removes the bottom value from a stack. Value of InOut[0] is assigned to OutVal. Then,
all Num − 1 elements from InOut[1] are shifted to the next lower element in the stack array. Then 0 is
stored in InOut[Num−1]. Finally, Num is decremented.
The following example is for when Size is UINT#5 and Num is UINT#3.
Boolean
Bit strings Integers
Real
numbers
Times, durations,
dates, and text strings
BOOL
BYTE
WORD
DWORD
LWORD
USINT
UINT
UDINT
ULINT
SINT
INT
DINT
LINT
REAL
LREAL
TIME
DATE
TOD
DT
STRING
Size OK
InOut[]
(array)
OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK
Arrays of enumerations or structures can also be specified.
OutVal Must be the same data type as the elements of InOut[].
Num OK
Out OK
Function
StackFIFO(abc[1], def, UINT#5, ghi);
LD ST
abc[1]
def
UINT#5
ghi
abc[1]
def
ghi
StackFIFO
EN ENO
InOut
OutVal
Size
Num
Num = ghi
OutVal = def
Num = ghi
OutVal = def
Decremented.
Removed.
1234
2345
3456
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
UINT#3
2345
3456
3456
0
0
UINT#2
INT#1234