7 Applied Instructions
7.1 Program Flow
121
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
8
Interrupt Function
and Pulse Catch
Function
A
Relationships
between devices
and addresses
Function and operation explanation
1. 16-bit operation
While the command input is ON, CALL instruction is executed and the program execution jumps to a step with
a label p.
Then, a subroutine program with the label p is executed.
When SRET instruction is executed, the program execution returns to the step after CALL instruction.
• At the end of the main program, put FEND instruction.
• Put a label p for CALL instruction after FEND instruction.
Cautions
1) The FX0, FX0S or FX0N PLC does not support the instructions of pulse operation type.
To execute pulse operation, make the instruction execution condition pulse type.
2) To use the subroutine call, follow the steps below.
Name the task "MELSEC_MAIN".
Using a different task name prompts an error because the "one set in the program block" by the function
FEND and the "one finally added to the program block during compiling" become redundant.
Be sure to program in combination with the SRET and FEND functions.
→ Refer to Section 7.1.3 for SRET.
→ Refer to Section 7.1.7 for FEND.
3) In CALL instructions, a same number can be used two or more times in operands (P).
However, do not use a label (P) and number used in another instruction (CJ).
4) Cautions about the use in subroutines or interrupt routines are described later.
M8000
Command
User program
User program
Main program
Program area from the
step 0 to FEND instruction
Subroutine program
Program area from a label p
to SRET instruction
User program
Label
CALL
EN ENO
p
SRET
EN ENO
FEND
EN ENO
p
p
RUN monitor
(normally ON)
Label
P 9
X030
X020
User program
CJ
EN ENO
p
CALLP
EN ENO
p
P9
P9