欢迎图片
Version 1.2 by Iris on 2025/10/21 11:41

Hide last authors
Iris 1.2 1 === **SFRD/Shift Read** ===
Iris 1.1 2
Iris 1.2 3 **SFRD(P)**
Iris 1.1 4
5 Data read instructions for first-in, first-out and control.
6
7 -[SFRD (s)  (d) (n)]
8
9 **Content, range and data type**
10
11 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
12 |(s)|(((
13 The start word device number storing data
14
15 (The start is a pointer, and the data starts from (s)+1)
16 )))|-|Signed BIN 16 bit|ANY16
17 |(d)|The word device number storing the first-out data|-|Signed BIN 16 bit|ANY16
18 |(n)|It should be specified as the value of the number of points + 1 of the stored data. +1 is pointer|2 to 512|Signed BIN 16 bit|ANY16
19
20 **Device used**
21
22 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|**Index modification**|(((
23 **Pulse**
24
25 **extension**
26 )))
27 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
28 |(% rowspan="3" %)SFRD|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | | | | |●|●
29 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
30 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
31
32 **Features**
33
34 Transfer (s)+1 written sequentially to (d) by SFWR instruction, shift up each point (n)-1 by one word from (s)+1. The number of stored data of (s) subtracts one.
35
36 The content of (s)+1 is transferred (read) to (d). At the same time, the content of the pointer (s) decreases, and the data is shifted up by 1 word each. (In the continuous execution instruction SFRD, each operation cycle will shift, so the pulse execution instruction SFRDP should be used for programming).
37
38 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps2.jpg]]
39
40 **Related device **
41
42 |**Devices**|**Name**|**Content**
43 |SM153|Zero bit|Data readout usually starts from (s)+1, but when the pointer (s) is 0, the zero bit SM153 will operate.
44
45 **✎Note: **
46
47 The data after reading would not change the content of (s)+(n) due to reading.
48
49 In the case of continuous execution (SFRD) instructions, each scan time (operation cycle) will be read sequentially, but the content of (s) + (n) would not change. When the pointer (s) is 0, it would become no processing, and the content of (d) would not change.
50
51 **Error code**
52
53 |**Error code**|**Content**
54 |(% rowspan="2" %)4084H|When the value set in (n) is other than the following. 2≤(n)≤512
55 |A negative value is specified in (s).
56 |4085H|When the device specified in the read application instruction (s) and (n) exceeds the corresponding device range.
57 |4086H|When the device specified in the write application instruction (s) and (d) exceeds the corresponding device range.
58
59 **Example**
60
61 The following examples illustrate the use of shift write (SFWR) and shift read (SFRD) instructions.
62
63 (1) Action content
64
65 1. While registering the product number, in order to realize the first-in-first-out principle, the following introduces an example of a ladder ladder diagram that outputs the current product number.
66 1. The product number is a hexadecimal number with 4 digits or less, and the maximum inventory is below 99 points.
67
68 (2) Program
69
70 1. Program 1
71
72 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps3.png]][[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps4.png]][[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps5.png]][[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps6.png]] [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps7.jpg]]
73
74 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps8.jpg]]
75
76 1. Program 2
77
78 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps9.jpg]] First-in-first-out data read instruction
79
80 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps10.jpg]]
81
82 Turn X0 from OFF to ON, and this instruction acts according to the following numbers 1 to 3. (The content of D10 remains unchanged),
83
84 * The content of D2 is read out and sent to D20.
85 * D10 to D3 all shift one register to the right.
86 * The contents of pointer D1 are reduced by 1.
87
88
89
90 === [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps11.png]]**6.14.2 POP/Read From the Back of the Data Table** ===
91
92 **POP(P)**
93
Iris 1.2 94 Read the last data written by the shift write instruction (SFWR) for first in first out/first in last out control. 
Iris 1.1 95
96 -[POP  (s)  (d)  (n)]
97
98 **Content, range and data type**
99
100 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
101 |(s)|The start device number that stores the first-in data (including pointer data) (the start word device number that stores data)|-|Signed BIN 16 bit|ANY16
102 |(d)|The device number that stores the last-out data|-|Signed BIN 16 bit|ANY16
103 |(n)|The points of stored data|2 to 512|Signed BIN 16 bit|ANY16
104
105 **Device used**
106
107 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**parameter**|(% colspan="24" %)**Devices**|**Index modification**|(((
108 **Pulse**
109
110 **extension**
111 )))
112 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
113 |(% rowspan="3" %)POP|Parameter 1| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
114 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
115 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
116
117 **Features**
118
119 For the word device of "(s) to (s)+(n)-1", the device of "(s) + instruction data (s)" will be read to (d) ( The last data written by the shift write instruction (SFWR) for first-in first-out control is read to (d)). (N) Specifies 2 to 512.
120
121 The value of pointer data (s) is reduced by one.
122
123 First-in-last-out control data
124
125 | |**Content**
126 |(S)|Pointer data (the number of stored data)
127 |(S)+1|(% rowspan="7" %)(((
128 Data field
129
130 (Data entered by shift write instruction (SFWR))
131 )))
132 |(S) +2
133 |(S) +3
134 |......
135 |(S)+(n)-3
136 |(S)+(n)-2
137 |(S)+(n)-1
138
139 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps12.jpg]]
140
141 **✎Note: **
142
143 **✎**If the POP(P) instruction is programmed in continuous execution type, the instruction will be processed per cycle. Therefore, it may not be possible to achieve the desired action. Generally, POP(P) instruction programming should be executed with "pulse execution type" or "pulse specified contact".
144
145 **✎**When the current value of pointer (s) is 0, the zero flag SM153 turns on, and the POP(P) instruction becomes no processing.
146
147 **✎**When the current value of pointer (s) is 1, write 0 to (s), and the zero flag SM153 turns on.
148
149 **Error code**
150
151 |**Error code**|**Content**
152 |(% rowspan="3" %)4084H|(s)>(n)-1
153 |(s)<0
154 |Data outside the specified range is entered in (n). 2≤(n)≤512
155 |4085H|When the device specified in the read application instruction (s) and (n) exceeds the corresponding device range
156 |4086H|When the device specified in the write application instruction (s) and (d) exceeds the corresponding device range
157
158 **Example**
159
160 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps13.jpg]]
161
162 Each time M1 is ON, for the values of D20 input first in D101 to D106, the last saved value would be saved in D10, and then the data saved number (pointer D100) will be reduced by 1.
163
164 When the data entered first is the content in the table below.
165
166 |**Pointer**|D100|K3
167 |(% rowspan="6" %)**Data**|D101|H1234
168 |D102|H5678
169 |D103|HABCD
170 |D104|H0000
171 |D105|H0000
172 |D106|H0000
173
174 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps14.png]]
175
176
177 === **6.14.3 SFWR/Shift Write** ===
178
179 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps15.png]]**SFWR(P)**
180
181 Data writing instructions for first-in-first-out and control.
182
183 -[SFWR (s)  ( d) (n)]
184
185 **Content, range and data type**
186
187 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
188 |(s)|The word device number that stores the data you want to enter first|-|Signed BIN 16 bit|ANY16
189 |(d)|The start word device number for storing data and shifting (the start is pointer, and data starts from (d)+1)|-|Signed BIN 16 bit|ANY16
190 |(n)|The value of points + 1 of stored data should be specified|2 to 512|Signed BIN 16 bit|ANY16
191
192 **Device used**
193
194 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|**Index modification**|(((
195 **Pulse**
196
197 **extension**
198 )))
199 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
200 |(% rowspan="3" %)SFWR|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
201 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
202 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
203
204 **Features**
205
206 Start from (d)+1, write the contents of (s) to point (n)-1, and the stored data of (d) add one. For example, if (d)=0, write to (d) +1, (d)=1, write to (d)+2.
207
208 Through the first execution, the content of (s) is stored to (d)+1 and becomes the value of (s).
209
210 If the content of (s) is changed and executed for the second time, the content of (s) is stored to (d)+2, and the content of (d)+2 becomes (s) (in the continuous execution instruction SFWR, each operation cycle will be stored sequentially, so the pulse execution instruction SFWRP should be used for programming). After that, the data will be filled in sequentially from the right, and the number of data storage points is displayed by the content of the pointer (d).
211
212 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps16.jpg]]
213
214 **Related device**
215
216 |**Devices**|**Name**|**Content**
217 |SM151|carry|When the content of pointer (s) exceeds (n)-1, it becomes no processing (no writing), and the carry flag SM151 turns ON.
218
219 **✎Note: **
220
221 In the continuous execution type (SFWR) instruction, you should be noted that each scan time (operation cycle) will be stored (overwritten) sequentially.
222
223 **Error code**
224
225 |**Error code**|**Content**
226 |(% rowspan="2" %) 4084H|When the value set in (n) is other than the following. 2≤(n)≤512
227 |A negative value is specified in (d).
228 |4085H|When the device specified in the read application instruction (s), (d) and (n) exceeds the corresponding device range.
229 |4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range.
230
231 **Example**
232
233 The following examples illustrate the use of shift write (SFWR) and shift read (SFRD) instructions.
234
235 7.14.4 (1) Action content
236
237 1. While registering the product number, in order to realize the first-in-first-out principle, the following introduces an example of a ladder ladder diagram that outputs the current product number.
238 1. The product number is a hexadecimal number with 4 digits or less, and the maximum inventory is below 99 points.
239
240 (2) Program
241
242 1. Program 1
243
244 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps17.png]][[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps18.png]][[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps19.png]][[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps20.png]] [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps21.jpg]]
245
246 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps22.jpg]]
247
248 1. Program 2
249
250 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps23.jpg]] First-in-first-out data read instruction
251
252 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps24.jpg]]
253
254 When X0=1, the content of D0 is stored in D2, and the content of D1 becomes 1. When X0 changes from OFF to ON again, the content of D0 is stored in D3, the content of D1 becomes 2, and so on. If the content of D1 exceeds n-1, the instruction is not processed, and the carry flag M8022 will be set to 1.
255
256
257 === **6.14.4 FINS/Data Table Data Insertion** ===
258
259 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps25.png]]FINS(P)
260
261 Insert the BIN 16-bit data specified in (s) into the number (n) of the data table specified in (d). After the instruction is executed, the data starting with number (n) in the data table will be postponed downward one by one.
262
263 -[FINS (s) (d) (n)]
264
265 **Content, range and data type**
266
267 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
268 |(s)|The start number of device storing the inserted data|-|Signed BIN 16 bit|ANY16
269 |(d)|The starting number of table|-|word|ANY16
270 |(n)|The position of the inserted table|1-512|Signed BIN 16 bit|ANY16
271
272 **Device used**
273
274 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|**Index modification**|(((
275 **Pulse**
276
277 **extension**
278 )))
279 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
280 |(% rowspan="3" %)FINS|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
281 |Parameter 2| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|●
282 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
283
284 **Features**
285
286 Insert the BIN 16-bit data specified in (s) into the number (n) of the data table specified in (d). After the instruction is executed, the data starting with number (n) in the data table will be postponed downward one by one.
287
288 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps26.jpg]]
289
290 * N: the number of data storage;
291 * DTr: data table range;
292 * When (n)=2, it will be inserted into (d)+2.
293
294 ✎Note:
295
296 ✎The range of device used in the data table is managed by user.
297
298 ✎The range of the data table is (d) started from device (d) +1) after the number of data (d).
299
300 Error code
301
302 |**Error code**|**Content**
303 |(% rowspan="4" %)4084H|FINS(P) instruction is executed when the value of (d) is 0.
304 |The storage data of the table of (d) exceeds 512.
305 |When the data set in (n) is other than the following, 1≤(n)≤512.
306 |When the FINS(P) instruction is executed, the table position (n) of the inserted data is greater than data storage number.
307 |4085H|When the device specified in the read application instruction (s), (d) and (n) exceeds the corresponding device range.
308 |4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range.
309
310 **Example**
311
312 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps27.jpg]]
313
314 When X10=ON, insert the data of D100 into No. 3 of the data table of D0 to D4.
315
316 However, when the number of saved data exceeds 7, the FINS(P) instruction is not executed (the device range used in the data table is D0 to D7).
317
318 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps28.png]]
319
320
321 === **6.14.5 FDEL/Data Deletion of Data Sheet** ===
322
323 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps29.png]]FDEL(P)
324
325 Delete the (n)th data of the data table specified in (d) and store it in the device specified in (s). After the instruction is executed, the data after (n)+1 in the data table will be postponed forward one by one.
326
327 -[FDEL (s)  (d) (n)]
328
329 **Content, range and data type**
330
331 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
332 |(s)|The start number of the device stored deleted data|-|Signed BIN 16 bit|ANY16
333 |(d)|The starting number of the table|-|word|ANY16
334 |(n)|The position of the deleted table|1-512|Signed BIN 16 bit|ANY16
335
336 **Device used**
337
338 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|**Index modification**|(((
339 **Pulse**
340
341 **extension**
342 )))
343 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
344 |(% rowspan="3" %)FDEL|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | | | | |●|●
345 |Parameter 2| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|●
346 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
347
348 **Features**
349
350 Delete the (n)th data of the data table specified in (d) and store it in the device specified in (s). After the instruction is executed, the data after (n)+1 in the data table will be postponed forward one by one.
351
352 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps30.jpg]]
353
354 **✎Note:**
355
356 **✎**The user is responsible for the management of the device range used in the data sheet.
357
358 **✎**The range of the data table is (d) after the data storage number (d) of the device ((d) + 1).
359
360 **Error code**
361
362 |**Code**|**Content**
363 |(% rowspan="4" %)4084H|FDEL(P) instruction is executed when the value of (d) is 0.
364 |The storage data of the table of (d) exceeds 512.
365 |When the data set in (n) is other than the following, 1≤(n)≤512.
366 |When the FDEL(P) instruction is executed, the table position (n) of the deleted data is greater than data storage number.
367 |4085H|When the device specified in the read application instruction (d) and (n) exceeds the corresponding device range.
368 |4086H|When the device specified in the write application instruction (s) and (d) exceeds the corresponding device range.
369
370
371
372 **Example**
373
374 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps31.jpg]]
375
376 When X10 is ON, delete the second data in the data table of D100 to D105, and save the deleted data in D0. However, when the number of data saved is 0, do not execute the FDEL instruction. (The device range used in the data table is D100 to D107.)
377
378 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7696\wps32.png]]
379
380