254
Z P U S H P
D
1
2
M
3
○
FNC
102
X Y M S
D.b R.b
KnX KnY
KnM KnS
T C
D,R
V,Z
UnG
K,H
E
" $"
D
Z P O P P
D
1
2
M
3
○
FNC
103
D : the pointer to manage the packed location of the Index Registers
M9000
M9000
ZPUSH
ZPOP D0
D0
D
D
〜
The VS series PLC has 16 Index Registers (Z0~Z7 and V0~V7). If those are reused in the program and may
disturb to the results of each other, it is necessary to manage the Index Registers.
Firstly, let the D0 = 0. When the ZPUSH instruction is executed, it will duplicate the content values of Z0~V7 to the
D1~D16 and increase the value at D0 become 1 that means one set of Index Registers is stored.
When the ZPOP instruction is executed, it will retrieve the content values of D1~D16 back to the Z0~V7 and
decrease the value at D0 from 1 to 0 that means no preserved data for Index Registers.
Below is an example to appoint the data storage by D0. The ZPUSH instruction will store all the data of Index
Registers into the specified registers; the ZPOP instruction will restore the data from the specified registers.
The purpose of the ZPUSH and ZPOP instructions are to manage the Index Registers conveniently.
To use these two instructions must be paired, the ZPUSH is to store the value of registers and the ZPOP is to
recover the data.
M9002
M9000
M9000
M9000
M9000
M9000
M9000
MOV K0 D0
ZPUSH D0
ZPUSH D0
ZPUSH D0
ZPOP D0
〜〜〜〜〜〜
ZPOP D0
ZPOP D0
When the PLC turns STOP → RUN, to make D0 = 0.
Duplicate the data from Z0~V7 to D1~D16 and increase the pointer D0=D0+1=1.
Duplicate the data from Z0~V7 to D17~D32 and increase the pointer D0=D0+1=2.
Duplicate the data from Z0~V7 to D32~D48 and increase the pointer D0=D0+1=3.
Retrieve the data from D33~D48 to Z0~V7 and decrease the pointer D0=D0 – 1=2.
Retrieve the data from D17~D32 to Z0~V7 and decrease the pointer D0=D0 – 1=1.
Retrieve the data from D1~D16 to Z0~V7 and decrease the pointer D0=D0 – 1=0.
The most common uses of the ZPUSH and ZPOP instructions are in the programming structure of the nest and call
subroutine.
Please note that occupied space of the instruction depends on the content value of and the value is driven by
the using times of call and nest levels.
D
Operand
Devices
Batch Store of All Index Register
Batch Recover of All Index Register