Chapter 6 Applied Instructions Symbol S : First device where the value is shifted from D : First device where the value is shifted to n 1 : Length of the data to be shifted n 2 : Number of bits in a group 6_ Explanation 1. This instruction divides the data in the n 1 word devices starting from D into groups ( n 2 words in a group), and shifts these groups to the right. This instruction then shifts the data in the n 2 word devices starting from S to the devices starting from D to fill the vacancy. 2. In general, the WSFRP pulse instruction is used. 3. The operand n 1 must be between 1–512. The operand n 2 must be between 1– n 1 . Example 1 1.
When M0 switches from OFF to ON, the instruction divides the data in the sixteen word devices starting from D20 to D35 into groups (four words in a group), and shifts these groups to the right. 2. The shift of the data in the word devices to the right during a scan is shown below. 6-311 API Instruction code Operand Function 1102 WSFR P S, D, n1, n2 Shifting the data in word devices to the right Device X Y M S T C HC D FR SM SR E K 16# “$” F S D n1 n2 BOOL WORD DWORD LWORD UINT INT DINT LINT REAL LREAL TMR CNT STRING Data type S D n1 n2 Pulse instruction 16-bit instruction 32-bit instruction ES3 ES3 -