288
Index Registers Section 6-2
Counting Table Data
The following diagram shows how data can be counted in a data table.
Stack Instructions
The following table lists the stack instructions and their functions. Typical
applications for stacks would be processing shelf information for automatic
warehousing systems, processing test results, and managing information on
workpieces on a conveyor.
Example 1:
This example defines a stack from D00000 to D00014 (which can store 10
words of data), stores data in the stack, and reads data from the stack.
(LIFO(634) reads the last word stored in the stack.)
Example 2:
This example defines a stack from D00000 to D00014 (which can store 10
words of data), finds the words in the stack that match a specified value, and
deletes all of the matching words.
Instruction Function
SSET(630) Defines a stack region.
PUSH(632) Stores data in the next available word in the stack.
FIFO(633) Reads data from the stack on a first-in first-out basis.
LIFO(634) Reads data from the stack on a last-in first-out basis.
SREAD(639) Read a specific entry from the table.
SWRITE(640) Writes a specific entry to the table.
SINS(641) Inserts a specific entry in the table.
SDEL(642) Deletes a specific entry from the table.
SNUM(638) Counts the number of entries in the table.
A
N
B
W
X
V
Pointer address
Counts all entries
from one before the
pointer address.
The number of entries in the data table
are counted from just before the pointer
address to the beginning of the table.
This can be used, for example, to count
the number of items on a conveyor.
SSET
D00000
&14
P_First_Cycle
ON for 1 cycle when
operation starts.
@LIFO
D00000
D00101
b
Execution condition
@PUSH
D00000
D00100
a
Execution condition
When the First Cycle Flag is
ON, SSET(630) defines a stack
in words D00000 to D00014.
When execution condition "a" is
ON, PUSH(632) stores the data
from D00100 into the stack.
When execution condition "b" is
ON, LIFO(634) reads the last
word stored in the stack and
writes that data to D00101.