Download  Print this page

Mitsubishi Electric MELSEC iQ-F FX5 Programming Manual

Program design.
Hide thumbs

Advertisement

MELSEC iQ-F
FX5 Programming Manual (Program Design)

Advertisement

Table of Contents

   Summary of Contents for Mitsubishi Electric MELSEC iQ-F FX5

  • Page 1 MELSEC iQ-F FX5 Programming Manual (Program Design)
  • Page 3: Safety Precautions

    • Since the examples indicated by this manual, technical bulletin, catalog, etc. are used as a reference, please use it after confirming the function and safety of the equipment and system. Mitsubishi Electric will accept no responsibility for actual use of the product based on these illustrative examples.
  • Page 4: Table Of Contents

    CONTENTS SAFETY PRECAUTIONS ..............1 INTRODUCTION .
  • Page 5 INDEX REVISIONS................58 WARRANTY .
  • Page 6: Relevant Manuals

    Describes basic knowledge required for program design, functions of the CPU <JY997D55401> module, devices/labels, and parameters. MELSEC iQ-F FX5 Programming Manual (Program Design) Describes specifications of ladders, ST, FBD/LD, and other programs and labels. <JY997D55701> (This manual) MELSEC iQ-F FX5 Programming Manual (Instructions, Standard Describes specifications of instructions and functions that can be used in programs.
  • Page 7: Terms

    TERMS Unless otherwise specified, this manual uses the following terms. •  indicates a variable part to collectively call multiple models or versions. (Example) FX5U-32MR/ES, FX5U-32MT/ES  FX5U-32M/ES • For details on the FX3 devices that can be connected with the FX5, refer to FX5 User’s Manual (Hardware). Terms Description ■Devices...
  • Page 8 Abbreviation of MELSEC iQ-F FX5 Programming Manual (Instructions, Standard Functions/Function Blocks) Functions/Function Blocks) Communication manual Generic term for MELSEC iQ-F FX5 User's Manual (Serial Communication), MELSEC iQ-F FX5 User's Manual (MODBUS Communication), MELSEC iQ-F FX5 User's Manual (Ethernet Communication), and MELSEC iQ-F FX5 User's Manual (SLMP) •...
  • Page 9: Chapter 1 Outline

    OUTLINE This manual describes program configurations, content, and method for creating programs. For how to create, edit, or monitor programs using the engineering tool, refer to the following. GX Works3 Operating Manual Type of programming languages With the FX5 series, the optimal programming language can be selected according to the application. Programming language Description Ladder diagram...
  • Page 10 • Ladder diagram and FBD/LD language are for customers who have knowledge or experience of sequence control and logic circuits. • ST language is for customers who have knowledge or experience of the C language programming. • By using labels in a program, the readability of the program is improved, and activating a program for the system with a different module configuration is easy.
  • Page 11: Chapter 2 Program Configuration

    PROGRAM CONFIGURATION Using the engineering tool, multiple programs and POUs (Program Organization Units) can be created. Thus, programs and POUs can be sorted by processing. This chapter describes the program configuration. Project Program file 1 Program file 2 POUs Function block Program block Program block Function block...
  • Page 12: Program Block

    Program Block A program block is a unit of a program. Multiple program blocks can be created in one program file, and are executed in the registered order. By dividing program blocks by functions or processing, changing the program order or replacing the program becomes easy. Program blocks are stored in program files of each program in the registration destination.
  • Page 13: Chapter 3 Program Organization Unit (pou)

    PROGRAM ORGANIZATION UNIT (POU) The POU includes the following types. • Function • Function block The processing of each POU can be described in a programming language according to the control. POUs are called from a program block, and then executed. Project Program file Program block...
  • Page 14: Function (fun)

    Function (FUN) Functions are a type of POU used by program blocks, function blocks, or other functions. The function sends back a value to the call source after execution. The value is called return values. The function always outputs the same return value as the processing result in response to the same input. The function can be re-used effectively by defining a simple, independent, and frequently used algorithm.
  • Page 15 EN/ENO An EN (enable input) and ENO (enable output) can be appended to a function to control its execution. • A Boolean variable used as an executing condition of a function is set to an EN. • A function with an EN is executed only when the executing condition of the EN is TRUE. •...
  • Page 16 Operation overview The program of a function is stored in the FB/FUN file and called by the calling source program when executed Execution flow (Program file) (FB file) (FB file) Main program FUN1 program FUN3 program FUN3 FUN1 (FB file) FUN2 program FUN2 You can nest all function blocks and functions up to 32 times.
  • Page 17 ■Calling source When calling a function, the calling source generates the processing that passes the argument and return value before and after the call processing. Program block 1 (displayed) Program file Passing the argument Calling the FUN1 program MOV D0 XX FUN1 Passing the return value FUNCall FUN1...
  • Page 18: Function Block (fb)

    Function Block (FB) Function blocks are a type of POU used by program blocks or other function blocks. Function block Function block Function block Function block Unlike the function, the function block does not output return values. The function block can save a value in a variable, and thus the input status and processing result are retained. Because the retained value is used for the next processing, the same result is not always output even with the same input value.
  • Page 19 Internal variable For the function block, internal variables can be used. For classes for which internal variables can be set, refer to the following. Page 23 Class External variable For the function block, external variables can be used. For classes for which external variables can be set, refer to the following. Page 23 Class Instances ■Instances...
  • Page 20 Breakdown Description Capacity of reserved area The capacity of the area reserved to add non-latched local labels and local instances when executing the online program change function. (fixed at 48 words) Local latch label area Capacity of local latch label area of instance = Total capacity of data of latched local labels + Capacity of reserved area Breakdown Description Capacity of latched local labels...
  • Page 21 Operation overview ■Macro type function blocks The program of a macro type function block is loaded by the calling source program according to the execution flow. At the time of program execution, the loaded program is executed in the same way as the main program. Use a macro type function block when giving higher priority to the processing speed of the program.
  • Page 22 ■Program The number of steps required for a function block program is the total number of instruction steps, like normal programs. For the number of steps required for each instruction, refer to the following. Programming manual (Instructions, Standard Functions/Function Blockls) Subroutine type function blocks ■Calling source When calling a subroutine type function block, the calling source generates the processing that passes the argument and...
  • Page 23 EN/ENO The following table lists the number of steps required for EN/ENO. Item Number of steps The number of steps may increase or decrease, depending on the following conditions. • The actual argument or return value of the function block are index-modified. •...
  • Page 24: Chapter 4 Labels

    Module labels are labels defined uniquely by each module. Module labels are automatically generated by the engineering tool from the module used, and can be used as a global label. For details, refer to the following. MELSEC iQ-F FX5 CPU Module Function Block Reference 4 LABELS 4.1 Type...
  • Page 25: Class

    Class The label class indicates how each label can be used from which POU. The selectable class varies depending on the POU. Global label Class Description Applicable POU Program Function Function block block    VAR_GLOBAL Common label that can be used in program blocks and function blocks ...
  • Page 26 Data type Description Value range length Time TIME Handles values as d (day), h (hour), m T#-24d20h31m23s648 ms to 32-bit (minute), s (second), or ms (millisecond) T#24d20h31m23s647 ms String(32) STRING Handles a character string (character) Up to 255 letters (half-width Variable character) Page 24 Data types of timers and counters...
  • Page 27 Generic data type (ANY) The generic data type indicates data type of a label which combines several basic data types. The data type name begins with "ANY". The generic data type is used when multiple data types are available in arguments or return values etc. of a function of a function block.
  • Page 28: Arrays

    Arrays An array represents a consecutive accumulation of the same data type labels, under the same name. Arrays can be defined by the elementary data types or structures or function blocks. The maximum number of arrays differs depending on the data types. One-dimensional array Two-dimensional array Label name Indexes...
  • Page 29 • The data storage location becomes dynamic by specifying a label for the array index. This enables arrays to be used in a program that executes loop processing.The following is a program example that consecutively stores "1234" in the "uLabel4" array. bLabel1 wLabel3 bLabel2...
  • Page 30: Structures

    ■Array elements When accessing the element defined in an array, access it within the range of the number of elements. If a constant out of the range defined for the array index is specified, a compile error will occur. If the array index is specified with data other than a constant, a compile error will not occur. The processing will be performed by accessing another label area or latch label area.
  • Page 31 Arrays of structures Structures can also be used as arrays. Structure label [1] Structure label [2] Structure label [3] Structure label [4] Member (Label 1) Member (Label 1) Member (Label 1) Member (Label 1) Member (Label 2) Member (Label 2) Member (Label 2) Member (Label 2) Member (Label 3)
  • Page 32: Constant

    Constant Types of constants The following table shows the expressions for setting a constant to a label. Applicable data type Type Expression Example Boolean data Input "TRUE" or "FALSE". TRUE, FALSE Binary Append "2#" in front of a binary number. 2#0, 2#1 Octal Append "8#"...
  • Page 33: Precautions

    Precautions Functions with limitations In the following functions, there is a limitation on label use. Item Description Trigger of an event execution type program Labels cannot be used. Consider taking the following measures. • Use devices. • Define a label to be used as a global label and assign devices to the global label. Intelligent function module refresh setting Labels cannot be used.
  • Page 34 Precautions for creating programs When specifying a label as an operand used in instructions, match the data type of the label with that of the operand. In addition, when specifying a label as an operand used in instructions that control continuous data, specify the data range used in instructions within the data range of the label.
  • Page 35: Chapter 5 Ladder Diagram

    LADDER DIAGRAM Ladder diagram is a language that describes the sequence control by indicating logical operations consisting of "AND" or "OR" with combinations of series connections and parallel connections in a ladder consisting of contacts and coils. Configuration With the ladder diagram, the following ladder can be created. (1) A ladder consists of contacts and coils (2) A ladder connected in series (3) A ladder connected in parallel...
  • Page 36: Program Execution Order

    • How to create function blocks (GX Works3 Operating Manual) • Standard function blocks (MELSEC iQ-F FX5 Programming Manual (Instructions, Standard Functions/Function Blocks)) • Module function blocks (MELSEC iQ-F FX5 CPU Module Function Block Reference) Program execution order The program is executed in order of the following numbers.
  • Page 37: Inline St

    Inline ST Inline ST is a function that creates, edits and monitors inline ST box that displays an ST program in a cell of an instruction that is equivalent to a coil in the ladder editor. Numerical operations or character string operations can be created easily in a ladder program. •...
  • Page 38: Statements And Notes

    Statements and Notes In a ladder program, statements and notes can be displayed. Statements By using statements, users can append comments to circuit blocks. Appending statements makes the processing flow easy to understand. Statements include line statements, P statements, and I statements. A line statement can be displayed on a tree view of the Navigation window.
  • Page 39: Chapter 6 St Language

    ST LANGUAGE The ST language is one of the languages supported by IEC 61131-3, the international standard that defines the description methods for logic. ST language is a text programming language with a grammatical structure similar to C language. ST language is suitable for programming some complicated processing that cannot be easily described using ladder diagram.
  • Page 40: Configuration

    Configuration Operators and syntaxes are used for programing in ST language. intV2 := ABS(intV1); Assignment statement THEN btn01 := TRUE; ELSE Conditional statement btn01 := FALSE; END_IF; Output_ENO := ENEG(btn01,Input1); Calling a function LadderFBInstance(Input1:=bool1,Input2:=bool2,Input3:=bool3); Calling a function block (* user function block *) A statement must end with ";"...
  • Page 41: Delimiter

    Delimiter The following delimiters are provided in ST language for clarifying the program structure. Symbol Description Parenthesized Specification of an array element . (period) Specification of members of the structure or function block , (comma) Separation of arguments : (colon) Device type specifier ;...
  • Page 42: Syntax

    Syntax The following table shows the types of statements that can be used in a ST program. Item Description Reference Page 40 Assignment statement Assignment statement Assignment statement Page 41 Sub-program control statement Sub-program control statement Function block call statement, function call statement RETURN statement Page 42 Conditional statement Conditional statement...
  • Page 43 To avoid the deletion of the data during type conversion, only conversion from smaller type to larger type is performed. Of the elementary data types, type conversion is performed only for the following data types among basic data types are the targets of a type conversion.
  • Page 44 ■Function call statement Format Description Function name(Variable1, Variable2, ...); Enclose an argument by "()" after the function name. When using multiple arguments, delimit them by "," (comma). Assigning to variables stores the execution result of the function. Function Example Calling a function with one input variable (Example: ABS) Outout1 := ABS(Input1);...
  • Page 45 Syntax Format Description Example CASE <Integer expression> OF When the statement that has the integer selection value that ■CASE CASE intV1 <Integer selection 1> : matches with the value of the integer expression (conditional <Statement 1> ; expression) is executed, and if no integer selection value bool1:=TRUE;...
  • Page 46 Precautions ■When an assignment statement is used • The maximum number of character strings that can be assigned is 255. If 256 or more character strings are assigned, a conversion error occurs. • Contacts and coils of the timer type or counter type cannot be used for the left side of an assignment statement. •...
  • Page 47 ■When a bit type label is used Once the Boolean expression (conditional expression) is satisfied in a conditional statement or an iteration statement, the bit type label that is turned ON in <Statement> is always set to ON. Program whose bit type label is always set to on ST program Ladder program equivalent to ST program bLabel1...
  • Page 48 When the timer or counter is operated according to the AND condition of bLabel1 and bLabel2, do not use any control statement, just use a function block only. Using the program after change operates the timer and counter. ■When the FOR...DO statement is used •...
  • Page 49: Constant

    ■When a master control instruction is used Shown here is the operation when the master control is OFF. • The statement in a selection statement (an IF statement or a CASE statement) or in a iteration statement (a FOR statement, a WHILE statement, or a REPEAT statement) is not processed. •...
  • Page 50: Comment

    Device type specifier Data type Example Description FLOAT (Single Precision) D0:E The value when D0 and D1 are single-precision real numbers The following shows the devices to which device type specifiers can be added. • Data register (D) • Link register (W) •...
  • Page 51: Chapter 7 Fbd/ld Language

    FBD/LD language This is a language that creates a program by wiring blocks for specific processing, variables, and constants along with the flows of data and signals. Configuration With the FBD/LD language, the following program can be created. (1) FBD unit (2) LD unit (3) Common unit (4) Connecting wire...
  • Page 52: Program Unit

    • Standard function blocks (MELSEC iQ-F FX5 Programming Manual (Instructions, Standard Functions/Function Blocks)) • Module function blocks (MELSEC iQ-F FX5 CPU Module Function Block Reference) ■The data type of a constant unit In the case of a constant unit, the data type of the constant value is not determined at the time when the constant value is input.
  • Page 53 ■The input/output point of a function • It is necessary that all the input points of a function should be connected to other FBD units over connecting wires. • The data types of the input variables and output variables of a function should be of certain types. It is necessary that the FBD units to be connected to the input point or output point should be of the same data types.
  • Page 54 ■The AND operation and OR operation of a contact symbol A contact symbol executes an AND operation or an OR operation depending on the status of the connection of a circuit chart. This is reflected in the operation result. • In the case of a series connection (1), an AND operation is executed with the operation results so far. This will be the operation result.
  • Page 55 ■The operation of a return unit A return unit operates differently depending on whether a program, function, and/or function block used there. Program unit to use Program The execution of the program unit is terminated. Function The function is terminated, and the step goes back to the one next to the instruction that has called the function. Function block The function block is terminated, and the step goes back to the one next to the instruction that has called the function block.
  • Page 56: Worksheet

    ■Inverting input and output points You can invert an input to an unit or an output from an unit by using a connecting point. The connecting point having been inverted is circled with a black circle. The data to be input or output is inverted (FALSE to TRUE or TRUE to FALSE).
  • Page 57: Program Execution Order

    Program execution order The order of executions of program units The order of executions of the units in the FBD/LD editor is determined depending on the positional relation of the units and on the status of connecting wires. Executed from the left side to the right side CTD_E_1...
  • Page 58: Index

    INDEX ......46 Symbols FOR...DO ..... . . 11,12 Function (FUN) .
  • Page 59 ....... . 23 REAL ......43 REPEAT .
  • Page 60: Revisions

    Chapter 1, Section 3.1, 3.2, 4.1, 4.3, 4.4, 4.5, 5.2, 5.3, Chapter 6, 7 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.
  • Page 61: Warranty

    WARRANTY Please confirm the following product warranty details before using this product. Gratis Warranty Term and Gratis Warranty 2. Onerous repair term after discontinuation of production Range If any faults or defects (hereinafter "Failure") found to Mitsubishi shall accept onerous product repairs for be the responsibility of Mitsubishi occurs during use of seven (7) years after production of the product is the product within the gratis warranty term, the...
  • Page 62: Trademarks

    TRADEMARKS   Microsoft and Windows are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. Ethernet is a trademark of Xerox Corporation.  MODBUS is a registered trademark of Schneider Electric SA. The company name and the product name to be described in this manual are the registered trademarks or trademarks of each company.
  • Page 64 Manual number: JY997D55701B Model: FX5-P-PS-E Model code: 09R538 When exported from Japan, this manual does not require application to the Ministry of Economy, Trade and Industry for service transaction permission. HEAD OFFICE: TOKYO BUILDING, 2-7-3 MARUNOUCHI, CHIYODA-KU, TOKYO 100-8310, JAPAN HIMEJI WORKS: 840, CHIYODA MACHI, HIMEJI, JAPAN Specifications are subject to change without notice.

Comments to this Manuals

Symbols: 0
Latest comments: