GX Works2 Eng Man
GX Works2 Eng Man
GX Works2
Programming and
Documentation System
Beginner's Manual
The texts, illustrations, diagrams and examples in this manual are only
intended as aids to help explain the functioning, operation,
use and programming of the GX Works2 programming
and documentation system.
For using and usage of this software only the user his own is responsible.
© August 2011
Beginner's Manual for
MELSOFT GX Works2
Version Changes / Additions / Corrections
A 08/2011 pdp First issue
Typographic Conventions
Use of notes
Notes containing important information are clearly identified as follows:
Use of examples
Examples containing important information are clearly identified as follows:
Procedures
In some cases the setup, operation, maintenance and other instructions are explained with numbered
procedures. The individual steps of these procedures are numbered in ascending order with black
numbers in a white circle, and they must be performed in the exact order shown:
Text
Text
Text
Footnotes in tables
Footnote characters in tables are printed in superscript and the corresponding footnotes shown be-
neath the table are identified by the same characters, also in superscript.
If a table contains more than one footnote, they are all listed below the table and numbered in as-
cending order with black numbers in a white circle, like this:
Text
Text
Text
GX Works2 I
II
Contents
Contents
1 Introduction
GX Works2 III
Contents
4 Installation
6 Getting Started
IV
Contents
GX Works2 V
Contents
VI
Introduction This manual…
1 Introduction
1.1 This manual…
...is a compact guide to using GX Works2, suitable both for beginners and experienced users upgrad-
ing from other systems. The "Getting Started" chapter provides a step-by-step description of how to
use GX Works2, followed by some precisely descriped sample projects. These executable applications
are used to demonstrate the operation of a program with the help of the exercises provided in this
manual.
NOTE Microsoft, Windows, Windows Vista, and Excel are either registered trademarks or trademarks of
Microsoft Corporation in the United States and/or other countries.
GX Works2 1-1
Manuals Introduction
1.4 Manuals
Related manuals are separately issued according to the purpose of their functions in GX Works2.
The manuals related to this product are shown below.
Refer to the following table when ordering required manuals.
Manual number
Manual name
(Model code)
To display the operating manuals select Help Operating Manual [manual name].
1-2
Getting to Know GX Works2 Main functions of GX Works2
2.1.1 Programming
Programs can be created in a Simple project in a similar way with existing GX Developer. Structured
programming in a Structured project is also available with GX Works2.
GX Works2 2-1
Main functions of GX Works2 Getting to Know GX Works2
Programmable controller CPU parameter and Network parameter can be set with GX Works2.
Intelligent function module parameter can be set as well.
(For FXCPU, Network parameter setting is not available.).
Created sequence programs can be written to/read from a programmable controller CPU using the
Read from PLC/Write to PLC function. Also, using the Online program change function, the sequence
programs can be changed even when the programmable controller CPU is in RUN.
Writing data
Reading data
2-2
Getting to Know GX Works2 Main functions of GX Works2
2.1.4 Monitoring/debugging
Created sequence programs can be written to the programmable controller CPU and device value at
operation can be monitored online/offline.
2.1.5 Diagnostics
The current error status and error history of the programmable controller CPU can be diagnosed. Us-
ing the diagnostics function, the recovery work is completed in a short time.
Using the System monitor function (for QCPU (Q mode)/LCPU), detailed information on such as in-
telligent function modules can be obtained. This helps to shorten the recovery work time at error oc-
currence.
Diagnosing the
programmable controller
CPU status
GX Works2 2-3
Features Getting to Know GX Works2
2.2 Features
This section explains the features of GX Works2.
In GX Works2, the project type can be selected from either of Simple project or Structured project.
Simple project
The Simple project creates sequence programs using instructions for Mitsubishi programmable con-
troller CPU.
Programs in a Simple project can be created in a similar way with existing GX Developer.
Programming without labels and label programming are supported as in GX Developer and
GX IEC Developer.
Program file
Program MAIN
Program SUB1
Program SUB2
2-4
Getting to Know GX Works2 Features
Structured project
In a Structured project, programs can be created by structured programming.
By segmenting a whole control process program into common program parts, highly manageable
and usable programming (structured programming) is possible.
Only label programming is supported.
Program block B
Function block 2
Program block C Program SUB1
Function 1 Program block D
Using the label programming, programs can be created without regard for the device numbers.
By compiling a program created with the label programming, devices are automatically assigned and
the program becomes available as an actual program.
Created global labels can be utilized for other programs.
In addition, global labels can be registered as system labels and be shared within iQ Works compliant
products (GX Works2, MT Developer2, and GT Designer3).
For details of system labels, refer to the following manual:
● iQ Works Beginner's Manual
GX Works2 2-5
Features Getting to Know GX Works2
Projects created with existing GX Developer or GX IEC Developer can be utilized in GX Works2.
GX Developer projects are opened as Simple projects and GX IEC Developer projects, as Structured
projects. Utilizing the past assets improves the efficiency of program design.
For further details please see Cap. 3.
Project created
with GX Developer
Can be used in
GX Works2.
In a Structured project, programs, global labels, and structures frequently used can be registered as
libraries. Utilizing these libraries reduces time required for creating programs.
Project A
Project B
Project C
Project D
Library file
2-6
Getting to Know GX Works2 Features
<Ladder> <SFC>
Programming similar to existing GX Developer Programming to clarify the procedure
ST programs can be used on the ladder editor of GX Works2 using the Inline structured text function.
GX Works2 2-7
Features Getting to Know GX Works2
Offline debugging
Offline debugging using the simulation function is possible with GX Works2. This enables debugging
to ensure the normal operation of created sequence programs without connecting GX Works2 to the
programmable controller CPU.
Simulation function
Connecting to the Without connecting to the programmable controller CPU, programs can
programmable be monitored and debugged in the same way with debugging by the
controller is unnecessary. programmable controller CPU.
2-8
Utilizing projects from GX Developer or GX IEC Developer Utilizing Projects and Data in Other Formats
3.1.1 Utilizing projects and data created with GX Developer or GX IEC Developer in
GX Works2
Projects created with GX Developer or GX IEC Developer can be utilized in GX Works2 by using the
Open Other Project function (see Section 3.2).
GX Works2 3-1
Utilizing Projects and Data in Other Formats Utilizing projects from GX Developer or GX IEC Developer
3.1.2 Utilizing files created using the Export function of GX IEC Developer
ASCII files created using the Export function of GX IEC Developer can be added as projects in GX
Works2 by using the Read ASC Format File function (see Section 3.3).
This function is not supported by FXCPU.
.
Read ASC
Format File
Fig. 3-2: Utilizing projects created in GX IEC Developer using the Export function
Files created/edited in Simple project with GX Works2 can be utilized in GX Developer by using the Ex-
port to GX Developer Format File function (see Section 3.4).
[Export to GX Developer
Format File]
3-2
Utilizing projects from GX Developer or GX IEC Developer Utilizing Projects and Data in Other Formats
Each project and data created with GX Developer or GX IEC Developer are stored in the areas shown
in the table below with GX Works2.
GX Developer projects are opened as Simple projects and GX IEC Developer projects, as Structured
projects.
Comparison of projects and data storage locations between GX Developer and GX Works2
GX Works2 GX Works2
GX Developer
(Simple project) (Structured project)
FB FB_Pool FB/FUN
Comparison of projects and data storage locations between GX IEC Developer and GX Works2
GX Works2
GX IEC Developer
(Structured project)
The security level in the GX IEC Developer project is cleared after reading the project.
When the GX IEC Developer project is read using GX Works2, the following Enter Password screen is
displayed.
Fig. 3-4:
Dialog window Enter Password
GX Works2 3-3
Utilizing Projects and Data in Other Formats Utilizing projects from GX Developer or GX IEC Developer
For Open Other Project and Export to GX Developer Format File, the supported versions may differ
depending on the CPU type.
For the application compatibility, refer to: GX Works2 Operating Manual (Common)
3-4
Utilizing projects from GX Developer or GX IEC Developer Opening projects in other formats
GX Works2 3-5
Opening projects in other formats Utilizing projects from GX Developer or GX IEC Developer
3-6
Utilizing projects from GX Developer or GX IEC Developer Reading ASC format data
GX Works2 3-7
Saving projects in other formats Utilizing projects from GX Developer or GX IEC Developer
3-8
Installation Hardware Requirements
4 Installation
4.1 Hardware Requirements
4.1.1 Recommended Hardware Configuration
4.2 Copyright
WARNING:
E This software is protected by copyright. By opening the distribution disks package you auto-
matically accept the terms and conditions of the License Agreement. You are only permitted to
make one single copy of the original distribution CD-ROM for your own backup and archiving
purposes.
GX Works2 4-1
Precautions on the installation of GX Works2 Installation
At the first installation of a MELSOFT product, the following screen may be displayed during instal-
lation. To continue the installation, click the button on the Software Installation
screen. (We have checked the operation and assured that the system operates without any problems
by performing this procedure.)
The Software Installation screen may be displayed behind another screen. Press the +
keys to bring it to the front.
Fig. 4-1:
Dialog window Software Installation
When the installation of a MELSOFT product or another software is not completed correctly, the fol-
lowing screen is displayed and the installation cannot continue unless the personal computer is re-
started.
In this case, restart the personal computer and start the installation again.
Fig. 4-2:
Dialog window Software Installation
4-2
Installation Precautions on the installation of GX Works2
When installing on Windows Vista®, the following screen may be displayed after the completion of the
installation.
In this case, select "This program installed correctly" and restart the personal computer.
Fig. 4-3:
Dialog window Programm Compatibility
Assistent
When "Reinstall using recommended settings" is erroneously selected, the Windows XP SP2 compat-
ibility mode is automatically set. Disable the Windows XP SP2 compatibility mode by following the
procedure described on the following page, and perform the reinstallation.
GX Works2 4-3
Precautions on the installation of GX Works2 Installation
4-4
Installation Installing GX Works2
Make sure that the correct Microsoft® Windows® version is properly installed on your computer.
For information on using Microsoft® Windows® please refer to the Windows® User's Guide.
Start Microsoft® Windows®.
Insert the installation DVD-ROM in the DVD-ROM drive.
The GX Works2 installation program starts automatically (if not, execute the file SETUP.EXE on the
installation DVD-ROM).
Follow the instructions that appear on the screen.
Enter the user name, company name, and serial number of the software.
Follow the instructions that appear on the screen.
When the installation procedure is finished the program will create a new program group in the
Start menu containing the GX Works2 program icon.
For further details on the necessary Microsoft® Windows® procedures please refer to your Microsoft®
Windows® documentation.
In the Start menu click on the GX Works2 program icon. The icon is located in: Start > Programs
> MELSOFT Application > GX Works2. This starts GX Works2 and displays the start-up screen.
Confirm with the « key.
You can quit GX Works2 directly at any point in the program by pressing the key combination ¦”.
Or:
Click on the Quit command in the Project menu.
GX Works2 4-5
Installing GX Works2 Installation
4-6
The User Interface The Elements of the User Interface
Title bar
Menu bar
Toolbar
Navigation
window
Work window
Docking window
Status bar
GX Works2 5-1
The Elements of the User Interface The User Interface
Name Description
Output window Displays compilation and check results (errors and warnings).
Watch window 1 to 4 A screen used for monitoring and changing current device values.
Find/Replace window A screen used for searching and replacing character strings in the project.
5-2
The User Interface The Elements of the User Interface
The GX Works2 menu bar uses the standard Windows® procedures. When you select one of the menu
titles in the menu bar, a drop-down list of available commands is displayed. Commands with an arrow
symbol open a submenu of additional commands. Selecting a command opens a dialogue or data en-
try box. The menu structure and the available options are context-sensitive, changing depending on
what you are currently doing in the program. Options displayed in light grey are not currently avail-
able for selection.
NOTE A list of all menu commands (functions) with explanations is provided in the GX Works2 Operating
Manual (Common) and in the Help menu of the application.
The toolbar is a block of on-screen buttons for executing frequently-used functions included in a
menu and enables you to select the most important menu commands directly by clicking on the cor-
responding icons. The toolbar is context-sensitive, i.e. different tool icons are displayed depending on
what you are currently doing in GX Works2.
NOTE A complete list of all the available tools and icons is provided in the GX Works2 Operating Manual
(Common) and in the Help menu of the application.
5.1.3 Windows
GX Works2 allows you to edit multiple objects at the same time (e.g. work window, parameter setting,
etc.). A window is opened on the screen for each object. You can change the size and position of the
windows on the screen as you wish. Objects often contain more information than can be displayed in
the window; when this happens, horizontal and vertical scroll bars are included that can be used to
"scroll" the contents of the windows up and down and from side to side.
Work windows
A work window is a main screen used for operations such as programming, parameter setting, and
monitoring in GX Works2.
Work window
switching button
GX Works2 5-3
The Elements of the User Interface The User Interface
Navigation window
The Navigation window displays the contents of a project in tree format.
The Navigator is the "control centre" used for selecting and handling the objects used in GX Works2.
This is the starting place for all operations performed on GX Works2 objects. The Navigator window
is not displayed until you open a project.
Operations such as creating new data or displaying editing screens can be performed in the Naviga-
tion window.
Fig. 5-3:
Title bar Navigation window
Toolbar
View
selection
area
Name Description
5-4
The User Interface The Elements of the User Interface
The status bar at the bottom of the screen is used to display information on the current status of your
project. You can disable the status bar if you wish, and you can also configure the information to be
displayed to suit your needs.
Item Description
Security information Displays the login user name when security is set for the project.
Programmable controller
Displays the programmable controller type of the project.
type
Connection destination Displays the set contents of the Transfer setup screen.
GX Works2 5-5
Projects The User Interface
5.2 Projects
Project contents displayed in the Project view in tree format are as follows.
Contents displayed in the view may vary depending on programmable controller types and project
types.
For (Simple), (Structured), and (Intelligent) indicated in the reference destinations, refer to the fol-
lowing manuals respectively:
● (Simple) ..................GX Works2 Operating Manual (Simple Project)
● (Structured) ...........GX Works2 Operating Manual (Structured Project)
● (Intelligent) ............GX Works2 Operating Manual (Intelligent Function Module)
The following are examples for QCPU (Q mode).
5-6
The User Interface Projects
.
<Simple project (with labels)>
································Set various parameters.
··········Make settings for the intelligent function modules.
···············Set global device comments.
·························Set global labels.
·······Create programs.
<Structured project>
································Set various parameters.
············Make settings for the intelligent function modules.
···············Set global device comments.
·························Set global labels.
······Create programs.
GX Works2 5-7
Projects The User Interface
5-8
The User Interface Program Organisation Units (POUs)
Title bar
Toolbar
POU
selection
in project
tree
View
selection
area
GX Works2 5-9
Programs, Function Blocks and Functions The User Interface
Fig. 5-9:
Program Function block Function Programs, function blocks,
and functions
Function Function
blocks blocks Functions
Functions Functions
The program POU is the standard program organisation unit. Program POUs can contain program-
ming instructions from libraries, functions and function blocks. The execution of the program POUs is
controlled by tasks.
POUs declared as functions or function blocks are independent program elements. They function
effectively as programming instructions that can be replaced whenever necessary, and they can also
be used in other program modules, just like ordinary instructions.
NOTES Function blocks can be called by program POUs and other existing function blocks, but not from
functions. The function blocks themselves can contain programming instructions from the librar-
ies, functions and other existing function blocks.
Function blocks pass one or more output variables as their result. All the values of the output vari-
ables and the internal values within the function block are stored for the following execution of
the function block. These values are then used the next time the function block is invoked. This
means that invoking the same function block twice with the same input parameters does not nec-
essarily result in the same output values!
Functions can be called by program POUs, function blocks and other existing functions. Func-
tions can contain programming instructions from the libraries and other existing functions.
Functions always pass an output value, and they do not store any internal status information.
Thus, you should always get the same output value every time you invoke a function with the
same input parameters.
5 - 10
Getting Started Simple Project and Structured Project
6 Getting Started
6.1 Simple Project and Structured Project
6.1.1 Simple Project
In a Simple Project, you can create sequence programs using instructions for the Mitsubishi program-
mable controller CPU.
The Simple Project offers the same operability for program creation as the conventional GX Devel-
oper.
You can create sequence programs using the following programming languages:
Graphic languages
● Ladder
Use this graphic language to describe programs as ladders consisting of contacts, coils, etc, using
the same operating procedures as the conventional GX Developer.
● SFC
Use this graphic language to describe sequence control in a way easy to understand.
Describe steps which specify the processing and transition conditions which specify conditions
for proceeding to the next step.
You can describe steps and transition conditions using the ladder language.
Text language
● ST (Structured Text)
This text language allows you to describe controls by syntax including alternative sequences
offered by conditional sentences and repetition offered by repetition sentences in the same way
as high-level languages such as the C language. Accordingly, you can briefly create programs easy
to look at.
Graphic languages
● Ladder
Use this graphic language to describe programs as ladders consisting of contacts, coils, etc, using
the same operating procedures as the conventional GX Developer.
● Structured Ladder
This graphic language is created based on the relay circuit design technology. Because this
language is easy to understand intuitively, it is used generally for ladder programs.
Every ladder always starts from a base line on the left.
Structured Ladder consists of contacts, coils, function blocks and functions which are connected
each other with vertical lines and horizontal lines.
● SFC
Use this graphic language to describe sequence control in a way easy to understand.
Describe steps which specify the processing and transition conditions which specify conditions
for proceeding to the next step.
You can describe steps and transition conditions using the ladder language.
GX Works2 6-1
Simple Project and Structured Project Getting Started
Text language
● ST (Structured Text)
This text language allows you to describe controls by syntax including alternative sequences
offered by conditional sentences and repetition offered by repetition sentences in the same way
as high-level languages such as the C language. Accordingly, you can briefly create programs easy
to look at.
NOTE The FXCPU does not support the ST language in Simple Project, and does not support the ladder
language and SFC language in Structured Project.
6-2
Getting Started Program Creation Procedure in a Simple Project
Procedure Reference
Start GX Works2. 7.1.3
Create a new Simple Project. Or open an existing Simple Project. 7.1.4
Setting parameters
Procedure Reference
Set the parameters. 7.1.5
Setting labels
Procedure Reference
Define global labels. 7.1.6
Define local labels. —
Procedure Reference
7.1.7
Edit the program in each program part.
7.2.7
Conversion and compiling
Procedure Reference
Convert ladder blocks. 7.1.8
Compile the program. 7.1.9
Procedure Reference
Connect the personal computer to the programmable controller CPU.
—
Set the connection destination.
Procedure Reference
Write the parameters to the programmable controller CPU.
—
Write the program to the programmable controller CPU.
GX Works2 6-3
Program Creation Procedure in a Simple Project Getting Started
Checking operations
Procedure Reference
Monitor the sequence program execution status and device contents, and check
operations. —
Check for errors in the programmable controller.
Printing
Procedure Reference
Print the program and parameters. —
Exiting GX Works2
Procedure Reference
Save the project. 7.1.10
Exiting GX Works2. —
6-4
Getting Started Program Creation Procedure in a Structured Project
Procedure Reference
Start GX Works2. 8.1.3
Create a new Structured Project. Or open an existing Structured Project. 8.1.4
Setting parameters
Procedure Reference
Set the parameters. 8.1.5
Procedure Reference
Create Program File.
Create Task in Program File.
—
Create POU.
Register program block of POU to Task in Program File.
Setting labels
Procedure Reference
Define global labels. 8.1.6
Define local labels. —
Editing the program
Procedure Reference
8.1.7
Edit the program in each POU.
8.2.7
Conversion
Procedure Reference
Compile the program. 8.1.8
Procedure Reference
Connect the personal computer to the programmable controller CPU.
—
Set the connection destination.
GX Works2 6-5
Program Creation Procedure in a Structured Project Getting Started
Procedure Reference
Write the parameters to the programmable controller CPU.
—
Write the program to the programmable controller CPU.
Checking operations
Procedure Reference
Monitor the sequence program execution status, and check operations.
—
Check for errors in the programmable controller.
Printing
Procedure Reference
Print the program and parameters. —
Exiting GX Works2
Procedure Reference
Save the project. 8.1.9
Exiting GX Works2. —
6-6
Sample Program: Simple Project Creating a Program of LADDER
● When X0 turns ON, the programmable controller turns ON Y10, and then turns OFF Y10 1 second
later.
● When X1 turns ON, the programmable controller transfers K10 to D0 (which is defined with the
Label "VAR1").
● When X2 turns ON, the programmable controller transfers K20 to D0 (which is defined with the
Label "VAR1").
GX Works2 7-1
Creating a Program of LADDER Sample Program: Simple Project
7-2
Sample Program: Simple Project Creating a Program of LADDER
NOTE When using labels in Simple project, check "Use Label" on the New Project screen.
GX Works2 7-3
Creating a Program of LADDER Sample Program: Simple Project
Double-click it.
7-4
Sample Program: Simple Project Creating a Program of LADDER
GX Works2 7-5
Creating a Program of LADDER Sample Program: Simple Project
Directly input the "Device" on the
Global Label Setting screen.
Settings:
– Device: D0
Double-click it.
7-6
Sample Program: Simple Project Creating a Program of LADDER
NOTE Click an icon on the Ladder toolbar to open the Enter Symbol screen for inputting a device or
instruction.
Set a device or instruction, and click the button to display the corresponding ladder sym-
bol or vertical line in the cursor position.
Click (Coil) on the Ladder tool-
bar to display the Enter Symbol
screen.
Directly input a device on the Enter
Symbol screen, and click the
button to display the Coil.
Settings:
– Y10
GX Works2 7-7
Creating a Program of LADDER Sample Program: Simple Project
NOTE In labels (VAR1 in this example), the programmable controller distinguishes uppercase characters
and lower case characters. Pay rigid attention to use uppercase characters and lower case char-
acters correctly in inputting a label.
7-8
Sample Program: Simple Project Creating a Program of LADDER
Settings:
– MOVP K20 VAR1
The label VAR1 is set in Section 7.1.6.
Specify the device D0 when not using labels.
GX Works2 7-9
Creating a Program of LADDER Sample Program: Simple Project
NOTES Make sure to ladder conversion and compile the created or edited program to make it a sequence
program executable in the programmable controller CPU.
Only ladder conversion is required, and compilation is not required when using the FXCPU or not
using labels.
Refer to the following sections for ladder conversion and compile:
● Section 7.1.8
● Section 7.1.9
If the following operation is performed after compilation, devices are displayed instead of labels.
Operation to convert labels into devices for display
Select View Address Display to check the menu item.
(Note that the menu item is unchecked when you select View Address Display while the
menu item is checked.)
7 - 10
Sample Program: Simple Project Creating a Program of LADDER
GX Works2 7 - 11
Creating a Program of LADDER Sample Program: Simple Project
There are following two types of compiling. The compiling target is different between the two types.
Select "Rebuild All" for this example.
The "Rebuild All" procedure is described below.
Refer to the following manual for compiling:
● GX Works2 Operating Manual (Simple Project)
7 - 12
Sample Program: Simple Project Creating a Program of LADDER
NOTES When you convert a ladder block, GX Works2 automatically compiles the program at the time of
conversion if labels are not used.
If labels are used, make sure to compile the created or edited sequence program after conversion
so that the created or edited sequence program will be an executable sequence program.
Refer to the following manual for the details on "Build", "Rebuild All":
● GX Works2 Operating Manual (Simple Project)
GX Works2 7 - 13
Creating a Program of LADDER Sample Program: Simple Project
Settings:
– Workspace folder path: Specify the save destination folder.
– Workspace Name: Specify the save destination folder name.
– Project Name: Specify the project name.
– Title: Specify the title. You can save a project without specifying a title.
Make sure that the total characters of "Save Folder Path", "Workspace Name" and "Project Name" is
200 or less.
You cannot save any project to route directories such as "C:\" or "D:\".
7 - 14
Sample Program: Simple Project Creating a Program of SFC
Mode selection
Start Standby
GX Works2 7 - 15
Creating a Program of SFC Sample Program: Simple Project
For QCPU/LCPU
For FXCPU
7 - 16
Sample Program: Simple Project Creating a Program of SFC
GX Works2 7 - 17
Creating a Program of SFC Sample Program: Simple Project
Double-click it.
7 - 18
Sample Program: Simple Project Creating a Program of SFC
Creating the SFC Diagram
(Series transition 1)
For the creation method, refer to
the following.
Put the cursor in the position "row
number 5, column number 1".
See step in Section 7.2.7.
Settings:
– Symbol :TR/1
– Comment : blank
GX Works2 7 - 19
Creating a Program of SFC Sample Program: Simple Project
7 - 20
Sample Program: Simple Project Creating a Program of SFC
GX Works2 7 - 21
Creating a Program of SFC Sample Program: Simple Project
NOTES The step ( ) specified as the jump destination will change into ( )
Perform the following procedure to display comments set on the Enter SFC Symbol screen.
Select View SFC Step/Transition Comment.
7 - 22
Sample Program: Simple Project Creating a Program of SFC
NOTES The step ( ) whose operation output is created will change into ( )
GX Works2 7 - 23
Creating a Program of SFC Sample Program: Simple Project
NOTE In the transition condition, the coil instruction accepts only one dummy coil ([TRAN]).
Click " " or " ", and click the button to enter the dummy coil. Then, "[TRAN]" will
be entered automatically.
7 - 24
Sample Program: Simple Project Creating a Program of SFC
Creating the zoom (step , series transition 1, step , series transition 2, step , series transition 3,
step , series transition 4, series transition 5)
For the zoom display and creation methods, refer to the following:
– See step in Section 7.2.7.
– See step in Section 7.2.7.
– See Note in step in Section 7.2.7.
GX Works2 7 - 25
Creating a Program of SFC Sample Program: Simple Project
7 - 26
Sample Program: Simple Project Creating a Program of SFC
When the FXCPU is used, it is necessary to create a ladder for turning ON the SFC program using
a ladder block.
Double-click "000: Block", and create a necessary circuit.
In this example, the initial state S0 is set to ON using the special auxiliary relay M8002 that is
actuated instantaneously when the programmable controller mode is changed from STOP to
RUN.
GX Works2 7 - 27
Creating a Program of SFC Sample Program: Simple Project
7 - 28
Sample Program: Simple Project Creating a Program of SFC
NOTE When using the FXCPU, set steps of the SFC program as follows:
● States S0 to S9 are called initial steps (states), and used only as head step numbers of SFC blocks.
Accordingly, you can create up to 10 SFC blocks (starting from S0 to S9) when using the FXCPU.
● States S10 and later can be used as general step numbers.
However, note that the maximum number of steps in 1 block is 512.
● Each step (state) number can be used only once throughout all blocks.
The SFC program creation procedure explains a case using the QCPU.
Use the above creation procedure when using the FXCPU.
7.2.8 Compiling a program (for QCPU/LCPU) or converting a SFC diagram (for FXCPU)
For the Saving a Project procedure, refer to Section 7.1.10, Saving a project.
GX Works2 7 - 29
Creating a Program of SFC Sample Program: Simple Project
7 - 30
Sample Program: Structured Project Creating a Program of STRUCTURED LADDER
● When X0 turns ON, the programmable controller turns ON Y10, and then turns OFF Y10 1 second
later.
● When X1 turns ON, the programmable controller transfers K10 to D0 (which is defined with the
Label "VAR1").
● When X2 turns ON, the programmable controller transfers K20 to D0 (which is defined with the
Label "VAR1").
GX Works2 8-1
Creating a Program of STRUCTURED LADDER Sample Program: Structured Project
8-2
Sample Program: Structured Project Creating a Program of STRUCTURED LADDER
Settings:
– Project Type : Structured Project
– PLC Series:QCPU (Q mode)
– PLC Type: Q02/Q02H
– Language: Structured Ladder
NOTE Labels are always available in structured projects. You do not have to check "Use Label".
GX Works2 8-3
Creating a Program of STRUCTURED LADDER Sample Program: Structured Project
Double-click "Parameter"
"PLC Parameter" on the Project
view to display the Q Parameter
Setting screen.
Double-click it.
8-4
Sample Program: Structured Project Creating a Program of STRUCTURED LADDER
GX Works2 8-5
Creating a Program of STRUCTURED LADDER Sample Program: Structured Project
Directly input the "Device" on the
Global Label Setting screen.
Settings:
– Device: D0
8-6
Sample Program: Structured Project Creating a Program of STRUCTURED LADDER
GX Works2 8-7
Creating a Program of STRUCTURED LADDER Sample Program: Structured Project
NOTES Positioning Function and Function block using the Function Block Selection window
You can easily position Function and Function block by dragging them from the Function Block
Selection window.
Perform the following procedure to display the Function Block Selection Window:
Select "View" "Docking window" "Function Block Selection Window".
In the example below, drag the Function "LDP" from the Function Block Selection window, and
drop it on the POU_01 [PRG] Program [Structured Ladder] screen to position it there.
Refer to the following manual for the details:
● GX Works2 Operating Manual (Structured Project)
8-8
Sample Program: Structured Project Creating a Program of STRUCTURED LADDER
You can easily connect grid lines by making valid the Auto Connect function in the Interconnect
Mode.
Perform the following procedure to make valid the Auto Connect function.
● Select Edit Auto Connect to put a check mark.
● Right-click the Structured Ladder work window to display the menu, and select "Auto Connect"
to put a check mark.
Click it.
Set the function "LDP".
Click the input variable "?" of "s",
and set the input variable.
Settings:
– s: X0
GX Works2 8-9
Creating a Program of STRUCTURED LADDER Sample Program: Structured Project
NOTE Referring to the data type of input/output labels in a Function or Function block
Double-click a positioned function or function block to display the Function/FB Label Setting
screen where you can refer to the data type of labels.
Refer to the following manual for the details:
● GX Works2 Operating Manual (Structured Project)
8 - 10
Sample Program: Structured Project Creating a Program of STRUCTURED LADDER
NOTE If there is no input or output in the connection source and connection destination as shown
below, you can connect a grid line as shown below while the Auto Connect function is valid.
Refer to the following manual for the details:
● GX Works2 Operating Manual (Structured Project)
GX Works2 8 - 11
Creating a Program of STRUCTURED LADDER Sample Program: Structured Project
8 - 12
Sample Program: Structured Project Creating a Program of STRUCTURED LADDER
Refer to the following manual for the details on the Label Registration/Selection screen:
● GX Works2 Operating Manual (Structured Project)
GX Works2 8 - 13
Creating a Program of STRUCTURED LADDER Sample Program: Structured Project
8 - 14
Sample Program: Structured Project Creating a Program of STRUCTURED LADDER
GX Works2 8 - 15
Creating a Program of STRUCTURED LADDER Sample Program: Structured Project
There are following two types of compiling. The compiling target is different between the two types.
Select "Rebuild All" for this example.
The "Rebuild All" procedure is described below.
Refer to the following manual for compiling:
● GX Works2 Operating Manual (Structured Project)
8 - 16
Sample Program: Structured Project Creating a Program of STRUCTURED LADDER
NOTES Make sure to compile the created or edited program to make it a sequence program executable in
the programmable controller CPU.
GX Works2 8 - 17
Creating a Program of STRUCTURED LADDER Sample Program: Structured Project
Settings:
– Workspace folder path: Specify the save destination folder.
– Workspace Name: Specify the save destination folder name.
– Project Name: Specify the project name.
– Title: Specify the title. You can save a project without specifying a title.
Make sure that the total characters of "Save Folder Path", "Workspace Name" and "Project Name" is
200 or less.
You cannot save any project to route directories such as "C:\" or "D:\".
8 - 18
Sample Program: Structured Project Creating a Program of ST LANGUAGE
● When X0 turns ON, the programmable controller turns ON Y10, and then turns OFF Y10 1 second
later.
● When X1 turns ON, the programmable controller transfers K10 to D0 (which is defined with the
Label "VAR1").
● When X2 turns ON, the programmable controller transfers K20 to D0 (which is defined with the
Label "VAR1").
NOTE Labels are always available in structured projects. You do not have to check "Use Label".
GX Works2 8 - 19
Creating a Program of ST LANGUAGE Sample Program: Structured Project
8 - 20
Sample Program: Structured Project Creating a Program of ST LANGUAGE
Added.
GX Works2 8 - 21
Creating a Program of ST LANGUAGE Sample Program: Structured Project
● Display colors
GX Works2 displays syntax, operators, comments, constants, string constants, devices and labels
using the following colors (in the initial setting).
• Syntax: ( blue)
• Operator: ( black )
• Comment: ( dark green )
• Constant: ( black )
• String constant: ( black )
• Device: ( black )
• Global label: ( )
• Local label: ( )
2) Drop it.
1) Drag it.
8 - 22
Sample Program: Structured Project Creating a Program of ST LANGUAGE
Refer to the following manual for the details on the Label Registration/Selection screen:
● GX Works2 Operating Manual (Structured Project)
Using templates
Using templates according to the instructions/functions.
Added.
GX Works2 8 - 23
Creating a Program of ST LANGUAGE Sample Program: Structured Project
Input "MOVP(X2,20,VAR1)" di-
rectly .
You can select "Function"
"MOVP" on the Function Block Se-
lection window.
Settings:
– MOVP(X2,20,VAR1)
"VAR1" is the label set in Section
8.1.5.
For the Saving a Project procedure, refer to Section 8.1.9, Saving a project.
8 - 24
Appendix Index
Index
B L
Build . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-11 Label programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5
Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5
C Ladder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-1
Compatible applications . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4
M
Compiling a program . . . . . . . . . . . 7-12, 7-29, 8-16, 8-24
Connection Destination view . . . . . . . . . . . . . . . . . . . . . . 5-4 Main functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1
Converting ladder blocks . . . . . . . . . . . . . . . . . . . . . . . . 7-11 MELSOFT product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
Creating a new project . . . . . . . . . . . . .7-2, 7-17, 8-2, 8-19 Menu bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
Creating a program . . . . . . . . . . . . . . . .7-6, 7-18, 8-7, 8-21 Monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
Cross Reference window . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2 Multi-language system . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7
D N
Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 Navigation window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
Device List window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
Diagnostics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 O
Docking window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2 Offline debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8
Open Other Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5
E
Open Other Project . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1, 3-5
Enter Password . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3 Output window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
Export . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2
Export function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2 P
Export to GX Developer . . . . . . . . . . . . . . . . . . . . . . . 3-2, 3-8 Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
POU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6
F
Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4, 2-8 Program Creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-5
Find/Replace window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2 Program Organization Unit . . . . . . . . . . . . . . . . . . . . . . . 2-6
Formats, other . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1 Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1
Function Block Selection window . . . . . . . . . . . . . . . . . 5-2 Programming languages . . . . . . . . . . . . . . . . . . . . . . . . . 2-7
FXCPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-27 Project types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4
Project view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4
G Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-6
Global Label . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-17
R
Graphic language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-1
GX Developer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6, 3-1 Read ASC Format File . . . . . . . . . . . . . . . . . . . . . . . . . 3-2, 3-7
GX IEC Developer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6, 3-1 Reading data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
GX Works2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1
S
H Sample Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-1, 8-1
Hardware Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1 Saving a project . . . . . . . . . . . . . . . . 7-13, 7-29, 8-17, 8-24
Screen layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8
I Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
Inline structured text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7 Security level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
Intelligent Function Module Monitor . . . . . . . . . . . . . . 5-2 Setting labels . . . . . . . . . . . . . . . . . . . . . . 7-4, 7-17, 8-4, 8-20
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1 Setting parameters . . . . . . . . . . . . . . . . 7-3, 7-17, 8-4, 8-19
iQ Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5 SFC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-1
GX Works2 A-1
Index Appendix
T
Text language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-1
Title bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
Toolbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
A-2
MITSUBISHI ELECTRIC
Mitsubishi Electric Europe B.V. /// FA - European Business Group /// Gothaer Straße 8 /// D-40880 Ratingen /// Germany
Tel.: +49(0)2102-4860 /// Fax: +49(0)2102-4861120 /// info@mitsubishi-automation.com /// www.mitsubishi-automation.com