Advanced Function Instruction
7-96
FUN111
D
P
STACK
STACK
FUN111
D
P
STACK
IW : Data pushed into stack, can be a constant
or a register
ST : Starting register of stack
L : Size of stack
Pr : Pointer register
OW : Register accepting data popped out from
stack
ST may combine with V, Z, P0~P9 to serve
indirect address application
WX
WY
WM
WS
TMR
CTR
HR
IR
OR
SR
ROR
DR
K
XR
Range
Ope-
rand
WX0
∣
WX240
WY0
∣
WY240
WM0
∣
WM1896
WS0
∣
WS984
T0
∣
T255
C0
∣
C255
R0
∣
R3839
R3840
∣
R3903
R3904
∣
R3967
R3968
∣
R4167
R5000
∣
R8071
D0
∣
D4095
16/32-bit
+/-
number
V
、
Z
P0~P9
IW
○
○
○
○
○
○
○
○
○
○
○
○
○
ST
○
○
○
○
○
○
○
○
*
○
*
○
○
L
○
○
*
○
2~256
Pr
○
○
○
○
○
○
○
○
*
○
*
○
OW
○
○
○
○
○
○
○
○
*
○
*
○
z
Like queue, stack is also a kind of table. The nature of its pointer is exactly the same as with queue, i.e. Pr = 1
to L, which corresponds to ST
1
to ST
L
, and when Pr = 0 the stack is empty.
z
Stack is the opposite of queue, being a last in first out (LIFO) device. This means that the data that was most
recently pushed into the stack will be the first to be popped out of the stack. The stack is comprised of L
consecutive 16 or 32-bit (
D
instruction) registers starting from ST, as shown in the following diagram:
Pr
4
c
~
g
is the sequence
number of operation
ST
ST1
c
1111
←
Bottom of stack
ST2
d
2222
ST3
e
3333
IW
ST4
f
4444
OW
g
5555
ST5
××××
push
ST
L
z
When execution control "EN" = 1 or "EN
↑
" (
P
instruction) has a transition from 0 to 1, the status of in/out
control "I/O" determines whether the IW data will be pushed into the stack (when "I/O" = 1), or the data pointed
by Pr within the stack (the data most recently pushed into the stack) will be moved out and transferred to OW
(when "I/O" = 0). Note that the data pushed in is stacking, so before pushed in, Pr will increased by 1 to point
to the top of the stack then the data will be pushed in. When it is popped out, the data pointed by pointer Pr
(the most recently pushed in data) will be transferred to OW. After then Pr will decreased by 1. Under any
circumstances, the pointer Pr will always point to the data that was pushed into the stack most recently.
push(I/O=1)
1.Pr
+
1
→
Pr
2.IW
→
STpr
pop(I/O=0)
1.STpr
→
OW
2.Pr
-
1
→
Pr
Содержание FBs-CBE
Страница 78: ...MEMO ...
Страница 111: ...4 6 X0 X1 Node A Y0 Y1 Node B differential down Incerse differential up t Scan time Inverse t t ...
Страница 141: ...Basic Function Instruction 6 16 FUN 2 SKP SKIP START FUN 2 SKP Y2 Y1 Y0 T201 10S X0 X1 X2 0 10 0 ...
Страница 305: ...MEMO ...
Страница 348: ...MEMO ...