Chapter 6 Applied Instructions Symbol S : Device where the data is shifted D : First device n : Data length Explanation 1. This instruction defines the data in the n word devices starting from the device specified by D as a first in-first out list 6_ type, and takes the device specified by D as a pointer. This instruction increments the value of the pointer by one, and writes the data in the device specified by S into the device specified by the pointer. When the value of the pointer is larger than or equal to n -1, the instruction stops writing data, and sets the carry flag SM602 is ON. 2. In general, the SFWRP pulse instruction is used. 3. The operand n must be between 2–512. Example 1.
The instruction clears the value of the pointer D0 to 0 first. When M0 switches from OFF to ON, the instruction writes the data in D20 into D1, and increments the value in D0 to 1. When M0 switches from OFF to ON again, the instruction writes the data in D20 to D2, and increments the value in D0 to 2. 2. The instruction shifts and writes the data in the word device as shown below. The data in D20 is written into D1. The value in D0 becomes 1.
6-317 API Instruction code Operand Function 1104 SFWR P S, D, n Shifting the data and writing it into a word device Device X Y M S T C HC D FR SM SR E K 16# “$” F S D n BOOL WORD DWORD LWORD UINT INT DINT LINT REAL LREAL TMR CNT STRING Data type S D n Pulse instruction 16-bit instruction 32-bit instruction ES3 ES3 -