Home

MELSEC iQ-F FX5 Programming Manual

image

Contents

1. bLabel1 wLabel3 MOV K1234 uLabel4 wLabel3 e In the case of the ladder diagram arrays can be used with element numbers omitted When the element bLabel2 number is omitted it is converted to the starting number of the array element For example when the label name you define is boolAry and the data type is bit 0 2 0 2 then boolAry 0 0 and boolAry are treated in the same way e A multidimensional array can be specified as setting data of an instruction function or function block using arrays In that case the rightmost element in the multidimensional array is treated as the first dimension Maximum number of array elements The maximum number of array elements differs depending on data types Data type Setting range Bit 1 to 32768 Word Unsigned Bit String 16 bit Double Word Unsigned Bit String 32 bit Word Signed Double Word Signed FLOAT Single Precision Time Timer Retentive Timer Counter Long Counter Function Block String 32 1 to 32768 character string length Precautions When an interrupt program is used When a label or device is specified for the array index the operation is performed with a combination of multiple instructions For this reason if an interrupt occurs during operation of the label defined as an array data inconsistency may occur producing an unintended operation result To prevent data inconsistency create a program using the DI El instructio
2. E Page 21 LABELS For available devices refer to the following LTIMELSEC iQ F FX5 User s Manual Application 6 ST LANGUAGE 6 1 Configuration MDevice expression with type specification A word device can be used in ST language as an arbitrary data type by adding a device type specifier to its name Device type specifier Data type Example Description N A Generic data type ANY 16 When no type specifier is added to DO When only devices are used in arithmetic operations the data type is Word signed However when the data is specified as a device without the type specification in the argument part of FUN FB the data type is the one of the argument definition U Word Unsigned Bit String 16 bit The value when DO is Word unsigned Bit string 16 bit D Double Word Signed DOD The value when DO and D1 are Double word signed UD Double Word Unsigned Bit String 32 bit DO UD The value when DO and D1 are Double word unsigned Bit string 32 bit E FLOAT Single Precision The value when DO and D1 are single precision real numbers The following shows the devices to which device type specifiers can be added e Data register D e Link register W e Module access device VUOIGO e File register R MDevice specification method The following methods can be used for specifying a device e Indexing e Bit specification e Nibble specification e Indirect specification For details refer to the follo
3. MITSUBISHI ELECTRIC PROGRAMMABLE CONTROLLERS series MELSEC iQ F FXS Programming Manual Program Design SAFETY PRECAUTIONS Read these precautions before using this product Before using the FX5 PLCs please read the manual supplied with each product and the relevant manuals introduced in that manual carefully and pay full attention to safety to handle the product correctly Store this manual in a safe place so that it can be taken out and read whenever necessary Always forward it to the end user INTRODUCTION This manual describes the instructions and functions required for programming of the FX5 Please read this manual and the relevant manuals and understood the functions and performance of the FX5 PLCs before attempting to use the unit It should be read and understood before attempting to install or use the unit Store this manual in a safe place so that you can take it out and read it whenever necessary Always forward it to the end user When utilizing the program examples introduced in this manual to the actual system always confirm that it poses no problem for control of the target system Regarding use of this product e This product has been manufactured as a general purpose part for general industries and has not been designed or manufactured to be incorporated in a device or system used in purposes related to human life e Before using the product for special purposes such as nuclear power electric power ae
4. The repeat variable at the end of the FOR DO syntax is the value at end of the execution The WHILE DO statement executes one or more statements while the value of Boolean expression conditional expression is TRUE The Boolean expression is evaluated before the execution of the statement If the value of Boolean expression is FALSE the statement in the WHILE DO statement is not executed Since a return result of the Boolean expression in the WHILE statement requires only TRUE or FALSE any Boolean expression that can be specified in the IF conditional statement can be used The REPEAT UNTIL statement executes one or more statements while the value of Boolean expression conditional expression is FALSE The Boolean expression is evaluated after the execution of the statement If the value of Boolean expression is TRUE the statement in the REPEAT UNTIL statement are not executed Since a return result of the Boolean expression in the REPEAT statement requires only TRUE or FALSE any Boolean expression that can be specified in the IF conditional statement can be used The EXIT statement is used only in an iteration statement to end the iteration statement in the middle of processing When the EXIT statement is reached during execution of the iteration loop the iteration loop processing after the EXIT statement is not executed The processing continues from the line after the one where the iteration statement is ended
5. 6 1 Configuration 37 38 Delimiter The following delimiters are provided in ST language for clarifying the program structure Parenthesized Specification of an array element period Specification of members of the structure or function block comma Separation of arguments colon Device type specifier semicolon End of a sentence single quotation mark Description of a character string two periods Specification of an integer range Operator The following shows the operators used in a ST program and the target data types and operation result data types for each operator AND amp XOR OR NOT ANY BIT ANY_REAL Base ANY_REAL ANY NUM Exponent The following table shows the priorities of the operators _ Parenthesized expression 2 3 4 5 CONCAR AB CD 3 0 4 Function Argument of a function di Exponentiation PD OO N Inversion of sign NOT TRUE 10 20 20 10 17 MOD 10 1 44 2 5 NOT Bit type complement i Multiplication Division MOD Modulus operation Addition O a oO de 1 N Subtraction 10 gt 20 T 26h T 1d2h 8 15 lt gt 13 TRUE AND FALSE TRUE XOR FALSE TRUE OR FALSE N lt gt lt gt Comparison 00 Equality lt gt Inequality amp AND Logical AND XOR Exclusive OR OR Logical OR mk O oo e If an expression includes multiple operators with the same priority the operation
6. FALSE 1 coil of a retentive timer device STC TRUE Word unsigned Bit Indicates a current value The operation is the 0 to 32767 String 16 bit same as the current value of a retentive timer Retentive Timer RETENTIVETIMER device STN Counter COUNTER Bit Indicates contacts The operation is the same O FALSE 1 as the contact of a counter device CS TRUE Bit Indicates coils The operation is the same as the 0 FALSE 1 coil of a counter device CC TRUE Word unsigned Bit Indicates a current value The operation is the 0 to 32767 String 16 bit same as the current value of a counter device CN Long Counter LCOUNTER Bit Indicates contacts The operation is the same O FALSE 1 as the contact of a long counter device LCS TRUE C Bit Indicates coils The operation is the same as the 0 FALSE 1 coil of a long counter device LCC TRUE N Double Word unsigned Indicates a current value The operation is the Bit string 32 bit same as the current value of a long counter device LCN 1 The unit of the current value is specified by instruction name 2 When use a long counter in the OUT LC instruction 0 to 4294967295 When use a long counter in the UDCNTF instruction 2147483648 to 2147483647 For the operation of each device refer to the following LTIMELSEC iQ F FX5 User s Manual Application The specification method of each member is the same as the member specification of the str
7. IN Bool iTim ICnt Instance For classes for which input variables output variables or input output variables can be set refer to the following gt Page 22 Class 3 PROGRAM ORGANIZATION UNIT POU 4 3 2 Function Block FB O 16 Internal variable For the function block internal variables can be used For classes for which internal variables can be set refer to the following gt Page 22 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 gt Page 22 Class Instances Minstances TO use the function block instances must be created By creating instances of the function block the function block can be used by calling from a program or another function block Multiple instances can be created from one function block definition To create an instance define it as a global label or local label of the POU that uses the function block The instance can be defined as an array The same function block can be used in different instances in one POU For each instance of a function block labels are assigned to different areas in memory Even though the same label names are used different states are held for each instance Ex Instance A Instance B Function block bLabel1 uLabel10 ON bLabel4 luLabel10 ON Count contact __ uLabel13 OFF bLabel3 Count contact __ uLabelt3 ON bLabel6 uLab
8. 10 PROGRAM ORGANIZATION UNIT POU Project A project is a collection of data including programs and parameters to be executed by the CPU module Only one project can be written to one CPU module For one project one or more program files need to be created Program file A program file is a collection of programs and POUs One program file consists of one or more program blocks The operation on the program file level can be changed such as the execution type of a program can be switched from scan execution type to standby type or whether to write data to the CPU module 2 PROGRAM CONFIGURATION 2 1 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 Program block 1 Program file Program block 2 gt AA HH Creating main routine programs subroutine programs and interrupt programs for each program block makes the program easy to read Type Description Main routine program Program segment from the step 0 to the FEND instruction Subroutine program Program segment from a pointer P to the RET instruction Executed only when a subroutine call instruction CALL instruction etc is executed Interrup
9. 2 Inline ST 5 3 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 statements A line statement can be displayed on a tree view of the Navigation window MLine statement A comment is appended to a ladder block as a whole MP statement A comment is appended to a pointer number Ml statement A comment is appended to an interrupt pointer number Notes By using notes users can append comments to coils and instructions in a program Appending notes makes the details of coils and application instructions easy to understand Types of statements and notes PLC and Peripheral are the types of statements and notes PLC e Line statement Statements and notes can be stored on the CPU module e P statement PLC statement uses the following number of steps When all the characters are input in one e statement byte characters Decimal fraction is rounded up e Note e Without character 3 steps e With character 4 Number of characters 2 14 5 Number of characters steps Peripheral e Line statement Statements and notes cannot be stored on the CPU module Only the position information can e P statement be stored e statement Statements and notes must be saved on a peripheral device No
10. 33 34 5 2 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 e Program with the inline ST XO 1 WO KO 2 WO DO D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 K12 e Program without the inline ST XO Specifications For the specifications of the inline ST refer to the ST language specifications K gt Page 36 ST LANGUAGE Precautions e Only one inline ST can be created in one line of a ladder program e Creating both a function block and an inline ST box in one line of a ladder program is impossible e Creating an inline ST box in a position of an instruction that is equivalent to a contact creates an inline ST box in a position of an instruction that is equivalent to a coil e The maximum number of characters that can be input in an inline ST is 2048 Line feed is counted as one character e In inline ST do not use rising execution instructions falling execution instructions special timer instructions or standard function blocks edge detection function blocks and counter function blocks as they may not work property e When the RETURN syntax is used in an inline ST the processing inside the inline ST box ends and the processing inside the program block does not end 5 LADDER DIAGRAM 5
11. EN 6 ENO 4 Global pointer local pointer pointer type global labels Global pointer local pointer and pointer type global labels cannot be used as labels indicating program steps in the function program 3 PROGRAM ORGANIZATION UNIT POU 3 1 Function FUN 3 2 Function Block FB Function blocks are a type of POU used by program blocks or other function blocks Function block Function block HA E EI 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 MCase of ladder diagram MCase of FBD LD language Instance name Function block name Output variables Input variables 1 2 3 4 gt o gt COUNTER FE M1 i COUNTER FB M ValueQut To use the function block in a program instances must be defined gt Page 16 Instances Input variable output variable and input output variable Input variables output variables and input output variables must be defined for function blocks The function block can output multiple operation results and can also be created without any output 1 Multiple outputs are returned Instance Instance 2 No outputs are returned SAMPLE_FB1
12. FBD unit are connected over a connecting wire the data type becomes the data type at the input point of the unit at the destination of the connection 1 The data type is not determined 2 INT type 3 INT type INT_TO_REAL Automatic conversion of data types The data type of an element may be automatically converted when it is connected to another element of a different data type To avoid the deletion of the data during the type conversion only conversion from smaller type to larger type is performed Automatic conversion of data type in the FBD LD language behaves in the same way as that in the ST language For details refer to the following gt Page 39 Automatic conversion of data types 7 FBD LD Language 7 1 Configuration MThe input output point of a function e It is necessary that all the input points of a function should be connected to other FBD units over connecting wires e 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 e Connect a variable element between an output variable except for ENO of a CPU module instruction or module dedicated instruction and an input variable of another function or function block e In a program that connects a function with EN to another function over a connecting wire the other function must be a function with EN a
13. String 32 bit 22 OWORD fac tau oho damas RE EE EN 22 O E OR pauces sedeeeeGeae ea a da a Bek 38 RE RE 12 17 Output variable o oooooo 11 15 se ue eee ee one a dd 12 17 E 42 P External variable ee ee eee 16 ER EE Pointer 23 F POO sea SE ORE ERA p 8 12 17 EB FUN file 00 12 13 17 18 dla ol A ahah Ona i l gram file ha Sh ee Pee ee eG te a a FEE UMi ss sados ewes ies Ee 49 50 Programming languages eee 6 FBDILD language oooooocoooooo 6 49 Project 0 0 0 0 cece eee eee eee 8 FLOAT Single Precision 22 POR pedro bea ie aaa os 42 REPEAT ist ed beide a de ae hs 42 Reserved word eee eee eee 37 Retentive Timer 00000 o 23 RETENTIVETIMER 23 RETURN aras ds e he BES as a Blas weak 41 ELA EER REED RR OR EE BEUR 6 36 Statements ES Es Es Es EE ee ee 35 STRING yes oho da sia EDE Be AE e 23 46 54 SUIG asie ak oe bee oe ee es 23 46 54 Structures ie ae ee ee Bee ee 23 217 Subroutine program o oo oooooooooo o 9 Subroutine type function blocks 18 19 System labels 0 0000 eee eee eee 21 TOWNES gt ase ace dra oe ek ae oe a Ge eas 23 WMG cakes todas a ed oa 23 TIMES ear ed Si ds da dd pita a 23 TIME RE ica o dice EE weak 23 Type conversion 2 0 00 eee eee 39 Type specification oooooo AT WHILE 225 OE N EER TER N 42 WORD o ou pobre aaa res AE ODE eee
14. Using the program after change operates the timer and counter WWhen the FOR DO statement is used e Structure members and array elements cannot be used as repeat variables e Match the type used for a repeat variable with the types of lt Last value expression and slncremental expression e lt Incremental expression can be omitted When omitted lt Incremental expression is treated as 1 and executed e When 0 is assigned to lt Incremental expression the statements after the FOR syntax may not be executed or the processing goes into an infinite loop e In the FOR DO syntax the counting process of repeat variables is executed after the execution of lt Statement gt in the FOR syntax If the count is greater than the maximum value or smaller than the minimum value of the data type of the repeat variable the processing goes into an infinite loop MWhen a rising execution instruction or a falling execution instruction is used Shown here is the operation when a rising execution instruction or an fall execution instruction is used in an IF statement or a CASE statement Agreement of TRUE or TRUE Not executed OFF OFF Not executed DisagreementofFALSE TRUE OFF Not executed or CASE OFF OFF Not executed FALSE OFF Not executed OFF OFF Not executed 1 This is a fall ON to OFF but the instruction is not executed because the condition in the IF statement or the CASE statement is not satisfied When the P
15. and using a global label with a device assigned Define a global label following the procedure below and use it when the functions having restriction on the use of labels are executed Since the device area in the device label memory is used reserve device area capacity The label area is not consumed 1 Reserve the device area to be used TO CPU Parameter gt Memory Device Setting Device Label Memory Area Capacity Setting 2 Define a label as a global label and assign a device manually 3 Use the label defined in step 2 for the functions having no restrictions on the use of labels Use the device assigned to the label for the function having restrictions on the use of labels MCopying the label data into a specified device Copy the label data into a specified device following the procedure below and use the copy target device Since the device area in the device label memory is used reserve device area capacity 1 Reserve the device area to be used TO CPU Parameter gt Memory Device Setting gt Device Label Memory Area Capacity Setting 2 Create a program using the label The following is the program example for copying the data The data logging function uses the data in udLabel1 SM400 omow vataber 00 3 Use the device where the data has been transferred in step 2 for the function having restrictions on the use of labels In the program example in step 2 use DO Point When copying a value of a label
16. es 22 Word Signed Es EE 0 eee eee eee 22 Word Unsigned Bit String 16 bit 22 Worksheet 00 00 ee a 49 54 ol REVISIONS October 2014 First Edition January 2015 MAdded functions FBD LD language MAdded or modified parts Chapter 1 Section 3 1 3 2 4 1 4 3 4 4 4 5 5 2 5 3 Chapter 6 7 April 2015 A part of the cover design is changed August 2015 MAdded or modified parts Section 4 4 Chapter 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 O 2014 MITSUBISHI ELECTRIC CORPORATION 98 WARRANTY Please confirm the following product warranty details before using this product 1 Gratis Warranty Term and Gratis Warranty 2 Onerous repair term after discontinuation Range If any faults or defects hereinafter Failure found to be the responsibility of Mitsubishi occurs during use of the product within the gratis warranty term the product shall be repaired at no cost via the sales representative or Mitsubishi Service Company However if repairs are required onsite at domestic or overseas location expenses to send an engineer will be solely at the customer s discretion Mitsubishi shall not be held responsible for any re commissioni
17. input variables or output variables can be set refer to the following gt Page 22 Class Poin tr Variables defined in a function are overwritten every time the function is called To retain the variable values at each call use a function block or design a program so that an output variable is saved in a different variable 3 PROGRAM ORGANIZATION UNIT POU 1 1 3 1 Function FUN 12 An EN enable input and ENO enable output can be appended to a function to control its execution e A Boolean variable used as an executing condition of a function is set to an EN e A function with an EN is executed only when the executing condition of the EN is TRUE e A Boolean variable used as an output of function execution result is set to an ENO For the Boolean variable refer to the following gt Page 22 Data Type The table below shows the ENO status corresponding to the EN status and the operation result TRUE Executes operation TRUE Operation output value FALSE Stops operation FALSE Indefinite value e Setting an output label to an ENO is not required e When an EN or ENO is used for standard functions functions with an EN are shown as Function name ET g programs The program of a function can be created by using the engineering tool TZ Navigation window gt FB FUN gt Right click gt Add New Data The created program is stored in the FB FUN file TO CPU Parameter gt Program Setting gt FB FUN Fil
18. is performed from the leftmost operator e Up to 1024 operators can be used in one statement 6 ST LANGUAGE 6 1 Configuration Syntax The following table shows the types of statements that can be used in a ST program Assignment statement Assignment statement K Page 39 Assignment statement Sub program control statement Function block call statement function call statement gt Page 40 Sub program control statement RETURN statement Conditional statement IF statement IF IF ELSE IF ELSIF gt Page 41 Conditional statement CASE statement Iteration statement FOR statement K Page 42 Iteration statement WHILE statement REPEAT statement EXIT statement Write statements using half width characters Assignment statement lt Left side gt lt Right side gt The assignment statement assigns the result of the right side expression to the label or device of the left side The result of the right side expression and the data type of the left side need to be the same data type When an array type label or a structure label is used check the data types of the left side and right side of the assignment statement When an array type label is used the data type and the number of elements need to be the same for the left side and right side Do not specify elements Ex intAry1 intAry2 When a structure label is used the data type needs to be the same for the left side and right side dutVar1 dutVar2 Au
19. tool from the module used and can be used as a global label For details refer to the following LLIMELSEC iQ F FX5 CPU Module Function Block Reference For registration of module labels refer to the following LAGX Works3 Operating Manual 4 LABELS 4 1 Type 21 4 2 Class The label class indicates how each label can be used from which POU The selectable class varies depending on the POU x VAR_GLOBAL Common label that can be used in program blocks and function blocks VAR_GLOBAL_CONSTANT Common constant that can be used in program blocks and function blocks VAR_GLOBAL_RETAIN Latch type label that can be used in program blocks and function blocks x x VAR Label that can be used within the range of declared POUs O This label cannot be used in other POUs VAR_CONSTANT Constant that can be used within the range of declared POUs O This label cannot be used in other POUs VAR_RETAIN Latch type label that can be used within the range of declared POUs This label x cannot be used in other POUs VAR_INPUT Label that inputs to a function or a function block x O This label receives a value and cannot be changed in POUs VAR_OUTPUT Label that outputs a value from a function or a function block ES fO O VAR_OUTPUT_RETAIN Latch type label that outputs a value from a function or a function block Jo x VAR_IN_OUT Local label which receives a value outputs it from a POU and can be changed x x in POUs VAR_PUBL
20. 111 8 0 8 337 8 1_ 1 123 K123 K 123 12 3 16 FF HFF 16 1_1 2 34 E2 34 E 2 34 3 14 15 1 0E6 E1 001 5 ABC T 1h T 1d2h3m4s5ms 1 In the binary notation the octal notation the decimal notation the hexadecimal notation and the real number notation values can be delimited by an underscore _ to make programs easy to read In the program processing underscores are ignored When is used in character string type data is used as an escape sequence Two hexadecimal numbers after are recognized as an ASCII code and characters corresponding to the ASCII code are inserted in the character string If no ASCII code for the two hexadecimal numbers after exists a conversion error occurs However when any of the following characters is described after no error occurs g gr L or l N or n P or p R or r T or t Line feed Newline Page form feed Return Tab 4 LABELS 4 6 Constant 29 30 4 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 e Use devices e 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 Consider taking the following measures e Use devices EDefining
21. CASE intV1 OF 1 bool1 TRUE 2 bool2 TRUE ELSE intV1 intV1 1 END CASE FOR intV1 0 TO 30 BY 1 DO intV3 intV1 1 END_FOR WHILE intV1 30 DO intV1 intV1 1 END_WHILE REPEAT intV1 intV1 1 UNTIL intV1 30 END_REPEAT FOR intV1 0 TO 10 BY 1 DO IF intv1 gt 10 THEN EXIT END IF END FOR Precautions MWhen an assignment statement is used e The maximum number of character strings that can be assigned is 255 If 256 or more character strings are assigned a conversion error occurs e Contacts and coils of the timer type or counter type cannot be used for the left side of an assignment statement e The instance of a function block cannot be used for the left side of an assignment statement Use input variables input output variables and external variables of the instance for the left side of an assignment statement MWhen an assigned arithmetic operation is used When an arithmetic operation result is assigned to a variable of the larger data type convert the variable of the arithmetic operation to the data type of the left side in advance and execute the operation Ex When an arithmetic operation result of 16 bit data INT type is assigned to 32 bit data DINT type varDint1 varlnt1 10 Varlnt1 is a INT type variable and varDint1 is a DINT type variable The arithmetic operation result is the same data type as that of the input operand Thus in the case of the above program when the operat
22. DOE seddi aiad aca daa to Ba 29 e dd 41 IF EL oe a ce ica wR Rote Rd De oe BOE a ER 41 A er S cr id e a EE 41 Sg oo Input variable 2 0 0 00 ee ee 11 15 TE EE IT 38 Input output variable 15 Arrays of structureS occ 28 e AA EO OR EE N EG 16 Assignment statement 39 INT 000 29 Internal variable 16 B Interrupt program 6 0 ee ee 9 Dlls aro nds can bee ae ened ee deed ed 22 BOOL Ee 22 L Ladder diagram ooooooooooooo o 6 32 C LEOLUNTER 2 an e258 Peon BOERE ae ASA Ee He 23 EL LURO esq cede sa oe oe Reed e AE 49 51 CASE SS 42 Local label 21 22 24 8E MEE NEE ORR ae 22 24 Long Counter 23 COMMON unit aaa ESE EES 49 52 Connecting pOiMt o o oooooo o 49 53 Connecting wire o o o o oooooo 49 53 M Constant Aa SE SS EEE Se RE 29 Macro type function blocks 18 Constant unii si dove heh rs ic aria ie Oe 50 Main routine program uaua aana 9 COUNTER eee ee EE EE EE ee eee 23 MOD cece cece ccc eeveeeeveeeees 38 Counter EE EE EE EE EE Ee 23 Module labels 0 0000 eee 21 D N Data type TEE EE ERG 22 23 24 NOT oc oe a ee E ee ER 38 Device assignment 1 e EE EE Ere 21 NOTES a armar er de o a N 35 DINT EE OS PES ADO GE Re 22 Number of array elementS 26 Double Word Signed A ARIES 22 Number OfStepS oooooooooooooo 13 Double Word Unsigned Bit
23. ELSIF bool3 THEN intV3 intV3 3 END IF 6 ST LANGUAGE 6 1 Configuration 41 42 MCASE MF OR MWHILE MREPEAT MEXIT CASE lt Integer expression gt OF lt Integer selection 1 gt lt Statement 1 gt lt Integer selection 27 lt Statement 2 gt lt Integer selection n gt lt Statement n gt ELSE lt Statement n 1 gt END_CASE iteration statement FOR lt Repeat variable initialization gt TO lt Last value gt BY lt Incremental expression gt DO lt Statement gt END FOR WHILE lt Boolean expression gt DO lt Statement gt END_WHILE REPEAT lt Statement gt UNTIL lt Boolean expression gt END_REPEAT 6 ST LANGUAGE 6 1 Configuration When the statement that has the integer selection value that matches with the value of the integer expression conditional expression is executed and if no integer selection value matches with the expression value the statement that follows the ELSE statement is executed The CASE statement is used to execute a conditional statement based on a single integer value or an integer value as the result of a complicated expression The FOR DO statement first initializes the data used as a repeat variable An addition or subtraction is made to the initialized repeat variable according to the incremental expression One or more statements from DO to END_FOR are repeatedly executed until the final value is exceeded
24. IC Label that can be accessed from other POUs Px fO x VAR_PUBLIC_RETAIN Latch type label that can be accessed from other POUs Px E x 4 3 Data Type Labels are classified into several data types according to the bit length processing method or value range The following two data types are provided e Elementary data type e Generic data type ANY The following data types are available as the elementary data type Bit BOOL Represents binary status such as ON or 0 FALSE 1 TRUE 1 bit OFF Word Unsigned Bit String 16 bit WORD Represents 16 bit 0 to 65535 16 bit Double Word Unsigned Bit String DWORD Represents 32 bit 0 to 4294967295 32 bit 32 bit Word Signed INT Handles positive and negative integer 32768 to 32767 16 bit values Double Word Signed DINT Handles positive and negative double word 2147483648 to 2147483647 32 bit integer values Handles the portion after the decimal point 2128 to 29128 y 27126 to 2128 32 bit of the float single precision FLOAT Single Precision REAL Effective digits 7 after the decimal point 6 4 LABELS 22 4 2 Class 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 Timer TIMER Structure that corresponds to a timer T of gt Page 23 Data typ
25. Instance name Input variable1 Variable List the assignment statement that assigns variables to the input variable and output variable before and after a function block call statement Instance name Variable2 Instance name Output variable The following table shows the symbols used for arguments in a function block call statement and available formats VAR IN OUT N A E All formats The execution result of the function block is stored by assigning the output variable that is specified by adding period after the instance name to the variable mes a deal block with one input variable and one di a FBADD EE FBADD1 IN1 Inputt output variable instance name de l Input variable1 IN1 Output1 FBADD1_OUT1 Output variable1 OUT1 Calling a function block with three input variables and two FB name FBADD FBADD1 IN1 Input1 IN2 Input2 IN3 Input3 output variables FB instance name FBADD1 Output1 FBADD1 _OUT1 Input variable1 IN1 Input variable2 IN2 Output2 FBADD1_OUT2 Input variable3 IN3 Output variable1 OUT1 Output variable2 OUT2 6 ST LANGUAGE 6 1 Configuration MF unction call statement 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 Calling a function with one input variable Example ABS Outout1 ABS Input1 C
26. LS instruction rising execution instruction is used in an IF statement IF bLabelO THEN PLS bLabel1 bLabel10 END IF 1 If bLabel0 OFF the condition expression in the IF statement is i FALSE the ON OFF judgment result is OFF The PLS bLabel0 OFF EE N instruction is not executed bLabel10 OFF does not change i 2 If bLabel0 ON the condition expression in the IF statement is TRUE and bLabel1 OFF the condition for executing the bLabel1 OFF o E instruction is OFF the ON OFF judgment result is OFF The PLS ION instruction is not executed bLabel10 OFF does not change ON OFF maa 3 If bLabel0 ON the condition expression in the IF statement is judgment OFF TRUE and bLabel1 ON the condition for executing the result instruction is ON the ON OFF judgment result is OFF to ON the 1 3 condition for a rise is satisfied The PLS instruction is executed 1 2 bLabel10 turns ON for once scan only bLabel10 OFF Ys Y Jj 6 ST LANGUAGE 6 1 Configuration 45 46 When a master control instruction is used Shown here is the operation when the master control is OFF e 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 e Outside of a selection statement or a iteration statement assignment statement is not processed and statement other than assignment statement is not exec
27. RR ER RE RR Rek Re The order of executions of program UNITS EE SE ES ee eee CONTENTS RELEVANT MANUALS User s manuals for the applicable modules Manual name manual number MELSEC iQ F FX5 User s Manual Startup lt JY997D58201 gt MELSEC iQ F FX5U User s Manual Hardware lt JY997D55301 gt MELSEC iQ F FX5UC User s Manual Hardware lt JY997D61401 gt MELSEC iQ F FX5 User s Manual Application lt JY997D55401 gt MELSEC iQ F FX5 Programming Manual Program Design lt JY997D55701 gt This manual MELSEC Q F FX5 Programming Manual Instructions Standard Functions Function Blocks lt JY997D55801 gt MELSEC iQ F FX5 User s Manual Serial Communication lt JY997D55901 gt MELSEC iQ F FX5 User s Manual MELSEC Communication Protocol lt JY997D60801 gt MELSEC iO F FX5 User s Manual MODBUS Communication lt JY997D56101 gt MELSEC Q F FX5 User s Manual Ethernet Communication lt JY997D56201 gt MELSEC Q F FX5 User s Manual SLMP lt JY997D56001 gt MELSEC iQ F FX5 User s Manual Positioning Control lt JY997D56301 gt MELSEC iQ F FX5 User s Manual Analog Control lt JY997D60501 gt GX Works3 Operating Manual lt SH 081215ENG gt TERMS Description Performance specifications procedures before operation and troubleshooting of the CPU module Describes the details of hardware of the FX5U CPU module including input output specifications wi
28. TION UNIT POU 3 1 Functian FUN ia cee eo ew RE a a inca ee Sl eh oe ee 3 2 Function Block FB iss ees s BERE ER ESE ies Qt ad EER Mee i obese oe Pee Rede CHAPTER 4 LABELS 4 1 We sarrera anipun OR beet RE OE edn ca EG aoa ee x 4 2 EE te sees estos E sees reese RA NE EE FA 4 3 Data IPOD DE OR REED OD SE DE HEG wee ee ER 4 4 POS ase eae AA RE N EO EE DE ETE 4 5 die di 244552256 EL EE Cassa Geers ot EE EE ENE 4 6 eo Gl AREA AE bobo EE EE RE OE EE N da des a ape 4 7 Precautions a ordre hae a ae da oa ee ds a ee ek CHAPTER 5 LADDER DIAGRAM 5 1 Configura sv s0cairacorda rod e ida ra da Ladder SIMDONS sub BR EER Re arder di rd dd as da Program execution order ss SE ee ee es es ee eee ee ee 5 2 LANNE ST RE EE AE OE EE EE EE RE ER OE EE 5 3 Statements and Notes sd nie sn RE RE EIER ER RR ER Re MR ER EER Re RR CHAPTER 6 ST LANGUAGE 6 1 CONMQUIANON iss se ER DE SR OAR DRR SEE HERE e SE SEEN wee Delimiter EE EER TE EK NE OE IR ds EE Labeland else RO IE EE OR EE N ee EE EO N df Comment eeaeee eraa e a E a a r e a a A EE EO EE a CHAPTER 7 FBD LD Language 7 1 COMMQUIaAION 24 9464 EE EER AA AA AAA slee EE ENE MA EE oo ee EE AE OE EO OE VOE ETE eee Volke lie ea ESRA EES BAAL HAD BEA AR RES ODE BAR ARE EE eee eet EE A o os ao ES SEE 6s see d dte hn BU ba he DA OER eee eb EE Se Labels and devices SE SE EE EE EE SEE es Ee EE eee eee es ee ee ee 7 2 Program execution order iss ee ER RE RR EER RE
29. a type of the argument The following table summarizes the instructions that can be used to pass the return value Argument class Data type Instruction used Number of steps VAR_OUTPUT Same as for passing the argument Same as for passing the argument Same as for passing the argument VAR IN OUT 3 PROGRAM ORGANIZATION UNIT POU 1 3 2 Function Block FB 9 20 EN ENO The following table lists the number of steps reguired for EN ENO Item Number of steps EN 6 ENO 4 ao Point The number of steps may increase or decrease depending on the following conditions e The actual argument or return value of the function block are index modified e The address specifying the device exceeds 16 bits in length e Nibble specification is performed EProgram 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 LAMELSEC iQ F FX5 Programming Manual Instructions Standard Functions Function Blocks Precautions Global pointer pointer type global labels Global pointer and pointer type global labels cannot be used as labels indicating program steps in the function block program MWhen an index register is used When an index register is used in the function block program ladder programs for saving and returning the index register values are required to protect the values Setting the in
30. acity 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 Capacity of latched local labels Total capacity of the data areas used for latched local labels Capacity of reserved area The capacity of the area reserved to add latched local labels and local instances when executing the online program change function fixed at 16 words The local label area capacity is assigned by using the engineering tool For details refer to the following LTIGX Works3 Operating Manual mm Ni NIE D Cl N ENO oe An EN enable input and ENO enable output can be appended to a function block in the same way as a function to control its execution K Page 12 EN ENO An actual argument must be assigned to EN when the instance of the function block to which an EN ENO is added is called rograms The program of a function block can be created by using the engineering tool TO Navigation window gt FB FUN gt Right click gt Add New Data The created program is stored in the FB FUN file TO CPU Parameter gt Program Setting gt FB FUN File Setting Up to 64 programs can be stored in one FB FUN file For details on program creation refer to the followin
31. alling a function with three input variables Example MAX Outout1 MAX Input1 Input2 Input3 Calling a function with EN ENO excluding standard functions Example MAX_E Output1 MAX_E boolEN boolENO Input1 Input2 Input3 Calling a standard function Example MOV boolENO MOV boolEN Input Output The execution result of the function is ENO and the first argument Variable is EN A user defined function that does not return a value and a function that includes a VAR_OUTPUT variable in the argument of a Call statement can be executed as a statement by adding a semicolon at the end WRETURN statement MRETURN RETURN The RETURN statement is used to end a program function block or function in the middle of processing When the RETURN statement is used in a program the processing jumps to the next step after the last line of the program When the RETURN statement is used in a function block the processing is returned from the function block When the RETURN statement is used in a function the processing is returned from the function One pointer type label is used by the system for one RETURN statement IF bool1 THEN RETURN END IF A user defined function that does not return a value and a function that includes a VAR OUTPUT variable in the parameter of a call statement can be executed as a statement by adding a semicolon at the end statement HIF IF lt Boolean expres
32. ant elements along with the flows of data and signals You can easily create a program that may be complicated to create by using a ladder program So you can enhance the productivity of programs MLadder diagram Write When using ladder diagram refer to the following gt Page 32 LADDER DIAGRAM EST language Es IF X0 THEN 7 YO TRUE 3 DO DIO ALEND IF T When using ST language refer to the following 3 Page 36 ST LANGUAGE MFBD LD language xD jar MOM 5 d Di9 When using FBD LD language refer to the following K Page 49 FBD LD Language 1 OUTLINE Poin tr e Ladder diagram and FBD LD language are for customers who have knowledge or experience of sequence control and logic circuits e ST language is for customers who have knowledge or experience of the C language programming e 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 1 OUTLINE l 2 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 Function block Program block Program block Function block Function Program block Function Function For the POU refer to the following K Page
33. ar7 Var8 Coil Pame gt A HK HO 0 This is the wire a connect the connecting points between FBD unit LD unit and common unit After units are connected the data is transferred from the left end to the right end The data types of the connected units need to be the same This is a mia point to use a connecting wire to connect FBD unit LD unit and common unit The point on the left side of each unit is the input side while the point on the right side represents the output side Contact GET Coll o Variable Constant me Function Block Function The return value is not shown on a function The connecting point is hidden after connecting a wire 7 FBD LD Language 7 1 Configuration 93 94 Minverting 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 You can invert the following data types BOOL WORD DWORD ANY_BIT and ANY_BOOL Worksheet A worksheet is a work area for inserting program units and for connecting them with wires Constant Methods for expressing constants The following table shows the expression methods for setting a constant in FBD LD language Data type Expressing method Example String 32 STRING Enclose character strings with single quota
34. bel2 Preset wLabel3 Valueln wLabel4 ValueOut gt wLabel5 Status gt bLabel6 END IF When bLabel1 on and bLabel2 on counting starts When bLabel1 on and bLabel2 off the counted value is cleared When bLabel1 off and bLabel2 on counting stops The counted value is not cleared When bLabel1 off and bLabel2 off counting stops The counted value is not cleared MProgram after change TIMER_100 FB _M_1 Coil bLabell8bLabel2 Preset wLabel3 Valueln wLabel4 ValueOut gt wLabel5 Status gt bLabel6 When a counter function block is used MProgram before change IF bLabel1 THEN COUNTER_FB_M_1 Coil bLabel2 Preset wLabel3 ValueIn wLabel4 ValueOut gt wLabel5 Status gt bLabel6 END_IF When bLabel1 on and bLabel2 on off the value is incremented by 1 When bLabel1 off and bLabel2 on off the value is not counted The counting operation does not depend on the on off status of bLabel1 MProgram after change COUNTER_FB_M_1 Coil bLabel1 amp bLabel2 Preset wLabel3 Valueln wLabel4 ValueOut gt wLabel5 Status gt bLabel6 44 6 ST LANGUAGE 6 1 Configuration An error occurs when the program before change is used since the statement related to the timer or counter is not executed when the selection statement is not satisfied 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
35. ble parts battery backlight fuse etc designated in the instruction manual had been correctly serviced or replaced e Relay failure or output contact failure caused by usage beyond the specified life of contact cycles f Failure caused by external irresistible forces such as fires or abnormal voltages and failure caused by force majeure such as earthquakes lightning wind and water damage g Failure caused by reasons unpredictable by scientific technology standards at time of shipment from Mitsubishi h Any other failure found not to be the responsibility of Mitsubishi or that admitted not to be so by the user of production 1 Mitsubishi shall accept onerous product repairs for seven 7 years after production of the product is discontinued Discontinuation of production shall be notified with Mitsubishi Technical Bulletins etc 2 Product supply including repair parts is not available after production is discontinued Overseas service Overseas repairs shall be accepted by Mitsubishi s local overseas FA Center Note that the repair conditions at each FA Center may differ Exclusion of loss in opportunity and secondary loss from warranty liability Regardless of the gratis warranty term Mitsubishi shall not be liable for compensation of damages caused by any cause found not to be the responsibility of Mitsubishi loss in opportunity lost profits incurred to the user or third person by failure of Mit
36. cess or function and each unit to be programmed individually 1 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 LAGX 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 Ladder diagram is a graphic language that indicates circuits using contacts coils and others The ladder diagram describes logic circuits with symbolized contacts and coils for easy to understand sequence control Structured text language ST language ST language is a text language that describes programs with IF statements operators and others Because operation processing that is difficult to describe in ladder diagram can be easily and briefly described with ST language ST language is suitable for applications requiring complicated arithmetic operation or comparative operation With ST language programs can be easily described with syntax using selective branches with conditional statements and repetition by repetitive statements in the same way as C language Function block diagram ladder diagram This is a graphic language that describes a program by wiring blocks for specific processing function FBD LD language elements FB elements variable elements and const
37. cks MCalling source When calling a subroutine type function block the calling source generates the processing that passes the argument and return value before and after the call processing 1 Passing the argument 2 Calling the FB1 program 3 Passing the return value Program block 1 displayed Program file es GN ey FB1 a i MO FB1 N ma ERA EE GE OE HE SEER E The call target program is replaced with the call instruction Calling the function block Passing the argument The instruction used to pass the argument differs depending on the class and data type of the argument The following table summarizes the instructions that can be used to pass the argument Argument class Data type Instruction used Number of steps VAR_INPUT Bit LD OUT For the number of steps required for VAR IN OUT LD MOVB each instruction refer to the Which of the above instructions to use is following determined by the combination of the LLIMELSEC iQ F FX5 Programming programming language type of function and Manual Instructions Standard type of input argument Functions Function Blocks Word Unsigned Bit String 16 bit LD MOV Double Word Unsigned Bit String 32 bit LD DMOV Word Signed Double Word Signed Calling the program A total of 12 steps are required to call the function block program Passing the return value The instruction used to pass the return value differs depending on the class and dat
38. d to several components according to their processing information and functions Each component is designed to have a high degree of independence for easy addition and replacement The following shows examples of the process that would be ideal to be structured e A process that is used repeatedly in a program e A process that can be divided into functions This chapter describes two types of POUs using labels Devices can also be used in the program of a function or function block For details on devices refer to the following LLIMELSEC iO F FX5 User s Manual Application 3 PROGRAM ORGANIZATION UNIT POU 3 1 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 Function Program block HA Ef Function block or function Program block Input variable and output variable For a function input variables and output variables can be defined Output variable can be created to output data separate from the return value MCase of ladder diagram MCase of FBD LD language 1 Function name 2 Input variables 3 Output variables For classes for which
39. dex register data to O after saving can prevent an error that could be caused by an index modification validity check Whether the device number exceeds the device range or not is checked Ex A program that saves the values in the index registers Z1 and Z2 before the program execution and returns the saved values after the program execution Save the index register values pa index_reg_tmp2 EE Clear the index register values SM400 Before the program execution save the index register values in index_reg_tmp Set 0 to the index register areas Program execution Return the register values ORE Ri SM400 After the program execution return the values saved in index_reg_tmp to the index register 3 PROGRAM ORGANIZATION UNIT POU 3 2 Function Block FB 4 LABELS Labels are variables for VO data or internal processing specified by a character string Users can create a program without considering devices or buffer memory size by using labels Thus a program where labels are used can be reused in a system with a different module configuration easily When labels are used there are some precautions on programming and functions used For details refer to the following gt Page 30 Precautions 4 1 Type This manual describes the following types of label e Global labels e Local labels Global labels Global labels are labels that can be shared by programs in a project Globa
40. e Comment line are used as a comment Multiple line comment ES The character strings between the start symbol and the end symbol MWithout newline are used as a comment Comment Newlines can be inserted in the comment MWith newline Comment in the first line Comment in the second line The character strings between the start symbol and the end symbol MWithout newline are used as a comment Comment Newlines can be inserted in the comment MWith newline Comment in the first line Comment in the second line When the multiple line comment format is used do not use end symbols inside comments 6 ST LANGUAGE 6 1 Configuration r 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 7 1 Configuration With the FBD LD language the following program can be created 11 10 A 3 VarQD1 ON i War003 FBD unit LD unit Common unit 1 2 3 4 5 6 Connecting wire Connecting point Worksheet In a program of the FBD LD language data flows from the output point of a function block FB a function FUN a variable unit label or device and constant unit to the input point of another function block variable unit and so forth 7 FBD LD Language 7 1 Configuration 49 50 Program unit FBD unit Uni
41. e Setting Up to 64 programs can be stored in one FB FUN file For details on program creation refer to the following How to create function programs LAGX Works3 Operating Manual Number of FB FUN files that can be written to a CPU module LLIMELSEC iQ F FX5 User s Manual Startup Applicable devices and labels The following table lists the devices and labels that can be used in function programs O Applicable A Applicable only by instructions Not applicable as a label indicating a program step X Not applicable Label other than pointer type Global label Local label Label pointer type Pointer type global label Pointer type local label Device Global device Ool elox Pointer Global pointer 1 The timer retentive timer counter and long counter types cannot be used 3 PROGRAM ORGANIZATION UNIT POU 3 1 Function FUN 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 Main program FB file FUN1 program FB file FUN3 program FB file FUN2 program You can nest all function blocks and functions up to 32 times Labels defined by a function The labels defined by a function are assigned in the temporary areas of the storage target memory during execution of the function and the areas are freed after the processing completes The following figure shows the label assignm
42. e main program and executed 2 FB3 is loaded into the FB1 program 3 The FB2 program is loaded into the main program and executed in the same way as the FB1 program Program file Execution flow Actual structure of Main program main program 3 Subroutine type function blocks The program of a subroutine type function block is stored in the FB FUN file and called by the calling source program when executed Use a subroutine type function block to reduce the program size Execution flow Program file FB file Main program FB1 program FB file FB3 program FB file FB2 program You can nest all of function blocks and functions up to 32 times Macro type function blocks Calling source When calling a macro type function block the calling source loads the call target program during compilation 1 The program is loaded in two or more call locations Program block 1 displayed Program file fe HEHEHE NE EEN NONE MH E EE EE EEEEEEEE eee ANnEAa fom s 1 For FB1 program EHEHEHEH EB1 b EEHEEHE E E r 3 PROGRAM ORGANIZATION UNIT POU 3 2 Function Block FB 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 LLIMELSEC iQ F FX5 Programming Manual Instructions Standard Functions Function Blocks Subroutine type function blo
43. ecify that device or label as an index e Members of labels structures or function blocks whose name ends with _ cannot be specified e Indexes cannot be specified to labels arrays whose name ends with _ 7 FBD LD Language 7 1 Configuration 1 2 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 7 SM400 10 11 Executed from the top to the bottom The number of the order of the execution is shown on each unit placed on the FBD LD editor ai Var001 Var003 ap di Var002 7 FBD LD Language 7 2 Program execution order 99 INDEX Symbols FOR DO 222 oe es Fae on BERS eee Ee 45 llllllllllalalalalalallallllllllllllli iaIaasl lM Function FUN 10 11 dr EE E 38 Function Block FB 10 15 ee ee ee ee a 38 Function block call statement 40 EE N N EE 38 Function call statement 41 RE OE ea a ok ica a ee da bd 38 IN 38 a toa added cue 38 G Big tae she 20g We are as LI ere 38 Generic data type ANY o o ooooo o 24 rr 38 Global label 2 00 c ccc cece ee cece 22 24 SP ERG 38 Global labels 0 0 ccc eee e cece ee o 21 METERS a HOE a ER eee 38 ME AE OE ER AT EE OOS HE 38 AE EE e oe use a OR NN 38 l
44. ed after conversion an automatic conversion is made into to a value with a zero extension In the case of a single precision real an automatic conversion is made into the same value as the integer before the conversion 1 When the data of 16 bits a word signed or a word unsigned bit string 16 bits is transferred to an input argument of the data type ANY_REAL an automatic conversion is made into a single precision real 2 When the data of a word unsigned bit string 16 bits is transferred to an input argument of ANY32 an automatic conversion is made into a double word unsigned bit string 32 bits For data types that are not described above use the type conversion function Since type conversion is not performed in the following cases use the type conversion function e Type conversion between integer data types with different signs e Type conversion between the data types by which the data is deleted For the precautions for assigning the result of an arithmetic operation refer to the following E Page 43 When an assigned arithmetic operation is used ram control statement MFunction block call statement Instance name Input variable1 Variable1 Output Enclose the assignment statement that assigns variables to the input variable and output variable1 gt Variable2 variable by after the instance name When using multiple variables delimit the assignment statement by comma
45. el2 uLabel12 10 Output contact uLabels luLabel12 500 Output contact Set value Set value taba 7 Current value Current value The above function block starts counting current value when the input variables Count contact turn on and turns on the output variable Output contact when the current value held in the internal variable reaches the set value Instance A and B are the same function blocks but instances A and B hold different states because the instance is different In the above example output variable Output contact of instance B is already turned ON but output variable Output contact of instance A is not turned ON Because the current value of instance A does not reach the set value output variable Output contact of instance A is not turn ON MStructure of instance An instance consists of the following data areas Data area Description Local label area Used to assign local labels of the function block Local latch label area Used to assign latched local labels of the function block MCapacity of instance The capacity of each data area of an instance should be calculated as follows Local label area Capacity of local label area of instance Total capacity of data of non latched local labels Capacity of reserved area Breakdown Description Capacity of non latched local labels Total capacity of the data areas used for local labels 3 PROGRAM ORGANIZATION UNIT POU 3 2 Function Block FB Cap
46. ent for recreation and amusement and safety devices shall also be excluded from the programmable controller range of applications However in certain cases some applications may be possible providing the user consults their local Mitsubishi representative outlining the special requirements of the project and providing that all parties concerned agree to the special circumstances solely at the user s discretion 99 60 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 MODBUSS 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 Manual number JY997D55701D 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 MITSUBISHI ELECTRIC CORPORATION HEAD OFFICE TOKYO BUILDING 2 7 3 MARUNOUCHI CHIYODA KU TOKYO 100 8310 JAPAN Specifications are subject to change without notice
47. ents while the above functions are being executed 0 Main program being FUN1 being executed FUNS being executed FUN1 being executed executed before FUNS is called after FUN3 is executed j Label area of FUN1 Label area of FUN1 _ _ _ ee _ ee ae EE EE N EE am Label area of FUNS gt gt BEE 3 Q Main program being FUN2 being executed Main program being executed executed m Label area of FUN2 For the types of labels that can be defined by a function refer to the following gt Page 22 Class Poin tr The label to be defined by a function must be initialized by a program before the first access because the label value will be undefined Number of steps To call a function the number of steps required is not only for the program itself but also for the processing that passes the argument and return value the processing that calls the program and additional steps used by the system Program The number of steps required for a function program is the total number of instruction steps plus at least additional 13 steps used by the system For the number of steps required for each instruction refer to the following LLIMELSEC iQ F FX5 Programming Manual Instructions Standard Functions Function Blocks 3 PROGRAM ORGANIZATION UNIT POU 1 3 1 Function FUN 3 14 MCalling source When calling a function the calling source generates the processing that passes the argument a
48. es of timers and counters a device Retentive Timer RETENTIVETIMER Structure that corresponds to a retentive timer ST of a device Counter COUNTER Structure that corresponds to a counter C of a device Long Counter LCOUNTER Structure that corresponds to a long counter LC of a device Pointer POINTER Type that corresponds to a pointer P of a device LLIMELSEC iQ F FX5 User s Manual Application 1 The time data is used in the time data type function of standard functions For the standard function refer to the following LLIMELSEC iQ F FX5 Programming Manual Instructions Standard Functions Function Blocks 2 When using a constant for a label of the time data prefix T to the label MData types of timers and counters The data types of a timer retentive timer counter and long counter are structures that have contacts coils and current values Timer TIMER Bit Indicates contacts The operation is the same O FALSE 1 as the contact of a timer device TS TRUE 1 Bit Indicates coils The operation is the same as the 0 FALSE coil of a timer device TC TRUE Word unsigned Bit String 16 bit Indicates a current value The operation is the 0 to 32767 same as the current value of a timer device TN Bit Indicates contacts The operation is the same 0 FALSE 1 as the contact of a retentive timer device STS TRUE Bit Indicates coils The operation is the same as the O
49. g How to create function programs LAGX Works3 Operating Manual Number of FB FUN files that can be written to a CPU module LLIMELSEC iQ F FX5 User s Manual Startup MType of programs There are two types of function blocks and the program of each function block type is stored in different ways e Macro type function block e Subroutine type function block For details refer to the following gt Page 18 Operation overview The above cannot be selected for module function blocks standard functions and standard function blocks Applicable devices and labels The following table lists the devices and labels that can be used by function block programs O Applicable A Applicable only by instructions Not applicable as a label indicating a program step Label other than pointer type Global label E A OOO A A e E A e O E Local label Label pointer type Pointer type global label Pointer type local label Device Global device Pointer Global pointer 3 PROGRAM ORGANIZATION UNIT POU 3 2 Function Block FB 1 7 18 Operation overview MMacro 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 1 The FB1 program is loaded into th
50. ined 2 None of the timer retentive timer long timer counter long timer long retentive timer and long counter types can be defined 4 LABELS 4 3 Data Type 4 4 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 N Two dimensional array Label name Indexes Label name Indexes me oa a a EEUE Definition of arrays MArray elements When an array is defined the number of elements or the length of array must be determined For the range of the number of elements refer to the following K Page 26 Maximum number of array elements MDefinition format The following table lists definition format examples up to three dimensions The range from the array start value to the array end value is the number of elements One dimension Array of elementary data type structure name array start value array end value e For elementary data types gt Page 22 Elementary data type e For structured data types Two dimensions Array of elementary data type structure name array start value array end value array start lt Page 27 Structures value array end value Definition example Bit 0 2 Definition example Bit 0 2 0 1 Three dimensions Array of elementary data type st
51. ion result of varlnt1 10 exceeds the range of the INT type 32768 to 32767 an overflow or underflow result is assigned to varDint1 In this case convert the operand of the operational expression to the data type of the left side in advance and execute the operation varDint2 INT TO DINT varlnt1 INT type variable is converted to DINT type variable varDint2 varDint2 10 DINT type multiplication is performed and the operation result is assigned Using the operator for sign inversion in an arithmetic operation When the operator is used to invert the sign of the minimum value of a data type the minimum value evaluates to the same value For example 32768 where the operator is used with the minimum value of INT type evaluates to 32768 Thus an unintended result may be produced if the operator is used to invert the sign of a variable whose data type will be automatically converted Ex When the value of varlnt1 INT type is 32768 and the value of varDint1 DINT type is 0 varDint2 varlnt1 varDint1 In the example above the value of varlnt1 evaluates to 32768 and 32768 is assigned to varDint2 When using the operator to invert the sign of a variable in an arithmetic operation perform automatic conversion of the data type of the variable before the arithmetic operation Alternatively avoid using the operator for sign inversion in the program Ex Performing automatic c
52. l labels can be used in all the programs in a project Global labels can be used in program blocks and function blocks When setting a global label set the label name class and data type and assign a device MDevice assignment Devices can be assigned to global labels Item Description Label to which no device is assigned e Programming without concern to devices is possible e Defined labels are allocated to the label area or latch label area in the device label memory Label to which a device is assigned e If a device is to be programmed as a label referring to a device that is being used for input or output the device can be assigned directly e Defined labels are allocated to the device area in the device label memory Local labels Local labels are labels that can be used in each POU only Local labels that are not included in POUs cannot be used When setting a local label set the label name class and data type Poin tr There are other types of labels available in addition to global labels and local labels MSystem labels System labels can be shared among iQ Works compatible products and are managed by MELSOFT Navigator Global labels registered as system labels can be monitored or accessed using the system labels on GOT For details refer to the following LAiQ Works Beginner s Manual Mi Module labels Module labels are labels defined uniquely by each module Module labels are automatically generated by the engineering
53. mbinations of series connections and parallel connections in a ladder consisting of contacts and coils 5 1 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 4 A ladder where instructions are used 5 A ladder where standard functions and function blocks are used Ladder symbols This section shows ladder symbols that can be used for programming in the ladder diagram Element Description NO contact E Turns on when a specified device or label is ON NC contact Turns on when a specified device or label is OFF Rising edge HA Turns on at the rising edge OFF to ON of a specified device or label Falling edge di Turns on at the falling edge ON to OFF of a specified device or label Negated rising edge Turns on when a specified device or label is OFF or ON or at the falling edge ON to OFF of a specified device or label LI Negated falling edge Turns on when a specified device or label is OFF or ON or at the rising edge OFF to ON of a specified device or label Conversion of operation result Turns on at the rising edge OFF to ON of an operation result Turns off when the operation result to leading edge pulse is other than the rising edge Conversion of operation result Turns on at the falling edge ON to OFF of an operation result Turns off when
54. nd return value before and after the call processing 1 Passing the argument 2 Calling the FUN1 program 3 Passing the return value Program block 1 displayed Program file H mov DO xx MO 1 H FUNCall FUN e 2 The call target program is replaced with the call i instruction l Calling the function Passing the argument The instruction used to pass the argument differs depending on the class and data type of the argument The following table summarizes the instructions that can be used to pass the argument VAR_INPUT i LD OUT For the number of steps required for LD MOVB each instruction refer to the Which of the above instructions is used is following determined by the combination of the LAMELSEC iQ F FX5 Programming programming language type of function and Manual Instructions Standard type of input argument Functions Function Blocks Word Unsigned Bit String 16 bit LD MOV Double Word Unsigned Bit String 32 bit LD DMOV Word Signed Double Word Signed Calling the program At least 16 steps are required to call the program of a function Passing the return value The instruction and the number of steps used for passing the return value are identical to those for passing the argument VAR_OUTPUT Same as for passing the argument Same as for passing the argument Same as for passing the argument EN ENO The following table lists the number of steps reguired for EN ENO
55. nd the program must connect ENO and EN over a connecting wire in order to prevent the function from using an indefinite value a a BOOL EN DATA bLabel1 BOOL_OUT_DATA1 bLabel2 ap bLabel3 1 Connect ENO and EN over a connecting wire LD unit Units of ladder diagram that can be used in a program of the FBD LD language are shown below Unit Symbol Description Left bus H This is an unit to represent a bus This is the starting point to create a ladder circuit NO contact Turns on when a specified device or label is ON NC contact y Turns on when a specified device or label is OFF Rising edge Ty Turns on at the rising edge OFF to ON of a specified device or label Falling edge TT Turns on at the falling edge ON to OFF of a specified device or label Negated rising edge Turns on when a specified device or label is OFF or ON or at the falling edge ON to OFF of a 7 specified device or label Negated falling edge PA Turns on when a specified device or label is OFF or ON or at the rising edge OFF to ON of a specified device or label Coil Outputs an operation result to a specified device or a label Complementing coil When the operation result turns OFF the specified device or label turns ON Lt j Set _ When the operation result turns ON the specified device or label turns ON S The device or the label that turns ON remains ON even if the operation result turns OFF Rese
56. ng maintenance or testing on site that involves replacement of the failed module Gratis Warranty Term The gratis warranty term of the product shall be for one year after the date of purchase or delivery to a designated place Note that after manufacture and shipment from Mitsubishi the maximum distribution period shall be six 6 months and the longest gratis warranty term after manufacturing shall be eighteen 18 months The gratis warranty term of repair parts shall not exceed the gratis warranty term before repairs Gratis Warranty Range 1 The range shall be limited to normal use within the usage state usage methods and usage environment etc which follow the conditions and precautions etc given in the instruction manual users manual and caution labels on the product 2 Even within the gratis warranty term repairs shall be charged for in the following cases a Failure occurring from inappropriate storage or handling carelessness or negligence by the user Failure caused by the user s hardware or software design b Failure caused by unapproved modifications etc to the product by the user c When the Mitsubishi product is assembled into a user s device Failure that could have been avoided if functions or structures judged as necessary in the legal safety measures the user s device is subject to or as necessary by industry standards had been provided d Failure that could have been avoided if consuma
57. ng multiple data types in a structure and used in a program the order the data is stored after converted is not the order the data types were defined When programs are converted using the engineering tool labels are classified into type and data type and then assigned to the memory memory assignment by packing blocks LAGX Works3 Operating Manual e Ifa member of a structure is specified in an instruction operand that uses control data series of consecutive devices from the operand used by the instruction the control data is assigned to members of the structure by the order they are stored in memory not the order the members are defined 4 LABELS 4 5 Structures 217 28 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 4 Member Label 4 Member Label 4 Member Label 4 When a structure is declared as an array append an index enclosed by after the structure label name The array of structure can be specified as arguments of functions and function blocks Ex When using an element of the structured array stLabel 0 bLabel1 t Member name Indexes Structure label name Data types that can be specified The following data types can be specified as a member of a structure e Elementary data type e Pointer type e Arrays e Other structures Structure ty
58. ns that disables enables interrupt programs as shown below For the DI El instructions refer to the following LLIMELSEC iQ F FX5 Programming Manual Instructions Standard Functions Function Blocks 4 LABELS 4 4 Arrays MArray 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 4 5 Structures A structure is a data type that includes different labels Structures can be used in all POUs Each member label included in a structure can be defined even when the data types are different Creating structures To create a structure first create the configuration of the structure and define members for the created structure Structure Member Label 1 Member Label 2 Member Label 3 Member Label 4 How to use structures To use structures register the label with the defined structure as a new data type To specify each member append an element name after the structure label name with period as a member name Ex When using the member of a structure stLabel1 bLabel1 Member name Structure label name Point FP e When labels are registered by defini
59. onversion of the data type before an arithmetic operation varDint3 varlnt varDint2 varDint3 varDint1 Avoiding the use of the operator for sign inversion varDint2 varDint1 varlnt1 6 ST LANGUAGE 6 1 Configuration 43 MWhen 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 lt Statement gt is always set to ON Ex Program whose bit type label is always set to on IF bLabel1 THEN bLabel1 pLabel2 TRUE H END IF To avoid the bit device to be always set to ON add a program to turn OFF the bit type label as shown below Ex Program to avoid the bit type label to be always set to ON IF bLabel1 THEN bLabel1 bLabel2 bLabel2 TRUE JP ELSE bLabel2 FALSE END IF 1 The above program can also be described as follows bLabel2 bLabel1 or OUT bLabel1 bLabel2 However when the OUT instruction is used in lt Statement gt the program status becomes the same as the program whose bit type label is always set to on MWhen a timer function block or counter function block is used Boolean expression conditional expression in a conditional statement differs for the execution conditions of the timer function block or counter function block Ex When a timer function block is used MProgram before change IF bLabel1 THEN TIMER 100 FB M_1 Coil bLa
60. pes The following data types are defined as a structure beforehand Type Reference Timer type gt Page 22 Data Type Retentive Timer type Counter type Long Counter type 4 LABELS 4 5 Structures 4 6 Constant Types of constants The following table shows the expressions for setting a constant to a label Bit e Word Unsigned Bit String 16 bit e Double Word Unsigned Bit String 32 bit e Word Signed e Double Word Signed FLOAT Single Precision String 32 Time Boolean data Input TRUE or FALSE TRUE FALSE Append 2 in front of a binary number Append 8 in front of an octal number Decimal Directly input a decimal number or append K in front of a decimal number Append 16 or H in front of a hexadecimal number Append 2 in front of a binary number Append 8 in front of an octal number Decimal Directly input a decimal number or append K in front of a decimal number Hexadecimal Append 16 in front of a hexadecimal number Or append H in front of a value Real number Directly input a real number or append E in front of a real number Real number Append E in front of an exponent expression or a real number exponent Append in front of exponent part expression Character string Enclose a character string with single quotations Append T in front 240 2 1 8 0 8 1 0 1 KO K1 16 0 16 1 HO H1 2 0010 2 01101010 2 1111_ 1
61. put variable O Test Input output variable lO Test FB label name FB1 FB1 I Test DO O Test gt D1 1O Test D100 Calling a standard function Convert BOOL data type to INT DINT data type wLabel2 BOOL TO INT bLabel1 6 ST LANGUAGE 36 6 1 Configuration Operators and syntaxes are used for programing in ST language intV2 ABS intV1 IF M1 THEN btn01 TRUE ELSE Conditional statement btn01 FALSE END IF Output ENO ENEG btn01 Input1 Calling a function LadderFBlnstance lnput1 bool1 Input2 bool2 Input3 bool3 Calling a function block user function block A statement must end with semicolon intV2 2 Spaces tabs and line feeds can be inserted anywhere between an operator and data ntv1 0 INLV2 Tab 2 Comments can be inserted in a program intV1 0 Substitution IntV2 2 Constituent elements of a program A ST program consists of the following elements Delimiter gt Page 38 Delimiter LOMELSEC iQ F FX5 User s Manual Application LLIMELSEC iQ F FX5 Programming Manual Instructions Standard Functions Function Blocks Constant gt Page 46 Constant Label lt Page 46 Label and device Comment Turn ON Turn ON Turn ON gt Page 48 Comment e Use one byte delimiters operators and reserved words e For details of reserved words refer to the following LAGX Works3 Operating Manual 6 ST LANGUAGE
62. ring installation and maintenance Describes the details of hardware of the FX5UC CPU module including input output specifications wiring installation and maintenance Describes basic knowledge required for program design functions of the CPU module devices labels and parameters Describes specifications of ladders ST FBD LD and other programs and labels Describes specifications of instructions and functions that can be used in programs Describes N N network MELSEC Communication protocol inverter communication non protocol communication and predefined protocol support Explains methods for the device that is communicating with the CPU module by MC protocol to read and write the data of the CPU module Describes MODBUS serial communication Describes the functions of the built in Ethernet port communication function Explains methods for the device that is communicating with the CPU module by SLMP to read and write the data of the CPU module Describes the built in positioning function Describes the analog function System configuration parameter settings and online operations of GX Works3 Unless otherwise specified this manual uses the following terms e O indicates a variable part to collectively call multiple models or versions Example FX5U 32MR ES FX5U 32MT ES gt FX5U 32MD ES e For details on the FX3 devices that can be connected with the FX5 refer to User s Manual Hardware of the CPU module
63. rospace medicine or passenger movement vehicles consult with Mitsubishi Electric e This product has been manufactured under strict quality control However when installing the product where major accidents or losses could occur if the product fails install appropriate backup or failsafe functions in the system Note e If in doubt at any stage during the installation of the product always consult a professional electrical engineer who is qualified and trained to the local and national standards If in doubt about the operation or use please consult the nearest Mitsubishi Electric representative e 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 e This manual content specification etc may be changed without a notice for improvement e The information in this manual has been carefully checked and is believed to be accurate however if you have noticed a doubtful point a doubtful error etc please contact the nearest Mitsubishi Electric representative When doing so please provide the manual number given at the end of this manual CONTENTS CHAPTER1 OUTLINE CHAPTER 2 PROGRAM CONFIGURATION 2 1 Program BIOEK 4 eins SERE a ete eS thee Reed oe eR eee E CHAPTER 3 PROGRAM ORGANIZA
64. ructure name array start value array end value array start value array end value array start value array end value Definition example Bit 0 2 0 1 0 3 EER i Y E O Y v to use arrays To identify individual labels of an array append an index enclosed by after the label name For an array with two or more dimensions delimit indexes in by using comma bLabel1 0 bLabel2 0 3 Label name Indexes nication i Constant bLabel1 0 An integer equal to or greater than 0 can be specified Decimal constant or hexadecimal constant can be specified Device bLabel1 D0 A word device or double word device can be specified Label bLabel1 uLabel2 The following data types can be specified e Word unsigned bit string 16 bits e Double word unsigned bit string 32 bits e Word signed Double word signed Expression bLabel1 5 4 Expressions can be specified only in ST language 4 LABELS 4 4 Arrays 25 26 Precautions When a bit of a device label example DO 0 is assigned to bit array in global label labels and devices can not be used for the array index in programming example bLabel1 DO cannot be programmed Poin tr e 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
65. side the program block Jumping from outside the program block Calling subroutine programs Called as subroutine programs 1 Includes branches caused by the BREAK instruction 2 7 FBD LD Language 5 7 1 Configuration MThe operation of a return unit A return unit operates differently depending on whether a program function and or function block used there 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 If a return element is used in a macro type function block do not place two or more function block elements of the same instance name A local label SYSTEM RETURN is automatically registered when a program using a return element is converted The local label SYSTEM RETURN has the following operational limitations Changing the label name Prohibited Changing the data type Prohibited Changing the class Prohibited Deleting the label Prohibited Changing the line of registration Permitted 1 Ifthe program is converted again after change or deletion a new local label is registered Connector unit Use a connector element to place the program within the display area or print area of the FBD LD editor Var Var2 Var3 Var4 Var5 Var6 V
66. sion gt THEN lt Statement gt END IF MIF ELSE IF lt Boolean expression gt THEN lt Statement 1 gt ELSE lt Statement 2 gt END IF mIF ELSIF IF lt Boolean expression 1 gt THEN lt Statement 1 gt ELSIF lt Boolean expression 2 gt THEN lt Statement 2 gt ELSIF lt Boolean expression 3 gt THEN lt Statement 3 gt END IF The statement is executed when the value of Boolean expression conditional expression is TRUE The statement is not executed if the value of Boolean expression is FALSE Any expression that returns TRUE or FALSE as the result of the Boolean operation with a single bit type variable status or a complicated expression that includes many variables can be used for the Boolean expression Statement 1 is executed when the value of Boolean expression conditional expression is TRUE Statement 2 is executed when the value of Boolean expression is FALSE Statement 1 is executed when the value of Boolean expression conditional expression 1 is TRUE Statement 2 is executed when the value of Boolean expression 1 is FALSE and the value of Boolean expression 2 is TRUE Statement 3 is executed when the value of Boolean expression 1 and 2 are FALSE and the value of Boolean expression 3 is TRUE IF bool1 THEN intV1 intV1 1 END_IF IF bool1 THEN intV3 intV3 1 ELSE intV4 intv4 1 END_IF IF bool1 THEN intV1 intV1 1 ELSIF bool2 THEN intv2 intV2 2
67. subishi products special damages and secondary damages whether foreseeable or not compensation for accidents and compensation for damages to products other than Mitsubishi products replacement by the user maintenance of on site equipment start up test run and other tasks Changes in product specifications The specifications given in the catalogs manuals or technical documents are subject to change without prior notice Product application 1 In using the Mitsubishi MELSEC programmable controller the usage conditions shall be that the application will not lead to a major accident even if any problem or fault should occur in the programmable controller device and that backup and fail safe functions are systematically provided outside of the device for any problem or fault 2 The Mitsubishi programmable controller has been designed and manufactured for applications in general industries etc Thus applications in which the public could be affected such as in nuclear power plants and other power plants operated by respective power companies and applications in which a special quality assurance system is required such as for railway companies or public service purposes shall be excluded from the programmable controller applications In addition applications in which human life or property that could be greatly affected such as in aircraft medical applications incineration and fuel devices manned transportation equipm
68. t When the operation result turns ON the specified device or label turns OFF j When the operation result is OFF the status of the device or the label does not change 7 FBD LD Language 1 7 1 Configuration WThe 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 e 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 e In the case of a parallel connection 2 an OR operation is executed with the operation results so far This will be the operation result s Series connection contact XK 2 Parallel connection contact Common unit This represents a common unit placed on the FBD LD editor Unit Symbol Description Jump The execution processing is jumped over from a jump unit to a jump label The portion that is jumped over is not executed Whether a jump is made or not is controlled depending on the ON OFF information to the jump unit ON The execution processing is jumped over up to a jump label OFF The execution processing is not jumped over but is executed Jump label JUMP This is the destination of a jump from a jump instruction in the same program The processing is executed from a program in the execution order after the jump label Jump Connec
69. t program Program segment from an interrupt pointer I to the IRET instruction When an interrupt is triggered the interrupt program corresponding to the interrupt pointer number is executed For details on the main routine program subroutine program and interrupt program refer to the following LAMELSEC iQ F FX5 User s Manual Application e Create subroutine programs and interrupt programs after the FEND instruction The program area after the FEND instruction is not executed as the main routine program For example when the FEND instruction is used at the end of the second program block the third program block and later are handled as subroutine programs or interrupt programs e To make the program easy to read use twin instructions such as FOR and NEXT instructions and MC and MCR instructions in the same program block e A simple program can be executed by the CPU module with just a main routine program in one program block 2 PROGRAM CONFIGURATION 2 1 Program Block 9 10 3 PROGRAM ORGANIZATION UNIT POU The POU includes the following types e Function e 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 POU folder Function block Function Poin tr A structured program is a program created by components Processes in lower levels of hierarchical program are divide
70. te One statement or note line uses one step A symbol is prefixed to the entered text automatically 5 LADDER DIAGRAM 3 5 3 Statements and Notes 5 6 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 ST language supports control syntaxes operational expressions function blocks FBs and functions FUNs Therefore the following description can be made Ex Control syntaxes using selective branches with conditional statements and repetition by iteration statements Control conveyors of Line A to C CASE Line OF 1 Start switch TRUE The conveyor starts 2 Start switch FALSE The conveyor stops 3 Start switch TRUE The conveyor stops with an alarm ELSE Alarm_lamp TRUE END_CASE IF Start switch TRUE THEN The conveyor starts and performs processing 100 times FOR Count 0 TO 100 BY 1DO Count_No Count_No 1 END FOR END IF Expressions using operators such as lt gt and DO D1 D2 D3 D4 D5 IF DO gt D10 THEN DO D10 END IF Calling a defined function block FB data name LINE1 FB Input variable Test Out
71. the operation result to trailing edge pulse is other than the falling edge Inverting the operation result Inverts the operation just before this instruction Coil Outputs an operation result to a specified device or a label Instruction Executes an instruction specified in Turn back gi Turns back a circuit by creating a turn source symbol and a turn destination symbol when the gt number of contacts exceeds the number of contacts that can be created in one line 5 LADDER DIAGRAM 5 1 Configuration Function ABS Executes a function e How to create functions LLIGX Works3 Operating Manual e Standard function LLIMELSEC Q F FX5 Programming Manual Instructions Standard Functions Function Blocks Executes a function block e How to create function blocks LLIGX Works3 Operating Manual e Standard function blocks LLIMELSEC Q F FX5 Programming Manual Instructions Standard Functions Function Blocks e Module function blocks LLIMELSEC iQ F FX5 CPU Module Function Block Reference Function block Instance CTD Program execution order The program is executed in order of the following numbers x1 0 x3 O yi x2 x O y2 O When executing the program above Y1 and Y2 turn on corresponding to turning ON or OFF of X1 to X4 as shown below O M MM ee ee ME AN ere or N WEEN EE MEN X2 OFF X3 OFF ON EES WEE X4 OFF y ON AA OFF yo ON MEET OFF 5 LADDER DIAGRAM 5 1 Configuration
72. tion For the expression methods other than the one described the above refer to the following gt Page 29 Constant Labels and devices Specification method You can directly describe and use labels and devices in an FBD LD program You can use labels and devices for inputs and output points of units for arguments of standard functions function blocks return values and so forth For available labels refer to the following E Page 21 LABELS For available devices refer to the following LTIMELSEC iQ F FX5 User s Manual Application MDevice expression with type specification A word device can be used as any data by adding a device type specifier to its name If you do not specify a data type the word device operates as a word signed INT For the device type specifiers and the devices you can use refer to the following gt Page 47 Device expression with type specification If you do not specify a data type for a word device the data type is determined by the type of device Word device Data type The current value of a timer device TN the current value of a retentive timer device STN the current value of a counter WORD device CN The current value of a long counter device LCN DWORD Other than the above INT Caution MWhen using label e Labels whose name ends with _ cannot be used as an array index To use such a device or label as an array index assign it to another device or label and sp
73. to another device by a transfer instruction note that the number of program steps increases In addition when adding a transfer instruction on a program consider execution timing of the function to be used 4 LABELS 4 7 Precautions 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 SFT P instruction ES or gt SFR P instruction To shift the bits correctly specify the array of a bit type label Specify the bit number of a word type label Start device number of search range wLabel1 0 Pl Data matched wLabel1 1 Search range n points wLabel1 n Specify a label which has a larger data range than the search range n points Limitations on label names Label names have the following limitations e A label name must start with a nonnumeric character or underscore _ It cannot start with a number e Reserved words cannot be used as label names For details of reserved words refer to the following LAGX Works3 Operating Manual 4 LABELS 4 7 Precautions 31 32 D LADDER DIAGRAM Ladder diagram is a language that describes the sequence control by indicating logical operations consisting of AND or OR with co
74. tomatic conversion of data types In the ST language if a different data type is assigned or a different arithmetic operation is described the data type may be automatically converted Example of automatic conversion dintLabel1 intLabel1 Assignment statement Automatically convert the INT type variable intLabel1 to a DINT type variable and assign it the DINT type variable dintLabel1 dintLabel1 dintLabel2 intLabel1 Arithmetic operation expression Automatically convert the INT type variable intLabel1 to a DINT type variable and perform DINT type addition Type conversion is performed in an assignment statement input argument pass to a function block and function VAR_INPUT part and an arithmetic operation 6 ST LANGUAGE 6 1 Configuration 39 40 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 Word Signed In the case of a double word signed after conversion the conversion is automatically made into a value with a sign extension In the case of a single precision real an automatic conversion is made into the same value as the integer before the conversion Word Unsigned Bit String 16 bit In the case of a double word unsigned bit string 32 bits or a double word sign
75. tor CONNECTOR This is used as a substitute of a connecting wire The processing moves on to the corresponding connector unit You can use one input connector or multiple input connectors for one output connector Return 4 RETURN The processing after a return unit in the program is aborted Use this when you want to prohibit the execution of the processing of a program function or a function block after the return unit Whether the return processing is executed or not is controlled depending on the ON OFF information to the return unit ON The return processing is executed OFF The return processing is not executed but the ordinary execution processing is executed Comment Use this to describe a comment Comment MPrecautions for a jump unit e If the timer of a coil that is ON is jumped over by using a jump unit a normal measurement cannot be conducted e You can add a jump label on the top side the execution is earlier of a jump unit In this case create the program by including a method to break the loop in order not to exceed the setting value of the watchdog timer e You can specify only a local label of a pointer type for a jump element and jump label Pointer devices cannot be used e The pointer branch instruction CJ cannot be used For jumping use jump elements e Jumps to or from outside the program block cannot be executed The following is a list of jump operations that cannot be executed Jumping to out
76. ts constituting FBD LD program are shown below Unit Symbol Description Variable A variable is used to store each value data The data type of a variable should be a certain type Only the value data of the data type is stored bLabel You can specify a label or a device to a variable Constant gt The constant specified is output Function FUN Executes a function e How to create functions LLIGX Works3 Operating Manual e Standard function LLIMELSEC iQ F FX5 Programming Manual Instructions Standard Functions Function Blocks Function Block FB Executes a function block e How to create function blocks LLIGX Works3 Operating Manual e Standard function blocks LLIMELSEC Q F FX5 Programming Manual Instructions Standard Functions Function Blocks e Module function blocks LLIMELSEC iQ F FX5 CPU Module Function Block Reference WThe 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 The data type is determined when the constant unit and an FBD unit are connected over a connecting wire The data type of the constant value is the same data type as the FBD unit at the destination of the connecting wire Ex When 1 is input as a constant value The data type can be a BOOL type a WORD type a DWORD type an INT type a DINT type or a REAL type So the data type is not determined When the constant unit and an
77. ucture data type Page 27 Structures 4 LABELS 4 3 Data Type 23 24 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 Labels defined as generic data types can be used for any sub level data type For the types of generic data types and the primitive data types refer to the following LLIMELSEC iQ F FX5 Programming Manual Instructions Standard Functions Function Blocks The following tables list the definable data types possibilities for each label class VAR_GLOBAL Primitive data type array structure function block VAR_GLOBAL_CONSTANT Primitive data type VAR_GLOBAL_RETAIN Primitive data type array structure VAR Primitive data type array structure function block VAR_CONSTANT Primitive data type VAR_RETAIN Primitive data type array structure VAR Primitive data type 2 array structure VAR_CONSTANT Primitive data type VAR_INPUT Primitive data type 12 array structure VAR_OUTPUT Return value VAR Primitive data type array structure function block VAR_CONSTANT Primitive data type VAR_RETAIN Primitive data type array structure VAR_INPUT VAR_OUTPUT VAR_OUTPUT_RETAIN VAR_IN_OUT VAR_PUBLIC VAR_PUBLIC_RETAIN 1 The pointer type cannot be def
78. used Terms MDevices FX5 FX3 FX5 CPU module FX5U CPU module FX5UC CPU module Extension module e FX5 extension module e FX3 extension module Extension module extension cable type Extension module extension connector type Description Abbreviation of FX5 PLCs Generic term for FX3S FX3G FX3GC FX3U and FX3UC PLCs Generic term for FX5U CPU module and FX5UC CPU module Generic term for FX5U 32MR ES FX5U 32MT ES FX5U 32MT ESS FX5U 64MR ES FX5U 64MT ES FX5U 64MT ESS FX5U 80MR ES FX5U 80MT ES and FX5U 80MT ESS Generic term for FX5UC 32MT D and FX5UC 32MT DSS Generic term for FX5 extension modules and FX3 function modules Generic term for VO modules FX5 extension power supply module and FX5 intelligent function module Generic term for FX3 extension power supply module and FX3 special function blocks Input modules extension cable type Output modules extension cable type Bus conversion module extension cable type and Intelligent function modules Input modules extension connector type Output modules extension connector type Input output modules Bus conversion module extension connector type and Connector conversion module extension connector type Terms VO module INput module e Input module extension cable type e Input module extension connector type Output module e Output module extension cable type e Output module extension connector type Input output modules Powered input o
79. uted Ex A statement in a selection statement IF statement MC MO N1 M1 Master control OFF IF M2 THEN M3 M4 No processing is executed when the master control is OFF So M3 maintains the value at the time of a previous scan END IF M20 MCR MO N1 A statement out of a selection statement or a iteration statement in the case of a bit assignment statement MC MO N1 M1 Master control OFF M3 M4 No processing is executed when the master control is OFF So M3 maintains the value at the time of a previous scan M20 MCR MO N1 A statement out of a selection statement or a iteration statement in the case of an OUT instruction MC MO N1 M1 Master control OFF OUT M2 M3 No execution is made when the master control is OFF M20 MCR MO N1 Constant Methods for expressing constants The following table shows the expression methods for setting a constant in a ST program Data type Expressing method Example String 32 STRING Enclose character strings with single quotation Stest ABC For the expression methods other than the one described the above refer to the following gt Page 29 Constant Label and device Specification method Labels and devices can be directly described in the ST program Labels and devices can be used for the left or right side of an expression or as an argument or return value of a standard function function block For available labels refer to the following
80. utput module Extension power supply module e FX5 extension power supply module e FX3 extension power supply module Intelligent module Intelligent function module e FX5 intelligent function module e FX3 intelligent function module Simple motion module Expansion board e Communication board Expansion adapter e Communication adapter e Analog adapter Bus conversion module e Bus conversion module extension cable type e Bus conversion module extension connector type Battery Peripheral device GOT MSoitware packages Engineering tool GX Works3 MProgram Operand Device Buffer memory POU Description Generic term for input modules output modules Input output modules and powered input output modules Generic term for Input modules extension cable type and Input modules extension connector type Generic term for FX5 8EX ES and FX5 16EX ES Generic term for FX5 C32EX D and FX5 C32EX DS Generic term for output modules extension cable type and output modules extension connector type Generic term for FX5 8EYR ES FX5 8EYT ES FX5 8EYT ESS FX5 16EYR ES FX5 16EYT ES and FX5 16EYT ESS Generic term for FX5 C32EYT D and FX5 C32EYT DSS Generic term for FX5 C32ET D and FX5 C32ET DSS Generic term for FX5 32ER ES FX5 32ET ES and FX5 32ET ESS Generic term for FX5 extension power supply module and FX3 extension power supply module Different name for FX5 1PSU 5V Different name for FX3U 1PSU 5V The abbre
81. viation for intelligent function modules Generic term for FX5 intelligent function modules and FX3 intelligent function modules Generic term for FX5 intelligent function modules Generic term for FX3 special function blocks Different name for FX5 40SSC S Generic term for board for FX5U CPU module Generic term for FX5 232 BD FX5 485 BD and FX5 422 BD GOT Generic term for adapter for FX5 CPU module Generic term for FX5 232ADP and FX5 485ADP Generic term for FX5 4AD ADP and FX5 4DA ADP Generic term for Bus conversion module extension cable type and Bus conversion module extension connector type Different name for FX5 CNV BUS Different name for FX5 CNV BUSC Different name for FX3U 32BL Generic term for engineering tools and GOTs Generic term for Mitsubishi Graphic Operation Terminal GOT1000 and GOT2000 series The product name of the software package for the MELSEC programmable controllers The product name of the software package SWnDND GXWS3 for the MELSEC programmable controllers The n represents a version A generic term for items such as source data s destination data d number of devices n and others used to configure instructions and functions A device X Y M D or others in a CPU module A memory in an intelligent function module where data such as setting values and monitoring values are stored Defined unit of a program Use of POUs enables a program to be divided into units according to pro
82. wing L IMELSEC iQ F FX5 User s Manual Application LIMELSEC iQ F FX5 Programming Manual Instructions Standard Functions Function Blocks Precautions e The pointer type can be used for ST programs e When a value is assigned using nibble specification use the same data type for the left side and right side of an operation DO K5X0 In the above case since K5X0 is the double word type and DO is the word type an error occurs in the program e When a value is assigned using nibble specification and the data size of the right side is larger than that of the left side data is transmitted within the range of the target points of the left side K5X0 21011 1101 1111 0111 0011 0001 In the above case since the target points of K5X0 is 20 1101_1111_0111_0011_0001 20 bits are assigned to K5X0 e When the current value such as TNn of a counter C timer T or retentive timer ST is used with a type other than Word unsigned Bit string 16 bit or when the current value such as LCNn of a long counter LC is used with a type other than Double word unsigned Bit string 32 bit use the type conversion function varlnt WORD TO INT TNO Use the type conversion function 6 ST LANGUAGE 6 1 Configuration 47 48 Comment The following table shows the comment formats that can be used in a ST program Single line comment II The character strings between the start symbol and the end of th

Download Pdf Manuals

image

Related Search

Related Contents

Philips HR1335  PICS 2 PC - Quickstart Guide - v1.6  eTEACH User`s Manual  CURING LIGHT LED.C USER`S MANUAL    TitraLab pH & Alkalinity content analyzer - Cole    Smeg P106 Instruction Manual  ventless fireplaces  Инструкция PICA II  

Copyright © All rights reserved.
Failed to retrieve file