5 Categories and Use of Basic Application InstructionsDVP-PM Application Manual 5-57API Mnemonic Operands Function38 SFWR P Shift Register WriteControllers20PM 10PMBit Devices Word devices Program StepsTypeOP X Y M S K H KnX KnY KnM KnS T C D E FS * * * * * * * * * * *D * * * * * *n * *SFWR, SFWRP: 7 stepsOperands:S: Source device D: Head address of data stack n: Length of data stackExplanations:1. This instruction defines the data stack of n words starting from D as a “first-in, first out (FIFO)” data stack andspecifies the first device as the pointer (D). When SFWRP is executed, content in pointer pluses 1, and thecontent in S will be written into the device designated by the pointer. When the content in pointer exceeds n-1,the instruction stops and carry flag M1970 = ON.2. This instruction is generally used in pulse execution mode (SFWRP).3. When SFWR is used as 16-bit instruction, Z device cannot be adopted; when SFWR is used as 32-bitinstruction, V device cannot be adopted.4. When specifying the bit device of KnX(Y/M/S), the starting No. should be a multiple of 16 in octal or decimalformat. For example, K1X0, K4Y20 (octal); K1M0, K4S16 (decimal).5. Valid range of operand n: 2≤ n ≤5126. Flags:OX O100Carry flag M1810 M1970Program Example:1. First, reset the content of D0. When X0 goes from OFF to ON, the content of D0 (pointer) becomes 1, and D20is written into D1. If the content of D20 is changed and X0 is triggered again, pointer D0 becomes 2, and thecontent of D20 is then written into D2.2. P The figure below illustrates the shift and writing process of the instruction.n The content of D0 becomes 1.o. The content of D20 is written into D1.X20RST D0D9 D8 D7 D6 D5 D4 D3 D2 D1 D0D20X0SFWRP D20 K10D0Reset the content of D0 to 0 (zero) previouslyPointern = 10 pointsD0 = 3 2 1Points to note:This instruction can be used together with API 39 SFRD for the reading/writing of “first-in, first-out” stack data