GX Developer Version 8 Operating Manual (Structured Text - Guidebook) Sh080368ef
GX Developer Version 8 Operating Manual (Structured Text - Guidebook) Sh080368ef
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 " DANGER" 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.
[Designing Precautions]
! DANGER
• 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.
[Startup/Maintenance Precautions]
! CAUTION
• The online operations performed from a personal computer to a running programmable
controller CPU (program change when a programmable controller CPU is RUN, forced I/O
operation, operating status change such as RUN-STOP switching, and remote control
operation) have to 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 (Online program
change), it may cause a program corruption in some operating conditions. Fully understand
the precautions described in GX Developer Operating Manual before use.
A-1 A-1
REVISIONS
* The manual number is given on the bottom left of the back cover.
Print Date * Manual Number Revision
Feb., 2003 SH (NA)-080368E-A First printing
Jul., 2003 SH (NA)-080368E-B Correction
Section 5.3
Oct., 2003 SH (NA)-080368E-C Correction
Section 5.2
Jun., 2004 SH (NA)-080368E-D Correction
Abbreviations and Generic Terms in This Manual, Chapter 3
May, 2008 SH (NA)-080368E-E Correction
Abbreviations and Generic Terms in This Manual, Chapter 3
Dec., 2008 SH (NA)-080368E-F Correction
About Manuals, Abbreviations and Generic Terms in This Manual,
Chapter 3
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.
© 2003 MITSUBISHI ELECTRIC CORPORATION
A-2 A-2
INTRODUCTION
Thank you for choosing the Mitsubishi MELSOFT series Integrated FA software.
Read this manual and make sure you understand the functions and performance of MELSEC series
programmable controller thoroughly in advance to ensure correct use.
Please make this manual available to the end user.
CONTENTS
SAFETY PRECAUTIONS...............................................................................................................................A- 1
REVISIONS .....................................................................................................................................................A- 2
CONTENTS.....................................................................................................................................................A- 4
About Manuals ................................................................................................................................................A- 5
How to Use This Manual.................................................................................................................................A- 6
Abbreviations and Generic Terms in This Manual .........................................................................................A- 7
1 OVERVIEW 1- 1 to 1- 2
3 ST PROGRAMMING 3- 1 to 3- 16
A-3 A-3
8 ST PROGRAMMING APPLICATION (PASTING FB TO LADDER PROGRAM) 8- 1 to 8- 20
A-4 A-4
About Manuals
Related Manuals
Manual Number
Manual Name
(Model Code)
GX Developer Version8 Operating Manual (Startup)
SH-080372E
Explains the system configuration, installation method and startup method of GX Developer.
(13JU40)
(Option)
REMARK
Each Operating Manual is contained in the CD-ROM together with the software
package as a set.
The Programming Manual is available separately in printed form as an option.
Please place an order with the manual number (model code) in the above table.
A-5 A-5
How to Use This Manual
A-6 A-6
Abbreviations and Generic Terms in This Manual,
In this guidebook, the following generic terms and abbreviations are used to
represent the GX Developer software package and programmable controller CPU.
The package name is given when the target model name must be pointed out
explicitly.
The following explains the symbols and information used in this guidebook.
Symbol Description Example
( ) Icon of toolbar
A-7 A-7
1 OVERVIEW MELSOFT
1-1 1-1
1 OVERVIEW MELSOFT
MEMO
1
1-2 1-2
2 ST PROGRAM CREATION PROCEDURE MELSOFT
The following flowchart indicates the basic procedure from ST program creation to online
debugging.
In the following example, programming was performed using only an ST program.
2
Definition of labels Define the local variables used in an ST program.
Refer to Chapter 3 for details.
Write to PLC CPU After performing change (compile) into a sequence program,
write it to the programmable controller CPU.
Refer to Chapter 4 for details.
End
REMARK
For details of each operation, refer to the "GX Developer Operating Manual" given in
Relevant Manuals.
2-1 2-1
2 ST PROGRAM CREATION PROCEDURE MELSOFT
MEMO
2-2 2-2
3 ST PROGRAMMING MELSOFT
Chapter 3 explains general basic operations from the input to convert (compile) of an ST program.
The following items will be explained in this chapter.
2) Enter as follows.
PLC series : QCPU (Q mode)
PLC Type : Q02 (H)
3) Click. Label setting : Use label
Program type : ST
2) Set these.
To next page
3-1 3-1
3 ST PROGRAMMING MELSOFT
REMARK
Here, "Q02(H)" is set as the PLC type.
There are the following programmable controller CPU types that are applicable to
ST programs.
3-2 3-2
3 ST PROGRAMMING MELSOFT
1) Double-click.
2) Double-click "MAIN".
2) Double-click.
To next page
3-3 3-3
3 ST PROGRAMMING MELSOFT
3) Double-click.
3-4 3-4
3 ST PROGRAMMING MELSOFT
For the reserved words, refer to the "GX Developer Operating Manual".
For the label information, refer to "CHAPTER 7 INTRODUCTION TO USEFUL FUNCTIONS FOR
ST PROGRAM EDITING" or "GX Developer Operating Manual (Structured Text)".
To next page
3-5 3-5
3 ST PROGRAMMING MELSOFT
4) When entering labels continuously, click the Insert or Add button under Edit operation to add a line.
The buttons under Edit operation have the following functions.
Insert button ... Inserts a blank line into the current cell position.
Add button ...... Inserts a blank line into the place one line below the current cell position.
Delete button ... Deletes one line in the current cell position.
To next page
3-6 3-6
3 ST PROGRAMMING MELSOFT
When registration is made, " " displayed on the title bar disappears.
REMARK
For details of the local variables, refer to the "GX Developer Operating Manual"
given in Relevant Manuals.
3-7 3-7
3 ST PROGRAMMING MELSOFT
Entering a program
A program can be input freely in text format using the ST edit screen.
Note the following points during input.
List-1.
IF Initialization THEN
good := 0; Defective := 0; Yield := 0.0;
ELSE
IF Inspection THEN
good := good +1;
ELSE
Defective := Defective + 1;
END_IF;
3-8 3-8
3 ST PROGRAMMING MELSOFT
1) Double-click.
3-9 3-9
3 ST PROGRAMMING MELSOFT
Entering a label
To enter a label, a label name may be entered directly or the label selection function be used.
To use the label selection function, labels must have been entered in advance.
Here, the input method using the label selection function will be explained.
1) Click.
2) Select "Initialization".
3) Click the OK button.
3) Click.
3 - 10 3 - 10
3 ST PROGRAMMING MELSOFT
Entering a function
Enter a function in upper case. To enter, a function may be entered directly or the function selection function
be used.
Here, the input method using the function selection function will be explained.
1) Click.
2) Select "DINT_TO_REAL".
3) Click.
To next page
3 - 11 3 - 11
3 ST PROGRAMMING MELSOFT
4) Inserted.
5) Complete
Entering a comment
Comments do not affect the program behavior at all. When program processings are described as
comments, they give the at-a-glance pictures of the processings.
To next page
3 - 12 3 - 12
3 ST PROGRAMMING MELSOFT
For details, refer to the "GX Developer Operating Manual (Structured Text)".
3 - 13 3 - 13
3 ST PROGRAMMING MELSOFT
Click.
3 - 14 3 - 14
3 ST PROGRAMMING MELSOFT
RYOUHIN := 0; RYOUHIN : = 0. 0;
Change.
Click.
1) Select.
2) Click.
To next page
3 - 15 3 - 15
3 ST PROGRAMMING MELSOFT
good : = 0. 0; good := 0;
3 - 16 3 - 16
4 READ/WRITE FROM/TO PLC CPU MELSOFT
Chapter 4 explains the procedure to write the converted (compiled) sequence program to the
programmable controller CPU and the procedure to read the sequence program from the
programmable controller CPU.
Display the Write to PLC dialog and write the program and parameters to the programmable controller CPU.
2) Select.
4-1 4-1
4 READ/WRITE FROM/TO PLC CPU MELSOFT
Display the Read from PLC dialog and read the program and parameters from the programmable controller
CPU.
4
2) Click "Param + Prog" in the <<File
selection>> tab.
3) Click.
2) Click.
3) Click the [Execute] button.
4-2 4-2
5 DEBUGGING THE PROGRAM MELSOFT
Chapter 5 explains the online debugging operation of the sequence program written to the
programmable controller CPU using the monitor function and device test function.
This section explains the operation method to monitor the sequence program.
5
1) Click.
The labels displayed on the ST edit screen are displayed on the same lines of the monitor screen.
5-1 5-1
5 DEBUGGING THE PROGRAM MELSOFT
The value of the label (bit device/word device) in the programmable controller CPU can be changed
directly.
Here, the bit device value is changed to confirm the program behavior.
1) Click.
Forcibly turn ON the label "Inspection" that represents the bit device. 5
3) Click.
To next page
5-2 5-2
5 DEBUGGING THE PROGRAM MELSOFT
ON
Also change the other label values and confirm the program behavior.
GX Developer supports the following debug functions for the programs created in
ST language.
• Break execution : debugs programs by halting the program execution at the
location specified by break point.
• 1 line execution : debugs programs by halting the program execution line-by-line.
For details, refer to the relevant section in GX Developer Operating Manual
(Structured Text).
5-3 5-3
5 DEBUGGING THE PROGRAM MELSOFT
When the programmable controller CPU is in a RUN status, part of the sequence program can be
changed.
This is called online change.
Actually change part of the sequence program and perform online change.
Changed.
" " indicating the line to be online changed is displayed on the indicator bar of the target line.
To next page
5-4 5-4
5 DEBUGGING THE PROGRAM MELSOFT
To next page
5-5 5-5
5 DEBUGGING THE PROGRAM MELSOFT
Reflected.
" " that indicates the online change target line disappears.
On the monitor screen, confirm that the present value of "Yield" has changed.
5-6 5-6
5 DEBUGGING THE PROGRAM MELSOFT
MEMO
5-7 5-7
6 SAVING THE PROGRAM INTO THE PERSONAL COMPUTER MELSOFT
1) Click.
2) Input as follows.
Drive/Path : C:\MELSEC
Project name : SAMPLE_ST
Title : work-check
3) Click.
6
2) Set these.
6-1 6-1
6 SAVING THE PROGRAM INTO THE PERSONAL COMPUTER MELSOFT
MEMO
6-2 6-2
7 INTRODUCTION TO USEFUL FUNCTIONS FOR ST PROGRAM EDITING MELSOFT
(2) Bookmark
When it is desired to jump to a specific line, it is troublesome to search the program from the beginning ...
At such a time, use "Bookmark".
Preset the bookmark by choosing [Find/Replace] [Bookmark setting/release] or [Find/Replace]
[Find] "Set bookmark" in the menu.
By choosing [Find/Replace] [Bookmark list] in the menu, any line can be selected from the Bookmark
list dialog to make a jump to that line.
7-1 7-1
7 INTRODUCTION TO USEFUL FUNCTIONS FOR ST PROGRAM EDITING MELSOFT
MEMO
7-2 7-2
8 ST PROGRAMMING APPLICATION (PASTING FB TO LADDER PROGRAM) MELSOFT
Chapters 1 to 7 explained the basic operation methods and functions for creating ST programs.
In Chapter 8, create a function block (FB) in ST language and paste it to a ladder program to create
a program to be used.
The main items to be explained in this chapter are as follows.
8.1 Creating an FB
Click [Project] [New project] in the menu to display the New project dialog.
1) Enter as follows.
PLC series :QCPU (Q mode)
PLC type :Q02(H)
Label setting :Use label
2) Click.
Program type :Ladder
1) Set these.
To next page
8-1 8-1
8 ST PROGRAMMING APPLICATION (PASTING FB TO LADDER PROGRAM) MELSOFT
Adding a new FB
Adding an FB
The operation method to add a new ST-written FB will be explained.
1) Right-click "Function Block" in the
1) Right-click. <<FB>> tab to display the menu.
To next page
8-2 8-2
8 ST PROGRAMMING APPLICATION (PASTING FB TO LADDER PROGRAM) MELSOFT
3) Set these.
5) Click.
To next page
8-3 8-3
8 ST PROGRAMMING APPLICATION (PASTING FB TO LADDER PROGRAM) MELSOFT
8-4 8-4
8 ST PROGRAMMING APPLICATION (PASTING FB TO LADDER PROGRAM) MELSOFT
Defining FB variables
8-5 8-5
8 ST PROGRAMMING APPLICATION (PASTING FB TO LADDER PROGRAM) MELSOFT
To next page
8-6 8-6
8 ST PROGRAMMING APPLICATION (PASTING FB TO LADDER PROGRAM) MELSOFT
To next page
8-7 8-7
8 ST PROGRAMMING APPLICATION (PASTING FB TO LADDER PROGRAM) MELSOFT
Registration is completed.
Click the OK button.
When registration is made, " " displayed on the title bar disappears.
REMARK
For details, refer to the "GX Developer Operating Manual (Function Block)" given in
Relevant Manuals.
8-8 8-8
8 ST PROGRAMMING APPLICATION (PASTING FB TO LADDER PROGRAM) MELSOFT
Creating an FB in ST language
List-3
YIELD_OUT := DINT_TO_REAL(GOOD_IN)/DINT_TO_REAL(GOON_IN + DEFECTIVE_IN);
1) Double-click.
8-9 8-9
8 ST PROGRAMMING APPLICATION (PASTING FB TO LADDER PROGRAM) MELSOFT
At normal completion of convert (compile), the number of steps is displayed on the title bar.
8 - 10 8 - 10
8 ST PROGRAMMING APPLICATION (PASTING FB TO LADDER PROGRAM) MELSOFT
1) Double-click.
8 - 11 8 - 11
8 ST PROGRAMMING APPLICATION (PASTING FB TO LADDER PROGRAM) MELSOFT
When registration is made, " " displayed on the title bar disappears.
8 - 12 8 - 12
8 ST PROGRAMMING APPLICATION (PASTING FB TO LADDER PROGRAM) MELSOFT
Display the main program edit screen and input the following program (List-4).
List-4
To next page
8 - 13 8 - 13
8 ST PROGRAMMING APPLICATION (PASTING FB TO LADDER PROGRAM) MELSOFT
Pasting the FB
Switch to the <<FB>> tab, and drag and drop the FB program to the target place.
To next page
8 - 14 8 - 14
8 ST PROGRAMMING APPLICATION (PASTING FB TO LADDER PROGRAM) MELSOFT
When convert (compile) is completed, the number of steps is displayed on the title bar.
8 - 15 8 - 15
8 ST PROGRAMMING APPLICATION (PASTING FB TO LADDER PROGRAM) MELSOFT
8.3 Online
Write the sequence program to the programmable controller CPU, and confirm the program
behavior using the monitor function and device test function.
8 - 16 8 - 16
8 ST PROGRAMMING APPLICATION (PASTING FB TO LADDER PROGRAM) MELSOFT
Monitor display
Comment display
The comments set on the Local variables setting screen can be displayed by choosing [View]
[Comment] in the menu.
8 - 17 8 - 17
8 ST PROGRAMMING APPLICATION (PASTING FB TO LADDER PROGRAM) MELSOFT
Change the value of the bit device in the programmable controller CPU and confirm the program
behavior.
2) Click.
ON "good" value increases. Also change the other label values and
confirm the program behavior.
8 - 18 8 - 18
8 ST PROGRAMMING APPLICATION (PASTING FB TO LADDER PROGRAM) MELSOFT
Click [Project] [Save as] in the menu to display the Save the project with a new name dialog.
1) Enter as follows.
Drive/Path : C:\MELSEC
Project name : SAMPLE_FBST
Title : FB is used and
calculated.
2) Click.
1) Set these.
8 - 19 8 - 19
8 ST PROGRAMMING APPLICATION (PASTING FB TO LADDER PROGRAM) MELSOFT
MEMO
8 - 20 8 - 20
INDEX
Ind
[A] [M]
Adding an FB.................................................. 8- 2 Monitor
Alarm history display function ....................... 6-16 Monitoring the Sequence Program
Alarm list display function ........................................................... 5- 1, 8-17
System alarm............................................. 6-19
User alarm ................................................. 6-18 [O]
Online change.................................................5- 4
[C]
Convert (compile) [P]
Converting (compiling) the FB .................. 8-10 Pasting the FB ...............................................8-14
Error indication mark ................................. 3-16 Performing read from PLC .............................4- 2
Performing convert (compile).................... 3-14 Performing write to PLC ....................... 4- 1, 8-16
The compile error (Detail) ......................... 3-15 Program
What is convert (compile).......................... 3-14 Entering a comment...................................3-12
Entering a function .....................................3-11
[D] Entering a label ..........................................3-10
Device Test Entering the characters...............................3- 9
Confirming the program behavior ..... 5- 2, 8-18 Function argument .....................................3-12
Displaying the FB definition screen ............... 8- 9 Function selection function .............. 3- 11, 7- 1
Inputting the program ................................ 8-10 Inputting the input ladder section and output
Displaying the FB variable screen ................. 8- 5 ladder section ............................................ 8-15
Displaying the ST edit screen ........................ 3- 9 Inputting the program in ladder format ......8-14
What should be noted during input.............3- 8
[E] Project
Editing Creating a new project ................................8- 1
Bookmark.................................................... 7- 1 Creating a new ST project ..........................3- 1
Change of font ............................................ 7- 1 Saving the project ............................. 6- 1, 8-19
Change of display font................................ 7- 1
Display of label information ........................ 7- 1 [S]
Select function ............................................ 7- 1 Enter a comment into the label.......................8- 7
Window division.......................................... 7- 1 Enter the device type ......................................8- 7
Enter the label name.......................................8- 6
[L] Select the Input/Output type...........................8- 6
Label Setting the FB variables .................................8- 6
What does defining the labels mean ......... 3- 3
Local variable [W]
Displaying the setting screen ............ 3- 3, 8-11 What is a function block (FB)
Enter a comment into the label .................. 3- 5 What is a function block (FB)......................8- 1
Enter a device type..................................... 3- 5 What is the ST language ................................1- 1
Enter a label name ..................................... 3- 5
Setting the local variables ................. 3- 5, 8-12
Index - 1 Index - 1
MEMO
Ind
Index - 2 Index - 2
SH (NA)-080368E-F