Mitsubishi Electronics FX3G User Manual

Page of 964
312
FX
3S
/FX
3G
/FX
3GC
/FX
3U
/FX
3UC
 Series
Programming Manual - Basic & Applied Instruction Edition
11 Rotation and Shift Operation – FNC 30 to FNC 39
11.9 FNC 38 – SFWR / Shift Write [FIFO/FILO Control]
Program example
1. Example of first-in first-out control
→ For a program example of FILO, refer to Section 27.3.
In the example below, the shift write (SFWR) and shift read (SFRD) instructions are used.
1) Contents of operation
- In this circuit example, a product number to be taken out now is output according to "first-in first-out" rule while 
products which were put into a warehouse with their product numbers registered are taken out of the warehouse. 
- The product number is hexadecimal, and up to 4 digits. Up to 99 products can be stored in the warehouse.
2) Program
X020
FNC 12
MOVP
K4X000
D256
FNC 38
SFWRP
D256
D257
K100
X021
FNC 39
SFRDP
D257
D357
K100
FNC 12
MOV
D357
K4Y000
M8000
RUN
monitor
Button for request to take a
product out of warehouse
Button for request to put a
product into warehouse
The product number is input from X000 to X017, and
transferred to D256.
Pointer
D257: Data register for storing the product number
D258 to D356 (99 points)
The product number of a product put into first is output
to D357 in response to the request to put a product out
of the warehouse.
The product number to be taken out is output to Y000
to Y017 in a four-digit hexadecimal number.
1234
D256
MOV instruction
0320
0
0232
0462
0539
0142
0
0
D258
D259
D260
D261
D262
D263
D355
D356
0
5
D257
0
0
4
0
Shift
0232
0462
0539
0142
0
0
+1
SFRDP instruction
is executed.
SFWRP instruction
is executed.
−1
0320
D357
0
0
0320
0
0232
0462
0539
0142
1234
6
100
99
1
7
2
3
4
5
6
MOV instruction
1
2
3
4
Request to
put a
product into
warehouse
Request to
take a
product out
of warehouse
X20
X21
Digital switch 0000 to FFFF
Seven-segment display unit
Y017 to Y000
X017 to X000
Command
Command