GX Work 3 Manual Basico
GX Work 3 Manual Basico
GX Work 3 Manual Basico
(Program Design)
SAFETY PRECAUTIONS
(Read these precautions before using this product.)
Before using the Mitsubishi Electric MELSEC iQ-R series programmable controllers, please read the manuals for the product
and the relevant manuals introduced in those manuals carefully, and pay full attention to safety to handle the product correctly.
Make sure that the end users read this manual and then keep the manual in a safe place for future reference.
1
• For SIL2 Process CPUs
(1) Although MELCO has obtained the certification for Product's compliance to the international safety standards
IEC61508, IEC61511 from TUV Rheinland, this fact does not guarantee that Product will be free from any malfunction
or failure. The user of this Product shall comply with any and all applicable safety standard, regulation or law and take
appropriate safety measures for the system in which the Product is installed or used and shall take the second or third
safety measures other than the Product. MELCO is not liable for damages that could have been prevented by
compliance with any applicable safety standard, regulation or law.
(2) MELCO prohibits the use of Products with or in any application involving, and MELCO shall not be liable for a default, a
liability for defect warranty, a quality assurance, negligence or other tort and a product liability in these applications.
(a) power plants,
(b) trains, railway systems, airplanes, airline operations, other transportation systems,
(c) hospitals, medical care, dialysis and life support facilities or equipment,
(d) amusement equipments,
(e) incineration and fuel devices,
(f) handling of nuclear or hazardous materials or chemicals,
(g) mining and drilling,
(h) and other applications where the level of risk to human life, health or property are elevated.
• For Safety CPUs
(1) Although MELCO has obtained the certification for Product's compliance to the international safety standards
IEC61508, EN954-1/ISO13849-1 from TUV Rheinland, this fact does not guarantee that Product will be free from any
malfunction or failure. The user of this Product shall comply with any and all applicable safety standard, regulation or
law and take appropriate safety measures for the system in which the Product is installed or used and shall take the
second or third safety measures other than the Product. MELCO is not liable for damages that could have been
prevented by compliance with any applicable safety standard, regulation or law.
(2) MELCO prohibits the use of Products with or in any application involving, and MELCO shall not be liable for a default, a
liability for defect warranty, a quality assurance, negligence or other tort and a product liability in these applications.
(a) power plants,
(b) trains, railway systems, airplanes, airline operations, other transportation systems,
(c) hospitals, medical care, dialysis and life support facilities or equipment,
(d) amusement equipments,
(e) incineration and fuel devices,
(f) handling of nuclear or hazardous materials or chemicals,
(g) mining and drilling,
(h) and other applications where the level of risk to human life, health or property are elevated.
2
INTRODUCTION
Thank you for purchasing the Mitsubishi Electric MELSEC iQ-R series programmable controllers.
This manual describes the program structures and data required for programming.
Before using this product, please read this manual and the relevant manuals carefully and develop familiarity with the
functions and performance of the MELSEC iQ-R series programmable controller to handle the product correctly.
When applying the program examples provided in this manual to an actual system, ensure the applicability and confirm that it
will not cause system control problems.
Please make sure that the end users read this manual.
Most of the information in this manual is described using labels. Devices can be used in the same way as
labels.
3
CONTENTS
SAFETY PRECAUTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1
CONDITIONS OF USE FOR THE PRODUCT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3
RELEVANT MANUALS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6
TERMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7
CHAPTER 1 OVERVIEW 8
CHAPTER 4 LABELS 41
CHAPTER 7 FBD/LD 65
7.1 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Program elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Constant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Labels and devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
7.2 Program Execution Order. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Execution order of program elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
4
8.2 Structure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Step . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Action. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Transition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
8.3 SFC Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
8.4 SFC Information Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
8.5 SFC Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
CPU parameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
CONTENTS
SFC block setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
8.6 SFC Program Execution Order. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Whole program processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
SFC program processing sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
8.7 SFC Program Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Starting and stopping the SFC program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Starting and ending a block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Pausing and restarting a block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Activating and deactivating a step . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
Behavior when an active step is activated. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Operation when a program is modified . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Checking SFC program operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
APPENDIX 143
Appendix 1 Operations of when the MC/MCR instructions are used to control EN . . . . . . . . . . . . . . . . . . . . . . 143
INDEX 148
REVISIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .150
WARRANTY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .151
TRADEMARKS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .152
5
RELEVANT MANUALS
Manual name [manual number] Description Available form
MELSEC iQ-R Programming Manual (Program Design) Program specifications (ladder, ST, FBD/LD, and SFC e-Manual
[SH-081265ENG] (this manual) programs) PDF
MELSEC iQ-R Programming Manual (CPU Module Instructions, Instructions for the CPU module and standard functions/ e-Manual
Standard Functions/Function Blocks) function blocks PDF
[SH-081266ENG]
MELSEC iQ-R Programming Manual (Process Control Function Blocks/ Standard process function blocks, tag access function blocks, e-Manual
Instructions) tag function blocks, and process control instructions designed PDF
[SH-081749ENG] for the process control
GX Works3 Operating Manual System configuration, parameter settings, and online e-Manual
[SH-081215ENG] operations of GX Works3 PDF
e-Manual refers to the Mitsubishi Electric FA electronic book manuals that can be browsed using a dedicated
tool.
e-Manual has the following features:
• Required information can be cross-searched in multiple manuals.
• Other manuals can be accessed from the links in the manual.
• The hardware specifications of each part can be found from the product figures.
• Pages that users often browse can be bookmarked.
• Sample programs can be copied to an engineering tool.
6
TERMS
Unless otherwise specified, this manual uses the following terms.
Term Description
Buffer memory Memory in an intelligent function module for storing data such as setting values and monitored values.
Buffer memory in a CPU module stores setting values and monitored values of the Ethernet function and data used for
data communications among the CPU modules in a multiple CPU system.
CPU module A generic term for the MELSEC iQ-R series CPU modules
Device A device (X, Y, M, D, or others) in a CPU module
Engineering tool The product name of the software package for the MELSEC programmable controllers
GX Works3 The product name of the software package, SWnDNC-GXW3, for the MELSEC programmable controllers (The 'n'
represents a version.)
I/O module A generic term for the input module, output module, I/O combined module, and interrupt module
Intelligent function module A module that has functions other than input and output, such as an A/D converter module and D/A converter module
Module label A label that represents one of memory areas (I/O signals and buffer memory areas) specific to each module in a given
character string. For the module used, the engineering tool automatically generates this label, which can be used as a
global label.
Multiple CPU system A system where two to four CPU modules separately control I/O modules and intelligent function modules
Network module A generic term for the following modules:
• Ethernet interface module
• CC-Link IE Controller Network module
• Module on CC-Link IE Field Network
• MELSECNET/H network module
• MELSECNET/10 network module
• RnENCPU (network part)
Operand A generic term for the devices, such as source data (s), destination data (d), number of devices (n), and others, used
as parts to configure instructions and functions
POU A unit that configures a program. Units are categorized and provided in accordance with functions. Use of POUs
enables dividing the lower-layer processing in a hierarchical program into some units in accordance with processing or
functions, and creating programs for each unit.
Predefined protocol support function A function of GX Works3.
This function sets protocols appropriate to each external device and reads/writes protocol setting data.
Standard/safety shared label A label that can be used in both standard programs and safety programs. This label is used to pass data between
safety programs and standard programs.
The following terms are used to explain systems using the SIL2 Process CPU and the Safety CPU.
Term Description
Safety communications Communication service that performs send/receive processing in the safety layer of the safety communication protocol
Safety control Machine control by safety programs and safety data communications. When an error occurs, the machine in operation
is securely stopped.
Safety device A device that can be used in safety programs
Safety program A program that performs safety control
Standard communications Communications other than safety communications, such as cyclic transmission and transient transmission of CC-Link
IE Field Network
Standard control Machine control by standard programs and standard data communications. Programmable controllers other than the
safety programmable controller perform only standard control. (This term is used to distinguish from safety control.)
Standard CPU A generic term for MELSEC iQ-R series CPU modules that perform standard control (This term is used to distinguish
from the CPU modules that perform safety control.)
Standard device A device (X, Y, M, D, or others) in a CPU module. (Safety devices are excluded.) This device can be used only in
standard programs. (This term is used to distinguish from a safety device.)
Standard program A program that performs sequence control. (Safety programs are excluded.) (This term is used to distinguish from a
safety program.)
7
1 OVERVIEW
This manual describes program configurations, contents, and coding methods required for programming.
For information on creating, editing, and monitoring programs using an engineering tool, refer to the following.
GX Works3 Operating Manual
Programming languages
With the MELSEC iQ-R series, an optimal programming language can be selected and used according to the application.
Programming language Description
Ladder diagram (Ladder) A graphic language which describes ladders consisting of contacts and coils.
This language is used to describe logical ladders using symbolized contacts and coils to enable
easy-to-understand sequence control.
Structured text language (ST) A textual language used to describe programs using statements (such as IF) and operators.
Compared with the ladder diagram, this language can describe hard-to-describe operation
processing concisely and legibly, and therefore is suitable for programming complicated
arithmetic operations and comparison operations. Also, as with C, ST language can describe
syntax control such as selective branches with conditional statements and iteration statements,
and thus can describe easy-to-understand, concise programs.
Function block diagram/ladder diagram (FBD/LD) A graphic language which describes programs by connecting blocks that perform predefined
processing, variable elements, and constant elements along the flow of data and signals.
This language facilitates programming of DDC (direct digital control) processing which is difficult
to describe in ladder diagram, and improves the productivity of programs.
Sequential function chart (SFC program) SFC is a program description format in which a sequence of control operations is split into a
series of steps to enable a clear expression of each program execution sequence and execution
conditions.
1 OVERVIEW
8
■Function block diagram/ladder diagram (FBD/LD)
■SFC program
• Programming in ladder is suitable for users who have knowledge and experience of sequence control and
logical ladders. Programming in ST is suitable for users who have knowledge and experience of C
programming. Programming in FBD/LD is suitable for users who perform process control. SFC program is
suitable for creating program blocks for each actual control of machines and controlling the transition of
each operation.
• Using labels in programs can improve readability of programs, and make it easy to immigrate programs to a
system having a different module configuration.
1 OVERVIEW
9
2 PROGRAM CONFIGURATION
Using the engineering tool, multiple programs and program organization units (POUs) can be created.
Programs and POUs can be divided according to processing.
This chapter describes the program configuration.
Project
·
Program block Program block Function block
Function block
Function
Program block
Function
Function
Project
A project is a group of data (such as programs and parameters) to be executed in a CPU module.
Only one project can be written to a single CPU module.
At least one program file needs to be created in a project.
Program file
A program file is a group of programs and POUs.
A program file consists of at least one program block. ( Page 13 Program Blocks)
The following operations are performed in units of program file: changing the program execution type from the fixed scan
execution type to the standby type and writing data to the CPU module.
2 PROGRAM CONFIGURATION
10
MEMO
2 PROGRAM CONFIGURATION
11
3 PROGRAM ORGANIZATION UNITS
There are three types of program organization units (POUs).
• Program block
• Function
• Function block
Processing can be described in the programming language that suits the control performed in each POU. Processing can be
described in the ladder diagram, structured text language, or FBD/LD in a function or a function block.
Functions and function blocks are called and executed by program blocks.
Project
Program file
Used
POU
Program block
POU folder
POU
Function block
POU
Function
Up to 32 worksheets can be created in one POU in the structured text language and FBD/LD.
Set the execution order of multiple worksheets on the "Worksheet Execution Order Setting" window of the
engineering tool. ( GX Works3 Operating Manual)
Program block 2
*1 Subroutine programs and interrupt programs cannot be created in safety programs. Subroutine programs cannot be executed from
safety programs.
• Create a subroutine program and interrupt program after the FEND instruction of the main routine program.
Any program after the FEND instruction is not executed as a main routine program. For example, when the
FEND instruction is used at the end of the second program block, the third program block or later runs as a
subroutine program or interrupt program.
• To create an easy-to-understand program, use a pair of instructions, such as the FOR and NEXT
instructions or the MC and MCR instructions, within a single program block.
• A simple program can be executed in the CPU module simply by writing the main routine in one program
block.
For details on the subroutine program and interrupt program, refer to the following.
MELSEC iQ-R CPU Module User's Manual (Application)
Program
Function block
FUN
Function block
or Program
function block
FUN FB or FUN
Operation overview
The program of a function is stored in the FUN file and called by the calling source program when executed.
Ex.
When calling FUN1 and FUN2 from the main program, and calling FUN3 by FUN1 (Nested three times)
to indicate the execution flow (order).
(Program file) (FUN file)
Main program FUN1 program (FUN file)
FUN3 program
Ò Ó
Ô
FUN3
FUN1
Ö Õ
(FUN file)
FUN2 program
FUN2
×
Up to 32 subroutine type function blocks, macro type function blocks, and functions in total can be nested.
Input variables are set in the VAR_INPUT class and output variables are set in the VAR_OUTPUT class.
Variables defined in the function are overwritten every time the function is called.
To hold the data in the variables, create a program by using function blocks or so that the data in the output
variable is saved in another variable.
EN and ENO
EN (enable input) and ENO (enable output) can be appended to a function to control execution processing.
• Set a boolean variable used as an execution condition of a function to EN.
• A function with EN is executed only when the execution condition of EN is TRUE.
• Set a boolean variable used to output a function execution result to ENO.
The following table lists the ENO states and operation results according to the EN states.
EN ENO Operation result
TRUE (executed) TRUE Operation result output value
FALSE (not executed) FALSE Undefined value
• Setting an output label to ENO is not always required for the program written in ladder or FBD/LD.
• When EN/ENO is used in a standard function, the function with EN is represented by "function-name_E".
Program a function name as a label in a function to set a return value of the function. Setting function names
as labels is not necessary. The data type set in "Result Type" in the properties of the function can be used.
Ex.
When calling FUN1 and FUN2 from the main program, and calling FUN3 by FUN1
( to indicate the execution flow (order).)
(Program file)
3
(FUN file)
Main program FUN1 program (FUN file)
FUN3 program
Ò Ó
Ô
FUN3
FUN1
Ö Õ
(FUN file)
FUN2 program
FUN2
×
The following figure shows the label assignments while the above functions are being executed.
Ò Ó Ô Õ
Main program being executed FUN1 being executed FUN3 being executed FUN1 being executed
(before FUN3 is called) (after FUN3 is executed)
Temporary area
Ö × Ø
Main program being executed FUN2 being executed Main program being executed
The class of labels that can be defined in the function are VAR, VAR_CONSTANT, VAR_INPUT, and VAR_OUTPUT.
The label to be defined by a function must be initialized by a program before the first access because the label
value will be undefined.
■Program
The number of steps required for a function program is the total number of instruction steps plus 22 steps. For the number of
steps required for each instruction, refer to the following.
MELSEC iQ-R Programming Manual (CPU Module Instructions, Standard Functions/Function Blocks)
■Calling source
When calling a function, the calling source generates the processing that passes the argument and return value before and
after the call processing.
(1) Passing the argument
Program block 1
(displayed) Program file (2) Calling the FUN1 program
(3) Passing the return value
FUN file
FUN1 program
Function Program
block block
FB
Function Program
block block
FB FB
(3) (3)
(4)
(4)
Ex.
When calling FB1_a and FB2_a from the main program, calling FB3_a by FB1_a, and calling FB3_b by FB2_a
Execution
3
(Program file) flow Actual structure of
Main program main program
FB1_a
FB1 FB1 program (1)
FB3 program
(2)
FB2_a
FB2 FB2 program (3)
FB3 program
(4)
(1) The FB1 program is loaded into the main program and executed.
(2) The FB3 program called by FB1 is loaded into the FB1 program.
(3) The FB2 program is loaded into the main program and executed in the same way as the FB1 program.
(4) The FB3 program called by FB2 is loaded into the FB2 program.
Ex.
When calling FB1_a and FB2_a from the main program, calling FB3_a by FB1_a, and calling FB3_b by FB2_a (Nested three
times)
to indicate the execution flow (order).
(Program file) (FB file)
Main program FB1 program (FB file) Program memory
FB3 program
Ò FB3_a Ó
FB1_a Ô Ø
FB3 Main program
FB1
Õ
Ö FB1 program
(FB file)
FB2_a
FB2 program
FB2 FB2 program
FB3_b ×
FB3
Ú
FB3 program
Ù
Up to 32 subroutine type function blocks, macro type function blocks, and functions in total can be nested.
RESET iTim
lCnt
(1) (2)
Instance
CTD
CD Q
LOAD CV
PV
Input variables are set in the VAR_INPUT class, output variables are set in the VAR_OUTPUT class and
VAR_OUTPUT_RETAIN class, and input/output variables are set in the VAR_IN_OUT class.
Internal variables
Function blocks use internal variables. For each instance of a function block, labels are assigned to the different areas. Even
though the same label names are used, different states are held for each instance.
Ex.
Instance A Instance B
cdLabel11 cdLabel11
Current value Current value
The above function block starts counting when the input variables turn on and turns on the output variable when the current
value held in the internal variable reaches the set value. Even though the same function block is used, the output timings differ
because the instances A and B hold different states.
Internal variables are set in the VAR, VAR_CONSTANT and VAR_RETAIN class.
Ex.
Structure of instance (Example of subroutine type function block)
Creating another
instance based on
FB1 definition Another instance of FB1
(same area size)
Local label area
For the local label area and local latch label area, since the label area is secured in units of four words, three-words (padding
size) are secured in the above example.
Each area has a reserved area. The reserved area is used to add instances of the function block or instructions that refer to
the local label or signal flow memory while keeping the label assignment by conversion or online change. If the area of the
target data type to be added cannot be secured, all programs are required to be converted (reassigned).
The instance of FB2 declared as a local label is secured in the local label area, local latch label area, and signal flow area of
FB1 which is the declared source.
When an FB type local label to FB1 is added in the above example, since the capacity of the reserved area is 48 words for
local label area, 16 words for local latch label area, and 4 words for signal flow area, all programs are required to be converted
(reassigned) to add a function block with an area exceeding the capacity.
To add local labels or FB instances while keeping the assignment without converting all programs (reassigned), secure the
capacity required to add them in the reserved area. For the reserved area setting method, refer to the following.
GX Works3 Operating Manual
*1 Local labels can be declared as the local labels of a program block or function block. Local labels cannot be declared in a function.
Same function blocks can be instantiated with different names in a single POU. 3
Instance A
Function block
wLabel5
wLabel1 Input variable 1 wLabel8
wLabel6 Output variable wLabel4
wLabel2 Input variable 2
wLabel7 wLabel9
wLabel3 Input variable 3 Local variable
(1) (2)
Instance A Instance B
wLabel5 wLabel5
wLabel1 Input variable 1 wLabel8 wLabel10 Input variable 1 wLabel8
wLabel6 Output variable wLabel4 wLabel6 Output variable wLabel13
wLabel2 Input variable 2 wLabel11 Input variable 1
wLabel7 wLabel9 wLabel7 wLabel9
wLabel3 Input variable 3 Local variable wLabel12 Input variable 1 Local variable
For the reserved area capacity, set the capacity of instructions that refer to the local label or signal flow
memory to be added by online change and instances of the function block. For the setting method, refer to the
following.
GX Works3 Operating Manual
If the reserved area capacity cannot be allocated to the data to be added by online change, the online change
cannot be executed and all programs are required to be converted (reassigned).
In the following function blocks, the CPU module memory can be efficiently used by setting smaller value than
default to the reserved area.
• Debugged subroutine type function block where no local label is added or changed and no program is
changed
• Subroutine type function block that declares many instances
(1) The initial values have not been set for the local labels in the FB1 definition.
(2) The default initial values are used.
FB definition initial value An initial value that is set when the local label of a function block is defined. If this initial value has been set, the same
definition initial value will be used for all the instances.
(1) The initial values have been set for the local labels in the FB1 definition.
(2) All the instances of FB1 will be initialized by the same definition initial value.
Instance initial value An initial value that is set for an instance included in the global label and program block local label definition.
(1) The initial value can be set for each instance in the FB1 definition.
If two instances of a function block for which the FB definition initial value has been set are created and the
instance initial value is set for only one of them, the FB1 definition initial value will be used for the instance for
which the instance initial value has not been set and the instance initial value will be used for the other.
Global label definition
Label name Initial value (1)
FB1 definition
- FB1_a -
FB1
AAA 1111
BBB 2222
CCC 3333
Local label definition (FB1)
Local label definition
Label name Initial value (program block 1)
(2)
AAA 1111 Label name Initial value
BBB 2222 - FB1_b -
CCC 3333 AAA 7777
BBB 8888
CCC 9999
(1) When the instance initial value is not set, the FB definition initial value will be used.
(2) When the instance initial value is set, it will be used.
[Defining FB]
Local label definition (FB1)
(1)
FB1 Label Data type Initial Setting initial value of FB definition
name value
AAA BIT TRUE
BBB INT 0
CCC INT 65535
[Creating instances]
(1) The common initial values are set for all the instances.
(2) The individual initial values can be set for each instance.
(3) If the individual initial values are not set, the common ones will be used.
EN and ENO
In the same way as a function, EN (enable input) and ENO (enable output) can also be appended to a function block to control
execution processing.
Page 15 EN and ENO
When the instance of a function to which EN/ENO has been appended is called, an actual argument must be assigned to EN.
Creating programs
The program of a function block can be created by using the engineering tool.
[Navigation window] [FB/FUN] Right-click [Add New Data]
Select "Function Block" for "Data Type" in "Basic Setting".
The created program is stored in the FB file.
[CPU Parameter] [Program Setting] [FB/FUN File Setting]
Up to 64 created programs can be stored in one FB file.
For details on program creation, refer to the following.
Item Reference
How to create function blocks GX Works3 Operating Manual
Number of FB/FUN files that can be written to a CPU module MELSEC iQ-R CPU Module User's Manual (Startup)
■Types of program
There are two types of function blocks and the program of each function block type is stored in different ways.
• Macro type function block
• Subroutine type function block
For details, refer to the following.
Page 21 Operation overview
The above cannot be selected for module function blocks, standard functions, and standard function blocks.
*1 To select this item, select "Yes" for "Use EN/ENO". However, the item cannot be used depending on the versions of the CPU module
and GX Works3 used when "Subroutine Type" is selected for "FB Type". For the versions of the CPU module and the GX Works3, refer
to the following.
MELSEC iQ-R CPU Module User's Manual (Application)
FB1_a
FB1 program
FB1
(FB1_a)
FB1_b
FB1
FB1 program
(FB1_b)
(1)
■Program
The number of steps required for a function block program is the total number of instruction steps, like usual programs.
For the number of steps required for each instruction, refer to the following.
MELSEC iQ-R Programming Manual (CPU Module Instructions, Standard Functions/Function Blocks)
FB1_b
FBCall FB1_a (2)
M10 FB1 Y40
D10
Y20 (3)
The call-target program is
replaced with the instruction
for calling a function block. ·
Calling the
function block
FB file
FB1 program
The number of steps may increase or decrease, depending on the following conditions.
• The actual argument of the function block are index-modified.
• The address specifying the device exceeds 16 bits in length.
• Digit specification is performed.
Ex.
A program that saves the values in the index register Z1 and Z2 before the program execution and returns the saved values
after the program execution
· Program execution ·
Ex.
Device used for passing the argument
MacroFbPou_1 (EN: = M0, ENO = > M1);
M2: = M1;
An unintended value may be generated if the argument of the macro type function block is used in other than the program of
the macro type function block.
Ex.
Unintended value
MacroFbPou_1 (EN: = M0, ENO = > M1);
M2: = MacroFbPou_1.ENO;
Ex.
A conversion error (1) occurs in VAR_OUTPUT in the macro type function block (FbPou)
(1)
If no error was found in (1), check the inputs and outputs (2) of the corresponding function block in the program block that is
the calling source.
(2)
Since the output variables of the function block have been passed to the write-protected label/device, a conversion error has
occurred in the above example.
Ex.
To access the I/O signals of the intelligent function module
Use the index register.
[Sequence program]
3
[FB program]
Ex.
To access the buffer memory of the intelligent function module
Input the start I/O number of the target intelligent function module in the index register.
Shift the four bits in the value to the right by using the SFR instruction, or use the quotient obtained by dividing the value by 16.
■When the CPU module that controls the target module of a module function block is changed
The module function block used in the program will be deleted if the CPU module set to "Control PLC Settings" of "I/O
Assignment" in system parameters is changed to another CPU module.
Copy the program into the project of another CPU module before changing the parameter setting.
Creating programs
■Applicable devices and labels
The following table lists the devices and labels that can be used in safety functions.
: Applicable, : Not applicable
Type of device/label Availability
Label (other than the pointer type) Global label
Local label
Standard/safety shared label
Safety global label
Safety local label *1
Label (pointer type) Pointer type global label
Pointer type local label
Device Global device
Local device
Safety global device
Safety local device
Pointer Global pointer
Local pointer
Number of steps
■Passing the argument
When calling a safety function, the calling source generates the processing that passes the argument before and after the call
processing. The instruction used to pass the argument differs depending on the class and data type of the argument. The
following table summarizes the instructions that can be used to pass the argument.
: Applicable, : Not applicable
Argument class Data type Instruction used Availability
VAR_INPUT Bit LD+OUT
Word [unsigned]/bit string [16 bits] LD+MOV
Double word [unsigned]/bit string [32 bits] LD+DMOV
Word [signed]
Double word [signed]
Single-precision real number LD+EMOV
Double-precision real number LD+EDMOV
Time LD+DMOV
String LD+$MOV
String [Unicode] LD+$MOV_WS
Array, Structure LD+BMOV
For the number of steps required for each instruction, refer to the following.
MELSEC iQ-R Programming Manual (CPU Module Instructions, Standard Functions/Function Blocks)
Instances
■Structure of instance
An instance of a safety function block consists of the following items.
: Applicable, : Not applicable
Item Description Availability 3
Local label area Used to assign the local label of the function block.
Local latch label area Used to assign the latch attribute local label of the function block.
Signal flow area Used to assign the signal flow for the instruction in the function block definition.
Creating programs
■Applicable devices and labels
The following table lists the devices and labels that can be used in safety function blocks.
: Applicable, : Not applicable
Type of device/label Availability
Label (other than the pointer type) Global label
Local label
Standard/safety shared label
Safety global label
Safety local label
Label (pointer type) Pointer type global label
Pointer type local label
Device Global device
Local device
Safety global device
Safety local device
Pointer Global pointer
Local pointer
For the number of steps required for each instruction, refer to the following.
MELSEC iQ-R Programming Manual (CPU Module Instructions, Standard Functions/Function Blocks)
4 LABELS
41
MEMO
4 LABELS
42
5 LADDER DIAGRAM
RnPCPU RnPCPU RnPSFCPU RnPSFCPU RnSFCPU RnSFCPU
RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) (Standard) (Safety)
Ladder diagram is a programming language used to describe sequence control. Each ladder consists of contacts and coils
and represents logical operations consisting of AND/OR in combinations of series and parallel.
This chapter describes the operation and specifications of the ladder diagram. For the operation method of the
engineering tool for creating a ladder program, refer to the following.
GX Works3 Operating Manual
5.1 Configuration
The following are the programs written in ladder diagram.
5
(1)
(2)
(3)
(4)
(5)
Ladder symbols
The following table lists the ladder symbols that can be used for programming in ladder diagram.
Item Description
Normally open contact Energized when the specified device or label is on.
Normally closed contact Energized when the specified device or label is off.
Rising edge pulse Energized on the rising edge (off to on) of the specified device or label.
Falling edge pulse Energized on the falling edge (on to off) of the specified device or label.
Negated rising edge pulse Energized when the specified device or label is off, on, or on the falling edge (on to off).
Negated falling edge pulse Energized when the specified device or label is off, on, or on the rising edge (off to on).
5 LADDER DIAGRAM
5.1 Configuration 43
Item Description
Operation result rising edge Energized on the rising edge (off to on) of the operation result. De-energized while the
pulse conversion operation result is not on the rising edge.
Operation result falling edge Energized on the falling edge (on to off) of the operation result. De-energized while the
pulse conversion operation result is not on the falling edge.
Loopback When the number of contacts that can be created on a single ladder line is exceeded, the
ladder is looped back with loopback source and destination symbols created on it.
Function Executes a function.
• How to create functions ( GX Works3 Operating Manual)
• Standard functions ( MELSEC iQ-R Programming Manual (CPU Module Instructions,
Standard Functions/Function Blocks))
X1 Ò X3 Ô Y1 Õ
X2 Ó X4 Ö Y2 ×
When the above program is executed, Y1 and Y2 turn on while X1 to X4 turn on or off as shown below.
ON
X1
OFF
ON
X2
OFF
ON
X3
OFF
ON
X4
OFF
ON
Y1
OFF
ON
Y2
OFF
5 LADDER DIAGRAM
44 5.1 Configuration
Precautions for using a function block in ladder diagram
(1)
To change the on/off states of EN and the input variables (bit type), use a contact or an instruction equivalent to the contact.
(2): Contact 5
(3): Instruction equivalent to a contact
(2)
(3)
5 LADDER DIAGRAM
5.1 Configuration 45
5.2 Inline ST
The inline ST is the function used to create an inline ST box that displays an ST program in the cell of the instruction
corresponding to a coil in the ladder editor, and edit and monitor it.
This function enables to create numerical operations and character string processing easily in ladder programs.
• Program that does not use the inline ST
Specifications
For the specifications of the ST program described to the inline ST, refer to the specifications of the ST language.
Page 49 STRUCTURED TEXT LANGUAGE
5 LADDER DIAGRAM
46 5.2 Inline ST
Precautions
• Only one inline ST can be created on a single line of a ladder program.
• Both a function/function block and inline ST box cannot be used on a single line of a ladder program.
• Creating an inline ST box at the position of an instruction corresponding to a contact creates an inline ST box at the position
of an instruction corresponding to a coil.
• Up to 2048 characters can be input in the inline ST. (A newline is counted as two characters.)
• Using a RETURN statement in the inline ST causes the processing in the inline ST box to end, instead of the processing of
the program block.
• When the inline ST in the program of a function is used, no function block can be called from the inline ST.
• The inline ST uses the CJ instruction in conversion to control the operation of a program. When the contact of the inline ST
is off, the processing in the inline ST is not executed by the CJ instruction. Thus, for example, the device that turned on by
the assignment statement in the inline ST holds its output status even when the inline ST is not executed. For details on the
CJ instruction, refer to the following.
MELSEC iQ-R Programming Manual (CPU Module Instructions, Standard Functions/Function Blocks)
• In the inline ST, OUT, OUTH, or other instructions which refer to the previous execution status of the signal flow memory
5
cannot be used.
MELSEC iQ-R CPU Module User's Manual (Application)
5 LADDER DIAGRAM
5.2 Inline ST 47
5.3 Statements and Notes
Statements and notes can be used in ladder programs.
Statements
A statement is used to add a comment to a ladder block. Adding a comment makes it easy to understand the flow of
processing.
There are three types of statements: line statement, P statement, and I statement.
The line statement can be displayed in the tree of the navigation window.
■Line statement
This type of statement adds a comment to the entire ladder block.
■P statement
This type of statement adds a comment to a pointer device.
■I statement
This type of statement adds a comment to an interrupt pointer device.
Notes
A note is used to add a comment to a coil and instruction in a program.
Adding a comment makes it easy to understand the contents of the coil and instruction.
5 LADDER DIAGRAM
48 5.3 Statements and Notes
6 STRUCTURED TEXT LANGUAGE
ST language is defined by International Standard IEC61131-3 that defines the logic description system. ST language is a text
language with a similar grammatical structure to C. This language is suitable for programming complicated processing that
cannot be easily described by ladder diagram.
This chapter describes the operation and specifications of the structured text language. For the operation
method of the engineering tool for creating an ST program, refer to the following.
GX Works3 Operating Manual
The ST language supports control syntax, operational expressions, function blocks (FB), and functions (FUN), and can
describe them as shown below.
Ex.
Control syntax such as selective branches by conditional statements and iteration statements 6
(*Control conveyors, Line A to C.*)
CASE Line OF
1:
Start_switch := TRUE; (*The conveyor starts.*)
2:
Start_switch := FALSE; (*The conveyor stops.*)
3:
Start_switch := TRUE; (*The conveyor stops with an alarm.*)
ELSE
Alarm_lamp := TRUE;
END_CASE;
IF Start_switch = TRUE THEN (*The conveyor starts and performs processing 100 times.*)
FOR Count := 0 TO 100 BY 1 DO
Count_No. := Count_No +1;
END_FOR;
END_IF;
Ex.
Expression using operators (*, /, +, -, <, >, =)
D0 := D1 * D2 + D3 / D4 - D5 ;
IF D0 > D10 THEN
D0 := D10;
END_IF;
Ex.
Calling function blocks that have been defined
//FB data name: LINE1_FB
//Input variable: I_Test
//Output variable: O_Test
//Input/output variable: IO_Test
//FB label name: FB1
FB1(I_Test:= D0 , O_Test => D1 ,IO_Test:= D100 );
Ex.
Calling standard functions
(*Convert BOOL data type to INT/DINT data type.*)
wLabel2 := BOOL_TO_INT (bLabel1);
Assignment statement
Select statement
Spaces, tabs, and line feeds can be inserted between an operator and data.
Space
Tab
Linefeed
Comments can be inserted into a program. Enclose a comment statement with "(*" and "*)".
Comment
Program components
An ST program consists of the following components.
Item Example Reference
Delimiter ;, (,) Page 51 Delimiters
Operator +, -, <, >, = Page 51 Operators
Reserved word Control statement IF, CASE, WHILE, RETURN Page 52 Control statements
Device X0, Y10, M100, ZR0 MELSEC iQ-R CPU Module User's Manual (Application)
Data type BOOL, DWORD MELSEC iQ-R CPU Module User's Manual (Application)
Standard function ADD, REAL_TO_STRING_E MELSEC iQ-R Programming Manual (CPU Module
Instructions, Standard Functions/Function Blocks)
Constant 123, "abc" Page 61 Constants
Label Switch_A Page 62 Labels and devices
Comment (*Turn on.") Page 64 Comments
Other symbols One-byte space, line feed code, TAB code
Operators
The following table lists the operators, applicable data types, and operation result data types used in ST programs.
Operator Applicable data type Operation result type
*, /, +, - ANY_NUM*1 ANY_NUM 6
<, >, <=, >=, =, <> ANY_ELEMENTARY*2 Bit
MOD ANY_INT ANY_INT
AND, &, XOR, OR, NOT ANY_BIT ANY_BIT
** ANY_REAL (base) ANY_REAL
ANY_NUM (exponent)*1
*1 Notation of constants with "WORD#" or "DWORD#" cannot be specified. ( Page 61 Notation of constants)
*2 WSTRING data type Unicode string cannot be specified.
The following table lists the operators in descending order of priority.
Operator Description Example Priority
() Parenthesized expression (2+3)*(4+5) 1
Function ( ) Function call expression CONCAT('AB','CD') 2
- Sign inversion -10 3
NOT Bit type complement NOT TRUE
** Exponentiation 3.0**4 4
* Multiplication 10*20 5
/ Division 20/10
MOD Remainder 17 MOD 10
+ Addition 1.4+2.5 6
- Subtraction 3-2
<, >, <=, >= Comparison 10>20 7
= Equality T#26h=T#1d2h 8
<> Inequality 8#15<>13
&, AND AND operation TRUE AND FALSE 9
XOR XOR operation TRUE XOR FALSE 10
OR OR operation TRUE OR FALSE 11
• If one expression includes multiple operators with the same priority, operation is performed in order from the leftmost
operator.
• Up to1024 operators can be used in a single expression.
Assignment statement
Format Description Example
<Left side>:=<Right side>; This statement assigns the result of the right side expression to the label or device on the left side. intV1:=0;
The data types of the result of the right side expression and the left side need to be the same. intV2:=2;
When using an array type label and structure label, note the data types of the left side and right side of the assignment
statement.
For array type labels, the data type and the number of elements need to be the same between the left and right sides. When
using array type labels, do not specify elements.
Ex.
intAry1:=intAry2;
For structure labels, the data type of the structure needs to be the same between the left and right sides.
Ex.
dutVar1:=dutVar2;
When the right side is the function call expression, the return value of the function is assigned to the left side. The following
table lists examples to assign the return value to the label.
Function Example
Having one input variable (example: ABS) Output1 := ABS( Input1 );
Having three input variables (example: MAX) Output1 := MAX( Input1 , Input2 , Input3 );
Having EN/ENO (except for standard functions) Output1 := MAX_E( boolEN , boolENO , Input1 , Input2 , Input3 );
(example: MAX_E)
Standard function (example: MOV) boolENO := MOV( boolEN , Input1 , Output1 );
(The execution result of the function is ENO, and the first argument (variable1) is EN.)
Ex.
Example of automatic conversion
dintLabel1 := intLabel1;
// Assignment statement: Automatically convert the INT type variable (intLabel1) to a DINT type variable, and assign it to the DINT type variable (dintLabel1).
dintLabel1 := dintLabel2 + intLabel1;
// Arithmetic operational expression: Automatically convert the INT type variable (intLabel1) to a DINT type variable, and perform addition in DINT type.
DMOV(TRUE, wordLabel1, dwordLabel1);
// Instruction, function, and function block call statement: Automatically convert the WORD type input argument (wordLabel1) to a DWORD type variable, and
transfer the data.
Type conversion is performed in assignment statements, VAR_INPUT part where input argument is passed to function blocks
and functions (including instruction, standard functions, and standard function blocks), and arithmetic operational
expressions.
To prevent data from being lost during type conversion, conversion is performed only from a smaller size data type to a larger
size data type. Type conversion is performed for the following data types among the primitive data types.
Data type
Word [signed]
Description
When the data type is converted to the double word [signed], the value is automatically sign extended.
6
When the data type is converted to the single-precision real number or double-precision real number, the value is
automatically converted to the same value as the integer before conversion.*1
Word [unsigned]/bit string [16 bits] When the data type is converted to the double word [unsigned]/bit string [32 bits] or double word [signed], the value is
automatically zero extended.*2
When the data type is converted to the single-precision real number or double-precision real number, the value is
automatically converted to the same value as the integer before conversion.*1
Double word [signed] When the data type is converted to the double-precision real number, the value is automatically converted to the
same value as the integer before conversion.
Double word [unsigned]/bit string [32
bits]
Single-precision real number When the data type is converted to the double-precision real number, the value is automatically converted to the
same value.
*1 When 16-bit data (word [signed] or word [unsigned]/bit string [16 bits]) is passed to the input argument of which data type is ANY_REAL,
the data is automatically converted to single-precision real number.
*2 When data (word [unsigned]/bit string [16 bits]) is passed to the input argument of which data type is ANY32, the data is automatically
converted to double word [unsigned]/bit string [32 bits].
For the data types other than the above, use the type conversion functions.
Use the type conversion functions for the following conversions as well.
• Type conversion between integral data types with different signs
• Type conversion between data types both of which lose data
For the precautions on assignment of the arithmetic operation result, refer to the following.
Page 56 When the result of an arithmetic operation is assigned
For the precautions on the use of devices, refer to the following.
Page 63 When performing automatic conversion of data type with devices
The following table lists the symbols used in the arguments of the function block call statements and the expressions that can
be assigned.
Type Description Symbol used Assignable expression
EN, VAR_INPUT Input variable := All expressions
ENO, VAR_OUTPUT, Output variable => Only variables
VAR_OUTPUT_RETAIN
VAR_IN_OUT Input/output variable := Only variables
The execution result of a function block is stored by specifying an output variable after the instance name with a period "." and
assigning the result to the specified variable.
Function block FB definition Example
Having one input variable and one output variable FB name: FBADD FBADD1(IN1:= Input1 );
FB instance name: FBADD1 Output1 := FBADD1.OUT1;
Input variable1: IN1
Output variable1: OUT1
Having three input variables and two output variables FB name: FBADD FBADD1(IN1:= Input1 ,IN2:= Input2 ,IN3:= Input3 );
FB instance name: FBADD1 Output1 := FBADD1.OUT1;
Input variable1: IN1 Output2 := FBADD1.OUT2;
Input variable2: IN2
Input variable3: IN3
Output variable1: OUT1
Output variable2: OUT2
■RETURN statement
Control statement Format Description Example
■RETURN RETURN; The statement is used to terminate a program, function block, or function IF bool1 THEN
during operation. RETURN;
When the RETURN statement is used in a program, control jumps to the END_IF;
step next to the last statement in the program.
When the RETURN statement is used in a function block, control returns
from the function block.
When the RETURN statement is used in a function, control returns from
the function.
A single RETURN statement uses one point of the pointer type label in the
system.
Iteration statements
Control statement Format Description Example
■FOR...DO FOR<iteration variable Data to be used as an iteration variable is initialized. FOR intV1 := 0
initialization> One or more statements between the DO statement and the END_FOR TO 30
TO<final value> statement are executed repeatedly, adding or subtracting the initialized BY 1 DO
BY<increase iteration variable according to the increase expression until the final value intV3 := intV1 + 1;
expression>DO is exceeded. END_FOR;
<statement>; The iteration variable after the FOR...DO statement is completed retains
END_FOR; the value at the end of the processing.
■WHILE...DO WHILE<boolean One or more statements are executed while the boolean expression WHILE intV1 = 30 DO
expression>DO (conditional formula) is TRUE. intV1 := intV1 + 1;
<statement>; The boolean expression is determined before execution of the statement END_WHILE;
END_WHILE; and, if it is FALSE, any statement in the DO...END_WHILE statement is
not executed. Since <boolean expression> in the WHILE statement is only
necessary to return TRUE or FALSE as the result, any expression that can
be specified in <boolean expression> of the IF statement can be used.
■REPEAT...UNTIL REPEAT One or more statements are executed while the boolean expression REPEAT
<statement>; (conditional formula) is FALSE. intV1 := intV1 + 1;
UNTIL<boolean The boolean expression is determined after execution of the statement UNTIL intV1 = 30
expression> and, if the value is TRUE, any statement in the REPEAT...UNTIL END_REPEAT;
END_REPEAT; statement is not executed. Since <boolean expression> in the REPEAT
statement is only necessary to return TRUE or FALSE as the result, any
expression that can be specified in <boolean expression> of the IF
statement can be used.
■EXIT EXIT; This statement can be used only within an iteration statement to terminate FOR intV1 := 0
the iteration statement in the middle of processing. TO 10
When the EXIT statement is reached during execution of the iteration BY 1 DO
loop, the iteration loop processing after the EXIT statement is not IF intV1 > 10 THEN
executed. The program execution continues from the line next to the one EXIT;
where the iteration statement was terminated. END_IF;
END_FOR;
■When the step relay (S) or SFC block device (BL) is used
If the step relay (S) or SFC block device (BL) is used at the left side of an assignment statement or as an input argument of a
function or function block, a conversion error may occur. If an error occurs, change the assignment statement.
Ex.
The following is the example of rewriting.
Before change After change
M0 := S0; IF S0 THEN
M0 := TRUE;
ELSE
M0 := FALSE;
END_IF;
In addition, to use the digit-specified step relay (S) or the step relay with block specification (BL\S), the data size must be
specified correctly. Since the step relay (S) and the step relay with block specification (BL\S) are not targeted for
automatic conversion of data type, a conversion error may occur if the data size is not the same.
Ex.
The following is the example of rewriting.
Before change After change
(*Conversion error because K4S0 is 16 bits and D0:UD is 32 bits*) (*Assign data to the 16-bit device.*)
D0:UD := K4S0; D0 := K4S0;
(*Conversion error because BL1\K4S10 is 16 bits and the second argument of (*Specify 32-bit data for DMOV.*)
DMOV is 32 bits*) DMOV(TRUE, BL1\K8S10, D100:UD);
DMOV(TRUE,BL1\K4S10,D100);
Ex.
To assign the arithmetic operation result with a data size of 16 bits (INT type) to the 32-bit data type (DINT type):
varDint1 := varInt1 * 10; //The varInt1 is an INT type variable, and the varDint1 is a DINT type variable.
The result of the arithmetic operation will be the same data type as the input operand. For this reason, if the operation result of
varInt1*10 in the above program exceeds the INT type range (-32768 to 32767), the operation result of overflow or underflow
is assigned to varDint1.
In this case, convert the operand of the operational expression to the data type of the left side in advance.
varDint2 := INT_TO_DINT( varInt1 ); //An INT type variable is converted to a DINT type variable.
varDint1 := varDint2 * 10; //Multiplication is performed in DINT type, and the operation result is assigned.
Ex.
When the value of varInt1 (INT type) is -32768 and the value of varDint1 (DINT type) is 0
varDint2 := -varInt1 + varDint1;
In this program, the value of (-varInt1) remains unchanged. Therefore, the value, -32768, is assigned to varDint2.
To use a sign inversion operator in an arithmetic operational expression, automatically convert data type before the arithmetic
operation or do not use a sign inverted operator in the program.
Ex.
When data type is automatically converted before the arithmetic operation
varDint3 := varInt;
varDint2 := -varDint3 + varDint1;
Ex.
When a sign inversion operator is not used
varDint2 := varDint1 - varInt1 6
■When the data type is converted from single-precision real number to double-precision real
number
When the type conversion function, REAL_TO_LREAL, is executed, an error may occur in the conversion result.
Consequently, when the data type is automatically converted or when a function with a return value of real number type (such
as SIN function) is used as the right side of an assignment statement or an operand of arithmetic operational expression, an
intended operation result may not be obtained.
Ex.
An error occurs.
varReal1 := -1234.567;
varLReal1 := ABS(varReal1);
In the above program, the data type of the return value of ABS(varReal1) is single-precision real number. Since the return
value is converted to a double-precision real number and assigned to varReal1, an error occurs.
Create a program using a function with the data type same as the assignment target.
Ex.
No error occurs.
varLReal2 := -1234.567;
varLReal1 := ABS(varLReal2);
Ex.
Program that keeps the label status on
ST program Ladder program performing the processing equivalent to ST program
IF bLabel1 THEN
bLabel2 := TRUE;
END_IF;
To prevent the label from being always on, add a program that turns off the bit type label as shown below.
Ex.
Program that avoids the label from being always on
ST program*1 Ladder program performing the processing equivalent to ST program
IF bLabel1 THEN
bLabel2 := TRUE;
ELSE
bLabel2 := FALSE;
END_IF;
Ex.
Timer function block
Program example before change
IF bLabel1 THEN
TIMER_100_FB_M_1 (Coil := bLabel2, Preset := wLabel3, ValueIn := wLabel4, ValueOut => wLabel5, Status => bLabel6);
END_IF;
(*When bLabel1 is on and bLabel2 is also on, counting starts.*)
(*When bLabel1 is on and bLabel2 is off, the counted value is cleared.*)
(*When bLabel1 is off and bLabel2 is on, counting stops. The counted value is not cleared.*)
(*When bLabel1 is off and bLabel2 is also off, counting stops. The counted value is not cleared.*)
Ex.
Counter function block
Program example before change
IF bLabel1 THEN
COUNTER_FB_M_1 (Coil := bLabel2, Preset := wLabel3, ValueIn := wLabel4, ValueOut => wLabel5, Status => bLabel6);
END_IF;
(*When bLabel1 is on and bLabel2 is on/off, the value is incremented by one.*)
(*When bLabel1 is off and bLabel2 is on/off, the value is not counted.*)
(*The counting operation does not depend on the on/off status of bLabel1.*)
The above examples of programs before change cause problems because the statement related to the timer or counter is not
executed unless the select statement is established.
To operate the timer or counter on the basis of the bLabel1 condition and bLabel1 AND condition, do not use control
statements but use only function blocks.
The timer and counter can be operated by using the programs after change.
■When instructions executed at the rising edge or falling edge are used
• The following table lists the operations of when instructions executed at the rising edge or falling edge used in the IF or
CASE statement.
Condition Operation result
Conditional Instruction On/off On/off Instruction at the Instruction at the
formula of IF or execution determination determination rising edge falling edge
CASE statement condition (EN) result of the result of the
instruction in the instruction
last scan
TRUE or CASE match TRUE On On Not executed Not executed
6
Off On Executed Not executed
FALSE On Off Not executed Executed
Off Off Not executed Not executed
TRUE or CASE TRUE On Off Not executed Not executed*1
mismatch
Off Off Not executed Not executed
FALSE On Off Not executed Not executed*1
Off Off Not executed Not executed
*1 On the falling edge (on to off), the instruction is not executed because the condition of the IF or CASE statement is not satisfied.
Ex.
When the PLS instruction (execution condition: rising edge) is used in the IF statement
IF bLabel0 THEN
PLS(bLabel1, bLabel10);
END_IF;
ON
bLabel0 OFF
ON ON
bLabel1 OFF
ON
On/off
determination OFF
result (3)
(1) (2) ON
bLabel10 OFF
1 scan
(1) When bLabel0 is off (the conditional formula of the IF statement is FALSE), the on/off determination result will be off. The PLS instruction is not executed.
(The bLabel10 remains off.)
(2) When bLabel0 is on (the conditional formula of the IF statement is TRUE) and bLabel1 is off (the instruction execution condition is off), the on/off
determination result will be off. The PLS instruction is not executed. (The bLabel10 remains off.)
(3) When bLabel0 is on (the conditional formula of the IF statement is TRUE) and bLabel1 is also on (the instruction execution condition is on), the on/off
determination result will be off to on (rising edge). The PLS instruction is executed. (The bLabel10 is on for one scan.)
Ex.
When instructions executed at the rising edge or falling edge are used in the FOR statement
Example of using the edge relay (V) in one location
(The edge relay (V) is used up to a total of 11 points (V0 to V10 for the INC instruction).)
FOR Z0 := 0 TO 9 BY 1 DO
INC(EGP(M100Z0 , V0Z0) , D100Z0);
END_FOR;
Example of using the edge relay (V) in two locations
(The edge relay (V) is used up to a total of 22 points (V0 to V10 for the INC instruction, V11 to V21 for the DEC instruction).)
FOR Z0 := 0 TO 9 BY 1 DO
INC(EGP(M100Z0 , V0Z0) , D100Z0);
DEC(EGF(M200Z0 , V11Z0) , D200Z0);
END_FOR;
Ex.
Statement in the select statement (IF statement)
MC(M0 , N1 , M1); //Master control is off.
IF M2 THEN
M3 := M4; // M3 retains the value in the last scan because no processing is performed when the master control is off.
END_IF;
M20 := MCR(M0, N1);
Ex.
Statement (bit assignment statement) outside the select statement or iteration statement
MC(M0 , N1 , M1); //Master control is off.
M3 := M4; //M3 retains the value in the last scan because no processing is performed when the master control is off.
M20 := MCR(M0, N1);
Ex.
Statement (OUT instruction) outside the select statement or iteration statement
MC(M0 , N1 , M1); //Master control is off.
OUT(M2, M3); //M3 turns off because the instruction is not executed when the master control is off.
M20 := MCR(M0, N1);
Notation of constants
In the ST program, the following notation of constant is available in addition to the standard notation.
Applicable data type Type Notation*1 Example
Bit Boolean Add "BOOL#" before the boolean value to be used. BOOL#1, BOOL#0
BOOL#TRUE, BOOL#FALSE
Word [unsigned]/bit string [16 Binary Add "UINT#2#" or "WORD#2#" before a binary number.*2 UINT#2#10101010
bits] WORD#2#10101010
Octal Add "UINT#8#" or "WORD#8#" before an octal number.*2 UINT#8#3370
WORD#8#3370
Decimal Add "UINT#" or "WORD#" before a decimal number.*2 UINT#123
WORD#123
Hexadecimal Add "UINT#16#" or "WORD#16#" before a hexadecimal number.*2 UINT#16#FF
WORD#16#FF
Double word [unsigned]/bit Binary Add "UDINT#2#" or "DWORD#2#" before a binary number.*2 UDINT#2#1100110011001100
string [32 bits] DWORD#2#1100110011001100
Octal Add "UDINT#8#" or "DWORD#8#" before an octal number.*2 UDINT#8#33703370
DWORD#8#33703370 6
Decimal Add "UDINT#" or "DWORD#" before a decimal number.*2 UDINT#456789
DWORD#456789
Hexadecimal Add "UDINT#16#" or "DWORD#16#" before a hexadecimal UDINT#16#FFFF
number.*2 DWORD#16#FFFF
Word [signed] Binary Add "INT#2#" before a binary number. INT#2#01010101
Octal Add "INT#8#" before an octal number. INT#8#3370
Decimal Add "INT#" before a decimal number. INT#-123
Hexadecimal Add "INT#16#" before a hexadecimal number. INT#16#1F
Double word [signed] Binary Add "DINT#2#" before a binary number. DINT#2#0011001100110011
Octal Add "DINT#8#" before an octal number. DINT#8#33703370
Decimal Add "DINT#" before a decimal number. DINT#-456789
Hexadecimal Add "DINT#16#" before a hexadecimal number. DINT#16#1F1F
Single-precision real number Real number Add "REAL#" before a real number. REAL#2.34
Real number REAL#1.0E6
(exponential
notation)
Double-precision real Real number Add "LREAL#" before a real number. LREAL#-2.34
number
Real number LREAL#1.001E16
(exponential
notation)
String STRING Enclose a string (ASCII, Shift JIS) in single quotation marks ('). 'ABC'
String [Unicode] WSTRING Enclose a Unicode string in double quotation marks ("). "ABC"
*1 Notation of constants are not case-sensitive. Notation of constants with K, H, or E cannot be used simultaneously.
*2 ANY_NUM of operand for arithmetic operator, ANY_NUM of arguments for a function call statement, function block call statement, and
function call expression, use the notation of constants with "UINT#" or "UDINT#". For the notation of constants with "WORD#" or
"DWORD#", an error occurs during the conversion because the data type is recognized as a bit string.
For the notations of constants other than the above, refer to the following.
MELSEC iQ-R CPU Module User's Manual (Application)
In the notation of binary, octal, decimal, hexadecimal, and real numbers, the numbers can be separated using
an underscore "_" to make programs easy to see. The binary number notation of double word [unsigned] can
be described as follows.
UDINT#2#1100_1100_1100_1100
The numerical value separation using an underscore "_" is ignored in program processing.
Specification method
Labels and devices can be directly described on ST programs. Labels and devices can be used for the left or right side of an
expression or as an argument or return value of a standard function/function block.
For details on labels and devices, refer to the following.
MELSEC iQ-R CPU Module User's Manual (Application)
Ex.
D0:=K5X0;
In this example, a program error occurs because K5X0 is the double word type and D0 is the word type.
• If the right side is greater than the left side when performing assignment using digit specification, data is transferred to
within the range of the number of applicable points of the left side.
Ex.
K5X0:=2#1011_1101_1111_0111_0011_0001;
In this example, K5X0 has 20 applicable points and therefore 1101_1111_0111_0011_0001 (20 digits) is assigned to K5X0.
• When using the current value (such as TNn) of the counter (C), timer (T), or retentive timer (ST) as a type other than the
word [unsigned]/bit string [16 bits], or when using the current value (such as LTNn) of the long counter (LC), long timer (LT),
or long retentive timer (LST) as a type other than the double word [unsigned]/bit string [32 bits], use the type conversion 6
functions.
Ex.
varInt:=WORD_TO_INT(T0);(*A type conversion function is used.*)
• If a coil (TC, STC, LTC, LSTC, CC, or LCC) of timer or counter devices is used at the right side of an assignment statement
or as an input argument of a function or function block, it operates as a contact (TS, STS, LTS, LSTS, CS, or LCS).
• To use a coil of the timer or counter as an input argument, use a timer type label or counter type label.
Ex.
Timer device and timer type label
M1 := TC0; (*Assign a value of the contact (TS0) to M1.*)
M2 := INV(TC1); (*Assign the inversion result of the contact (TS1) to M2.*)
M1 := tLabel0.C; (*Assign a value of the coil of the timer type label, tLabel0, to M1.*)
M2 := INV(tLabel1.C); (*Assign the inversion result of the coil of the timer type label, tLabel0, to M1.*)
Ex.
When transferring the values of D2 and D3 to dwordLabel1, a double word [unsigned] label
//Example of when adding a device type specifier and transferring the values in a correct data type
dwordLabel1 := D2:UD;
//Since the data type of D2: UD (D2 with a device type specifier) is double word [unsigned], the values of D2 and D3 are transferred to dwordLabel1.
FBD/LD (function block diagram/ladder diagram) is a graphic language which describes programs by connecting blocks that
perform predefined processing, variable elements, and constant elements along the flow of data and signals.
• This chapter describes the operation and specifications of the FBD/LD. For the operation method of the
engineering tool for creating an FBD/LD program, refer to the following.
GX Works3 Operating Manual
• A program can be easily created through placing and connecting FB elements of process control function
blocks which can be used with the Process CPU. A wide variety of provided function blocks for the process
control simplifies the programming. When process control function blocks are used with the Process CPU,
refer to the following.
MELSEC iQ-R Programming Manual (Process Control Function Blocks/Instructions)
7.1 Configuration
7
The following are the programs written in FBD/LD.
(1) Worksheet
(2) LD element
(3) FBD element
(4) Common element
(1)
(5) Connection point
(6) Connection line
(2)
(3)
(4)
(5)
(6)
In FBD/LD programs, data flows from the output point of a function block, function, variable (label or device), or constant to the
input point of another function block or variable.
7 FBD/LD
7.1 Configuration 65
Program elements
FBD elements
The following table lists FBD elements consisting an FBD/LD program.
Item Description
Variable Stores a value. A specific data type is assigned to each variable, and only data of the assigned
data type are stored.
Labels and devices can be specified as a variable.
Ex.
When the constant value is 1
The possible data types are BOOL, WORD, DWORD, INT, DINT, REAL, and LREAL, but the data type of the input value
cannot be determined at this point. The data type is determined when the constant is connected to another FBD element.
(1) The data type has not been determined.
(2) INT data type
(3) INT data type
(1)
(2) (3)
7 FBD/LD
66 7.1 Configuration
■Input/output points of a function
• Connect all input points of a function with another element.
• The data type is assigned to each input variable and output variable of a function. Match the data type of an element
connected to the input point or output point with that of the input variable or output variable.
■Precautions for connecting the output variables of the function with EN and function block
with EN to another element
When ENO of the function with EN and function block with EN are FALSE (not executed), the program operation differs
depending on the element connected.
Element connected Program operation when ENO of the function with EN and function block with EN are FALSE (not
executed)
• Function The values of the input variables connected to the output variables of the function with EN and function block with EN
• Function block are undefined.
Other than above The values of the elements connected to the output variables of the function with EN and function block with EN are not
changed. (The last values are input.)
Unintended operation may occur if the output variable of the function block with EN is directly connected to the input variable
of other functions or function blocks.
To prevent an undefined value from being used, refer to either of the following examples for the connection.
Ex.
Connect elements so that the function with EN or function block with EN is the connection destination. Connect ENO
(connection source) to EN (connection destination) as well.
7
Ex.
Connect elements using the SEL (selection function) so that the last value is input if ENO is FALSE.
7 FBD/LD
7.1 Configuration 67
■When the step relay (S) or SFC block device (BL) is used
If the step relay (S) or SFC block device (BL) is used as a variable element, a conversion error may occur. If an error occurs,
change the variable element to a contact element.
Ex.
The following is the example of rewriting.
Before change After change
In addition, to use the digit-specified step relay (S) or the step relay with block specification (BL\S), the data size must be
specified correctly. Since the step relay (S) and the step relay with block specification (BL\S) are not targeted for auto data
type conversion, a conversion error may occur if the data size are not the same.
Ex.
The following is the example of rewriting.
Before change After change
7 FBD/LD
68 7.1 Configuration
LD elements
The following table lists the LD elements that can be used in FBD/LD programs.
Item Description
Left rail A start point of ladder program.
The output of the left rail is always on.
Normally open contact Energized when the specified device or label is on.
Normally closed contact Energized when the specified device or label is off.
Rising edge pulse Energized on the rising edge (off to on) of the specified device or label.
Falling edge pulse Energized on the falling edge (on to off) of the specified device or label.
Negated rising edge pulse Energized when the specified device or label is off, on, or on the falling edge (on to off).
Negated falling edge pulse Energized when the specified device or label is off, on, or on the rising edge (off to on).
Inverse coil When the operation result turns off, the specified device or label turns on.
Set coil When the operation result turns on, the specified device or label turns on.
The device or label keeps on state even after the operation result turns off.
7
Reset coil When the operation result turns on, the specified device or label turns off.
If the operation result is off, the status of the device or label does not change.
( )
(2)
7 FBD/LD
7.1 Configuration 69
■When another program element is connected to a connection point of coil for output
When another program element is connected to a connection point of coil for output in series, the operation is the same as
that of the parallel connection.
Item Description
Program example
7 FBD/LD
70 7.1 Configuration
Common elements
The following table lists the common elements that can be used in FBD/LD programs.
Item Description
Jump*1 Jumps the execution processing to a jump element. Processing between this element and a jump
label is not performed.
Whether to perform jump processing or not is controlled by inputting on/off information to the
element.
On: Jump processing performed
Off: Jump processing not performed
Jump label*1 A jump destination of a jump element in the same program. When the jump processing is
performed, the program continues from the processing located after the jump label.
7 FBD/LD
7.1 Configuration 71
■Return element
• The operation of a return element differs depending on the POU (program, function, or function block) used.
POU used Description
Program Execution of the program is stopped.
Function Execution of the function is stopped, and processing returns to the step next to the instruction that called the function.
Function block Execution of the function block is stopped, and processing returns to the step next to the instruction that called the
function block.
• If a return element is used in a macro type function block, do not allocate multiple function block elements with the same FB
instance name.
■Connector element
A connector element is used to place the program within the area to be displayed in the FBD/LD editor or to be printed.
7 FBD/LD
72 7.1 Configuration
Connection line
A connection line is a line that connects the end points of FBD element, LD element, and common element.
When connected, the value is passed from the left end to the right end of the line. The data types of the program elements
connected must be identical, or support automatic data type conversion.
Connection point
A connection point is an end point of FBD element, LD element, and common element for connecting them to create an FBD/
LD program.
The left-side end point is for input, and the right-side end point is for output.
Item Connection point for input Connection point for output
Contact
Coil
Variable
Constant
Function
7
The value of the following data types can be inverted: BOOL, WORD, DWORD, ANY_BIT, and ANY_BOOL.
7 FBD/LD
7.1 Configuration 73
Constant
Notation of constants
The following table lists the notations of strings in FBD/LD programs.
Data type Notation Example
String STRING Enclose a string (ASCII, Shift JIS) in single quotation marks (').
String [Unicode] WSTRING Enclose a Unicode string in double quotation marks (").
For the notations of constants other than the above, refer to the following.
MELSEC iQ-R CPU Module User's Manual (Application)
Specification method
Labels and devices can be directly described on FBD/LD programs. Labels and devices can be used as an input point or
output point of a program element and an argument or return value of a standard function/function block.
For details on labels and devices, refer to the following.
MELSEC iQ-R CPU Module User's Manual (Application)
7 FBD/LD
74 7.1 Configuration
Precautions
■When labels are used
• Local devices cannot be used as an array index. To use local devices as an array index, assign the target device to another
device, and specify the assigned device.
Ex.
When the values of D2 and D3 are transferred to dwordLabel1, a double word [unsigned] label
Example of when adding a device type specifier and Example of an unintended transfer result
transferring the values in a correct data type
Since the data type of D2:UD (D2 with a device type specifier) is double word Since the data type of D2 without a device type specifier is word [signed], the
[unsigned], the values of D2 and D3 are transferred to dwordLabel1. data type is automatically converted into double word [unsigned] and data is
transferred to dwordLabel1.
Therefore, the value of D3 is not transferred but only the value of D2 is
transferred.
Ex.
Timer device and timer type label
Assign a value of the contact (TS0) to M1.
Assign a value of the coil of the timer type label, tLabel0, to M1.
Assign the inversion result of the coil of the timer type label, tLabel1, to M2.
7 FBD/LD
7.1 Configuration 75
7.2 Program Execution Order
Execution order of program elements
The execution order of program elements in the FBD/LD editor is determined by the location and connecting status.
(1)
(2)
7 FBD/LD
76 7.2 Program Execution Order
Precautions
For a program that uses functions, do not directly connect the return value of a function and an input variable of another
function, but connect a variable element between them.
Ex.
When the variable element (1) is connected between the return value and input variable
(1)
Connecting the return value of a function and the input variable of another function directly may lead an execution order to an
unintended one.
Ex.
An unintended execution order 7
(3)
(2)
Since both the output variable (3) that comes from another program element and the return value (2) of the program element arranged on the left are connected
as inputs of the program element arranged on the right, the execution order has changed.
7 FBD/LD
7.2 Program Execution Order 77
8 SFC PROGRAM
SFC is a program description format in which a sequence of control operations is split into a series of steps to enable a clear
expression of each program execution sequence and execution conditions.
This chapter describes the operations and specifications of SFC programs. For details on the information not
described in this chapter, refer to the following.
GX Works3 Operating Manual
MELSEC iQ-R CPU Module User's Manual (Application)
Check the versions of the CPU module and the engineering tool before using the SFC language. For the
versions of the CPU module and the engineering tool, refer to the following.
MELSEC iQ-R CPU Module User's Manual (Application)
8 SFC PROGRAM
78
The SFC program consists of steps that represent units of operations in a series of machine operations.
In each step, the actual detailed control is programmed.
Machining operation SFC diagram Ladder diagram of the action or transition of each step
flowchart
Workpiece
Start switch detection Conveyer start
X0 X1 Y20
Start processing 1 operation unit
Pallet detection
X2
TRAN
Clamp confirmation
X3
TRAN
Always ON Drill rotation
SM400 Y22
Y22
PLS M0
M0 Drill down
SET Y23
Hole making
operation 1 operation unit X4 Drill down endpoint
RST Y23
OUT T0 K20
T0 Drill up
SET Y24
Drill up endpoint 8
X5
TRAN
Always ON Pallet unclamping
SM400 Y25
Unclamping Y25
operation and 1 operation unit PLS M1
workpiece unloading
M1
RST Y24
Conveyer start
X6 Unclamp confirmation Y20
Workpiece unloading
X7
confirmation TRAN
An SFC program starts at an initial step, executes an action of the next step in due order every time the relevant transition
becomes TRUE, and ends a series of operations at an end step.
8 SFC PROGRAM
79
It is possible to correspond the controls of the entire facility, mechanical devices of each station, and all machines to the
blocks and steps of the SFC program on a one-to-one basis.
Step transition control unit for Station 1 control unit Station 2 control unit Station 3 control unit
overall process (Block 0) (Block 1) (Block 2) (Block 3)
8 SFC PROGRAM
80
8.1 Specifications
This section lists the performance specifications related to SFC Programs.
Item Specifications
Number of device points Step relay (S) R00CPU, R01CPU, R02CPU: 8192 points maximum
(SFC) CPU modules other than the above: 16384 points maximum
SFC block R00CPU, R01CPU, R02CPU: 128 points
device (BL) CPU modules other than the above: 320 points
SFC transition 0 point
device (TR)
Number of executable SFC programs 1
Number of blocks R00CPU, R01CPU, R02CPU: 128 blocks maximum
CPU modules other than the above: 320 blocks maximum
Number of SFC steps R00CPU, R01CPU, R02CPU: 1024 steps maximum for all blocks in total, 128 steps for one block alone
CPU modules other than the above: 16384 steps maximum for all blocks in total, 512 steps for one block alone
Step No. R00CPU, R01CPU, R02CPU: 0 to 127 per block
CPU modules other than the above: 0 to 511 per block
Number of branches 32 branches maximum
Number of simultaneously active steps R00CPU, R01CPU, R02CPU: 1024 steps maximum for all blocks in total, 128 steps for one block alone
CPU modules other than the above: 1280 steps maximum for all blocks in total, 256 steps for one block alone
Number of initial steps 32 steps maximum per block
Number of actions 4 actions maximum per step
Number of sequential Action About 32K sequential steps per block
steps (No restriction on the number per SFC step)
Transition Only one per ladder block
Number of online change (SFC block)
target blocks
1*1
8
*1 For the online change (SFC block), refer to the following.
Page 138 Online change (SFC block)
Before using the online change (SFC block), check the versions of the CPU module and the engineering tool used. ( MELSEC iQ-R
CPU Module User's Manual (Application))
For the processing time of the SFC program, refer to the following.
MELSEC iQ-R CPU Module User's Manual (Application)
8 SFC PROGRAM
8.1 Specifications 81
8.2 Structure
Basic operation
An SFC program starts at an initial step, executes the next step every time the relevant transition becomes TRUE, and ends a
series of operations at an end step.
(1) Initial step
(2) Action
(1)
(3) Transition
(2)
(4) Normal step
(5) Normal step
(3) (6) End step
(4)
(5)
(6)
1. When starting a block, the initial step (1) is activated first and then the action (2) is executed. After execution of the
action (2), the program checks whether the next transition (3) has become TRUE.
2. The program executes only the action (2) until the transition (3) becomes TRUE. When the transition (3) becomes
TRUE, the program ends the action (2), deactivates the initial step (1), and activates the next normal step (4).
3. After execution of the action of the normal step (4), the program checks whether the next transition has become TRUE.
If the next transition does not become TRUE, the program repeats the execution of the action of the normal step (4).
4. When the transition becomes TRUE, the program ends the action, deactivates the step (4), and activates the next step
(5).
5. Every time the transition becomes TRUE, the program activates the next step and ends the block when it finally
activates the end step (6).
• Up to 4 actions can be created in one step. When multiple actions are created, they are executed in order
from the top. ( Page 95 Action)
• The operation of the initial step and normal step can be changed by adding the attribute. ( Page 85 Step
types)
8 SFC PROGRAM
82 8.2 Structure
Block
A block is a unit showing a series of operation consisting of steps and transitions.
Block0 Block1 Block2
For the maximum number of blocks that can be created in an SFC program, refer to the following.
Page 81 Specifications
A block begins with an initial step, a step and a transition are connected alternately, and ends with an end step or jump
sequence.
8
A block has an either state of active or inactive.
• Active: The block has an active step.
• Inactive: All steps in the block are inactive.
When the block state changes from inactive to active, the initial step becomes active to start sequential processing. (
Page 128 Block execution sequence)
• Setting CPU parameters enables only block 0 to be started automatically when the SFC program starts. In
this case, when the end step is activated and the block 0 is finished, the block 0 is automatically restarted
and execution of steps is started again from the initial step. ( Page 122 Start condition setting)
• If a start request is issued to a step in an inactive block by using the SET instruction (activating a step), the
block is activated to execute processing from the specified step.
8 SFC PROGRAM
8.2 Structure 83
Step
A step is the basic unit for comprising a block.
(1) Step name
(1) (2)
(2) Step No.
(3) Attribute
(4) Attribute target
(3) (4)
For the maximum number of steps that can be created per block, refer to the following.
Page 81 Specifications
Steps have the following characteristics.
• When the step becomes active, the related action is executed.
• A step No. is assigned to each step. Step No. is used to monitor a specific step being executed or forcibly start or stop the
step by using the SFC control instruction. ( Page 94 Assigning the step relay (S) areas to steps)
• Each step name and No. are unique within each block. (Each cannot be a blank.)
The step name, step No., attribute, and attribute target can be changed from the "Step Properties" window.
Select a step and select [Edit] [Properties] in the menu. The "Step Properties" window is displayed. ( GX
Works3 Operating Manual)
8 SFC PROGRAM
84 8.2 Structure
Step types
The following table lists the types of steps.
Item Description
Initial step A step that indicates the beginning of a block.
While this type of step is active, the transition following the step is
always checked, and when the transition becomes TRUE, the next
step becomes active.
Attributes of SC, SE, ST, and R can be added.
This step can also be used as a step without an action.
SE Operation HOLD step A step which continues the operation of the action even after the
8
(without transition check) [SE] active state transitions.
After the transition becomes TRUE and the next step is activated,
the transition is not checked.
ST Operation HOLD step (with A step which continues the operation of the action even after the
transition check) [ST] active state transitions.
Even after the transition becomes TRUE and the next step is
activated the transition is checked repeatedly.
R Reset step [R] A step that deactivates the specified step.
BC Block start step (with END A step that activates the specified block.
check) [BC] When the specified block becomes inactive and the transition
becomes TRUE, the active state transitions to the next step.
An action cannot be created.
BS Block start step (without END A step that activates the specified block.
check) [BS] When the transition becomes TRUE, the active state transitions to
the next step.
An action cannot be created.
• The type of a step can be changed by changing the setting of "Type" in the "Step Properties" window.
• For the reset step [R], block start step (with END check) [BC], or block start step (without END check) [BS],
specify a step name or a block No. in "Attribute Target" in the property window.
For the setting method, refer to the following.
GX Works3 Operating Manual
8 SFC PROGRAM
8.2 Structure 85
Normal step (without attribute)
Normal step is a basic step used to comprise a block.
While this type of step is active, the transition following the step is always checked, and when the transition becomes TRUE,
the next step becomes active.
The output status of the action of a step, when a transition to the next step occurs, varies depending on the instruction used.
Item Description Example
When the OUT When a transition to the next step occurs and the
X1 Y0
instruction is used relevant step becomes inactive, the output by using the
(1)
(Other than the OUT instruction turns off automatically.
OUT C instruction) Similarly, the timer also clears the current value and
turns off the contact. (2)
However, the select statement of structured text
language or the output by using the OUT instruction
which is repeatedly using within the statement does not
turn off automatically.
When the transition (2) becomes TRUE while Y0 is turned on by using the
OUT instruction triggered by the action of step (1), Y0 is automatically turned
off.
When the OUT C If the execution condition of the counter in the action is
instruction is used already on when the transition becomes TRUE and
(1)
activate the step, the counter is incremented by 1.
When a transition to the next step occurs before reset
instructions of the counter is executed, the present (2)
value of the counter and the ON state of the contact is X10
held even if the step becomes inactive. (3) OUT C0 K10
To reset the counter, use the RST instruction in another
step.
If X10 is already on while step (1) is active, counter C0 counts once when
execution proceeds to step (3) after the transition (2) becomes TRUE.
When the SET, If a transition to the next step occurs and the step
basic, or application becomes inactive, the ON state or the data stored in the X2
(1) SET Y0
instruction is used device/label is held.
To turn off the ON device/label or clear the data stored (2)
in the device/label, use the RST instruction in another (3)
step.
(4)
Even when the contact of the execution condition is on (1), the PLS instruction
is executed every time the step (2) becomes active.
8 SFC PROGRAM
86 8.2 Structure
Initial step
The initial step represents the beginning of a block. Up to 32 initial steps per block can be described. ( Page 81
Specifications) When there are more than one initial step, the convergence enabled is only a selective convergence. Execute
the initial steps in the same way as executing other steps.
If steps are selectively connected in the block that has more than one active initial steps, the step immediately after the 8
convergence becomes active when any of the transition conditions immediately before the convergence is satisfied. In the
above program example, step 8 (S8) becomes active when any of transition conditions t4 to t7 is satisfied. When the step
immediately after the convergence (S8 in the above program example) becomes active and another transition condition
immediately before the convergence (any of t4 to t7 in the above program example) is satisfied, the step immediately after the
convergence becomes active again.
8 SFC PROGRAM
8.2 Structure 87
Coil HOLD step [SC]
Coil HOLD step [SC] is a step that holds the outputs of a coil that has been turned on by the action even after the active state
transitions.
Y10
ON ON
(2) (1)
Y10
ON
(3)
Y10 (1) that has been turned on by using the OUT instruction remains on (3) even when the transition (2) becomes TRUE.
No operation in the action is performed after a transition becomes TRUE and the next step is activated. Therefore, the coil
output status will remain unchanged even if the input condition in the action is changed.
(2)
■Deactivation timing
An operation HOLD step (without transition check) [SE] becomes inactive when:
• The end step of a block is executed.
• A block is forcibly terminated by using the RST instruction (Ending a block).
• A step is reset by using the RST instruction (Deactivating a step).
• The device specified as the block START/END bit of the SFC information devices is reset.
• A reset step [R] for resetting the operation HOLD step (without transition check) [SE] becomes active.
• SM321 (SFC program start/stop) is turned off.
• S999 is specified at a reset step [R] within a block.
8 SFC PROGRAM
88 8.2 Structure
■Operation when the block is paused or restarted
Operation when the block is paused or restart depends on the combination of SM325 (Output mode at block stop), block stop
mode bit setting of SFC information device, and step hold status. ( Page 123 Operation when the block is paused or
restarted)
■Deactivation timing
An operation HOLD step (with transition check) [ST] becomes inactive when:
• The end step of a block is executed.
• A block is forcibly terminated by using the RST instruction (Ending a block). 8
• A step is reset by using the RST instruction (Deactivating a step).
• The device specified as the block start/end bit of the SFC information devices is reset.
• A reset step [R] for resetting the operation HOLD step (with transition check) [ST] becomes active.
• SM321 (SFC program start/stop) is turned off.
• S999 is specified at a reset step [R] within a block.
■Precautions
• For the operation HOLD step (with transition check) [ST], the next step is activated every scan while the transition
immediate after the operation HOLD step becomes TRUE. To prevent transition every scan, use instructions executed on
the rising edge such as the PLS instruction for the transition.
By setting the start of rising edge pulse operation as the transition, step (1) is
activated during only one scan caused when X0 is turned on.
X0 Even when step (2) is activated and becomes inactive, step (1) is not activated
TRAN unless X0 is turned off and on again.
(1)
(2)
• When SM328 (Clear processing mode when the sequence reaches the end step) is on, prevent the transition immediately
after the operation HOLD step (with transition check) [ST] from becoming always TRUE. Otherwise, the next step is kept
activating and holding no operation, therefore the block cannot be ended.
8 SFC PROGRAM
8.2 Structure 89
Reset step [R]
Reset step [R] is a step that deactivates the specified step.
• The reset step [R] deactivates the specified step in the current block before execution of the action every scan. Except for
resetting the specified step, the reset step is the same as a normal step (without step attributes).
• When the specified step No. is S999, the HOLD steps [SC, SE, ST] that hold operations in the current block are all
deactivated. In this case, only the HOLD steps [SC, SE, ST] that hold operations can be deactivated. However, any
operation HOLD step [SE, ST] is not deactivated when operating with the state that does not hold an operation.
• The current step No. cannot be specified as specified step No.
(2)
The operation to be performed if multiple attempts to start one block are performed simultaneously or if an attempt to start an
already started block is performed follows the operation setting applicable to the block double start. ( Page 125 Act at
block multi-activated)
Only one block can be specified. To start multiple blocks simultaneously, use parallel branches and multiple block start steps.
■Precautions
• An action cannot be created to the block start step (with end check) [BC].
• The block start step (with END check) [BC] cannot be created immediately before convergence of a parallel convergence.
To create the step immediately before the convergence of a parallel convergence, use a block start step (without END
check) [BS].
8 SFC PROGRAM
90 8.2 Structure
Block start step (without END check) [BS]
Block start step (without END check) [BS] is a step that activates the specified block.
When the transition becomes TRUE, the active state transitions to the next step.
After this step starts block (BL1), only the transition (2) is
BL1
checked and, when the transition becomes TRUE, execution
proceeds to the next step without waiting for the start destination
block to end.
(1)
X0
(2) TRAN
The operation to be performed if multiple attempts to start one block are performed simultaneously or if an attempt to start an
already started block is performed follows the operation setting applicable to the block double start. ( Page 125 Act at
block multi-activated)
Only one block can be specified. To start multiple blocks simultaneously, use parallel branches and multiple block start steps.
■Precautions
• An action cannot be created to the block start step (without END check) [BS].
8
8 SFC PROGRAM
8.2 Structure 91
End step
End step is a step that ends a block.
• When the active state transitions to the end step and no active step exists other than steps that hold operations in the block,
all the HOLD steps [SC, SE, ST] that hold operations in the block are deactivated and the block is ended.
• When a block contains any active steps other than steps that hold operations in a block, the following processing is
performed depending on the status of SM328 (Clear processing mode when the sequence reaches the end step).
Status of SM328 Description
Off (default) Clear processing is performed.
The active steps remaining in the block are all terminated forcibly to end the block.
On Clear processing is not performed.
The execution of the block is continued as is and the block is not ended.
• When clear processing is performed, the coil outputs turned on by using the OUT instruction are all turned off. However, for
the coil output of the HOLD steps [SC, SE, ST] that hold operations, the following processing is performed depending on
the status of SM327 (Output mode at execution of the end step).
Status of SM327 Description
Off (default) All the HOLD steps [SC, SE, ST] that hold operations are turned off.
On All the outputs of the HOLD steps [SC, SE, ST] that hold operations are held.
The setting of SM327 is valid for only the HOLD steps [SC, SE, ST] that hold operation. All the outputs
of the HOLD steps [SC, SE, ST] that do not hold operations and the transition does not become TRUE
are turned off. Also, when SM327 is on, the steps become inactive.
However, when a forced end is performed such as by the block end instruction, the coil outputs of all
steps are turned off.
8 SFC PROGRAM
92 8.2 Structure
■Precautions
• An action cannot be created to the end step.
• The setting of SM327 (Output mode at execution of the end step) is valid only when the end step becomes active. When a
forced termination is performed such as by using the RST instruction (Ending a block), the coil outputs of all steps are
turned off.
• If the HOLD steps [SC, SE, ST] holding operations remain when the end step becomes active, those steps [SC, SE, ST] are
deactivated even though SM328 (Clear processing mode when the sequence reaches the end step) is on. If turning off the
coil outputs of the HOLD steps [SC, SE, ST] that hold operations is not required, turn on SM327. The following figure shows
the operational relationships between SM328 and HOLD steps [SC, SE, ST].
When a normal active step remains or when a HOLD step [SC, When an active step that holds an operation remains
SE, ST] whose transition has not become TRUE remains (the
step does not hold an operation)
• When SM328 is off, the block is ended by clearing the step. • The block is ended by clearing the step regardless of the setting of SM328.
• When SM328 is on, processing is continued without clearing the step.
8
• If a block is started at the block start step when SM328 is on, execution returns to the source as soon as there are no active
step that does not hold the operation in the block.
• Prevent the transition after the operation HOLD step (with transition check) [ST] from becoming always TRUE. When the
transition immediately after the operation HOLD step (with transition check) [ST] always becomes TRUE, the next step is
kept active and, therefore, the block can no longer be ended when SM328 is on.
8 SFC PROGRAM
8.2 Structure 93
Assigning the step relay (S) areas to steps
The step relay is a device corresponding to each step in the SFC program. It is on when the relevant step is active (including
stop and hold state), and is off when the relevant step is inactive.
Step relays are assigned as follows.
• Step relays are assigned sequentially in order of block No. starting from block 0 in an SFC program and in order of step No.
within a block.
• No step relay is assigned to any non-existing block No.
• Similarly, no step relay is assigned to any missing step No. within a block. The relevant bit is always off.
• All bits after the step relays assigned in the last block are off.
Ex.
The following example shows the step relay assignments of the following block configuration.
Block0: The largest step No. is 8, and step No. 3 and 6 are missing.
Block1: Missing
Block2: The largest step No. is 12, and step No. 3 is missing.
Block3 and after: Missing
Block2 Block0
(3) Block2
Any step No. can be assigned to each step (except end step).
• Assign step numbers in ascending order wherever possible because any missing step No. will decrease the
maximum number of steps that can be created.
• The step No. other than step No.0 (S0) cannot be used for the initial step of the top line and left end.
Ex.
Specifying step No. 23 in block No. 12
Program type Device notation Description
SFC program In the same block S23 The block name can be omitted when specifying a step in the same block
Other than block 12 BL12\S23 Specify the target block No. and step No.
Sequence program other Specifying the current target S23 The block name can be omitted when specifying a step in the target block
than SFC program block
Specifying a block different BL12\S23 Specify the target block No. and step No.
from the current target block
■Precautions
• Even if "Output Mode at Block Stop" of the SFC setting is off, the step relay is on when the step is stopped the operation.
8 SFC PROGRAM
94 8.2 Structure
Action
An action is a program which is executed while a step is active.
(1) (3)
(2)
(4)
*1 N indicates that the action is executed while a step is active. Nothing but N can be set.
When the step becomes active, the action is executed every scan. When the step becomes inactive, the action is ended and
not executed until next time the step becomes active.
Up to 4 actions can be created in one step. When multiple actions are created, they are executed in order from the top.
Detailed expression of an action can be created in ladder diagrams, ST language, or FBD/LD. In ladder diagrams, the
description method can be switched between detailed expression and MELSAP-L (instruction format). ( Page 96 Action in
MELSAP-L (instruction format)) 8
For details on detailed expression or labels/devices, refer to the following.
GX Works3 Operating Manual
8 SFC PROGRAM
8.2 Structure 95
Action in MELSAP-L (instruction format)
In MELSAP-L (instruction format), instructions for actions are described in text format in a SFC diagram.
To switch from detailed expression in ladder diagrams to MELSAP-L (instruction format), select [View]
[Switch Ladder Display] [MELSAP-L (Instruction Format)] from the menu. ( GX Works3 Operating
Manual)
For actions in MELSAP-L (instruction format), instructions and coils to output are described without contacts to be input
conditions of each instruction.
In MELSAP-L (instruction format), programs are described in the following format.
: Applicable label/device, Kn: Setting value of timer/counter
Item MELSAP-L (instruction format) Example
Coil output (OUT instruction) o oY0
Setting devices (SET instruction) s sM0
Resetting devices (RST instruction) r rM0
Low-speed timer (OUT T instruction)*1 o Kn oT0 K100
High-speed timer (OUTH T instruction) h Kn hT1 K10
Counter (OUT C instruction)*1 o Kn oC0 K10
Instructions other than listed above*2 Describe instructions in the same way as in ladder MOV D10 D120
diagrams.
8 SFC PROGRAM
96 8.2 Structure
Instructions that cannot be used
Some instructions cannot be used in actions. The following table lists the instructions that cannot be used.
Classification Instruction symbol
Master control instruction MC*1
MCR*1
Termination instruction FEND
END
Program branch instruction CJ*1
SCJ*1
JMP*1
GOEND
Program execution control instruction IRET
Structure creation instruction BREAK*1
RET
Creating a dummy transition condition TRAN
Create a contact to be input condition of each instruction in the ladder of detailed expression.
■Restrictions 8
The following table lists the restrictions on individual programming languages used to create an action.
Language Description
Ladder diagram Detailed expression A pointer and an interrupt pointer cannot be input in the pointer input area.
■Functions/function blocks that cannot be used
• Function/function block that includes an instruction that cannot be used in an action
• Function/function block that includes a pointer
• A macro type function block for which "Use MC/MCR to Control EN" is set to "Yes" and "Use EN/ENO" is set
to "No"
MELSAP-L (instruction The instructions corresponding to contacts (including comparison operation instructions such as LD<), the
format) NOP, MPS, MRD, and MPP instructions, pointers, interrupt pointers, functions, and function blocks cannot be
described.
Structured text language Page 49 STRUCTURED TEXT LANGUAGE
FBD/LD Page 65 FBD/LD
8 SFC PROGRAM
8.2 Structure 97
Precautions
• The step operation is almost the same as the following circuit.
(1)
(2)
Action
(1)
• If the CALL instruction is used to issue a subroutine call in an action of the step, the output of the call destination is not
turned off even when the step becomes inactive after the transition becomes TRUE. To turn off the output of the call
destination when the step becomes inactive after the transition becomes TRUE, write the FCALL instruction after the CALL
instruction or use the XCALL instruction. When using a subroutine call in an action of the step, using the XCALL instruction
can reduce the number of steps.
• Even when the input condition in the action is always on, it is assumed to be off when the action is inactive. Therefore,
immediately after the step becomes active, the instruction is executed when the output is turned on. For example, when the
input condition is set to be always on by using the instructions executed at the rising edge such as the PLS or INCP
instruction, the instruction is executed every time the step becomes active.
• The device that turned on by the OUT C instruction, the SET instruction, a basic instruction, or an application instruction in
the action is not turned off even when the step is deactivated and the action is ended. To turn off the device, execute the
RST instruction separately.
• With the PLS or PLF instruction, the specified device is normally turned on for only one scan and thereafter becomes off.
However, the specified device holds the ON state if it is turned on at the same time when the transition of the coil HOLD
step [SC] becomes TRUE. In this case, it is turned off by changing the condition to the one where the coil output of the coil
HOLD step [SC] turns off or activating the step again. For the conditions where the coil output turns off, refer to the
following.
Page 88 Timing of when coil output turns off
• If the step is deactivated and the action is ended while the input condition of the PLF instruction is on, the specified device
remains on.
• When the transition becomes TRUE in the coil HOLD step [SC] or the step is stopped by SM325 (Output mode at block
stop) which is set to hold, operation may not be performed just holding the coil output. This case means the non-execution
status, and therefore the operation of each instruction at the time of operation resumption depends on the execution
condition before the no-execution status is entered.
• When a program which cannot be described in MELSAP-L (instruction format) is created in detailed expression in ladder
diagrams and switched to MELSAP-L (instruction format), the program will be displayed "????????". When the definition of
the label used in a program is deleted, the program will be also displayed in the same way. To check and modify the
program, switch to detailed expression.
• When a program which has been created in MELSAP-L (instruction format) is switched to detailed expression in ladder
diagrams, a contact SM400 (Always ON) will be added as an execution condition of an instruction.
MELSAP-L (instruction format) Detailed expression in ladder diagrams
8 SFC PROGRAM
98 8.2 Structure
Transition
A transition is the basic unit for comprising a block and transfers the active state to the next step when the condition becomes
TRUE.
(1)
(3)
(2)
(4)
(5)
8 SFC PROGRAM
8.2 Structure 99
Transition types
The following table lists the types of transition.
Item Description
Series sequence When the transition becomes TRUE, the active state transitions from the
preceding step to the subsequent step.
Selective sequence Divergence: A step branches to multiple transitions, and only the step in the line
(divergence/convergence) where the transition becomes TRUE first is activated.
Convergence: The next step is activated when the transition immediately before
convergence, which is in the line where the transition becomes TRUE first,
becomes TRUE.
Simultaneous sequence Divergence: All the steps branched from one step are activated simultaneously.
(divergence/convergence) Convergence: When all the steps immediately before convergence are activated
and the common transition becomes TRUE, the active state transitions to the
next step.
Jump sequence When the transition becomes TRUE, the active state transitions to the specified
step in the same block.
For the operation of transition to the step which is already activated, refer to the following.
Page 135 Behavior when an active step is activated
8 SFC PROGRAM
100 8.2 Structure
Series sequence
When the transition becomes TRUE, the active state transitions from the preceding step to the subsequent step.
When the transition (2) becomes TRUE while the step (1) is active, the step (1) is deactivated and the step (3) is
activated.
(1)
(2)
(3)
Convergence When the transition (1) or transition (2) on the activated branch becomes TRUE, the step
8
(5) is activated.
(3) (4) The activated step (3) or step (4) becomes inactive. However, if it is a HOLD step [SC, SE,
ST], the step holds the coil output or action according to its attribute.
(1) (2)
(5)
8 SFC PROGRAM
8.2 Structure 101
• The selective sequence allows branching to up to 32 transition.
• If multiple transitions become TRUE simultaneously, the condition to the left will take precedence.
If transition (1) and (2) become TRUE simultaneously, the action of step
(3) will be executed.
(1) (2)
(3)
• An SFC diagram in which the numbers of branches and convergences of a selective sequence do not match can also be
created. However, in an SFC diagram, a selection branch and parallel convergence or a parallel branch and selective
convergence cannot be combined.
• In a selective transition, a convergence can be omitted by a jump transition or end transition.
When transition (2) becomes TRUE during action of step (1), step (3) and step (4) are sequentially executed. When the transition
(5) becomes TRUE, a jump sequence to step (1) occurs.
(1)
(2)
(3)
(4)
(5)
The above program can be created by changing the step other than those at the left end of selective branches
to the end step and changing the end step at the left end of the selective branch to a jump sequence.
For the operation method for changing steps, refer to the following.
GX Works3 Operating Manual
8 SFC PROGRAM
102 8.2 Structure
Simultaneous sequence (divergence/convergence)
All the steps branched from one step are activated simultaneously. When all the steps immediately before convergence are
activated and the common transition becomes TRUE, the active state transitions to the next step.
Item Description
Divergence When the transition (2) becomes TRUE while the step (1) is active, both of the step (3) and
(1) step (4) are activated at the same time.
The step (1) becomes inactive. However, if it is a HOLD step [SC, SE, ST], the step holds
(2)
the coil output or action according to its attribute.
Processing will proceed to step (7) when transition (5) becomes TRUE, and to step (8)
(3) (4) when transition (6) becomes TRUE.
(5) (6)
(7) (8)
Convergence When the transition (3) and transition (4) become TRUE while the step (1) and step (2) are
(1) (2) active, the step (5) and step (6) are activated.
After the step (5) and step (6) immediately before the convergence become active, the
(3) (4) transition (7) is checked and then becomes TRUE, the step (8) is activated.
The step (5) and step (6) become inactive. However, if it is a HOLD step [SC, SE, ST], the
(5) (6) step holds the coil output or action according to its attribute.
(7)
(8)
■Precautions
• When the steps connected by a convergence include HOLD steps [SC, SE, ST] that hold operations, the operation is
performed as follows.
Item Description
Coil HOLD step [SC] A transition to the next step does not occur the same as an inactive step.
Operation HOLD step (without transition
check) [SE]
Operation HOLD step (with transition A transitions to the next step occurs if another connected step is active.
check) [ST]
• In the simultaneous convergence, a block start step (with END check) [BC] cannot be created immediately before the
convergence. Use a block start step (without END check) [BS].
8 SFC PROGRAM
8.2 Structure 103
Jump sequence
When the transition becomes TRUE, the active state transitions to the specified step in the same block.
When the transition (2) becomes TRUE while the step (1) is active, the step (3) is activated.
The step (1) becomes inactive. However, if it is a HOLD step [SC, SE, ST], the step holds the coil output
(3) or action according to its attribute.
(1)
(2)
Ex.
Example of jump sequence that can be specified in the simultaneous branch
■Precautions
Under the following conditions, a step cannot be specified as the destination of jump sequence.
• When a step at the position escaping from a simultaneous sequence is specified
• When a step at the position entering a simultaneous sequence is specified
• When a step immediately before the preceding transition is specified
• When current step is specified
8 SFC PROGRAM
104 8.2 Structure
Detailed expression of transitions
Create detailed expression of transitions in the Zoom editor. The condition can be created in following programming
languages.
Type Description
Ladder Detailed Used to create a transition program consisting of a contact circuit and the TRAN instruction (Creating a dummy transition condition)
diagram expression in a single circuit block. The transition becomes TRUE when the TRAN instruction is executed.
■Restrictions
• Inline ST cannot be used.
• Only a TRAN instruction can be input to the coil.
MELSAP-L Page 107 Transition in MELSAP-L (instruction format)
(instruction
format)
Structured text language Used to create the following transition program.
■Method of writing a TRAN function (Creating a dummy transition condition) call statement
TRAN(bLabel1 & bLabel2);
//The transition becomes TRUE when the Boolean expression of the input argument is true.
■Method of writing an assignment statement of Boolean expression for reserved word "TRAN"
TRAN := bLabel1 & bLabel2;
//The transition becomes TRUE when the Boolean expression of the right-hand side is true.
■Method of writing an assignment statement of Boolean expression for the transition name
Transition1 := bLabel1 & bLabel2;
//Transition1 indicates the transition name input on the SFC editor. The transition becomes TRUE when the Boolean expression
of the right-hand side is true.
FBD/LD Used to create a transition program ending with the TRAN instruction (Creating a dummy transition condition) in a single FBD
network block.
■Restrictions
• Only one TRAN instruction can be used.
• A program to be assigned to the device/label cannot be created.
• Coil, function block, function (except some), jump, jump label, and return program elements cannot be used.
For the available instructions other than TRAN, refer to the following.
Page 106 Usable instructions
• The detailed expression of the same transition can be used for multiple transitions.
• The created detailed expression of a transition can be checked from the Zoom list. ( GX Works3
Operating Manual)
8 SFC PROGRAM
8.2 Structure 105
■Usable instructions
The following table lists the instructions that can be used in transition programs.
Classification Instruction symbol
Contact instruction LD, LDI, AND, ANI, OR, ORI
LDP, LDF, ANDP, ANDF, ORP, ORF
LDPI, LDFI, ANDPI, ANDFI, ORPI, ORFI*2
Association instruction ANB, ORB
INV
MEP, MEF
EGP, EGF*1
Comparison operation instruction LD, LD_U, AND, AND_U, OR, OR_U
LDD, LDD_U, ANDD, ANDD_U, ORD, ORD_U
Real number instruction LDE, ANDE, ORE
LDED, ANDED, ORED
Character string processing LD$, AND$, OR$
instruction
Creating a dummy transition TRAN*2
condition
*1 The EGP and EGF instructions cannot be used in a transition program created in ST or FBD/LD.
*2 The LDPI, LDFI, ANDPI, ANDFI, ORPI, ORFI, and TRAN instructions cannot be used in a transition program created in MELSAP-L
(instruction format).
8 SFC PROGRAM
106 8.2 Structure
Transition in MELSAP-L (instruction format)
In MELSAP-L (instruction format), transitions are described in text format in a SFC diagram.
To switch from detailed expression in ladder diagrams to MELSAP-L (instruction format), select [View]
[Switch Ladder Display] [MELSAP-L (Instruction Format)] from the menu. ( GX Works3 Operating
Manual)
In MELSAP-L (instruction format), transitions are described using the instructions corresponding to contacts. If a Boolean
expression of a transition is TRUE, the transition becomes TRUE.
In MELSAP-L (instruction format), programs are described in the following format.
8
: applicable label/device
Item MELSAP-L (instruction format) Example
Normally open contact (LD instruction) a aX0
Normally closed contact (LDI instruction) b bX1
Rising edge pulse (LDP instruction) p pM2
Falling edge pulse (LDF instruction) f fM3
Inverting the operation result (INV & INV aM0 & INV
instruction)
Converting the operation result into a pulse & MEP aM1 & MEP
(rising edge) (MEP instruction)
Converting the operation result into a pulse & MEF aM2 & MEF
(falling edge) (MEF instruction)
Converting the edge relay operation result & EGP aM3 & EGP V0
into a pulse (rising edge) (EGP instruction)
Converting the edge relay operation result & EGF aM4 & EGF V1
into a pulse (falling edge) (EGF instruction)
Comparison operation instruction Describe instructions in the same way as in ladder diagrams. < D10 D20
corresponding to contacts The following comparison operation instructions can be used.
Comparing 16-bit binary data (signed): <, <=, <>, =, >, >=
Comparing 32-bit binary data (signed): D<, D<=, D<>, D=, D>, D>=
Comparing single-precision real numbers: E<, E<=, E<>, E=, E>, E>=
Comparing double-precision real numbers: ED<, ED<=, ED<>, ED=, ED>, ED>=
Comparing 16-bit binary data (unsigned): <_U, <=_U, <>_U, =_U, >_U, >=_U
Comparing 32-bit binary data (unsigned): D<_U, D<=_U, D<>_U, D=_U, D>_U, D>=_U
Comparing string data: $<, $<=, $<>, $=, $>, $>=
Parallel connection (OR) | aX0 l aM0
Series connection (AND) & aX0 & aM0
Parentheses () (aX0 l aM0) & aX1
When "&" and "|" are used in a single expression, "&" takes a priority. Use "( )" to alter priorities.
8 SFC PROGRAM
8.2 Structure 107
Direct expression of transitions
The transition which transfers an active state to the next step can be created directly on the SFC diagram. A contact of FBD/
LD element is connected to it.
Coil, function block, function, jump, jump label, and return elements cannot be used.
Select a transition and select [Edit] [Modify] [Direct Expression for Transition] from the menu. This can
connect the FBD/LD element to the left side of the transition. ( GX Works3 Operating Manual)
Transition label/device
Bit type label, bit device or Boolean value can be specified as a condition which transfer an active state to the next step.
Bit type label Bit device Boolean value
Select a transition name, select [Edit] [Modify] [Name] from the menu, and input the bit type label, bit
device, or Boolean value to be specified. ( GX Works3 Operating Manual)
■Precautions
• When a device (T, ST, LT, LST, C, LC) of timer or counter is used as a transition, the device operates as a contact (TS, STS,
LTS, LSTS, CS, LCS). Also, when a coil (TC, STC, LTC, LSTC, CC, LCC) of timer or counter is used, the coil operates as a
contact.
• To use a coil of timer or counter for transition, use a timer type or counter type label.
Ex.
Timer device and timer type label
When the contact (TS0) is on, the transition becomes TRUE.
When the coil of the timer type label (tLabel0) is on, the transition becomes TRUE.
When the coil of the timer type label (tLabel1) is off, the transition becomes TRUE.
8 SFC PROGRAM
108 8.2 Structure
8.3 SFC Control Instructions
SFC control instructions are used to check a block or step operation status (active/inactive), or to execute a forced start, end
or others. If SFC control instructions are used, SFC programs can be controlled from the actions of sequence programs and
SFC programs.
Instruction List
The following table lists the SFC control instructions.
Instruction name Instruction symbol Processing
Checking the status of a step LD, LDI, AND, ANI, OR, ORI [S]*1 Checks whether a specified step is active or inactive.
LD, LDI, AND, ANI, OR, ORI [BL\S]
Checking the status of a block LD, LDI, AND, ANI, OR, ORI [BL] Checks whether a specified block is active or inactive.
Batch-reading the status of MOV(P) [K4S]*1 Batch-reads (in units of 16-bit binary data) the status (active or inactive)
steps of steps in a specified block, and stores the read data in a specified
MOV(P) [BL\K4S]
device.
DMOV(P) [K8S]*1 Batch-reads (in units of 32-bit binary data) the status (active or inactive)
of steps in a specified block, and stores the read data in a specified
DMOV(P) [BL\K8S]
device.
BMOV(P) [K4S]*1 Batch-reads (in units of the specified number of words starting from a
specified step) the status (active or inactive) of steps in a specified
BMOV(P) [BL\K4S]
block.
Starting a block SET [BL] Activates a specified block and executes a step sequence starting from
an initial step.
Ending a block RST [BL] Deactivates a specified block.
Pausing a block PAUSE [BL] Temporarily stops a step sequence in a specified block.
Restarting a block RSTART [BL] Releases the temporary stop and restarts the sequence from the step 8
where the sequence was stopped in the specified block.
Activating a step SET [S]*1 Activates a specified step.
SET [BL\S]
Deactivating a step RST [S]*1 Deactivates the specified step.
RST [BL\S]
Switching a block BRSET Specifies a target block No. of SFC control instruction.
*1 When using in a sequence program, block 0 is the target block. When using in a SFC program, current block is the target block.
For details on the SFC control instructions, refer to the following.
MELSEC iQ-R Programming Manual (CPU Module Instructions, Standard Functions/Function Blocks)
8 SFC PROGRAM
8.3 SFC Control Instructions 109
■Precautions
• Do not use the SFC control instructions in interrupt programs.
• Execute the SFC control instruction only when SM321 (SFC program start/stop) is on.
Index modification
The step relays and SFC block devices specified by SFC control instructions can be index-modified.
Device Index modification target part
SZ Step relay
BL\SZ Step of step relay with block specification
BLZ\S Block of step relay with block specification
BLZ\SZ Block and step of step relay with block specification
BLZ SFC block device
The step relays and SFC block devices can be specified within the following range, including the case of index modification.
Device Range
S R00CPU, R01CPU, R02CPU: 0 to 8191
CPU modules other than the above: 0 to 16383
(The maximum value is set by a CPU parameter)
BL\S BL R00CPU, R01CPU, R02CPU: 0 to 127
CPU modules other than the above: 0 to 319
S R00CPU, R01CPU, R02CPU: 0 to 127
CPU modules other than the above: 0 to 511
BL R00CPU, R01CPU, R02CPU: 0 to 127
CPU modules other than the above: 0 to 319
8 SFC PROGRAM
110 8.3 SFC Control Instructions
8.4 SFC Information Devices
SFC information device is the device or label which operates the forced start/termination and pause/restart direction to a
block, check of the status of transition and the number of active steps, or direction of continuous transition operation of a
transition.
SFC information device is set every blocks.
[Navigation window] [Program] SFC program fileproperties of block to be set
Window
Displayed items
Item Description Available data
Device Data type (label)
Block START/END Bit Sets the device or label to check whether the block is active. Bit: Y, M, L, F, V, B Bool, Boolean array,
Setting the bit to on can start the block and setting it to off can end the block. Word: Bit INT bit specification,
Step Transition Bit Sets the device or label to check whether the transition of the step being executed specification of D, W, Word bit
RD specification
becomes TRUE.
This bit turns on when the transition to the next step becomes TRUE after
execution of the action of each step.
Block PAUSE/RESTART Sets the device or label to pause or restart an active block.
Bit Setting the bit to on stops the block at the step in execution and setting it to off
restarts executing the block from the step where the block was stopped previously.
Block Stop Mode Bit Sets the device or label that decides the timing for stopping a block.
Setting the bit to on stops the block after transition of each step and setting it to off
stops all steps immediately.
Continuous Transition Bit Sets the device or label that decides the continuous transition action when the
transition becomes TRUE.
Setting the bit to on enables continuous transition and accordingly the action of the
next step is executed in the same scan. Setting the bit to off disables continuous
transition and accordingly one step is executed every scan.
Number of Active Steps Sets the device or label in which the number of currently active steps of a block is D, W, R, ZR, RD INT, WORD
Register to be stored.
Not only global devices and local devices but also global labels or local labels can be specified for SFC information devices.
Indirect specification, digit specification, and index modification (Z, LZ) cannot be performed.
The settings of SFC information device are required only when an SFC information device is used. If such
device is not used, the settings of SFC information device are not required.
8 SFC PROGRAM
8.4 SFC Information Devices 111
Block START/END bit
This bit is a device or label to check whether the block is active.
Setting the bit to on can start the block and setting it to off can end the block.
If a program to start a block is not available or because the START/END of a block can also be controlled from the engineering
tool, this device or label can be used for debugging or test operation in units of block.
• When the set block starts, the block START/END bit is automatically turned on. While the set block is active, the block
START/END bit stays on.
• When the set block becomes inactive, the block START/END bit is automatically turned off. While the set block is inactive,
the block START/END bit stays off.
Ex.
M0 is specified in the block START/END bit of Block 1 (BL1).
BL1 (1) (2)
M0
(1)
(2)
• When the block START/END bit is turned on while the set block is inactive, the block is started independently.
• When the block START/END bit is turned off while the set block is active, the block is ended.
The block START/END bit can also be turned on or off by the test operation of the engineering tool. ( GX Works3
Operating Manual)
When the block START/END bit is turned off to make the set block inactive, processing will occur as follows:
• Execution of the set block is stopped and the outputs of the step being executed are all turned off. However, the devices turned on by using the SET
instruction will not be turned off.
• If another block has been started by a block start step in the set block, the set block ends but the start destination block will remain active and continue
processing.
By changing the current value of BL or BL\S from watch window of the engineering tool, the status of a
block (START/END) or a step (active/inactive) can be changed.
Also, the status of the specified step (active/inactive) is changed from the menu [Debug] [Control SFC
Steps]. ( GX Works3 Operating Manual)
8 SFC PROGRAM
112 8.4 SFC Information Devices
■Precautions
• The following table shows the restart operation after the set block is deactivated.
Set block Description
Block 0 When the start conditions setting of is Operation is restarted from the initial step following end step processing.
"Auto-start block 0" in the SFC setting of
the CPU parameter.
When the start conditions setting of is "Do The block is deactivated after end step processing, and processing is restarted from the initial step
not auto-start block 0" in the SFC setting of when another start request occurs for that block.
the CPU parameter.
Other than block 0
• When the SFC program ends, all block START/END bits that have been set in the SFC information devices are turned off.
However, only when a resume start is enabled with the resume start setting, all block START/END bits are restored when
the SFC program starts.
8 SFC PROGRAM
8.4 SFC Information Devices 113
Step transition bit
This bit is a device or label to check whether the transition of the step being executed becomes TRUE.
This bit turns on when the transition to the next step becomes TRUE after execution of the action of each step.
A step transition bit which is on is automatically turned off when processing of the specified block is performed again.
Ex.
M1 is specified in the step transition bit of Block0
If transition (2) becomes TRUE after execution of step
Block0
(1), M1 is on during execution of another block.
(1)
M1 is turned off at the time of Block0 processing in the
next scan.
(2) If transition (4) does not become TRUE after execution
of step (3), M1 stays off.
(3) If transition (4) becomes TRUE, M1 is on during
execution of another block.
(4) If transition (6) does not become TRUE after execution
1 scan 1 scan 1 scan of step (5), M1 stays off.
(5)
M1
(6) (1) (3) (5)
If the continuous transition bit is turned on and set to "Continuous transition", the step transition bit will remain on during the
action of the next step after the transition becomes TRUE. It will also remain on following the execution of multiple steps, even
if the transition becomes FALSE. In these cases, the step transition bit will be turned off when the specified block is executed
in the next scan.
If transition (2) becomes TRUE after execution of step (1), M1 is turned on.
1 scan
Even if transition (4) does not become TRUE, M1 stays on.
M1 is turned off at the time of Block0 processing in the next scan.
M1
(1)
(4)=OFF
(2)=ON
When multiple active steps exist in the block, the step transition bit turns on when one of the transition becomes TRUE.
■Precautions
• When the end step is executed, the step transition bit of the block is turned on. The step transition bit remains on until the
block is reactivated next.
• The step transition bit is not turned off when the SFC program starts or ends.
8 SFC PROGRAM
114 8.4 SFC Information Devices
Block PAUSE/RESTART bit
This bit is a device or label to pause or restart an active block.
Setting the bit to on stops the block at the step in execution and setting it to off restarts executing the block from the step
where the block was stopped previously.
Setting Description
OFFON When this bit is turned on, the specified block stops at the step being executed.
ONOFF When this bit is turned off, the specified block restarts execution from the action of the step that has been stopped
previously.
• An operation HOLD step (without transition check) [SE] or an operation HOLD step (with transition check) [ST]
which has been stopped in operation hold state is restarted with the state in effect.
• The coil HOLD step [SC] cannot be restarted in hold state since the step is deactivated when it stops with the coil
output is set to off (SM325 is off). If the step stops with the coil output hold setting (SM325 is on), it keeps the hold
state even after it restarts.
• If another block has been started by a block start step, turning on the block PAUSE/RESTART bit stops the specified block,
but the start destination block will remain active and continue processing. To stop the start destination block at the same
time, the start destination's block PAUSE/RESTART bit must also be turned off.
• When the block PAUSE/RESTART bit specified in an inactive block is turned on, the block does not operate in inactive state
and is put in the stopped state immediately when it becomes active.
• Even after the specified block is forcibly terminated, the state of the block PAUSE/RESTART bit remains held. If the block is
forcibly terminated while it is stopped and the status of the block PAUSE/RESTART bit is not changed, the block is put in
stopped state immediately after the restart.
Operation when the block is paused or restart depends on the combination of the SM325 (Output mode at block stop) status,
block stop mode bit setting of the SFC information device, and step hold status. ( Page 123 Operation when the block is
paused or restarted)
8
■Precautions
• The block PAUSE/RESTART bit is not turned off when the SFC program starts or ends.
Operation when the block is paused or restart depends on the combination of the SM325 (Output mode at block stop) status,
block stop mode bit setting of the SFC information device, and step hold status. ( Page 123 Operation when the block is
paused or restarted)
■Precautions
• The block stop mode bit is not turned off when the SFC program starts or ends.
8 SFC PROGRAM
8.4 SFC Information Devices 115
Continuous transition bit
This bit is a device or label that determines the continuous transition action when the transition becomes TRUE.
Setting the bit to on enables continuous transition and accordingly the action of the next step is executed in the same scan.
Setting the bit to OFF disables continuous transition and accordingly one step is executed every scan.
Setting Description
Off (no continuous transition) When the transition becomes TRUE, the action of the transition destination step is executed in the next scan.
On (continuous transition) When the transition becomes TRUE, the action of the transition destination step is executed within the same scan.
When the transition of the steps become TRUE continuously, the actions are executed within the same scan until the
transition becomes FALSE or reaches the end step.
Ex.
The continuous transition bit of an SFC information device is specified.
(2)
(3)
(4)
(5)
(1) (2) (3) (4) (5) END (1) (5)
processing
(6)
1 scan
Scan Description
Scan 1 After execution of the sequence program (1), steps (2) to (5) of the SFC program are executed continuously.
Scan 2 and after After execution of the sequence program (1), the action of step (2) is executed until the transition (6) becomes TRUE.
• When the continuous transition bit is set, a continuous transition is disabled while the set bit device is off and is enabled
when the bit device is on, regardless of the on/off state of SM323 (All-blocks continuous transition status). When the
continuous transition bit is not set, a continuous transition is disabled while SM323 is off and is enabled when it is on. (
Page 130 Continuous transition ON/OFF operation)
• SM324 (Continuous transition disable flag) is turned on automatically by the system at SFC program execution, but is off
during continuous transition. Use of SM324 under the AND condition in a transition disables a continuous transition.
When M0 is on, one scan causes continuous transitions from steps (1) to (3).
(1) Since SM324 is added as the AND condition to the transition (4), the transition (4) after execution of step (3)
M0 does not become TRUE.
In the next scan, SM324 is turned on after step (3) and therefore a transition to step (5) occurs within the scan.
(2)
M0
(3)
M0 SM324
(4)
(5)
M0
8 SFC PROGRAM
116 8.4 SFC Information Devices
■Precautions
• If the continuous transition bit is turned on, execution of actions (from a transition becoming TRUE to destination step)
takes priority over the other processing. This can shorten a takt time. In this case, however, the operations of the other
blocks and sequence program may become slower.
• The continuous transition bit is not turned off when the SFC program starts or ends.
• When a jump transition or selective convergence causes the active state to transition from multiple steps to one step, the
action of one step may be executed twice in a single scan.
When the setting is "Continuous transition", step (1) is executed twice in a single scan.
(1)
• If the transition after the step becomes TRUE with the setting of "Continuous transition", a step is started or ended within
one scan. In this case, since the END processing has not been executed, the input/output refresh of coil output by using the
OUT instruction in the action is not reflected and therefore other programs cannot detect ON of the coil. In the case of
output (Y), for example, output (Y) is not output while END processing is unexecuted and other programs cannot detect
output (Y) ON. Accordingly, ON of the step relay cannot be detected, either. To reflect the I/O refresh of the OUT instruction,
create a program so that one step is executed in multiple scans.
When the transition (1) and (2) become TRUE, the following is executed in one scan.
(3) • The action of step (3) is executed.
• As the transition (1) becomes TRUE, the action of step (3) is turned off. 8
(1) • Step (3) becomes inactive and step (4) becomes active.
• As continuous transitions are enabled, the action of step (4) is executed.
(4)
• As the transition (2) becomes TRUE, the action of step (4) is turned off.
(2) • Step (4) becomes inactive and step (5) becomes active.
• As continuous transitions are enabled, the action of step (5) is executed.
(5) • As the transition (6) does not become TRUE, the action of step (5) is not turned off.
(6)
• When creating a program that uses a jump sequence for looping, eliminate continuous transitions or prevent all transitions
in the loop from becoming TRUE during execution. If all transitions in the loop become TRUE during execution with
continuous transitions enabled, an infinite loop occurs in a single scan.
8 SFC PROGRAM
8.4 SFC Information Devices 117
Number of Active Steps Register
This register is a device or label in which the number of active steps of a block is to be stored.
The number of active steps stored in the number of active steps register includes the following steps.
• Normal active step
• Coil HOLD step [SC] that holds the operation
• Operation HOLD step (with transition check) [ST] that holds the operation
• Operation HOLD step (without transition check) [SE] that holds the operation
• Steps that stop each operation
■Precautions
• When a block ends, the number of active steps register becomes 0.
• The register does not become 0 when the SFC program ends but becomes 0 when the program starts.
8 SFC PROGRAM
118 8.4 SFC Information Devices
8.5 SFC Setting
Set start conditions and others of SFC program in CPU parameter or SFC block setting.
CPU parameter
The following table lists the SFC settings.
Type Item Description
SFC Setting SFC Program Start Mode Setting Set whether to start with initial status (Initial Start) or to start holding the previous
execution status (Resume Start) at the start-up of SFC program.
Start Conditions Setting Set whether to automatically start and activate block 0 or to keep it inactive until a start
request is issued, when starting the SFC program.
Output Mode Setting at Block Stop Set whether to turn off the coil output or to hold it when stopping a block.
Keep the certain number of step relay (S) points before using the SFC program. (Default number of step relay
(S) points is 0.)
Set the number of step relay (S) points in units of 1024 points in [CPU Parameter] [Memory/Device Setting]
[Device/Label Memory Area Setting] [Device Setting]. ( Page 81 Specifications)
8 SFC PROGRAM
8.5 SFC Setting 119
SFC program start mode setting
Set whether to start with initial status (Initial Start) or to start holding the previous execution status (Resume Start) at the start-
up of SFC program.
[CPU Parameter] [SFC Setting] [SFC Program Start Mode Setting]
Window
Displayed items
Setting Description
Initial Start The program is started after the active state at a previous stop is cleared.
(default) The operation after a start is performed according to the start condition setting of the SFC setting. ( Page 122 Start
condition setting)
Resume Start The program starts while holding the active state at a previous stop.
Whether to start an SFC program with initial status or the previous execution status is determined by the combination of the
SFC program start mode setting and the SM322 (SFC program start mode) status.
Operation SFC program start mode setting: Initial Start SFC program start mode setting: Resume Start
SM322: OFF SM322: ON SM322: ON SM322: OFF
(Initial status)*1 (When the setting is (Initial status)*1 (When the setting is
changed) changed)
(1) SM321 is turned off and on. Initial Start Resume Start Initial Start
*4
(2) CPU module is powered off and Resume Start/Initial Start
on.
(3) SM321 is turned on and off, or Resume Start
CPU module is powered off and
on after changing the operating
status from RUN to STOP.
(4) CPU module is reset and the Resume Start/Initial Start*4
operating status is changed to
RUN.
(5) SM321 is turned on and off, or Resume Start
CPU module is reset and the
operating status is changed to
RUN after RUN to STOP.
(6) Operating status is changed from Resume Start*3
STOP to RUN.
(7) Operating status is STOP, write a Initial Start*2
program, and the status is
changed to RUN.
*1 The initial status of SM322 is determined when the operating status of the CPU module is changed from STOP to RUN according to the
setting of the SFC program start mode.
*2 When the Resume Start is set for the SFC program start mode, a program is resumed unless there is any change before and after
program writing.
*3 The on/off state of an action is determined according to the setting of "Output Mode at STOP to RUN" of parameter setting.
*4 Depending on the timing, a program cannot be resumed and starts with initial status.
8 SFC PROGRAM
120 8.5 SFC Setting
■Precautions
• When a program is resumed, the SFC program stop position is held but the status of the label or device used for an action
is not held. Therefore, if labels or devices are required to be held to start with previous status, set them to be latched.
• When a program is resumed with conditions other than the ones ((1), (3), (5) in the table) where the coil output of the coil
HOLD step [SC] is turned off, the coil HOLD step [SC] that holds the operation is restarted but the output is not turned on.
To continue the output, set the labels and devices required to be held to be latched. The on/off state of the output at the
time of changing STOP to RUN is determined according to the setting of "Output Mode Setting at STOP to RUN" of CPU
parameter setting. ( MELSEC iQ-R CPU Module User's Manual (Application))
• At power-off or reset, the intelligent function module is initialized. To resume a program, creating an initial program for the
intelligent function module in the block which is always active or in a sequence program is recommended.
• At power-off or reset, labels and devices are also cleared. When the SFC information device is set, the values are held only
when latch setting is performed.
• Depending on the timing, a program may not be resumed after power-off or reset. If a program is started with initial status
while the start mode is set to Resume Start, an event indicates that a program cannot be resumed is stored in the event
history. To resume a program without fail, turn off SM321 or switch the operating status of the CPU module from RUN to
STOP, and then power off or reset the CPU module.
8 SFC PROGRAM
8.5 SFC Setting 121
Start condition setting
Set whether to automatically start and activate block 0 or to keep it inactive until a start request is issued, when starting the
SFC program.
[CPU parameter] [SFC Setting] [Start Conditions Setting]
Window
Displayed items
Setting Description
At SFC Program START At the end of block 0
Auto-start block 0 Block 0 is started automatically and starts execution from its Block 0 is restarted automatically and restarts execution from
(default) initial step. its initial step.
Do not auto-start block 0 Block 0 is activated by a start request resulting from the SET Block 0 is not restarted automatically and remains inactive
(Starting a block) instruction or a block start step, in the same until another start request is issued.
manner as other blocks.
Use the start condition setting when it is desired to specify the start block at the start of SFC program according to the product
type.
"Auto-start block 0" is useful when block 0 is used as described below.
• Management block
• Preprocessing block
• Continuous monitoring block
■Precautions
• To execute the SFC program when "Do not auto-start block 0" is set, execute the SET instruction (Starting a block) from the
sequence program or turn on the block START/END bit that is set in the SFC information device.
• When "Auto-start block 0" is set, be sure to create block 0.
Window
Displayed items
Setting Description
Turn OFF Coil output is turned off.
(default)
Keep ON Coil output is held in the state immediately before stop.
• The settings made are reflected to the initial value of SM325 (Output mode at block stop) at power-on, reset, or switching
from STOP to RUN, and follow the settings of SM325 when the SFC program operates. CPU parameter settings are
ignored.
8 SFC PROGRAM
122 8.5 SFC Setting
■Operation when the block is paused or restarted
Operation when the block is paused or restart depends on the combination of the SM325 (Output mode at block stop) status,
block stop mode bit setting of the SFC information device, and step hold status.
The following table lists the operations at block PAUSE/RESTART.
Output mode Setting of block Operation
setting at block stop mode bit Active step other than step Step that holds operation
stop that holds operation Coil HOLD step Operation HOLD Operation HOLD
(including SC, SE, and ST [SC] step (without step (with
whose transition does not transition check) transition check)
become TRUE) [SE] [ST]
SM325=OFF OFF or no setting Immediately after a stop request Immediately after a Immediately after a stop request is made, the
(coil output OFF) (immediate stop) is made, the coil output of the stop request is made, coil output of the action is turned off and the
action is turned off and the block the coil output of the block is stopped. The status remains active.
is stopped. The status remains action is turned off and
active. the block is
On After the transition becomes deactivated.
(stop after transition) TRUE, step end processing is
performed and simultaneously the
transition destination step
becomes active and the block is
stopped before execution of the
action.
SM325=ON OFF or no setting Immediately after a stop request Immediately after a stop request is made, the block is stopped with the
(coil output held) (immediate stop) is made, the block is stopped with coil output of the action being held. The status remains active.
the coil output of the action being
held. The status remains active.
On Normal operation is performed
(stop after transition) until the transition becomes
TRUE. After the transition
becomes TRUE, step end
8
processing is performed and
simultaneously the transition
destination step becomes active
and the block is stopped before
execution of the action.
At restart Returns to normal operation. Coil output is off: Restarts the execution In the hold status, the
Becomes inactive and of the action in a action is restarted and
restart is disabled HOLD status. the transition is also
Coil output is held: checked.
Restarts with the hold
state
■Precautions
• When the block specified with the LD instruction (Checking the status of a block) has stopped, the coil output is turned on.
Also, when the step specified with the LD instruction (Checking the status of a step) has stopped, the coil output is turned
on.
• If the block is started while the PAUSE/RESTART bit of the SFC information device is on, the initial step stops before it
becomes active. If the SET instruction (Activating a step) is executed for an inactive block, the specified step stops before it
becomes active.
• When SM325 (Output mode at block step) is on, the block can be stopped while holding the coil output. Even when SM325
is turned on and off in stopped state, the state of the coil output does not change. When a block restart request is issued,
the coil output restarts while keeping the hold state.
• If the block is stopped when SM325 is on, the coil HOLD step [SC] in the hold state keeps its state even after restart but the
step operation does not restart. To make the coil HOLD step [SC] inactive, execute the RST instruction (Deactivating a
step).
• When a stop request is issued in the action to the block, the step being executed currently is executed until it ends, and
then the stop request is executed. Therefore, when the block stop mode bit is off (immediate stop), the step being executed
does not stop even if a stop request is issued within the step. If the block stop mode bit is changed to on (stop after
transition) afterwards in the same step, a stop request is executed in stop mode after transition.
8 SFC PROGRAM
8.5 SFC Setting 123
Ex.
M100 is the block stop mode bit and M101 is the block PAUSE/RESART bit.
Block0
SM400
RST M100
M0
PAUSE BL0
M101 Y0
M2
SET M100
If M0 is turned on during execution of the above action, the PAUSE instruction is executed and the block PAUSE/RESTART bit (M101) of Block0 is turned on but
the execution continues to the end of the action, so Y0 is turned on.
When M2 is on, the block stop mode bit is turned on even after execution of the PAUSE instruction and, after the actions are all executed, a stop request is
executed in stop mode after transition.
• If the RST instruction (Deactivating a step) is executed while the block is stopped, the specified step relay is turned off.
However, the monitor of the engineering tool keeps showing the active status and changes to inactive when the block is
restarted. The same is also true when the instruction is executed while the block is stopped by turning on SM325 (holding
the coil output when the block is stopped), but the coil output is not turned off.
• The SET instruction (Activating a step) is executed immediately even while the block is stopped and the specified step relay
is turned on. The display on the monitor of the engineering tool also shows the active status. However, the action is
executed only after the block is restarted.
Ex.
Block PAUSE/RESTART when the RST instruction (Deactivating a step) is used
(1) When M0 is turned on, block 0 is stopped.
M0
(2) When M1 is turned on, a termination request is executed for step No. 0 and BL0\S0 of the step relay is turned
PAUSE BL0
off but step No. 0 is left active on the monitor of the engineering tool.
(3) BL0\S0 is turned off, so Y0 is also turned off.
M1 (4) When M2 is turned on while M0 and M1 are off, block 0 restarts and step No. 0 ends.
RST BL0\S0
BL0\S0 Y0
M2
RSTART BL0
• If the block stop mode bit (stop after transition mode) is turned off while a step in a state that is waiting to stop operation
after transition exists, the step remains in that state. To immediately stop after clearing this state, restart the block and issue
a stop request again while the block stop mode bit is off.
• When the step transition destination is an end step in stop after transition mode, end step processing is executed and
therefore the step is not put in the stopped state.
• To check that a stop request has been issued, monitor the block list display of the engineering tool or monitor the bit that
has been set in the block PAUSE/RESTART bit. However, whether the step is in stop state or operating to wait to stop
cannot be checked from the monitor of the engineering tool.
• The stop after transition state can be cleared by turning off the block PAUSE/RESTART bit or executing the RESTART
instruction before the transition becomes TRUE. If a restart request is issued while steps that is already stopped and steps
that is waiting to stop operations coexist, the former starts and the latter continues the operation. The stop request is
cleared.
8 SFC PROGRAM
124 8.5 SFC Setting
SFC block setting
Window
(1)
Displayed items
Setting Description
No setting Standby CPU module operation continues, and standby until the start destination block becomes inactive while the
(default) transition becomes TRUE.
When the start destination block is deactivated, the block is reactivated.
If a transition in standby state, the previous step is deactivated, the output is switched OFF, and the action
will not be executed.
Block stop range is set. Stop An error results. 8
BL1
■Precautions
• When the SET instruction (Activating a block) is executed for the block that is already active, the start request is ignored
and the processing of the SFC program is continued as is.
• If an attempt to transition to an active block start step is made, the activation of the block start step is ignored. The block is
not executed again from the initial step.
8 SFC PROGRAM
8.5 SFC Setting 125
8.6 SFC Program Execution Order
Whole program processing
Initial execution
type program
Fixed scan
execution type
program
■Precautions
When no scan execution type SFC program exists (only standby type program), do not execute an SFC control instruction
and monitoring for an SFC program.
8 SFC PROGRAM
126 8.6 SFC Program Execution Order
Changing the execution type by an instruction
The execution type of a program can be changed by using a program control instruction.
The following table lists program control instructions with regard to whether an SFC program can be specified.
Instruction symbol Specification Remarks
enable/
disable
PSCAN Changes the execution type of the specified SFC program to the scan execution type.
If this instruction is executed with another SFC program specified while an scan execution type SFC
program already exists, an error occurs.
PSTOP If this instruction is executed for an SFC program, an error results.
POFF Executes end processing of all blocks in the next scan and changes the execution type of the specified
SFC program to the standby type in the following scan.
PSCAN POFF
instruction instruction
Standby type
program
■Precautions
• Do not use the PSCAN instruction to read/write a file from/to the CPU module or use the data logging function. If the
PSCAN instruction is executed, the scan time may extend several hundred milliseconds.
• When the SFC program, which is different program from the one operated last time, is operated by using the PSCAN 8
instruction while specifying resume start, the specified SFC program performs the initial start. In this case, "SFC program
continuous start not possible" (event code: 0430) is saved in the event history.
8 SFC PROGRAM
8.6 SFC Program Execution Order 127
SFC program processing sequence
(2)
Only block 0 can be started automatically when the block 0 autostart is specified in the start condition setting of the SFC
setting. With this setting, even when block 0 reaches the end step and becomes inactive, it is started again in the next scan.
( Page 122 Start condition setting)
A request for END, PAUSE, RESTART of a block is processed immediately before execution processing in the block.
8 SFC PROGRAM
128 8.6 SFC Program Execution Order
Step execution sequence
In the SFC program, the actions of all active steps are processed within one scan.
When the action of each step is finished, whether the transition to the next step becomes TRUE or not is checked.
• When the transition has not become TRUE: The action of the same step is executed again in the next scan.
• When the transition has become TRUE: The outputs of the executed actions by using the OUT instruction are all turned off.
When the next scan is executed, the action of the next step is executed. The step executed previously is deactivated and
the action becomes inactive.
Even when the transition becomes TRUE, if coil HOLD step [SC] is set in the step attribute, the step is not deactivated but
performs processing according to the attribute. ( Page 88 Coil HOLD step [SC])
(1) Execution of sequence program
STOP→RUN
(SM321=ON) (2) Execution of action
(3) Checking the transition to the next step
(FALSE)
(1) (2) (3) (4) (1) (2) (5) (4) (1) (6) (4) END processing
(5) Checking the transition to the next step (TRUE)
1 scan 1 scan 1 scan (6) The next action is executed.
Ex. 8
The continuous transition bit of an SFC information device is not specified.
(1) (2)
(3) (4)
(5) (6)
(7) (8)
(9)
Scan Description
Scan 1 Step (1) is activated and the action (2) is executed.
Scan 2 Step (3) is activated and the action (4) is executed.
Scan 3 Step (5) is activated and the action (6) is executed.
Scan 4 Step (7) is activated and the action (8) is executed.
Scan 5 and after Step (7) is active until the transition (9) becomes TRUE, and the action (8) is executed.
8 SFC PROGRAM
8.6 SFC Program Execution Order 129
■Precautions
• As a step for which the transition becomes TRUE at the first execution is deactivated in a single scan, the I/O refresh of coil
output is not reflected and therefore other programs cannot detect that the coil output is on. To reflect the I/O refresh, create
a program so that one step is executed in multiple scans.
• The actions of active steps in a block are executed simultaneously (within the same scan). For this reason, do not create
SFC programs which depend on the execution sequence of actions.
The execution sequence of actions (1), (2), and (3) are undefined.
(2)
(1) (3)
The takt time can be shortened by setting "Continuous transition". This resolves the problem of waiting time
from when the transition becomes TRUE until the action of the transition destination step is executed.
However, when "Continuous transition" is set, the operations of the other blocks and sequence program may
become slower.
8 SFC PROGRAM
130 8.6 SFC Program Execution Order
8.7 SFC Program Execution
Starting and stopping the SFC program
The SFC program can be started and stopped by either of the following methods.
• CPU parameter
• Starting and stopping the program by the special relay (SM321)
• Starting and stopping the program by using instructions
CPU parameter
Set "Auto-start block 0" to "Start Conditions Setting" in the CPU parameter. Block 0 of the SFC program starts automatically
when the CPU module is powered on or reset, or the operating status is changed from STOP to RUN. ( Page 122 Start
condition setting)
The resume start of the SFC program can be set in the CPU parameter ("SFC Program Start Mode Setting").
( Page 120 SFC program start mode setting)
8
Starting and stopping the program by using instructions
The SFC program is started and stopped by using the program control instructions. ( Page 127 Changing the execution
type by an instruction)
• The standby type SFC program is started by using the PSCAN instruction. The program execution type changes from the
standby type to the scan execution type.
• Outputs are turned off and the SFC program is stopped by the POFF instruction. The program execution type changes from
the scan execution type to the standby type.
8 SFC PROGRAM
8.7 SFC Program Execution 131
Starting and ending a block
Starting a block
A block in the SFC program can be started by either of the following methods.
Item Method Remarks Reference
CPU parameter Set "Auto-start block 0" to "Start Conditions Setting" in This method is used to use block 0 Page 122 Start
(auto start, only for block 0) the CPU parameter. When the SFC program is executed, as a control block, preprocessing condition setting
block 0 starts automatically and processing is performed block, or continuous monitoring
sequentially from the initial step. block.
Block start step Start another block by using a block start step [BC or BS] This method is effective when the Page 90 Block
in a block. control sequence is clear. start step (with END
check) [BC]
Page 91 Block
start step (without END
check) [BS]
SFC control instruction Start the block specified by the SFC control instruction This method is effective to restart Page 109 SFC
used in the action of the SFC program or in another the error processing block or Control Instructions
sequence program. execute interrupt processing.
• Use the SET [BL] (Starting a block) instruction to
execute the program from the initial step of the
specified block.
• Use the SET [S/BL\S] (Activating a step)
instruction to execute the program from the specified
step of the specified block.
SFC information device Start the specified block by turning on the block START/ This method is effective for Page 112 Block
END bit set to each block. debugging (in units of blocks) and START/END bit
test operation because blocks can
be restarted even from external
devices.
Engineering tool Start the specified block by turning on the SFC block This method is effective for GX Works3
device. debugging and test operation. Operating Manual
Ending a block
A block in the SFC program can be ended by either of the following methods.
Item Method Remarks Reference
End step Execute the end step in a block. Processing is stopped This method is effective to stop Page 92 End step
and the block becomes inactive. operation by stopping a cycle in
automatic operation.
SFC control instruction End and deactivate the block specified by the RST [BL] This method is effective to end Page 109 SFC
(Ending a block) instruction used in the action of the SFC processing regardless of the Control Instructions
program or in another sequence program. operation status, such as an
(The block ends when all the active steps in the specified emergency stop.
block are deactivated by using the RST [BL\S]
(Ending a block) instruction.)
SFC information device End the specified block by turning off the block START/ This method is effective for Page 112 Block
END bit set to each block. debugging (in units of blocks) and START/END bit
test operation because blocks can
be ended even from external
devices.
Engineering tool End the specified block by turning off the SFC block This method is effective for GX Works3
device. debugging and test operation. Operating Manual
8 SFC PROGRAM
132 8.7 SFC Program Execution
Pausing and restarting a block
Pausing a block
The specified block in the SFC program being executed can be paused by either of the following methods.
Item Method Remarks Reference
SFC control instruction Pause the block specified by the PAUSE [BL] (Pausing This method is effective to clear the Page 109 SFC
a block) instruction used in the action of the SFC error by temporarily stopping the Control Instructions
program or in another sequence program. machine and operating it manually.
SFC information device Pause the specified block by turning on the block This method is effective for Page 115 Block
PAUSE/RESTART bit set to each block. debugging and test operation PAUSE/RESTART bit
because blocks can be paused
even from external devices.
Operation when the block is paused or restart depends on the combination of the SM325 (Output mode at block stop) status,
block stop mode bit setting of the SFC information device, and step hold status. ( Page 123 Operation when the block is
paused or restarted)
Restarting a block
The paused block in the SFC program can be restarted by either of the following methods.
Item Method Remarks Reference
SFC control instruction Restart the block specified by the RSTART [BL] This method is effective in operating Page 109 SFC
(Restarting a block) instruction used in the action of the machine automatically again Control Instructions
blocks other than the paused block in the SFC program after it is stopped temporarily and
or in another sequence program. operated manually.
SFC information device Restart the specified block by turning off the block This method is effective for Page 115 Block
PAUSE/RESTART bit set to each block. debugging (in units of blocks) and PAUSE/RESTART bit 8
test operation because blocks can
be restarted even from external
devices.
Operation when the block is paused or restart depends on the combination of the SM325 (Output mode at block stop) status,
block stop mode bit setting of the SFC information device, and step hold status. ( Page 123 Operation when the block is
paused or restarted)
8 SFC PROGRAM
8.7 SFC Program Execution 133
Activating and deactivating a step
Activating a step
A step in the SFC program can be activated by either of the following methods.
Item Method Remarks Reference
Transition condition The transition is checked at the end of the step. If it is Page 99
TRUE, the next step is automatically activated. Transition
SFC control instruction Activate the step specified by the SET [S/BL\S] Page 109 SFC
(Activating a step) instruction used in the action of the Control Instructions
SFC program or in another sequence program.
Engineering tool • Activate the specified step by turning on the step relay. This method is effective for GX Works3
• Activate the selected step from the menu [Debug] debugging and test operation. Operating Manual
[Control SFC Steps].
Deactivating a step
A step in the SFC program can be deactivated by either of the following methods.
Item Method Remarks Reference
Transition condition The transition is checked at the end of the step. If it is Page 99
TRUE, the current step is automatically deactivated. Transition
Reset step [R] Activating this step deactivates the step specified for This method is effective to Page 90 Reset
attribute target. deactivate HOLD steps [SC, SE, step [R]
ST] when the sequence for error
processing is selected in the
selection branch.
SFC control instruction Deactivate the step specified by the RST [S/BL\S] When all the active steps in the Page 109 SFC
(Deactivating a step) instruction used in the action of the specified block are deactivated by Control Instructions
SFC program or in another sequence program. using the RST instruction, the block
also ends.
Engineering tool • Deactivate the specified step by turning off the step This method is effective for GX Works3
relay. debugging and test operation. Operating Manual
• Deactivate the selected step from the menu [Debug]
[Control SFC Steps].
8 SFC PROGRAM
134 8.7 SFC Program Execution
Behavior when an active step is activated
When an active step is activated, the step behaves as follows.
Series sequence
When the transition (2) becomes TRUE, the step (1) becomes inactive.
(1)
(2)
Selective sequence
■Divergence
Transitions are checked from left to right. If the step connected to the transition having a TRUE value is active, the steps
behave in the same way as in the series sequence. After the first TRUE path is taken, transitions are no longer checked.
■Convergence
The steps behave in the same way as in the series sequence.
When the transition (2) becomes TRUE, the step (1) becomes
(1)
inactive.
(2)
Simultaneous sequence
■Divergence
If any one of the steps in divergence of the simultaneous sequence is active, all steps below the transition become active in
the next scan.
When the transition (1) becomes
TRUE, the steps (2) to (5) become
active in the next scan.
(1)
(3)
(2) (4) (5)
■Convergence
All steps above the transition become inactive. The HOLD steps [SC, SE, ST] hold operations.
8 SFC PROGRAM
8.7 SFC Program Execution 135
Operation when a program is modified
To change an SFC program, use the following functions.
• Write to the programmable controller
• Online change
• Online change (SFC block)*1
The following table lists changes that can be made to SFC programs by executing each function above.
Change type Write to the programmable Online change Online change
controller (SFC block)*1
STOP/PAUSE RUN
SFC program addition
SFC block addition/deletion
SFC block SFC diagram Step/transition condition
change change addition/deletion
Transition condition (branch/
convergence/jump) change
Step attribute change
Change in SFC Operation output program
diagram change
Transition program change
Block information change
Values of devices and labels used in all programs will be as follows depending on the setting of SM326 (SFC device/label
clear mode).
SM326 (SFC device/label clear mode)*1 Description
Off Values of devices and labels, excluding the following, are cleared, and the SFC program is
executed.
• Step relay (S)
• File register (R/ZR)*2
• Latched labels
On Values of devices and labels, excluding the step relay (S), are held, and the SFC program is
executed.
*1 The setting of SM326 is valid only when an SFC program exists after data is written to the programmable controller. It is also valid when
a program file or parameter file is written to the programmable controller. It will be invalid when only the common device comment file,
device memory file, or device initial value file is written.
*2 Even when the device is not latched, data is not cleared.
8 SFC PROGRAM
136 8.7 SFC Program Execution
■When the operating status is changed from STOP to RUN
If the operating status of the CPU module is changed from RUN to STOP during execution of an SFC program, device values
and active/inactive state of the SFC program immediately before the stop are held and restored after the operating status is
changed back to RUN. The resume start is performed regardless of the CPU parameter setting ("SFC Program Start Mode
Setting").
If any of the sequence program file (including an SFC program), FB file, or parameter file (such as CPU parameter file and
system parameter file) is written to the CPU module while it is in the STOP state, the SFC program will be executed initially
when the operating status is changed back to RUN. Note that the resume start may be performed if there is no change in the
SFC program before and after writing the program file. ( Page 120 SFC program start mode setting)
■Precautions
• After an SFC program is modified by writing data to the programmable controller, reset the CPU module, and execute the
SFC program.
• If "Resume Start" is set to "SFC Program Start Mode Setting" in the CPU parameter, turn off SM322 (SFC program start
mode) first, and modify the program by writing data to the programmable controller. Thereafter, initial-start the SFC program
and then turn on SM322 (resume start) again.
8 SFC PROGRAM
8.7 SFC Program Execution 137
Online change (SFC block)
An SFC program can be changed in units of blocks. Since an SFC program can be changed online in units of blocks with the
active state held, efficiency of debugging and maintenance of SFC programs will be improved.
Before change After change
Transition 0 Transition 0
(1)
Step 0 N Action 1 Step 0 N Action 1
Transition 1 Transition 1
Added
Step 1 N Action 2
Block 0 Block 0
Transition 2
Transition 0 Transition 0
Transition 1 Transition 1
Before using the online change (SFC block), check the versions of the CPU module and the engineering tool
used.
For the versions of the CPU module and the engineering tool, refer to the following.
MELSEC iQ-R CPU Module User's Manual (Application)
8 SFC PROGRAM
138 8.7 SFC Program Execution
■Available execution type
The online change (inactive SFC block) can be executed to a scan execution type program (cannot be executed to a standby
type program).
■Online change (SFC block) while SM321 (Start/stop SFC program) is off
While SM321 (Start/stop SFC program) is off, the online change (inactive block) can be executed regardless of a target block
status immediately before SM321 turns off. Note that online change (SFC block) while SM321 is off always starts in initial start
mode, regardless of the following setting.
• SFC Program Start Mode Setting (Resume Start) in the CPU parameter (Page 120 SFC program start mode setting)
• SM322 (SFC program start mode)
■Changing/adding/deleting a block
The following table describes available operations (changing, adding, or deleting a block) in the online change (SFC block).
Operation Description
When the target block is inactive When the target block is active
Changing a block • An existing SFC block program in the CPU module can be • An existing SFC block program in the CPU module can be
changed. changed. However, deleting, attribute change, and changing
• An SFC information device set in a target SFC block can be step number of the active step cannot be performed.
changed. • An SFC information device set in a target SFC block can be
changed.
Adding a block • An SFC block can be added to an SFC program in the CPU
module.
• An SFC information device can be added to a target SFC block.
Deleting a block • A specified SFC block can be deleted from an SFC program in An active SFC block cannot be deleted. 8
the CPU module.
• An SFC information device set in a target SFC block can be
deleted.
• When a target block is not in an SFC program in the CPU
module, deleting a block cannot be performed.
In the STOP or PAUSE status, an active step holds its active state. Therefore, when deleting, changing
attribute, or changing step numbers of the active step, inactivate the step that maintains the active state
before the online change (SFC block).
■Area to be overwritten
The ladder in the added/changed steps or transitions and added/changed action or transitions in a target block are
overwritten. The last execution information of the rising instruction and falling instruction for the ladder in added/changed
action and transition is initialized.
■Changing the execution type of a program during the online change (SFC block)
The execution type of a program file for which the online change (SFC block) is being executed cannot be changed by using
the program control instructions (the POFF and PSCAN instructions). If the instructions are executed, they result in non
processing.
8 SFC PROGRAM
8.7 SFC Program Execution 139
■Online change (SFC block) during the boot operation
When the online change (SFC block) is executed while booting from an SD memory card, the corresponding files on the
booting SD memory card can also be changed.
■Operation when a target block or step is attempted to be activated during the online change
(SFC block)
A block and step targeted for the online change (SFC block) are not activated even if they are attempted to be activated while
the online change (SFC block) is being executed. The following table describes operations depending on block or step start
methods.
Start method (activation method) Operation at block or step start
Auto-start by the CPU parameter setting The block or step is not activated until the online change (SFC block) is completed. The
block or step is automatically activated after the online change (SFC block) is completed.
Block start step (without END check) • A target block is not activated but waits until the online change (SFC block) is
completed. Even when a transition following a step is TRUE, the next step does not
become active.
• A target block is activated after the online change (SFC block) is completed. When a
transition is TRUE, the next step becomes active.
Block start step (with END check) • A target block is not activated but waits until the online change (SFC block) is
completed.
• A target block is activated after the online change (SFC block) is completed. When the
block ends and a transition following a step is TRUE, the next step becomes active.
SFC control instructions (SET BL, SET S, SET BL\S A target block is not activated. If an instruction contact remains on, the target block is
instructions) activated after the online change (SFC block) is completed.
SFC information device (start by the block start/end bit) A target block is not activated even when the block start/end bit turns on. When the block
start/end bit is on, the target block is activated after the online change (SFC block) is
completed. (The system does not activate the target block until the online change (SFC
block) is completed.)
Block start by the engineering tool*1 A target block is not activated. A request is ignored. (The system does not activate the
target block until the online change (SFC block) is completed.)
Step start by the transition condition (activate) • Due to the previous transition becoming TRUE, a target step is not activated until the
online change (SFC block) is completed. (The state is not activated but waits.)
• After the online change (SFC block) is completed, when a transition is TRUE, the state
is activated.
*1 This indicates the following activation methods: Changing values of BL and BL\S on the watch window or the device/buffer
memory batch monitoring window and selecting an item in Control SFC steps under Debug.
■Precautions
• Do not power off or reset the CPU module while the online change (SFC block) (including transfer of data to the program
memory) is being executed. If doing so, write the data to the programmable controller.
• The online change (SFC block) and the following operations from the engineering tool cannot be executed simultaneously.
• Online change (ladder block)
• Write to the programmable controller (excluding device, local device, global label, or local label data)
• Memory initialization
• When deleting the OUT instruction (coil) which is not necessary for control, be sure to check that the OUT instruction is off
before deleting it. If the OUT instruction is deleted without turning it off in advance, the output will be retained.
• If a subroutine-type FB is called within the changed ladder block, information of the last execution, such as instructions
executed at the rising edge or falling edge within the FB definition of the called subroutine-type FB, is not initialized.
• When the online change (SFC block) is executed, the start-up of an interrupt program may be delayed. Therefore, when the
execution time is monitored (Error Detections Setting of the CPU parameter) for the interrupt program that uses the inter-
module synchronous interrupt (I44) and multiple CPU synchronous interrupt (I45), an error may be detected in the CPU
module. (MELSEC iQ-R CPU Module User's Manual (Application))
• Some sections are not targeted for the scan monitoring while the online change (SFC block) is being executed, and
therefore a WDT error may not be detected even though the scan time set in the scan time monitoring time (WDT) setting is
exceeded.
• When an instruction is executed during the online change (SFC block) and an error is detected, a step number stored as
the error location information is the one in a program being written. The step number after the completion of writing is not
stored.
8 SFC PROGRAM
140 8.7 SFC Program Execution
• The online change (SFC block) cannot be executed in the following cases.
• A target program file is not registered in the corresponding parameter.
• The number of SFC steps exceeds the number of step relay points set in the device setting of the CPU parameter.
• Operating status of the CPU module is switched to STOP and data are written to a specified program or a parameter in the programmable controller.
(The function cannot be executed until the operating status of the CPU module is back to RUN.)
• Program execution error (error code: 3204H) has been detected.
• To perform online change (SFC block) for the active block, use SM329 (Online change (SFC block) status flag) or SD329
(Online change (SFC block) target block number) to interlock so that the active step transition does not become TRUE. If
the transition to the target step becomes TRUE during the online change (SFC block), the state is not activated but waits.
After the online change (SFC block) is completed, when a transition is TRUE, the target step is activated. When a step
transition bit is set, the bit does not turn on in the waiting state.
• When performing online change (SFC block) including step movement across the active step, perform the following
procedure.
Cut the step to be moved.
Execute the online change (SFC block).
Paste the cut step to the desired position.
Execute the online change (SFC block) again.
When the step is skipped and the procedure is performed in order of , the online change (SFC block) may not
be executed.
Before edit After edit
Ó Õ
8 SFC PROGRAM
8.7 SFC Program Execution 141
Checking SFC program operation
Use the following functions of the engineering tool to check SFC program operation.
• Monitor
• Watch
• Device/buffer memory batch monitor
• Control SFC steps
• SFC block list
• SFC all blocks batch monitor
• Active step monitor
For details on each functions and operation check methods, refer to the following.
GX Works3 Operating Manual
8 SFC PROGRAM
142 8.7 SFC Program Execution
APPENDIX
Appendix 1 Operations of when the MC/MCR
instructions are used to control EN
The following table lists operations of instructions, devices, and labels used in a function block when "Use MC/MCR to Control
EN" is enabled in the inherent property setting of the function block.
Instruction/device/label used in a function Operation of Instruction/device/label used in a function block
block When "Yes" is selected for "Use MC/ When "No" is selected for "Use MC/MCR
MCR to Control EN" to Control EN"
Instructions executed at the rising edge or falling The next time EN is turned on, the instruction is The next time EN is turned on, the instruction may
edge (PLS, instructions for conversion to pulses executed if the condition contact is TRUE. not be executed even though the condition contact is
(P))*1 TRUE.
Timer (low-speed/high-speed), long timer The count value becomes 0 and the both coil The state of devices remains unchanged.
and contact turn off.
Retentive timer (low-speed/high-speed), long The coil turns off, but the current count value The state of devices remains unchanged.
retentive timer, counter, long counter and the current state of the contact remain
unchanged.
Devices specified as the device part of the OUT The devices are forcibly turned off. The state of devices remains unchanged.
instruction
When "Yes" is selected for "Use MC/MCR to Control EN", do not use the MC/MCR instructions while the
function block is being executed. If the MC/MCR instructions are used, the EN control may not operate
properly.
APPX
Appendix 1 Operations of when the MC/MCR instructions are used to control EN 143
Instructions executed at the rising/falling edge
The following describes operations of instructions executed at the rising/falling edge.
Ex.
A subroutine-type FB using an instruction executed at the rising edge
EN IN ENO
MOVP
IN OUT
END
Sc
Õ
EN
IN
Ó (1)
Ö
MOVP Ô
Sc: Scan
EN is turned on. (User operation)
IN is turned on. (User operation)
The MOVP instruction is executed. (CPU module operation)
EN is turned off. (User operation)
The MOVP instruction is executed. (CPU module operation)
Sc
Õ
EN
IN
Ó (1)
Ö
MOVP Ô
Sc: Scan
EN is turned on. (User operation)
IN is turned on. (User operation)
The MOVP instruction is executed. (CPU module operation)
EN is turned off. (User operation)
The MOVP instruction is executed when the condition contact is FALSE immediately before EN is turned off at . (CPU module operation) (The MOVP
instruction is not executed when the condition contact is TRUE immediately before EN is turned off at .)
APPX
144 Appendix 1 Operations of when the MC/MCR instructions are used to control EN
Timer (low-speed/high-speed) and long timer
The following describes operations of the timer (low-speed/high-speed) and long timer.
Ex.
A subroutine-type FB using a low-speed timer
EN SM400 ENO
OUT T0 K3
END
Sc
Ò
EN
(1) Ó
T0(Count) 0 1 2 3 0 1 2
Ó
T0(Coil)
(2)
Sc: Scan
T0(Count): T0 (count value)
T0(Coil): T0 (coil)
EN is turned off. (User operation)
The coil turns off and the timer value and the count value are cleared. (CPU module operation)
Sc
Ò
EN
(1) Ó
T0(Count) 0 1 2 3 3 3 3
T0(Coil)
Ó
(1)
Sc: Scan
T0(Count): T0 (count value)
T0(Coil): T0 (coil)
EN is turned off. (User operation)
The values remain unchanged. (CPU module operation)
APPX
Appendix 1 Operations of when the MC/MCR instructions are used to control EN 145
Retentive timer (low-/high-speed), long retentive timer, counter, and long counter
The following describes operations of the retentive timer (low-speed/high-speed), long retentive timer, counter, and long
counter.
Ex.
A subroutine-type FB using a low-speed retentive timer
EN SM400 ENO
OUT ST0 K3
END
Sc
Ò
EN
(1) Ó
ST0(Count) 0 1 2 3 3 3 3
Ó
ST0(Coil)
(2)
Sc: Scan
ST0(Count): T0 (count value)
ST0(Coil): T0 (coil)
EN is turned off. (User operation)
The coil turns off, but the current count value and the current state of the contact remain unchanged. (CPU module operation)
Sc
Ò
EN
(1) Ó
ST0(Count) 0 1 2 3 3 3 3
ST0(Coil)
Ó
(1)
Sc: Scan
ST0(Count): T0 (count value)
ST0(Coil): T0 (coil)
EN is turned off. (User operation)
The values remain unchanged. (CPU module operation)
APPX
146 Appendix 1 Operations of when the MC/MCR instructions are used to control EN
Devices specified as the device part of the OUT instruction
The following describes operations of devices specified as the device part of the OUT instruction.
Ex.
A subroutine-type FB using M0 for the device part of the OUT instruction.
EN SM400 M0 ENO
END
Sc
Ò
EN
M0
Ó
(1)
Sc: Scan
EN is turned off. (User operation)
The coil turns off. (CPU module operation)
Sc
Ò
EN
A
M0
(1) Ó
Sc: Scan
EN is turned off. (User operation)
The state of coil remains unchanged. (CPU module operation)
APPX
Appendix 1 Operations of when the MC/MCR instructions are used to control EN 147
INDEX
- .. ................................. 51
*.. ................................. 51 I
**. . ................................. 51 IF THEN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55
/ .. ................................. 51 IF...ELSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55
&. . ................................. 51 IF...ELSEIF . . . . . . . . . . . . . . . . . . . . . . . . . . . .55
+. . ................................. 51 Initial step . . . . . . . . . . . . . . . . . . . . . . . . . . . . .85
<. . ................................. 51 Input variable . . . . . . . . . . . . . . . . . . . . . . . . 15,22
<= . ................................. 51 Input/output variable . . . . . . . . . . . . . . . . . . . . . .22
<> . ................................. 51 Instance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .23
=. . ................................. 51 Internal variable . . . . . . . . . . . . . . . . . . . . . . . . .22
>. . ................................. 51 Interrupt program . . . . . . . . . . . . . . . . . . . . . . . . 13
>= . ................................. 51
J
A
Jump sequence . . . . . . . . . . . . . . . . . . . . . . . .100
AND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
ASCII. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61,74
Assignment statement . . . . . . . . . . . . . . . . . . . . 52 L
Label/device. . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
B Ladder diagram . . . . . . . . . . . . . . . . . . . . . . . 8,43
BC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Block PAUSE/RESTART Bit . . . . . . . . . . . . . . . 111 M
Block start step (with END check) . . . . . . . . . . . . 85
Macro type function block . . . . . . . . . . . . . . . 21,30
Block start step (without END check) . . . . . . . . . . 85
Main routine program . . . . . . . . . . . . . . . . . . . . . 13
Block START/END Bit . . . . . . . . . . . . . . . . . . . 111
MOD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51
Block Stop Mode Bit . . . . . . . . . . . . . . . . . . . . 111
BS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Buffer memory . . . . . . . . . . . . . . . . . . . . . . . . . . 7 N
Normal step . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
C NOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51
Note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .48
CASE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Number of Active Steps Register . . . . . . . . . . . .111
Coil HOLD step. . . . . . . . . . . . . . . . . . . . . . . . . 85 Number of steps . . . . . . . . . . . . . . . . . . . . . . . . .18
Continuous Transition Bit . . . . . . . . . . . . . . . . . 111
Conversion of data type . . . . . . . . . . . . . . . . . 53,66
O
D Online change (SFC block) . . . . . . . . . . . . . . . .138
Operation HOLD step (with transition check) . . . . . 85
Detailed expression . . . . . . . . . . . . . . . . . . . . . . 99
Operation HOLD step (without transition check) . . .85
Device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
OR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51
Direct expression . . . . . . . . . . . . . . . . . . . . . . . 99
Output Mode Setting at Block Stop . . . . . . . . . . .119
Output variable . . . . . . . . . . . . . . . . . . . . . . . 15,22
E
EN. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15,29 P
End step . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 Program . . . . . . . . . . . . . . . . . . . . . . . . .10,16,29
ENO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15,29 Program Block . . . . . . . . . . . . . . . . . . . . . . . . . .13
EXIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Program file . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
External variable . . . . . . . . . . . . . . . . . . . . . . . . 22 Programming language . . . . . . . . . . . . . . . . . . . . .8
Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10
F
FB file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 R
FBD/LD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
R ........... . . . . . . . . . . . . . . . . . . . . . . . .85
FOR...DO . . . . . . . . . . . . . . . . . . . . . . . . . . . 55,59
REPEAT...UNTIL . . . . . . . . . . . . . . . . . . . . . . . . 55
FUN file . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14,16
Reserved word . . . . . . . . . . . . . . . . . . . . . . . . . .50
Function (FUN) . . . . . . . . . . . . . . . . . . . . . . . 12,14
Reset step . . . . . . . . . . . . . . . . . . . . . . . . . . . . .85
Function block (FB) . . . . . . . . . . . . . . . . . . . . 12,20
RETURN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .54
Function block call statement . . . . . . . . . . . . . . . 54
148
S
Safety communications . . . . . . . . . . . . . . . . . . . . 7
Safety control . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Safety device . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Safety function (Safety FUN) . . . . . . . . . . . . . . . 38
Safety function block (Safety FB) . . . . . . . . . . . . 39
Safety program . . . . . . . . . . . . . . . . . . . . . . . . . . 7
SC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
SE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Selective sequence (divergence/convergence)
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Series sequence . . . . . . . . . . . . . . . . . . . . . . . 100
SFC program . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
SFC Program Start Mode Setting . . . . . . . . . . . 119
Shift JIS . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61,74
Simultaneous sequence (divergence/convergence)
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
ST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Standard communications . . . . . ............. 7
Standard control . . . . . . . . . . . . ............. 7
Standard CPU . . . . . . . . . . . . . ............. 7
Standard device . . . . . . . . . . . . ............. 7
Standard program . . . . . . . . . . . ............. 7
Start Conditions Setting . . . . . . . . . . . . . . . . . . 119
Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Step Transition Bit . . . . . . . . . . . . . . . . . . . . . . 111
STRING . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61,74
String. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61,74
String [Unicode] . . . . . . . . . . . . . . . . . . . . . . 61,74
Structured text (ST) . . . . . . . . . . ............. 8
Subroutine program . . . . . . . . . . . . . . . . . . . . . 13
Subroutine type function block . . . . . . . . . . . . 21,31
T
Transition name . . . . . . . . . . . . . . . . . . . . . . . . 99
Transition No . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Type specifier . . . . . . . . . . . . . . . . . . . . . . . . 62,74 I
U
Unicode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
W
WHILE...DO . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
WSTRING . . . . . . . . . . . . . . . . . . . . . . . . . . 61,74
X
XOR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
149
REVISIONS
*The manual number is given on the bottom left of the back cover.
Revision date *Manual number Description
June 2014 SH(NA)-081265ENG-A First edition
February 2015 SH(NA)-081265ENG-B ■Added or modified parts
Chapter 1, Section 4.7, 6.1, Chapter 7
August 2015 SH(NA)-081265ENG-C ■Added or modified parts
CONDITIONS OF USE FOR THE PRODUCT, TERMS, Chapter 1, Section 2.1, 3.1, 3.2, 3.3, 3.4, 4.3,
4.8, 6.1, Chapter 8, WARRANTY
January 2016 SH(NA)-081265ENG-D ■Added or modified parts
Section 8.1, 8.2
August 2016 SH(NA)-081265ENG-E ■Added or modified parts
Chapter 2, Section 3.1, 3.4, Chapter 5, 6, 7, 8
October 2016 SH(NA)-081265ENG-F ■Added or modified parts
Chapter 8
January 2017 SH(NA)-081265ENG-G ■Added or modified parts
RELEVANT MANUALS, Section 3.3, 4.2, 6.1, Chapter 7
June 2017 SH(NA)-081265ENG-H ■Added or modified parts
Chapter 7, Section 8.4, 8.7, Appendix 1
October 2017 SH(NA)-081265ENG-I ■Added or modified parts
CONDITIONS OF USE FOR THE PRODUCT, TERMS, Section 3.3, Chapter 4, 5, 6, 7, 8, Section
8.1, 8.2, 8.3, 8.5, 8.7
April 2018 SH(NA)-081265ENG-J ■Added or modified parts
RELEVANT MANUALS, TERMS, Chapter 1, Section 3.1, 3.2, 3.3, 3.4, 3.5, 5.1, 5.2, 5.3, Chapter 6,
Section 6.1, Chapter 7, Section 7.1, 7.2, 8.1, 8.3, 8.4, 8.7
150
WARRANTY
Please confirm the following product warranty details before using this product.
1. Gratis Warranty Term and Gratis Warranty Range
If any faults or defects (hereinafter "Failure") found to be the responsibility of Mitsubishi occurs during use of the product
within the gratis warranty term, the product shall be repaired at no cost via the sales representative or Mitsubishi Service
Company.
However, if repairs are required onsite at domestic or overseas location, expenses to send an engineer will be solely at
the customer's discretion. Mitsubishi shall not be held responsible for any re-commissioning, maintenance, or testing
on-site that involves replacement of the failed module.
[Gratis Warranty Term]
The gratis warranty term of the product shall be for one year after the date of purchase or delivery to a designated place.
Note that after manufacture and shipment from Mitsubishi, the maximum distribution period shall be six (6) months, and
the longest gratis warranty term after manufacturing shall be eighteen (18) months. The gratis warranty term of repair
parts shall not exceed the gratis warranty term before repairs.
[Gratis Warranty Range]
(1) The range shall be limited to normal use within the usage state, usage methods and usage environment, etc., which
follow the conditions and precautions, etc., given in the instruction manual, user's manual and caution labels on the
product.
(2) Even within the gratis warranty term, repairs shall be charged for in the following cases.
1. Failure occurring from inappropriate storage or handling, carelessness or negligence by the user. Failure caused
by the user's hardware or software design.
2. Failure caused by unapproved modifications, etc., to the product by the user.
3. When the Mitsubishi product is assembled into a user's device, Failure that could have been avoided if functions
or structures, judged as necessary in the legal safety measures the user's device is subject to or as necessary by
industry standards, had been provided.
4. Failure that could have been avoided if consumable parts (battery, backlight, fuse, etc.) designated in the
instruction manual had been correctly serviced or replaced.
5. Failure caused by external irresistible forces such as fires or abnormal voltages, and Failure caused by force
majeure such as earthquakes, lightning, wind and water damage.
6. Failure caused by reasons unpredictable by scientific technology standards at time of shipment from Mitsubishi.
7. Any other failure found not to be the responsibility of Mitsubishi or that admitted not to be so by the user.
2. Onerous repair term after discontinuation of production
(1) Mitsubishi shall accept onerous product repairs for seven (7) years after production of the product is discontinued.
Discontinuation of production shall be notified with Mitsubishi Technical Bulletins, etc.
(2) Product supply (including repair parts) is not available after production is discontinued.
3. Overseas service
Overseas, repairs shall be accepted by Mitsubishi's local overseas FA Center. Note that the repair conditions at each FA
Center may differ.
4. Exclusion of loss in opportunity and secondary loss from warranty liability
Regardless of the gratis warranty term, Mitsubishi shall not be liable for compensation to:
(1) Damages caused by any cause found not to be the responsibility of Mitsubishi.
(2) Loss in opportunity, lost profits incurred to the user by Failures of Mitsubishi products.
(3) Special damages and secondary damages whether foreseeable or not, compensation for accidents, and
compensation for damages to products other than Mitsubishi products.
(4) Replacement by the user, maintenance of on-site equipment, start-up test run and other tasks.
5. Changes in product specifications
The specifications given in the catalogs, manuals or technical documents are subject to change without prior notice.
151
TRADEMARKS
Ethernet is a registered trademark of Fuji Xerox Co., Ltd. in Japan.
The company names, system names and product names mentioned in this manual are either registered trademarks or
trademarks of their respective companies.
In some cases, trademark symbols such as '' or '' are not specified in this manual.
152 SH(NA)-081265ENG-J
SH(NA)-081265ENG-J(1804)
MODEL: R-P-PS-E
HEAD OFFICE : TOKYO BUILDING, 2-7-3 MARUNOUCHI, CHIYODA-KU, TOKYO 100-8310, JAPAN
NAGOYA WORKS : 1-14 , YADA-MINAMI 5-CHOME , HIGASHI-KU, NAGOYA , JAPAN
When exported from Japan, this manual does not require application to the
Ministry of Economy, Trade and Industry for service transaction permission.