SH (NA) - 080788ENG-P - GX Works2 Beginner's Manual (Structured Project)
SH (NA) - 080788ENG-P - GX Works2 Beginner's Manual (Structured Project)
SH (NA) - 080788ENG-P - GX Works2 Beginner's Manual (Structured Project)
(Structured Project)
-SW1DNC-GXW2-E
SAFETY PRECAUTIONS
(Always read these instructions before using this product.)
Before using this product, thoroughly read this manual and the relevant manuals introduced in this manual
and pay careful attention to safety and handle the products properly.
The precautions given in this manual are concerned with this product. For the safety precautions of the
programmable controller system, refer to the User’s Manual for the CPU module.
In this manual, the safety precautions are ranked as " WARNING" and " CAUTION".
Note that the CAUTION level may lead to serious consequences according to the circumstances.
Always follow the precautions of both levels because they are important for personal safety.
Please save this manual to make it accessible when required and always forward it to the end user.
[Design Instructions]
WARNING
● When data change, program change, or status control is performed from a personal computer to a running
programmable controller, create an interlock circuit outside the programmable controller to ensure that the whole
system always operates safely.
Furthermore, for the online operations performed from a personal computer to a programmable controller CPU, the
corrective actions against a communication error due to such as a cable connection fault should be predetermined as
a system.
CAUTION
● The online operations performed from a personal computer to a running programmable controller CPU (Program
change when a programmable controller CPU is RUN, operating status changes such as forced input/output
operation and RUN-STOP switching, and remote control operation) must be executed after the manual has been
carefully read and the safety has been ensured.
When changing a program while a programmable controller CPU is RUN, it may cause a program corruption in some
operating conditions. Fully understand the precautions described in GX Works2 Version 1 Operating Manual
(Common) before use.
● The positioning test functions of OPR, JOG, inching or positioning data for QD75/LD75 positioning module must be
executed with the programmable controller set to STOP after the manual has been carefully read and the safety has
been ensured. Specially when executing the function on the network system, ensure the safety thoroughly since the
machinery whose operation cannot be checked by an operator may be activated. The operation failure may cause the
injury or machine damage.
A-1
CONDITIONS OF USE FOR THE PRODUCT
(1) Mitsubishi programmable controller ("the PRODUCT") shall be used in conditions;
i) where any problem, fault or failure occurring in the PRODUCT, if any, shall not lead to any major or
serious accident; and
ii) where the backup and fail-safe function are systematically or automatically provided outside of the
PRODUCT for the case of any problem, fault or failure occurring in the PRODUCT.
(2) The PRODUCT has been designed and manufactured for the purpose of being used in general
industries.
MITSUBISHI SHALL HAVE NO RESPONSIBILITY OR LIABILITY (INCLUDING, BUT NOT LIMITED
TO ANY AND ALL RESPONSIBILITY OR LIABILITY BASED ON CONTRACT, WARRANTY, TORT,
PRODUCT LIABILITY) FOR ANY INJURY OR DEATH TO PERSONS OR LOSS OR DAMAGE TO
PROPERTY CAUSED BY the PRODUCT THAT ARE OPERATED OR USED IN APPLICATION NOT
INTENDED OR EXCLUDED BY INSTRUCTIONS, PRECAUTIONS, OR WARNING CONTAINED IN
MITSUBISHI'S USER, INSTRUCTION AND/OR SAFETY MANUALS, TECHNICAL BULLETINS AND
GUIDELINES FOR the PRODUCT.
("Prohibited Application")
Prohibited Applications include, but not limited to, the use of the PRODUCT in;
• Nuclear Power Plants and any other power plants operated by Power companies, and/or any other
cases in which the public could be affected if any problem or fault occurs in the PRODUCT.
• Railway companies or Public service purposes, and/or any other cases in which establishment of a
special quality assurance system is required by the Purchaser or End User.
• Aircraft or Aerospace, Medical applications, Train equipment, transport equipment such as Elevator
and Escalator, Incineration and Fuel devices, Vehicles, Manned transportation, Equipment for
Recreation and Amusement, and Safety devices, handling of Nuclear or Hazardous Materials or
Chemicals, Mining and Drilling, and/or other applications where there is a significant risk of injury to
the public or property.
Notwithstanding the above, restrictions Mitsubishi may in its sole discretion, authorize use of the
PRODUCT in one or more of the Prohibited Applications, provided that the usage of the PRODUCT is
limited only for the specific applications agreed to by Mitsubishi and provided further that no special
quality assurance or fail-safe, redundant or other safety features which exceed the general
specifications of the PRODUCTs are required. For details, please contact the Mitsubishi representative
in your region.
A-2
REVISIONS
The manual number is written at the bottom left of the back cover.
A-3
Print date Manual number Revision
A-4
Print date Manual number Revision
This manual confers no industrial property rights or any rights of any other kind, nor does it confer any patent licenses.
Mitsubishi Electric Corporation cannot be held responsible for any problems involving industrial property rights which may occur
as a result of using the contents noted in this manual.
A-5
INTRODUCTION
Thank you for purchasing the Mitsubishi integrated FA software, MELSOFT series.
Before using the product, thoroughly read this manual to develop full familiarity with the functions and performance
to ensure correct use.
CONTENTS
1 OVERVIEW 1 - 1 to 1 -6
A-6
3.5 Diagnosing the programmable controller 3 - 38
3.7 Printing 3 - 41
3.7.1 Setting the printer ....................................................................................................................... 3 - 41
3.7.2 Previewing a program................................................................................................................. 3 - 42
3.7.3 Printing a program ...................................................................................................................... 3 - 44
3.7.4 Previewing a PLC Parameter ..................................................................................................... 3 - 45
3.7.5 Printing a PLC Parameter........................................................................................................... 3 - 46
3.8 Saving a Project 3 - 47
4.7 Printing 4 - 12
A-7
5.2.5 Preparing (creating) the program configuration ........................................................................... 5 - 5
5.2.6 Setting labels................................................................................................................................ 5 - 8
5.2.7 Creating a program ...................................................................................................................... 5 - 9
5.2.8 Compiling a program.................................................................................................................. 5 - 11
5.3 Writing a Project to the programmable controller 5 - 12
5.7 Printing 5 - 19
A-8
■ MANUALS
Related manuals are separately issued according to the purpose of their functions in GX Works2.
● Related manuals
The manuals related to this product are shown below.
Refer to the following tables when ordering required manuals.
1) Operation of GX Works2
Manual number
Manual name
(Manual code)
2) Structured Programming
Manual number
Manual name
(Manual code)
A-9
3) Operation of iQ Works
Manual number
Manual name
(Manual code)
The Operating Manuals are included on the CD-ROM of the software package in a PDF file format.
Manuals in printed form are sold separately for single purchase. Order a manual by quoting the manual
number (model code) listed in the table above.
A - 10
● Purpose of this manual
This manual explains the operation for creating sequence programs in Structured project, one of the
functions supported with GX Works2.
Manuals for reference are listed in the following table according to their purpose.
For information such as the contents and manual number of each manual, refer to the list of 'Related
manuals'.
1) Installation of GX Works2 and USB driver
GX Works2 GX Works2 Version 1
Purpose Installation Operating Manual
Instructions Common
2) Operation of GX Works2
GX Works2 GX Works2 Version 1
Beginner’s Manual Operating Manual
Purpose Simple Project Intelligent
Simple Structured Structured
Common Function Function
Project Project Project
Block Module
A - 11
3) Operations in each programming language
For details of instructions used in each programming language, refer to the section 4 / section 5 on
the next page.
GX Works2 GX Works2 Version 1
GX Works2 Beginner’s Manual Operating Manual
Purpose Installation Intelligent
Instructions Simple Structured Simple Structured
Common Function
Project Project Project Project
Module
Ladder Details
Outline
Simple *1
SFC Details
Project Outline
ST Details
Outline
Ladder Details
Outline
*1
SFC Details
Outline
Structured
Project
Structured Ladder/FBD Details
Outline
ST Details
Outline
A - 12
4) Details of instructions in each programming language (for QCPU (Q mode)/LCPU)
MELSEC-
MELSEC-
Q/L/F Manual for
MELSEC-Q/L Structured Q/L MELSEC-Q/L/QnA
Structured module to
Programming Manual Programming Programming Manual
Purpose Programming be used
Manual
Manual
Common Special Application Common PID Control
Fundamentals SFC -
Instructions Instructions Functions Instructions Instructions
Learning details of
programmable
All controller CPU
Details
languages error codes,
special relays, and
special registers
Learning the types
and details of
Details
common
instructions
Learning the types
and details of
instructions for Details
intelligent function
Using modules
ladder
language Learning the types
and details of
Details
instructions for
network modules
Learning the types
and details of
instructions for the Details
PID control
function
Learning details of
Using specifications,
SFC functions, and Details
language instructions of
SFC (MELSAP3)
Learning the
fundamentals for
creating a Details
structured
program
Learning the types
and details of
Details
common
instructions
Learning the types
and details of
Using instructions for Details
Ladder/ modules
FBD or ST Learning the types
language and details of
Details
instructions for Outline
network modules
Learning the types
and details of
instructions for the Details
PID control Outline
function
Learning the types
and details of
Details
application
functions
A - 13
5) Details of instructions in each programming language (for FXCPU)
MELSEC-
Q/L/F
Structured FXCPU Structured Programming Manual FXCPU Programming Manual
Programming
Purpose Manual
Basic & FX0, FX0S, FX1S, FX1N, FX3S,
Device & Application
Fundamentals Applied FX0N, FX1, FX2N, FX1NC, FX3G, FX3U,
Common Functions
Instruction FXU, FX2C FX2NC FX3GC, FX3UC
Learning the types
and details of
Using ladder basic/application
instructions, Details Details Details
language
descriptions of
devices and
parameters
Learning details of
Using SFC specifications,
language functions, and Details Details Details
instructions of SFC
Learning the
fundamentals for
creating a Details
structured program
Learning the
descriptions of
Using devices, Details
Structured parameters, and
Ladder/FBD error codes
or ST Learning the types
language and details of
sequence Details
instructions
Learning the types
and details of
application Details
instructions
A - 14
● How to read this manual
Chapter heading
Section title
Reference location
Section title
* Since the above page was created for explanation purpose, it differs from the actual page.
A - 15
This manual also uses the following columns:
This explains notes for requiring attention or useful functions relating to the information given on the
same page.
Restrictions
This explains restrictions relating to the information given on the same page.
− Keyboard key
A - 16
■ GENERIC TERMS AND ABBREVIATIONS IN THIS MANUAL
This manual uses the generic terms and abbreviations listed in the following table to discuss the
software packages and programmable controller CPUs. Corresponding module model names are also
listed if needed.
Generic terms and
Description
Abbreviations
Generic product name for SWnDNC-GXW2-E model
GX Works2
(n: version)
Existing application -
Generic product name for SWnD5C-GPPW-E, SWnD5C-GPPW-EA, SWnD5C-GPPW-EV, and
GX Developer SWnD5C-GPPW-EVA
(n: version)
Generic product name for SWnD5C-GPPW-E, SWnD5C-GPPW-EA, SWnD5C-GPPW-EV, and
GX Simulator SWnD5C-GPPW-EVA
(n: version)
iQ Works Abbreviation for MELSOFT iQ Works
Personal computer Generic term for personal computers on which Windows® operates
Q series Abbreviation for Mitsubishi programmable controller MELSEC-Q series
L series Abbreviation for Mitsubishi programmable controller MELSEC-L series
FX series Abbreviation for Mitsubishi programmable controller MELSEC-F series
Basic model QCPU Generic term for Q00J, Q00, Q01
High Performance model
Generic term for Q02, Q02H, Q06H, Q12H, and Q25H
QCPU
Generic term for Q00UJ, Q00U, Q01U, Q02U, Q03UD, Q03UDE, Q03UDV, Q04UDH,
Q04UDEH, Q04UDV, Q04UDPV, Q06UDH, Q06UDEH, Q06UDV, Q06UDPV, Q10UDH,
Universal model QCPU
Q10UDEH, Q13UDH, Q13UDEH, Q13UDV, Q13UDPV, Q20UDH, Q20UDEH, Q26UDH,
Q26UDEH, Q26UDV, Q26UDPV, Q50UDEH, and Q100UDEH
Generic term for Basic model QCPU, High Performance model QCPU, and Universal model
QCPU (Q mode)
QCPU
LCPU Generic term for L02S, L02S-P, L02, L02-P, L06, L06-P, L26, L26-P, L26-BT, and L26-PBT
Generic term for FX0S, FX0, FX0N, FX1S, FX1N, FX1NC, FXU, FX2C, FX2N, FX2NC, FX3S, FX3G,
FXCPU
FX3GC, FX3U, and FX3UC
CPU module Generic term for QCPU (Q mode), LCPU, and FXCPU
SFC Generic term for MELSAP3, MELSAP-L, and FX series SFC
A - 17
MEMO
A - 18
1
OVERVIEW
1 OVERVIEW 2
CREATED PROGRAM
CONFIGURATION
This manual explains the procedures to actually create a program (Structured Project) using GX Works2 and
AND SYSTEM
operate the programmable controller using the created program.
If this is your first time creating a Structured Project using GX Works2, you are recommended to read this
manual first, and then use GX Works2.
Refer to the following manual for Simple Projects: 3
GX Works2 Beginner’s Manual (Simple Project)
CREATING PROGRAM IN
STRUCTURED LADDER/
FBD LANGUAGE
4
1.1 Simple Project and Structured Project . . . . . . . . . . . . . . . . . . . 1-2
1.2 Program Creation Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4
PROGRAM IN ST
LANGUAGE
CREATING
5
CREATING TWO OR
MORE PROGRAM
BLOCKS
1-1
GX Works2
1 OVERVIEW
■ Simple Project
In a Simple Project, you can create sequence programs using instructions for the Mitsubishi
programmable controller CPU.
The Simple Project offers the same operability for program creation as the conventional GX Developer.
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.
■ Structured Project
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.
• Structured Ladder/FBD
Structured Ladder is created based on the relay circuit design technology. Because this
language is easy to understand intuitively, it is used generally for sequence 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.
FBD connects functions and function blocks with ruled lines to describe ladders.
• 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.
1-2
1.1 Simple Project and Structured Project
1
● Text language
• ST (Structured Text)
This text language allows you to describe controls by syntax including alternative sequences
OVERVIEW
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.
2
CREATED PROGRAM
Restrictions
CONFIGURATION
AND SYSTEM
The FXCPU does not support the ST language in Simple Project, and does not support the ladder language
and SFC language in Structured Project.
CREATING PROGRAM IN
STRUCTURED LADDER/
FBD LANGUAGE
4
PROGRAM IN ST
LANGUAGE
CREATING
5
CREATING TWO OR
MORE PROGRAM
BLOCKS
1-3
GX Works2
1 OVERVIEW
1. Opening a project
Procedure Reference
Start GX Works2. 3.2.1
Create a new Structured Project. Or open an existing Structured Project. 3.2.3
2. Setting parameters
Procedure Reference
Set the parameters. 3.2.4
4. Setting labels
Procedure Reference
Define global labels. 3.2.5
Define local labels. --
1-4
1.2 Program Creation Procedure
6.
OVERVIEW
Conversion
Procedure Reference
Compile the program. 3.2.7
2
CREATED PROGRAM
CONFIGURATION
7.
AND SYSTEM
Connecting the programmable controller CPU
Procedure Reference
Connect the personal computer to the programmable controller CPU.
3.3.1
Set the connection destination. 3
CREATING PROGRAM IN
STRUCTURED LADDER/
FBD LANGUAGE
8. Writing to the programmable controller
Procedure Reference
Write the parameters to the programmable controller CPU.
3.3.2 4
Write the program to the programmable controller CPU.
PROGRAM IN ST
LANGUAGE
CREATING
9. Checking operations
Procedure Reference
5
3.4
CREATING TWO OR
Monitor the sequence program execution status, and check operations. 4.4
MORE PROGRAM
5.4
Check for errors in the programmable controller. 3.5
BLOCKS
10.Printing
Procedure Reference
3.7
Print the program and parameters. 4.7
5.7
11.Exiting GX Works2
Procedure Reference
Save the project. 3.8
Exiting GX Works2. 3.9
1-5
GX Works2
1 OVERVIEW
MEMO
1-6
1
OVERVIEW
2 CREATED PROGRAM AND 2
CREATED PROGRAM
SYSTEM CONFIGURATION
CONFIGURATION
AND SYSTEM
This chapter explains the system configuration and gives an overview of the program created by using this
manual.
3
CREATING PROGRAM IN
STRUCTURED LADDER/
FBD LANGUAGE
4
2.1 System Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
2.2 Overview of Program Creation. . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
PROGRAM IN ST
LANGUAGE
CREATING
5
CREATING TWO OR
MORE PROGRAM
BLOCKS
2-1
GX Works2
GX Works2
USB cable
1 Chapter 3
Structured
Ladder
3 Chapter 5
2-2
2.2 Overview of Program Creation
1
Table 2.1 Overview of created program
Number of
Program
program Operation overview Reference
language
blocks
OVERVIEW
2
CREATED PROGRAM
CONFIGURATION
FBD 1 Chapter 3
AND SYSTEM
3
CREATING PROGRAM IN
STRUCTURED LADDER/
FBD LANGUAGE
ST 1 Chapter 4
4
Refer to the following manual.
PROGRAM IN ST
GX Works2 Beginner's Manual (Simple Project)
You can create the Inline ST Box that displays ST language programs in the Ladder Editor, and edit
LANGUAGE
Ladder
CREATING
and monitor ST language programs.
Refer to the following manual for the details.
GX Works2 Version 1 Operating Manual (Simple Project)
SFC
Refer to the following manual. 5
GX Works2 Beginner's Manual (Simple Project)
CREATING TWO OR
MORE PROGRAM
BLOCKS
2-3
GX Works2
MEMO
2-4
1
OVERVIEW
3 CREATING PROGRAM IN 2
STRUCTURED LADDER/
CREATED PROGRAM
CONFIGURATION
AND SYSTEM
FBD LANGUAGE
This chapter explains how to create a program in the Structured Ladder/FBD language with a Structured 3
Project using a simple Structured Ladder program.
CREATING PROGRAM IN
STRUCTURED LADDER/
Refer to the following manuals for the details on structured programs including programming languages,
FBD LANGUAGE
labels, data types and functions (instructions):
MELSEC-Q/L/F Structured Programming Manual (Fundamentals)
Structured Programming Manual of the programmable controller CPU
4
3.1 Created Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2
3.2 Creating a Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
PROGRAM IN ST
3.3 Writing a Project to the programmable controller . . . . . . . . . 3-21
LANGUAGE
CREATING
3.4 Monitoring Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-29
3.5 Diagnosing the programmable controller . . . . . . . . . . . . . . . . 3-38
3.6 Reading a Project from programmable controller . . . . . . . . . 3-39
3.7 Printing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-41
5
CREATING TWO OR
3.8 Saving a Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-47
MORE PROGRAM
3.9 Exiting GX Works2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-48
BLOCKS
3-1
GX Works2
● 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").
1
3.2 Creating a Project
OVERVIEW
Create a project using Structured Ladder programs.
Refer to Section 3.2.8 for creating an FBD program.
2
3.2.1 Starting GX Works2
CREATED PROGRAM
CONFIGURATION
AND SYSTEM
1. Select the software package menu to be
started.
CREATING PROGRAM IN
STRUCTURED LADDER/
FBD LANGUAGE
4
PROGRAM IN ST
2. The selected software package is started.
LANGUAGE
CREATING
5
CREATING TWO OR
MORE PROGRAM
BLOCKS
You can double-click the icon on the desktop to start the software package.
Output window
Displays the compile
result, error information
and warning information.
View selection area
Allows selection of the
view to be displayed.
Status bar
1
3.2.3 Creating a new project
OVERVIEW
1. Perform either procedure below to display the
New Project screen.
• Select [Project] [New]. 2
CREATED PROGRAM
• Click (New).
CONFIGURATION
AND SYSTEM
3
CREATING PROGRAM IN
STRUCTURED LADDER/
FBD LANGUAGE
2. Select the "Series", "Module Type", "Project
Type" and "Language" from the list boxes for
the new project to be created.
After the setting, click the button. 4
Settings
• Series : QCPU (Q mode)
PROGRAM IN ST
• Module Type : Q02/Q02H
LANGUAGE
CREATING
• Project Type : Structured Project*1
• Language : Structured Ladder/FBD
*1: Labels are always available in structured
projects. You do not have to check "Use Label". 5
CREATING TWO OR
MORE PROGRAM
3. GX Works2 creates a new project.
BLOCKS
1
3.2.4 Setting parameters
Set parameters.
OVERVIEW
1. Double-click "Parameter" "PLC Parameter"
on the Project view to display the Q Parameter
Setting screen. 2
CREATED PROGRAM
Double-click it.
CONFIGURATION
AND SYSTEM
3
CREATING PROGRAM IN
STRUCTURED LADDER/
FBD LANGUAGE
2. Click the button to determine the 4
settings and close the screen.
The parameters remain unchanged from the initial
PROGRAM IN ST
setting in the example in this manual.
LANGUAGE
CREATING
Refer to the following manuals for the details on
parameter setting:
GX Works2 Version 1 Operating Manual
(Common) 5
CPU Manual
CREATING TWO OR
MORE PROGRAM
Click the [End] CPU Programming manual
button after
finishing the setting. Manual of the Network being used
BLOCKS
Restrictions
● Characters available for the label name
You can enter up to 32 characters as the label name.
However, note that the following label name will cause a compile error.
• Label name which contains space
• Label name whose first character is a number
• Label name equivalent to a device name
For other characters unavailable for the label name, refer to the following manual.
GX Works2 Version 1 Operating Manual (Common)
OVERVIEW
Label Setting screen.
Settings
• Date Type: Word [Signed]
2
CREATED PROGRAM
CONFIGURATION
AND SYSTEM
3
CREATING PROGRAM IN
STRUCTURED LADDER/
FBD LANGUAGE
You can click to display the Type Selection screen, and then select the Types on this screen.
Settings*1
1) Libraries : ALL
4
2) Type Class : Simple Types
3) Types : Word [Signed]
PROGRAM IN ST
4) Array Element : Not checked
LANGUAGE
CREATING
*1: Set "Libraries", "Type Class", "Types" and "Array
Element" in this order.
CREATING TWO OR
MORE PROGRAM
BLOCKS
5. Directly input the "Device" on the Global Label
Setting screen.
Inputting "Device" in GX Works2 automatically sets
"Address".
In the same way, inputting "Address" automatically
sets "Device".
Settings
• Device: D0
Refer to the following manual for the details on the programming of global labels and labels:
MELSEC-Q/L/F Structured Programming Manual (Fundamentals)
1
3.2.6 Creating a program
Create the Structured ladder/FBD program shown in Section 3.1.2.
OVERVIEW
1. Double-click "POU" "Program"
"POU_01" "Program" on the Project view to
display the POU_01 [PRG] Program [Structured
Ladder/FBD] screen. 2
CREATED PROGRAM
CONFIGURATION
AND SYSTEM
Double-click it.
3
CREATING PROGRAM IN
STRUCTURED LADDER/
FBD LANGUAGE
2. Drag "Function" "LDP" from the Function
Block Selection window, and drop it on the 4
POU_01 [PRG] Program [Structured Ladder/
FBD] screen to position it there.
PROGRAM IN ST
Position "LDP".
LANGUAGE
CREATING
5
CREATING TWO OR
MORE PROGRAM
Positioning Function and Function block using the Element Selection window
You can easily position Function and Function block by dragging them from the Element Selection window.
Perform the following procedure to display the Element Selection Window:
BLOCKS
Select "View" "Docking Window" "Element Selection".
In the example below, drag the Function "LDP" from the Element Selection window, and drop it on the POU_01
[PRG] Program [Structured Ladder/FBD] screen to position it there.
Refer to the following manual for the details:
GX Works2 Version 1 Operating Manual (Structured Project)
2) Drop it.
1) Drag it.
Perform either of the following procedures to turn ON the Auto Connect function.
Click it.
OVERVIEW
Click the input variable "?" of "s", and set the input
variable.
Settings
Input Variable
• s: X0 2
CREATED PROGRAM
CONFIGURATION
AND SYSTEM
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: 3
GX Works2 Version 1 Operating Manual (Structured Project)
CREATING PROGRAM IN
STRUCTURED LADDER/
FBD LANGUAGE
Double-click it to
display the screen.
PROGRAM IN ST
6. Click (Open Contact) on the Structured
LANGUAGE
CREATING
Ladder/FBD toolbar, and then move the cursor
to a desired position to display an open contact
there. Click the open contact to connect it with
the left bus line and enable setting of a variable. 5
CREATING TWO OR
(GX Works2 is using the Auto Connect function
MORE PROGRAM
described in "Point".)
Settings
BLOCKS
• Variable: Y10
OVERVIEW
described in the step 3.
• After drawing a grid line, click (Select Mode)
1)
on the Structured Ladder/FBD toolbar to specify 2
the Select mode.
CREATED PROGRAM
CONFIGURATION
AND SYSTEM
12.Select a ladder block, and click (New
Ladder Block After) on the Structured Ladder/
FBD toolbar to add a ladder block.
Select a ladder block.
3
CREATING PROGRAM IN
STRUCTURED LADDER/
FBD LANGUAGE
Create a one Structured Ladder program in one ladder block.
4
PROGRAM IN ST
13.Click (Open Contact) on the Structured
LANGUAGE
CREATING
Ladder/FBD toolbar, and then move the cursor
to a desired position to display an open contact
there.
Click the open contact to connect it with the left bus
5
CREATING TWO OR
line and enable setting of a variable.
MORE PROGRAM
Variable
Settings
• Variable: X1
BLOCKS
14.Select "Function" "MOVP" on the Function
Block Selection window, drag it, and drop it in a
desired position to position "MOVP" there.
Draw a grid line on the left figure (position 1) using
1)
the procedure described in the step 3.
Click "?" of "s" and "d", and set the input and output
variables.
Input variable "s" Output variable "d" Settings
• s: 10
• d: VAR1*1
Refer to the following manual for the details on the Label Registration/Selection screen:
GX Works2 Version 1 Operating Manual (Structured Project)
OVERVIEW
Ladder/FBD toolbar, and then move the cursor
to a desired position to display an open contact
there.
Click the open contact to connect it with the left bus 2
line and enable setting of a variable.
CREATED PROGRAM
Settings
CONFIGURATION
• Variable: X2
AND SYSTEM
17.Select "Function" "MOVP" on the Function
Block Selection window, drag it, and drop it in a 3
desired position to position "MOVP" there.
CREATING PROGRAM IN
STRUCTURED LADDER/
1)
Draw a grid line on the left figure (position 1) using
FBD LANGUAGE
the procedure described in the step 3.
Click "?" of "s" and "d", and set the input and output
Input variable "s" Output variable "d" variables.
Settings
• s: 20 4
• d: VAR1*1
PROGRAM IN ST
*1: The label VAR1 is set in Section 3.2.5.
LANGUAGE
CREATING
(To the next page)
5
CREATING TWO OR
MORE PROGRAM
BLOCKS
When copying only a ladder symbol such as contact, coil and function, click a desired ladder symbol, drag it,
and drop it while pressing the key to copy the ladder symbol.
1
3.2.7 Compiling a program
There are two types of compiling shown below. The compile target is different between the two types.
OVERVIEW
Select "Rebuild All" here.
The "Rebuild All" procedure is described below.
Refer to the following manual for compiling:
GX Works2 Version 1 Operating Manual (Structured Project) 2
CREATED PROGRAM
Table 3.1 Compiling type and target program
CONFIGURATION
Target program to be compiled
AND SYSTEM
Converts non-compiled program blocks among program blocks registered in the task into
Build
sequence program. (Does not compile already compiled program blocks.)
Converts all program blocks registered in the task into sequence program.
Rebuild All
(Compiles already compiled program blocks also.)
3
1.
CREATING PROGRAM IN
STRUCTURED LADDER/
Select [Compile] [Rebuild All] to execute
"Rebuild All".
FBD LANGUAGE
You can click (Rebuild All) to execute "Rebuild
All".
4
2. The screen shown on the left appears.
PROGRAM IN ST
Click the button to execute "Rebuild All".
LANGUAGE
CREATING
5
CREATING TWO OR
MORE PROGRAM
BLOCKS
3. When finishing "Rebuild All", GX Works2
displays the result on the Output window.
If an error occurs, check the contents, eliminate
the cause of error, and then execute "Build" or
"Rebuild All" as described in the step 1.
When an error is not detected.
• Make sure to compile the created or edited program to make it a sequence program executable in the
programmable controller CPU.
• "Warning C9062" is compiled correctly as a program, and can be monitored.
• Compile status checking method
You can check the compile status on the Project view.
Create an FBD program using the same procedure for Structured Ladder programs without using left
power rail on the left for Structured Ladder.
Display or hide left power rail by selecting [Edit] on the menu bar, selecting [Ladder Symbol], and
clicking [Left Power Rail].
Or hide Left Power Rail by clicking (Left Power Rail) on the Structured Ladder/FBD tool bar.
Refer to 3.1.2 for an FBD program.
1
3.3 Writing a Project to the programmable controller
OVERVIEW
Write a project to the programmable controller CPU.
CREATED PROGRAM
CONFIGURATION
Connect the personal computer and a programmable controller with a cable, and set the connection
AND SYSTEM
channel.
CREATING PROGRAM IN
STRUCTURED LADDER/
programmable controller CPU.
FBD LANGUAGE
Refer to the following manual for the details on setting when using another channel or using the FXCPU
for connection.
Notebook personal computer
Programmable controller
(Q02HCPU)
4
PROGRAM IN ST
USB Cable
LANGUAGE
CREATING
■ Setting the Transfer Setup
Set the channel to connect the personal computer to the programmable controller CPU (Q02HCPU) 5
with a USB cable.
CREATING TWO OR
MORE PROGRAM
Refer to the following manual for the details on setting when using another channel or using the FX
CPU for connection.
BLOCKS
GX Works2 Version 1 Operating Manual (Common)
Double-click it.
Click it.
6.
OVERVIEW
Click the button to execute
a communication test with the programmable
controller through the specified connection
Click it. channel. 2
CREATED PROGRAM
CONFIGURATION
AND SYSTEM
3
CREATING PROGRAM IN
STRUCTURED LADDER/
FBD LANGUAGE
7. When communication with the programmable
4
controller is finished normally, the left screen
PROGRAM IN ST
appears, and the "PLC Type" field screen the
LANGUAGE
programmable controller CPU model name.
CREATING
Click the button to close the screen.
If communication with the programmable controller
has failed, the screen below appears. 5
Check the connection destination, connection cable,
CREATING TWO OR
MORE PROGRAM
etc.
BLOCKS
8. Click the button to finish "Transfer
Setup" and close the screen.
● You can set two or more connection destinations and change them over if there are two or more
connection destinations.
1. Select "Connection1" in the Current
Connection on the Connection
Destination view, right-click it, and then
select the menu item "Add New Data".
The Add New Data screen will appear.
Settings
• Data Name : Connection2
• Set as Default Connection: Unchecked
● For selecting the newly created connection destination, check "Set as Default Connection " while creating
the data, or set the newly created connection destination as the default connection destination as described
OVERVIEW
below.
Then, the newly created connection destination will be selected as the connection destination for
communication with the programmable controller CPU (for "Read from PLC", "Write to PLC", etc).
CREATED PROGRAM
Connections on the Connection
CONFIGURATION
Destination view, right-click it, and then
AND SYSTEM
select the menu item "Set as Default
Connection".
CREATING PROGRAM IN
STRUCTURED LADDER/
FBD LANGUAGE
4
PROGRAM IN ST
2. The connection destination set as the
LANGUAGE
CREATING
default connection destination is
displayed in "Current Connection" on the
Connection Destination view.
5
CREATING TWO OR
MORE PROGRAM
Default Connection
BLOCKS
Write the project data to the programmable controller CPU set as the connection destination in Section
3.3.1.
Click it.
Setting of the project
Restrictions
OVERVIEW
In the case of FXCPU
• The symbolic information is displayed only in the FX3U and FX3UC Series version 3.00 or later.
• In the case of structured project, data can be read from the FXCPU only in the FX3U and FX3UC Series version
3.00 or later.
When data cannot be read from the FXCPU, carefully store projects written in the programmable controller. 2
CREATED PROGRAM
3. The left screen is displayed.
CONFIGURATION
AND SYSTEM
Click the button to write
the project (program).
CREATING PROGRAM IN
STRUCTURED LADDER/
FBD LANGUAGE
If a program or parameters already exist in the programmable controller, the following screen appears.
Click the or button to overwrite the existing program or parameters.
When you click the button, GX Works2 overwrite the existing program or parameters without
4
displaying the overwrites confirmation screen for other data.
PROGRAM IN ST
When parameters already exist When a program already exists
LANGUAGE
CREATING
5
CREATING TWO OR
MORE PROGRAM
BLOCKS
4. The left screen is displayed during
writing.
When writing is finished, "Write to
PLC: Completed" appears.
Click the button to close the
Write to PLC screen.
Writing Completed
1
3.4 Monitoring Operations
OVERVIEW
Execute "Monitor" to check the operations.
In some monitor screen display examples, colors are changed for the convenience of printing.
GX Works2 has the function to simulate programmable controller operations in the offline mode.
Refer to the following manual for the simulation function: 2
GX Works2 Version 1 Operating Manual (Common)
CREATED PROGRAM
CONFIGURATION
3.4.1 Monitoring a program
AND SYSTEM
1. Click "Project" in the view selection area on the
Navigation window to display the Project view. 3
CREATING PROGRAM IN
STRUCTURED LADDER/
Click it.
FBD LANGUAGE
2. Double-click "POU" "Program" 4
"POU_01" "Program" on the Project view to
display the POU_01 [PRG] Program [Structured
PROGRAM IN ST
Ladder/FBD] screen.
LANGUAGE
CREATING
5
CREATING TWO OR
MORE PROGRAM
Double-click it.
BLOCKS
3. Select [Online] [Monitor] [Start
Monitoring] to switch the POU_01 [PRG]
Program [Structured Ladder/FBD] screen to the
monitoring status.
You can switch the programmable controller status between "RUN" and "STOP" using remote operation as
follows.
The Settings of the remote operation may vary depending on the programmable controller used.
Refer to the following manual for the details on the remote operation:
GX Works2 Version 1 Operating Manual (Common)
Select [Online] [Remote Operation] to display the Remote Operation screen. You can switch the
programmable controller status between "RUN" and "STOP" on this screen.
Connection Channel
List information
Displays the connection
Specify Execution
target information Target
currently set. Allows you to set the
Programmable target station for
remote operation.
controller status Select "Currently
Displays the programmable Specified Station" for
controller CPU status. this example.
Operation
Allows you to select the
programmable controller
CPU status to be set.
Select either "RUN",
"PAUSE" or "STOP" for
this example.
Operation during RUN
Allows you to set the
operations to be
executed to the device
memory and signal
flow when the
programmable
controller CPU is
switched to RUN.
Monitor status
OVERVIEW
GX Works2 displays the Monitor status while it is executing the work window monitor.
The Monitor status disappears when GX Works2 stops all types of monitoring.
The Monitor status indicates the programmable controller CPU, simulator scan time, RUN/STOP status, etc.
Scan status
2
Select the Local Device monitor
CREATED PROGRAM
CONFIGURATION
AND SYSTEM
USER status
ERR. status
3
RUN/STOP status
Connection status
CREATING PROGRAM IN
STRUCTURED LADDER/
Refer to the following manual for the Monitor status:
GX Works2 Version 1 Operating Manual (Common)
FBD LANGUAGE
Monitor status display
● Display of bit value status (ON/OFF status)
GX Works2 displays the ON/OFF status (bit values) of contacts, coils, etc. as the ON/OFF status of devices and
labels.
Refer to the following manual for the bit value ON/OFF status display:
4
GX Works2 Version 1 Operating Manual (Common)
OFF status ON status
PROGRAM IN ST
LANGUAGE
CREATING
● Display of contents status (current value) other than bit values
GX Works2 displays the current values (of non -bit devices for) of contacts, coils, etc. and the contents of
character strings as shown below.
5
CREATING TWO OR
MORE PROGRAM
Current value of VAR1
BLOCKS
You can switch the current value display between decimal and hexadecimal using the following operations.
Operation to switch the current value display to decimal
Select [Online] [Monitor] [Change Value Format (Decimal)].
Operation to switch the current value display to hexadecimal
Select [Online] [Monitor] [Change Value Format (Hexadecimal)].
Test operation
● Forcing a contact ON/OFF
Double-click a monitored device or label while pressing the key to force a device in the programmable
controller ON/OFF.
● Changing the current value of a word device
Double-click a monitored word device to display the Modify Value screen where you can change the current
value.
5. Turn ON inputs X0, X1 and X2 in the programmable controller, and check the following
OVERVIEW
operations.
You can turn ON inputs X0, X1 and X2 using the test operation above.
• When X0 turns ON, the programmable controller turns ON Y10, and then turns OFF Y10 1 2
second later.
CREATED PROGRAM
CONFIGURATION
X0 turns ON. Y10 remains ON for 1 second.
AND SYSTEM
3
CREATING PROGRAM IN
STRUCTURED LADDER/
• When X1 turns ON, the programmable controller transfers K10 to VAR1 (device: D0).
FBD LANGUAGE
X1 turns ON. The programmable controller transfers K10 to VAR1.
4
• When X2 turns ON, the programmable controller transfers K20 to VAR1 (device: D0).
PROGRAM IN ST
X2 turns ON. The programmable controller transfers K20 to VAR1.
LANGUAGE
CREATING
5
CREATING TWO OR
6.
MORE PROGRAM
Select [Online] [Monitor] [Stop
Monitoring] to reset the monitor status of the
POU_01 [PRG] Program [Structured Ladder/
BLOCKS
FBD] screen.
Setting
2. Set a device to be monitored.
Select D0 in this example.
Setting of "Device"
• Device : Select "Device Name".
• Device Name : D0
Restrictions
Set a device/address to be monitored.
Label Name is not available.
OVERVIEW
monitored.
Setting on the Display Format screen
• Monitor Format : Bit and Word
• Display : 16 bit Integer
2
CREATED PROGRAM
• Value : DEC
CONFIGURATION
• Bit Order : 0-F
AND SYSTEM
• Switch No. of Points : Bit Device Bit and Word
Format 16 Points
Word Device Word Multi-
point Format 8 Points
After the setting, click the button to close
3
CREATING PROGRAM IN
STRUCTURED LADDER/
the Display Format screen.
Refer to the following manual for the details on
FBD LANGUAGE
Display Format.
GX Works2 Version 1 Operating Manual
(Common)
4
PROGRAM IN ST
● You can save the contents set on the Display Format screen.
LANGUAGE
When the monitoring screen is opened again, the contents set previously on the "Display
CREATING
Format" screen will not be displayed. (The default setting will be displayed.) To display the
previous setting, you can save the setting to a file, and read the file. To save the setting, click
button on the Device/Buffer Memory Batch Monitor screen. To read the saved setting,
click button on the Device/Buffer Memory Batch screen Monitor screen. 5
CREATING TWO OR
● You can set the data display format also on the Device/Buffer Memory Batch Monitor screen.
MORE PROGRAM
For setting the display format, click the "Display Format" button on the Device/Buffer Memory
Batch Monitor screen.
The contents of setting are reflected on the Display Format screen.
BLOCKS
5. Click (Start Monitoring) on the toolbar to
start monitoring.
OVERVIEW
● Changing the current value
Click the button on the Device/Buffer Memory Batch Monitor screen to display the Modify
Value screen which allows you to change the current value. 2
CREATED PROGRAM
1. Select a device whose current
CONFIGURATION
value is to be changed.
AND SYSTEM
Selecting 3
CREATING PROGRAM IN
STRUCTURED LADDER/
FBD LANGUAGE
4
2. Click the button to
display the Modify Value screen.
PROGRAM IN ST
Or click (Modify Value) to display
LANGUAGE
CREATING
the Modify Value screen.
Click it.
5
CREATING TWO OR
MORE PROGRAM
BLOCKS
3. Change the current value.
For the change procedure, refer to the
following.
"Point" in the 3.4.1
1)
13) 2)
3)
4)
7)
8)
14) 9)
5)
10)
11)
7)
9)
12)
15)
16) 6)
No. Item Description
Connection Channel List:
1) Connection Channel List Displays the information on connection between the personal computer and the programmable controller CPU.
System Image: Displays visually the Connection Channel List.
CPU information of
2) Displays the model name, operation status and switch status.
connected station
Displayed information Select a radio button to display Error Information (Current Error and Error History)/Continuation
3)
selection Error Information/PLC Status Information/Serial Communication Error.
Check this check box to reduce the PLC Diagnostics screen size and adjust the display position at
4) Setting for Error Jump
the time of Error Jump.
5) Current Error Displays the current CPU error information.
6) Error History Displays the error history.
Jumps to the ladder step number which contains the error corresponding to the currently selected
7) Error Jump
error number.
8) Error Clear Clears the error information displayed in "Current Error".
9) Error Help Displays the explanation window for the currently selected error number.
10) Error History Displays the latest error history.
11) Clear History Deletes the error history list in "Error History".
12) Status Icon Legend Indicates icons corresponding to errors displayed in the "Status" column of the "Error Information".
13) Monitor Status Indicates the monitoring status (executed or stopped).
Programmable controller
14) Displays the programmable controller CPU status.
CPU information
15) Stop Monitor Starts or stops monitoring.
16) Create CSV File Saves the error information to a CSV file.
1
3.6 Reading a Project from programmable controller
OVERVIEW
You can read data to a project from the programmable controller CPU selected as the connection destination
in Section 3.3.1.
CREATED PROGRAM
screen.
CONFIGURATION
You can click (Read from PLC) to
AND SYSTEM
display the Online Data Operation
screen.
3
2. Set the "Target module" and "Target
CREATING PROGRAM IN
STRUCTURED LADDER/
project" on the Online Data
FBD LANGUAGE
Operation screen.
Setting of the target module
After the setting, click the
button to read the project (program)
from the programmable controller.
4
PROGRAM IN ST
LANGUAGE
CREATING
Click it.
Setting of the project
CREATING TWO OR
Setting of the target module
MORE PROGRAM
• Target module: Select <<PLC Module>>.
BLOCKS
Setting of the project
• Symbolic Information : Select "Program Memory/Device Memory" in "Target Memory", and
check "GX Works2 (Structured Project)" in "Target".
"Symbolic Information" contains program files and variables.
• PLC Data : Select "Program Memory/Device Memory" in "Target Memory", and
check "PLC/Network/Remote Password/Switch Setting" in "Target". *1
Do not check "Global Device Comment" and "Device Memory".
*1: If you have checked desired items for the Write to PLC setting, such items are checked as the
default for the Read from PLC setting.
Restrictions
In the case of FXCPU
• In the case of structured project, data can be read from the FXCPU only in the FX3U and FX3UC Series version
3.00 or later.
When data cannot be read from the FXCPU, carefully store projects written in the programmable controller.
If a program or parameters already exist in the GX Works2, the following screen appears.
Click the or button to overwrite the existing program or parameters.
When you click the button, GX Works2 overwrite the existing program or parameters without
displaying the overwrites confirmation screen for other data.
Reading Completed
1
3.7 Printing
OVERVIEW
You can print programs and parameters created using GX Works2 in a printer.
The print function consists of Batch print and print. This section explains print.
For details of printing, refer to the following manual.
GX Works2 Version 1 Operating Manual (Common) 2
CREATED PROGRAM
3.7.1 Setting the printer
CONFIGURATION
AND SYSTEM
The printer which prints is set up.
1. Select [Project] [Printer Setup] to display the
Printer Setup screen.
3
CREATING PROGRAM IN
STRUCTURED LADDER/
FBD LANGUAGE
4
PROGRAM IN ST
LANGUAGE
CREATING
5
CREATING TWO OR
MORE PROGRAM
BLOCKS
2. Select the Printer, Paper size, Orientation, etc.
After the setting, click the button to close
the Printer Setup screen.
Click it.
Double-click it.
OVERVIEW
2
CREATED PROGRAM
CONFIGURATION
AND SYSTEM
3
CREATING PROGRAM IN
STRUCTURED LADDER/
FBD LANGUAGE
4
4. After checking the contents, click the button to print the program.
PROGRAM IN ST
Click the button to close the Print Window Preview screen.
LANGUAGE
CREATING
Click button to print the program.
CREATING TWO OR
MORE PROGRAM
BLOCKS
1. Display a program.
For the display procedure, refer to the following.
3.7.2 Previewing a program
Click it.
1
3.7.4 Previewing a PLC Parameter
OVERVIEW
You can display PLC Parameter in the image of printing.
1. Display PLC parameters.
Double-click "Parameter" "PLC Parameter" on
Double-click it. the Project view to display the Q Parameter Setting 2
screen.
CREATED PROGRAM
CONFIGURATION
AND SYSTEM
3
CREATING PROGRAM IN
STRUCTURED LADDER/
FBD LANGUAGE
2. Click the button.
PROGRAM IN ST
LANGUAGE
CREATING
Click it.
5
CREATING TWO OR
MORE PROGRAM
BLOCKS
Click button to print PLC 3. After checking the contents, click the
Parameter. button to print PLC Parameter.
Click the button to close the Print Window
Preview screen.
Click it.
Click it.
1
3.8 Saving a Project
OVERVIEW
You can save a project.
When saving a newly created project, use the menu item [Save as].
CREATED PROGRAM
CONFIGURATION
AND SYSTEM
3
2. Set the "Save Location", "Workspace Name",
CREATING PROGRAM IN
STRUCTURED LADDER/
"Project Name", "Title", etc.
FBD LANGUAGE
After the setting, click the button to save the
project (program).
Refer to the following manual for the details:
GX Works2 Version 1 Operating Manual 4
(Common)
Settings
PROGRAM IN ST
• Save in : Specify the save destination
LANGUAGE
CREATING
folder.
• File name : Specify the file name.
• Title : Specify the title.
You can save a project without 5
specifying a title.
CREATING TWO OR
MORE PROGRAM
BLOCKS
Restrictions
● Input within 128 characters to "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:\".
If you have not saved the project, the following message appears.
Click the button to save the project.
Click the button to exit GX Works2 without saving the project.
OVERVIEW
4 CREATING PROGRAM IN 2
CREATED PROGRAM
ST LANGUAGE
CONFIGURATION
AND SYSTEM
This chapter explains how to create a program in the ST language with a Structured Project using a simple ST
program.
Refer to the following manuals for the details on structured programs including programming languages,
3
CREATING PROGRAM IN
STRUCTURED LADDER/
labels, data types and functions (instructions):
MELSEC-Q/L/F Structured Programming Manual (Fundamentals)
FBD LANGUAGE
Structured Programming Manual of the programmable controller CPU
4
4.1 Created Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
4.2 Creating a Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3
PROGRAM IN ST
4.3 Writing a Project to the programmable controller . . . . . . . . . . 4-8
LANGUAGE
CREATING
4.4 Monitoring Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8
4.5 Diagnosing the programmable controller . . . . . . . . . . . . . . . . 4-12
4.6 Reading a Project from programmable controller . . . . . . . . . 4-12
4.7 Printing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-12
5
CREATING TWO OR
4.8 Saving a Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-12
MORE PROGRAM
4.9 Exiting GX Works2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-12
BLOCKS
4-1
GX Works2
● 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").
1
4.2 Creating a Project
OVERVIEW
Create a project using ST program.
CREATED PROGRAM
Refer to the following section for the GX Works2 startup procedure:
CONFIGURATION
3.2.1 Starting GX Works2
AND SYSTEM
4.2.2 Screen configuration in GX Works2 3
CREATING PROGRAM IN
STRUCTURED LADDER/
Refer to the following section for the GX Works2 screen configuration:
FBD LANGUAGE
3.2.2 Screen configuration in GX Works2
PROGRAM IN ST
Refer to the following section for the new project creation procedure:
LANGUAGE
3.2.3 Creating a new project
CREATING
4.2.4 Setting parameters 5
CREATING TWO OR
MORE PROGRAM
Refer to the following section for the parameter setting procedure:
3.2.4 Setting parameters
BLOCKS
Refer to the following manuals for the details on parameter setting:
GX Works2 Version 1 Operating Manual (Common)
CPU Manual
CPU Programming manual
Refer to the following section for the global label setting procedures:
3.2.5 Setting labels
Refer to the following manual for the details on global/local label setting procedures:
GX Works2 Version 1 Operating Manual (Structured Project)
Refer to the following manual for the details on programming of global labels and local labels:
MELSEC-Q/L/F Structured Programming Manual (Fundamentals)
Double-click it.
Settings
• Y10:= (LDP(TRUE*1, X0) OR Y10) AND NOT
(TS0*2);
1
● Display colors
GX Works2 displays syntax, operators, comments, constants, string constants, devices and labels using the
following colors (in the initial setting).
OVERVIEW
• Syntax: ( blue)
• Operator: ( black )
• Comment: ( dark green )
• Constant: ( black ) 2
CREATED PROGRAM
• String constant: ( black )
CONFIGURATION
• Device: ( black )
AND SYSTEM
• Global label: ( magenta )
• Local label: ( magenta )
CREATING PROGRAM IN
STRUCTURED LADDER/
In the example below, drag the function "LDP" from the Function Block Selection window, and drop it on the
POU_01 [PRG] Program [ST] screen to input it there. After that, input the parameters of the function.
FBD LANGUAGE
Refer to the following manual for the details:
GX Works2 Version 1 Operating Manual (Structured Project)
PROGRAM IN ST
2) Drop it.
LANGUAGE
CREATING
1) Drag it.
CREATING TWO OR
3. Input "OUT_T(Y10,TC0*1,10);" directly, and
MORE PROGRAM
click the key.
BLOCKS
You can select "Function" "OUT_T" on the
Function Block Selection window.
Settings
• OUT_T(Y10,TC0*1,10);
Refer to the following manual for the details on the Label Registration/Selection screen:
GX Works2 Version 1 Operating Manual (Structured Project)
Using templates
Using templates according to the instructions/functions.
OVERVIEW
3.2.7 Compiling a program
GX Works2 Version 1 Operating Manual (Structured Project)
CREATED PROGRAM
CONFIGURATION
AND SYSTEM
3
CREATING PROGRAM IN
STRUCTURED LADDER/
FBD LANGUAGE
4
PROGRAM IN ST
LANGUAGE
CREATING
5
CREATING TWO OR
MORE PROGRAM
BLOCKS
Click it.
Double-click it.
You can switch the programmable controller status between "RUN" and "STOP" using remote operation as
follows.
OVERVIEW
The Settings of the remote operation may vary depending on the programmable controller used.
Refer to the following manual for the details on the remote operation:
GX Works2 Version 1 Operating Manual (Common)
Select [Online] [Remote Operation] to display the Remote Operation screen. You can switch the
programmable controller status between "RUN" and "STOP" on this screen. 2
CREATED PROGRAM
Connection Channel
CONFIGURATION
List information
AND SYSTEM
Displays the connection
target information Specify Execution
currently set. Target
Allows you to set the
Programmable target station for
controller status
remote operation.
Select "Currently 3
Specified Station" for
CREATING PROGRAM IN
STRUCTURED LADDER/
Displays the programmable
controller CPU status. this example.
Operation
FBD LANGUAGE
Allows you to select the
programmable controller
CPU status to be set.
Select either "RUN",
"PAUSE" or "STOP" for
this example.
Operation during RUN
4
Allows you to set the
PROGRAM IN ST
operations to be
executed to the device
memory and signal
LANGUAGE
CREATING
flow when the
programmable
controller CPU is
switched to RUN.
CREATING TWO OR
Monitor status display example
MORE PROGRAM
BLOCKS
Displays the OFF status.
Monitor status
GX Works2 displays the Monitor status while it is executing the work window monitor.
The Monitor status disappears when GX Works2 stops all types of monitoring.
The Monitor status indicates the programmable controller CPU, simulator scan time, RUN/STOP status, etc.
Scan status
Select the Local Device monitor
USER status
ERR. status
RUN/STOP status
Connection status
Refer to the following manual for the Monitor status:
GX Works2 Version 1 Operating Manual (Common)
Monitor status display
● Switching of the current value display between decimal and hexadecimal
You can switch the current value display between decimal and hexadecimal using the following procedure.
Test operation
● Forcing a contact ON/OFF
Double-click a monitored device or label while pressing the key to force a device in the programmable
controller ON/OFF.
● Changing the current value of a word device
Double-click a monitored word device to display the Modify Value screen where you can change the current
value.
5. Turn ON inputs X0, X1 and X2 in the programmable controller, and check the following
OVERVIEW
operations.
You can turn ON inputs X0, X1 and X2 using the test operation above.
• When X0 turns ON, the programmable controller turns ON Y10, and then turns OFF Y10 1
2
second later.
CREATED PROGRAM
CONFIGURATION
AND SYSTEM
Y10 remains ON X0 turns ON.
for 1 second.
• When X1 turns ON, the programmable controller transfers K10 to VAR1 (device: D0).
3
CREATING PROGRAM IN
STRUCTURED LADDER/
FBD LANGUAGE
VAR1 becomes "10".
X1 turns ON.
• When X2 turns ON, the programmable controller transfers K20 to VAR1 (device: D0). 4
PROGRAM IN ST
LANGUAGE
CREATING
X2 turns ON. VAR1 becomes "20".
CREATING TWO OR
6. Select [Online] [Monitor] [Stop
MORE PROGRAM
Monitoring] to stop (pause) the monitor status
on the POU_01 [PRG] Program [ST] screen.
BLOCKS
You can click (Stop Monitoring) to reset the
POU_01 [PRG] Program [ST] screen.
For the Batch monitoring of device values procedure, refer to the following.
3.4.2 Batch monitoring of device values
4.7 Printing
For the Saving a Project procedure, refer to the following.
3.7 Printing
OVERVIEW
5 CREATING TWO OR MORE 2
CREATED PROGRAM
PROGRAM BLOCKS
CONFIGURATION
AND SYSTEM
This chapter explains how to create a Structured Project in which two or more program blocks are made into
one program using a simple example.
Refer to the following manuals for the details on structured programs including programming languages,
3
CREATING PROGRAM IN
STRUCTURED LADDER/
labels, data types and functions (instructions):
MELSEC-Q/L/F Structured Programming Manual (Fundamentals)
FBD LANGUAGE
Structured Programming Manual of the programmable controller CPU
4
5.1 Created Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
5.2 Creating a Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4
PROGRAM IN ST
5.3 Writing a Project to the programmable controller . . . . . . . . . 5-12
LANGUAGE
CREATING
5.4 Monitoring Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-12
5.5 Diagnosing the programmable controller . . . . . . . . . . . . . . . . 5-18
5.6 Reading a Project from programmable controller . . . . . . . . . 5-18
5.7 Printing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-19
5
CREATING TWO OR
5.8 Saving a Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-19
MORE PROGRAM
5.9 Exiting GX Works2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-19
BLOCKS
5-1
GX Works2
Tea leaf
replacement
Tea leaf indicator lamp
replacement Y12
check button
Water refill output
X2
Y11
Cup detection
X0
When a user presses the tea pouring button X1 (that is, when X1 turns ON) while the cup detection
X0 is ON, the tea pouring output Y10 turns ON and the tea server pours tea into the cup. The tea
server pours tea while the user is pressing and holding the button, and stops pouring when the user
releases the button.
The tea server does not pour tea when the user presses the tea pouring button X1 if the cup
detection X0 is OFF.
When water inside the water refill tank is running low, the lower limit switch X3 turns ON, and the
water refill output Y11 turns ON.
When the water refill output Y11 is ON and the water supply to the tank is sufficient, the upper limit
switch X4 turns ON and the water refill output Y11 turns OFF.
• When the tea server performs the water refilling operation 5 times, the tea leaf replacement
indicator lamp Y12 turns ON.
• When a user presses the tea leaf replacement check button X2, the tea leaf replacement indicator
lamp Y12 turns OFF.
1
5.1.2 Created program
OVERVIEW
■ Program block for the tea pouring operation
2
CREATED PROGRAM
CONFIGURATION
AND SYSTEM
3
■ Program block for the water refilling operation
CREATING PROGRAM IN
STRUCTURED LADDER/
FBD LANGUAGE
4
PROGRAM IN ST
LANGUAGE
CREATING
■ Program block for the warning indicating operation
5
CREATING TWO OR
MORE PROGRAM
BLOCKS
Refer to the following section for the new project creation procedure:
3.2.3 Creating a new project
1
5.2.5 Preparing (creating) the program configuration
Create a POU (three program blocks) for Structured Ladder/FBD program, and register the three
OVERVIEW
program blocks created in the POU to a task.
When you create a new project, GX Works2 automatically creates the Program File, Task and POU
shown in the table below.
2
Table 5.1 Name of Program File, Task and POU created automatically
CREATED PROGRAM
Item Name
CONFIGURATION
Program Setting
AND SYSTEM
MAIN
(No Execution Type)
Task_01
Task
The program block "POU_01" is registered in "Task_01".
POU POU_01 3
CREATING PROGRAM IN
STRUCTURED LADDER/
1. Select "POU" "Program" "POU_01" on the
Project view, right-click "POU_01", and then
FBD LANGUAGE
select the menu item "Delete".
PROGRAM IN ST
LANGUAGE
CREATING
5
CREATING TWO OR
MORE PROGRAM
BLOCKS
When creating a new project, GX Works2 automatically creates "POU_01 [PRG]" under "POU_Pool".
Because the language (Structured Ladder/FBD) used in this chapter is same as the language adopted in
"POU_01 [PRG]", you can use "POU_01 [PRG]" by changing its data name instead of deleting it.
OVERVIEW
*1
Type" "MAIN" Task_01 on the Project
view, right-click the Task_01, and then select
the menu item "Open Task Setting".
The Task Setting (task name*1) window appears. 2
CREATED PROGRAM
*1: The Task Name is "Task_01" for this example.
CONFIGURATION
AND SYSTEM
3
CREATING PROGRAM IN
STRUCTURED LADDER/
FBD LANGUAGE
4
PROGRAM IN ST
LANGUAGE
CREATING
6. Click the button to display the Program
Selection screen.
Click it.
5
CREATING TWO OR
MORE PROGRAM
BLOCKS
7. Select the program block name.
Click the button to register the selected
program block to the Task Setting screen and close
the Program Selection screen.
Refer to the following section for the global label setting procedures:
Refer to the following "Setting global labels" for settings:
3.2.5 Setting labels
Refer to the following manual for the details on global/local label setting procedures:
GX Works2 Version 1 Operating Manual (Structured Project)
Refer to the following manual for the details on programming of global labels and local labels:
MELSEC-Q/L/F Structured Programming Manual (Fundamentals)
1
5.2.7 Creating a program
Refer to the following section and manual for the program creation procedures:
OVERVIEW
3.2.6 Creating a program
GX Works2 Version 1 Operating Manual (Structured Project)
2
■ Creating the program block for the tea pouring operation
CREATED PROGRAM
CONFIGURATION
Create the program block for the tea pouring operation shown in Section 5.1.2.
AND SYSTEM
1. Double-click "POU" "Program" "pouring"
"Program" on the Project view to display the
pouring [PRG] Program [Structured Ladder/ 3
FBD] screen.
CREATING PROGRAM IN
STRUCTURED LADDER/
FBD LANGUAGE
Double-click it.
4
PROGRAM IN ST
LANGUAGE
CREATING
5
CREATING TWO OR
MORE PROGRAM
2. Create the program block for the tea pouring
BLOCKS
operation shown in Section 5.1.2.
Refer to the following section and manual for the
program creation procedures:
3.2.6 Creating a program
GX Works2 Version 1 Operating Manual
(Structured Project)
Create the program block for the water refilling operation shown in Section 5.1.2.
Double-click it.
OVERVIEW
Create the program block for the warning indicating operation shown in Section 5.1.2.
CREATED PROGRAM
FBD] screen.
CONFIGURATION
AND SYSTEM
3
CREATING PROGRAM IN
STRUCTURED LADDER/
FBD LANGUAGE
Double-click it.
PROGRAM IN ST
2. Create the program block for the warning
LANGUAGE
indicating operation shown in Section 5.1.2.
CREATING
Refer to the following section and manual for the
program creation procedures:
3.2.6 Creating a program 5
GX Works2 Version 1 Operating Manual
CREATING TWO OR
MORE PROGRAM
(Structured Project)
Click it.
OVERVIEW
You can also click (Start Monitoring), to switch
individual screens to the monitoring status.
2
4. Set the programmable controller CPU to RUN.
CREATED PROGRAM
CONFIGURATION
Set the RUN/STOP switch on the programmable
AND SYSTEM
controller CPU to "RUN".
You can also switch the programmable controller
status between "RUN" and "STOP" using remote
operation.
Refer to the next page for remote operation.
3
CREATING PROGRAM IN
STRUCTURED LADDER/
FBD LANGUAGE
4
PROGRAM IN ST
LANGUAGE
CREATING
(To the next page)
5
CREATING TWO OR
MORE PROGRAM
BLOCKS
You can switch the programmable controller status between "RUN" and "STOP" using remote operation as
follows.
The Settings of the remote operation may vary depending on the programmable controller used.
Refer to the following manual for the details of the remote operation:
GX Works2 Version 1 Operating Manual (Common)
Select [Online] [Remote Operation] to display the Remote Operation screen. You can switch the
programmable controller status between "RUN" and "STOP" on this screen.
Connection Channel
List information
Displays the connection
target information
Specify Execution
currently set. Target
Allows you to set the
target station for
Programmable remote operation.
controller status Select "Currently
Displays the programmable Specified Station" for
this example.
controller CPU status.
Operation
Allows you to select the
programmable controller
CPU status to be set.
Select either "RUN",
"PAUSE" or "STOP" for
this example.
Operation during RUN
Allows you to set the
operations to be executed
to the device memory and
signal flow when the
programmable controller
CPU is switched to RUN.
Monitor status
OVERVIEW
GX Works2 displays the Monitor status while it is executing the work window monitor.
The Monitor status disappears when GX Works2 stops all types of monitoring.
The Monitor status indicates the programmable controller CPU, simulator scan time, RUN/STOP status, etc.
Scan status
Select the Local Device monitor
2
CREATED PROGRAM
CONFIGURATION
AND SYSTEM
USER status
ERR. status
RUN/STOP status
Connection status
3
CREATING PROGRAM IN
STRUCTURED LADDER/
Refer to the following manual for the Monitor status:
GX Works2 Version 1 Operating Manual (Common)
FBD LANGUAGE
Monitor status display
● Display of bit value status (ON/OFF status)
GX Works2 displays the ON/OFF status (bit values) of contacts, coils, etc. as the ON/OFF status of devices and
labels.
Refer to the following manual for the bit value ON/OFF status display:
GX Works2 Version 1 Operating Manual (Common)
4
OFF status ON status
PROGRAM IN ST
LANGUAGE
CREATING
● Display of contents status (current value) other than bit values
GX Works2 displays the current values of non-bit device for contacts, coils, etc. and the contents of character
5
CREATING TWO OR
strings as shown below.
MORE PROGRAM
Current value of label Current value of label
BLOCKS
● Switching of the current value display between decimal and hexadecimal
You can switch the current value display between decimal and hexadecimal using the following operations.
Operation to switch the current value display to decimal
Select [Online] [Monitor] [Change Value Format (Decimal)].
Operation to switch the current value display to hexadecimal
Select [Online] [Monitor] [Change Value Format (Hexadecimal)].
Test operation
● Forcing a contact ON/OFF
Double-click a monitored device or label while pressing the key to force a device in the programmable
controller ON/OFF.
● Changing the current value of a word device
Double-click a monitored word device to display the Modify Value screen where you can change the current
value.
5. Turn ON inputs X0, X1 and X2 in the programmable controller, and check the following
OVERVIEW
operations.
You can turn ON inputs X0, X1 and X2 using the test operation above.
• When X1 turns ON while X0 is ON, the programmable controller turns ON Y10. When X1 turns
ON while X0 is OFF, the programmable controller does not turn ON Y10. 2
CREATED PROGRAM
X1 (Tea_pouring_button) turns ON The programmable controller turns ON Y10
(Tea_pouring_output).
CONFIGURATION
while X0 (Cup_detection) is ON.
AND SYSTEM
• When X3 turns ON, the programmable controller turns ON Y11. 3
X3 (Lower_LS_of_water The programmable controller turns ON Y11
CREATING PROGRAM IN
STRUCTURED LADDER/
_tank) turns ON. (Water_refill_output).
FBD LANGUAGE
4
• When X4 turns ON while X3 is ON, the programmable controller turns OFF Y11.
PROGRAM IN ST
X4 (Upper_LS_of_water The programmable controller turns OFF
LANGUAGE
CREATING
_tank) turns ON. Y11 (Water_refill_output).
CREATING TWO OR
MORE PROGRAM
• When Y11 turns ON/OFF 5 times, the programmable controller turns ON Y12.
BLOCKS
Y11 (Water_refill_output)
turns ON/OFF 5 times.
Refer to the following section for the Batch monitoring of device values.
3.4.2 Batch monitoring of device values
1
5.7 Printing
OVERVIEW
For the Printing a project procedure, refer to the following.
3.7 Printing
CREATED PROGRAM
CONFIGURATION
AND SYSTEM
3
CREATING PROGRAM IN
STRUCTURED LADDER/
FBD LANGUAGE
4
5.8 Saving a Project
PROGRAM IN ST
Refer to the following section for the project saving procedure:
LANGUAGE
CREATING
3.8 Saving a Project
CREATING TWO OR
Refer to the following section for the project ending procedure:
MORE PROGRAM
3.9 Exiting GX Works2
BLOCKS
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.