6 Application Instructions API 00-49 API 38 Operands: S : Device of stack data written in D : Start No. of stack data n : Length of stack data Explanations: 1. Range of n : 2 ~ 512 2. See the specifications of each model for their range of use. 3. Flag: M1022 (carry flag) 4. The stack data of n words starting from D are defined as “first-in, first-out” stack data and designate the first device as the pointer. When the instruction is executed, the content in the pointer pluses 1, and the content in the device designated by S will be written into the designated location in the “first-in, first-out” stack data designated by the pointer.
When the content in the pointer exceeds n - 1, this instruction will not process any new value written in and the carry flag M1022 = On. 5. This instruction adopts pulse execution instructions (SFWRP) Program Example: 1. Pointer D0 is reset as 0. When X0 = Off→On, the content in D20 will be sent to D1 and the content in pointer D0 becomes 1. After the content in D20 is changed, make X0 = Off→On again, and the content in D2 will be sent to D2 and the content in D0 becomes 2. 2. The figure below illustrates the shift and writing in 1~2 execution of the instruction. The content in D20 is sent to D1. The content in pointer D0 becomes 1.
X10 Reset the content of D0 as 0 in advance X0 K10 D0 = 3 2 1 Remarks: This instruction can be used together with API 39 SFRD for the reading/writing of “first-in, first-out” stack data. DVP-PLC Application Manual 6-59 Mnemonic Operands Function SFWR P Shift Register Write Type OP Bit Devices Word Devices Program Steps X Y M S K H KnX KnY KnM KnS T C D E F SFWR, SFWRP: 7 steps S * * * * * * * * * * * D * * * * * * n * * PULSE 16-bit 32-bit EH3 V SV2 ES EX SS EH3 ES EX SS SA SX SC EH SV EH3 SV2 ES EX SS SA SX SC EH S S A SX SC EH SV SV2 RST D0 SFWRP D20 D0 D20 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 pointe D20 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 pointe