Mitsubishi Electronics FXCPU Video Game Controller User Manual


 
10 Applied Instructions (Rotation and Shift Operation)
10.9 SFWR / Shift Write [FIFO/FILO Control]
221
FXCPU Structured Programming Manual
[Basic & Applied Instruction]
1
Outline
2
Instruction List
3
Configuration of
Instruction
4
How to Read
Explanation of
Instructions
5
Basic Instruction
6
Step Ladder
Instructions
7
Applied Instructions
(Program Flow)
8
Applied Instructions
(Move and
Compare)
9
Applied Instructions
(Arithmetic and
Logical Operation)
10
Applied Instructions
(Rotation and
Shift Operation)
Program examples
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
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 take
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.
M8000
MOV
EN
s
ENO
d
D357 K4Y000
X020
MOVP
EN
s
ENO
d
K4X000 D256
D256
D257
K100
SFWRP
EN
s
n
ENO
d
X021
D257
D357
K100
SFRDP
EN
s
n
ENO
d
[Structured ladder/FBD]
[ ST ]
MOVP(X020, K4X000, D256);
SFWRP(X020, D256, K100, D257);
SFRDP(X021, D257, K100, D357);
MOV(M8000, D357, K4Y000);
MOV
0320
0
0232
0462
0539
0142
0
0
D258
D259
D260
D261
D262
D263
D355
D356
0
5D257
0
0
4
0
Shift
0232
0462
0539
0142
0
0
+1
SFRDP
instruction
is executed.
SFWRP
instruction
is executed.
-1
0320D357
0
0
0320
0
0232
0462
0539
0142
1234
6
100
99
1
7
2
3
4
5
6
MOV
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 Y000X017 to X000
Command
Command
1234D256