Home

GX Works2 Version 1 Operating Manual (Simple

image

Contents

1. eee 3 6 FB instance name ccccccccececceeeccuecceuceceueeceueecueeeseeesees 3 2 CHang sissississse fussinu aerar uis Ea aiii 4 10 Character strings that cannot be used App 2 Searching REPlacing cccssseccccsseeeeceeeeeeceeeeeeees 4 16 FB Label Setting screen cccccceseeeceseeeeeeeeesaeeees 1 10 2 4 FELIDO IIOS soseri cutee ates 5 1 Index 2 Displaying the Reference Manual 0cccceseees 5 5 Importing to a project wisianucrctansicoctindusiandeandvdmbtadnbocaians 5 3 AO ae S 5 2 OBTAINING sospens erana neoe 5 2 ATU SUMMING srian 5 6 FB FOJAS cestiertenstotuneiiedgommrixeissdeasuiieeidadencianieniinauieuss 2 12 Aligning programs eeseseenessnnesereeerrenrrererrreerreeenne 3 11 Considerations a cc csccedcereaciradandesidbecsvctediteantecesasecieaes 2 14 Gioia 51011 6 scarse E eve en een se eee 2 13 Crealng asctcstesecsteouenieeannsasese asetueoicsmetedgssaesiaehiccontes 2 12 Reading from Programmable Controller CPU 4 2 FBs Considerations for using FBS ccesseeeeeeeeseeeeeees 3 9 PAO pace oe ciecaesceeeiec sete eeteect ecb detect cceueosee eee 3 2 FBs Created with GX Developer ccccceeeeeeeeeees App 6 Function Blocks FB Features of FBS seccdadacecenecadecsenesxtdvecsteadadvextetacsieeseetece 1 3 G Gl bal 2 ae ee Eee ne een eel ae a 1 4 L Label name ae eee eee ee en oe 2 4 3 2 3 4 EO CIS E EE E A E E A
2. MITSUBISHI V T ELECTRIC Engineering Software GX Works2 Version 1 Operating Manual Simple Project Function Block SW1DNC GXW2 E SAFETY PRECAUTIONS Always read these instructions before using this product Before using this product thoroughly read this manual and the relevant manuals introduced in this manual and pay careful attention to safety and handle the products properly The precautions given in this manual are concerned with this product For the safety precautions of the programmable controller system refer to the User s Manual for the CPU module In this manual the safety precautions are ranked as WARNING and A CAUTION Indicates that incorrect handling may cause hazardous conditions resulting in A WARNING death or severe injury Indicates that incorrect handling may cause hazardous conditions resulting in minor or moderate injury or property damage N CAUTION wl e SSS Note that the CAUTION level may lead to serious consequences according to the circumstances Always follow the precautions of both levels because they are important for personal safety Please save this manual to make it accessible when required and always forward it to the end user Design Instructions WARNING When data change program change or status control is performed from a personal computer to a running programmable controller create an interlock circuit outside the progra
3. INCP timeri es FBistu 1 second Conveyor 3 second Ze nning clock measure x Q ment sta gt W rt lt Conveyor operation start gt counter end conveyor end 3 gt timer 1 K3 o_conveyor 3 second Loading Conveyor Conveyor measure complete driving ment sta d ended rt mi Couns the number of boses loaded LL i sensor FB ENO counter end 0 x 102 i OS DECP counter Z a Sensor FBisru Loading Remainin Ta m nning complete g number D d of boxe 6 128 counter KO hk courter_ennd N Remainin Loading OX q number complete ZO of boxe d Tp e Conveyor operation stop after 3 second measurement Lt at O counter end SM412 Yor 133 J f T p timer2 ORTO Loading 1 second 3 second 2 F complete clock measure 0 Wie d ment sto p A 165 gt timer2 K3 Ret oonvevor end 3 second Conveyor measure driving ment sto ended p Operation ended xL conveyor_end 170 FB OK WwW Conveyor Normal e QA driving nd A ended lt RST counter end Loading complete d RST FB_ENO FB is ru x lt nning U Q zZ LO GX Works2 v 6 PROGRAM EXAMPLES USING FUNCTION BLOCKS E Sequence program example using FBs Paste FBs to a sequence program to create the input circuit and output circuit Chapter 3 In the program example below the number of boxes to be conveyed is six Conveyor conveyor_01_1 B i sensor Sensor Wil counter o_conveyor B Conveyor o_buzzer B Buzzer 36 mM Sequence
4. Learning the types and details of basic application instructions descriptions of devices and parameters Learning details of specifications functions and instructions of SFC Learning the fundamentals for creating a structured program Learning the descriptions of devices parameters and error codes Learning the types and details of sequence instructions Learning the types and details of application instructions Details eee Details How to read this manual 2 3 Setting Local Labels s 2 3 5 Assigning devices automatically Devices are automatically assigned to labels during compilation The device range to be automatically assigned to a label can be changed on the Device Label Automatic Assign Setting screen Set a range to be assigned not to overlap with devices used in a sequence program FUNCTION BLOCK FB OVERVIEW OF E QCPU Q mode LCPU Screen display Screen display Describes the screen display Select Tool gt Device Label Automatic Assign Setting procedure Follow the and select menu to open the screen Screen display may differ depending on the CPU type In that case typical example is described Latch selection a field E VAR Range Creating FBs N Device Label Automatic Assign Setting Set a device range to automatically assign to labels Labels will be assigned from its way down the displayed device list when mul
5. Watch 1 to 4 A screen used for monitoring and changing current device values Intelligent function module eT ee GX Works2 Version 1 A screen used for monitoring intelligent function modules monitor 1 to 10 Operating Manual A screen used for searching and replacing character strings in Common Find Replace the project A screen used for setting the debug which uses the simulation Debug function Status bar Display information about a project being edited Sequence program A program and local labels OVERVIEW OF FUNCTION CREATING FUNCTION USING FUNCTION J BLOCKS EDITING FUNCTION MANAGING AND FB data A program and local labels of FB FB instance entity An FB pasted to a sequence program m LL ad rave oo D_I EXAMPLES USING FUNCTION BLOCKS PROGRAM gt APPENDIX INDEX 1 5 1 Main frame configuration 1 9 LO GX Works2 Fj 1 OVERVIEW OF FUNCTION BLOCKS 1 5 2 Label setting editor This section explains the configurations of label setting editor Global Label Setting screen Define labels that can be used for all sequence programs in the project lt GX Works2 Version 1 Operating Manual Simple Project 25 Global Label aiis Global1 WAR GLOBAL vl ATI Peet pet ered AA Parameter Intelligent Function Module Global Device Comment 5 Global Label Saar Setting Pou 5i k Frogram na MAIN Prog
6. A Eee FB instance name e FB instance names can be changed later Section 4 6 e A name can be set using up to 16 characters Alphabets are case sensitive e Numeric characters cannot be used as the first character For unusable characters refer to Appendix 1 Registering FB instance names to local label or global label When an FB is pasted an FB instance name is automatically registered as a label on the setting screen of the label selected in step 2 EDITING FUNCTION MANAGING AND Other pasting methods FBs can also be pasted from the Element Selection window with the drag and drop operation The Element Selection window is displayed by selecting View Docking Window gt Element Selection When the same FB is pasted repeatedly Pasting an FB to a sequence program causes the file size to be increased Pasting the same FB to one sequence program repeatedly also causes the size increase of the sequence program according to the number of times of pasting mi LL ad D Zg Nn D N lt lt O O m zZ O O Z 5 LL O lt a 5 N u A L x fi PROGRAM gt APPENDIX INDEX 3 1 1 Pasting FBs to sequence programs 3 3 LE GX Works2 v 3 USING FUNCTION BLOCKS E Display of FB instance On the pasted FB instance label names of I O variables and their corresponding data types are instance name conveyor_01_1 B FB_ EN pe lees displayed
7. Learning the types and details of common instructions Learning the types and details of instructions for intelligent function modules Learning the types and details of instructions for network modules Learning the types and details of instructions for the PID control function Learning details of specifications functions and instructions of SFC MELSAP3 Learning the fundamentals for creating a structured program Learning the types and details of common instructions Learning the types and details of instructions for intelligent function modules Learning the types and details of instructions for network modules Learning the types and details of instructions for the PID control function Learning the types and details of application instructions MELSEC QIL F Manual Structured MEEO eo kaa MELSEC Q L MELSEC Q LIQnA for Structured Programming Programming P i P ming Manual module rogramming Manual Mandal rogramming u Paine Manual used Fund tal Common Special Application Common PID Control SFC ee etree ere Instructions Instructions Functions Instruction Instructions Pf ft r a Pf ff tf B E ff de 7 7 Pf ff pf E E Pf ff fd oe K o fo of od Pf ff Using Ladder Diagram Using Sequential Function Chart Using Structured Ladder FBD or Structured Text A 12 5 Details of instructions in each programming language for FXCPU
8. Explains methods for such as creating and monitoring programs in Simple project of GX Works2 Sold separately GX Works2 Version 1 Operating Manual Structured Project Explains methods for such as creating and monitoring programs in Structured project of GX Works2 Sold separately GX Works2 Version 1 Operating Manual Intelligent Function Module Explains methods of intelligent function module for such as parameter setting monitoring programs and predefined protocol support function in GX Works2 Sold separately GX Works2 Beginner s Manual Simple Project Explains fundamental methods for such as creating editing and monitoring programs in Simple project for users inexperienced with GX Works2 Sold separately GX Works2 Beginner s Manual Structured project Explains fundamental methods for such as creating editing and monitoring programs in Structured project for users inexperienced with GX Worksz2 Sold separately 2 Structured Programming Manual name MELSEC Q L F Structured Programming Manual Fundamentals Explains the programming methods types of programming languages and other information required to create structured programs Sold separately MELSEC Q L F Structured Programming Manual Common Instructions Explains the specifications and functions of common instructions such as sequence instructions basic instructions and application instructions that can be used in structured programs Sold separately M
9. For details of the Memory Capacity Calculation Result screen refer to the following manual K GX Works2 Version 1 Operating Manual Common 3 14 3 1 4 Converting compiling all sequence programs 3 1 Creating Sequence Programs with FBs E Calculating memory size FXCPU Display sizes and capacities of program and symbolic information calculated offline Displayed values are values when the program and parameters are written to a programmable controller CPU OVERVIEW OF FUNCTION Operating procedure Select Tool gt Confirm Memory Size The Confirm Memory Size screen is displayed For details refer to the following manual K GX Works2 Version 1 Operating Manual Common CREATING FUNCTION Confirm Memory Size Offline Status Compiled Program Size 66 Steps Program Capacity z000 Steps PLE parameter setting Error Information Mone W confirm Symbolic Information Memory Type Memory Cassette FX3U FLROM 64 64L Symbolic Information Size 2680 Bytes Symbolic Information Capacity 124000 Bytes Error Information Mone USING FUNCTION AERIS To increase the symbolic information capacity use a large capacity memory type or decrease the setting in PLE parameter For memory capacity Program data and symbolic memory information will be written to the same memory device EDITING FUNCTION MANAGING AND mi L ad D Zo Nn D EXAMPLES USING FUNCTION BLOCKS O PROGRAM g
10. Insert a coil to receive the output and use the contact of the coil as the target instruction condition x0 DEC_1 B IN1 MINUS3 W D200 pioo WeMINUS1 OUT1 B ei ee Ko Trop HD Ko K100 KI MINUS3 Y H D200 USING FUNCTION EN BLOCKS EDITING FUNCTION MANAGING AND m LL ad Ze oo mp 3 Parallel connections cannot be created in the input or output circuit An error occurs when the program is converted EXAMPLES USING FUNCTION BLOCKS PROGRAM gt 4 The data type of the input or output circuit of the FB instance and the data type of the contact coil application instruction to be connected must be the same Using different data types at the connection causes an error at compilation 5 If the instance is not registered on the label setting screen when utilizing the FB to the ladder program the information of FB name change and FB deletion are not applied to the label setting and the program In this case delete the FB instance in the program manually and utilize the FBs again APPENDIX INDEX 3 1 2 Creating input and output circuits of FB instances 3 9 La GX Works2 WT 3 USING FUNCTION BLOCKS 6 When the label setting of FB is changed compile the program or all programs The change of input output label is applied to the utilization destination ladder program at compilation Note that the change is not applied when the FB instance is not registered in the
11. global label setting or local label setting lt Example of FB before changing label setting gt 10 Y10 Du C Moy DO C1 D100 PLUSZ vy F D200 lt Label setting of FB gt Class Label Name Data Type q e CCST ani eS eee Switch input label sequence 3 VAR INPUT qpa i wode T 4 VAR_OUTPUT qom w O T Delete output label OUT1 5 VAR OUTPUT puss wasg sCvan ouro ruus3 wode UUU UUU _ lt Add output label PLUS3 Execute compilation lt Example of FB after changing label setting gt 10 PLUSZ j D200 7 Function blocks using inline structured text programs cannot be used in programs other than Ladder Diagram 3 10 3 1 2 Creating input and output circuits of FB instances 3 1 Creating Sequence Programs with FBs 3 1 3 Aligning sequence program and FB program An alignment of a sequence program and an FB program allows a sequence program to be edited while checking the FB program OVERVIEW OF FUNCTION Operating procedure 7 Move the cursor to the FB instance E MELSOFT Series GX Works2 Strator Desktop tmp 090 7 Project E 06 001 1 2xw PRG Write MAIN 36 Step Project Edit Find Replace Compile view Online Debug Diagnostics Tool Window Help IDEALO 75 18695 ee ot OF BR e E ET AT E E TEBE T ioll dha is e t H Foso AS dol dih db ath deb Se Sb o ats cts ano tro Ses LET A B R LRL GAl E ae FB Write conveyor _O1 MAIN conv CREATING FUNCTIO
12. Block Password 2 Select an FB to unlock the block password and click the Disable Lock button The Unlock Block Password screen is displayed CREATING FUNCTION Unlock Block Password Unlock Block Password Please enter the password and then click OK Password I cencel_ USING FUNCTION EN BLOCKS 3 Enter a password and click the button The block password is unlocked and Unlocked is displayed on the Registration Status field of the Set Block Password screen EDITING FUNCTION MANAGING AND E Deleting block passwords Delete the block password Operating procedure o M 11 UL x 1 Select Tool Block Password Os sg 2 Select an FB to delete the block password and click the Delete Password button 6 The following message is displayed oS TAE MELSOFT Application sa Sz TET Sze A 4re you sure you want to delete the password of the specified Function block Os OtZ xs QO WILL 3 Click the button The password is deleted Q Z L A A lt L x lt LW Q Z LO GX Works2 v 4 MANAGING AND EDITING FUNCTION BLOCKS 4 7 Searching Replacing FB Instance Names FB instance names and labels can be searched replaced In this section the search function is explained as an example Operating procedure 71 Select Find Replace gt Find String The Find Replace screen is displayed Find Replace Device Instruction String Open Close Contact Device
13. FB lt m Select FB and stri sed in FB local label and global label which in FB list Dependent Element Selection 4 e conversion method when t ai re invalid For the editing project in FB of the acquired ladder OK Cancel Import Library to Project Select a library to install Library Selection 4 f Library List Explanation A D converter module FB library Refresh FB List Select FB to install FB Selection E A D converter module FB library Hi M Q644D_Read4DVal A D conversion data read FB Oia M Q644D_Read4ll4DVal A D cnv data read All CHs FB iam M Q644D_Set4DConversion 4 D conversion enable disable FB F fil M 064AD_SetAverage Averaging process setting FB Wiki M Q644D_RequestSetting OP condition setting request FB Win M Q644D_SetOffsetV al Offset setting FB fil M Q644D_SetGainVal Gain setting FB Wii M Q644D_ErrorOperation Error operation FB in M Q644D_ScalingOperation Scaling process FB lt i sed in FB local label and in FB list Dependent Element Selection 4 Extended Setting e conversion method when the instructions al re invalid For the editing project in FB of the ladde care Conversion Method Setting MANAGING AND PROGRAM OVERVIEW OF FUNCTION CREATING FUNCTION USING FUNCTION J BLOCKS EDITING FUNCTION 631 BLOCKS USING FB FUNCTION BLOCKS O Malian EXAMPLES USING gt APPENDI
14. MANAGING AND m L ad An DA D EXAMPLES USING FUNCTION BLOCKS O PROGRAM gt APPENDIX INDEX LO GX Works2 v 4 MANAGING AND EDITING FUNCTION BLOCKS 4 2 2 Exporting FBs to other project Export the FBs which are created in the project being edited to other project using the Export FB to Library Project screen Global labels and structures can be exported at the same time An FB whose PLC type is different from that of the project being edited can be exported However FBs created with QCPU Q mode LCPU project cannot be exported to FXCPU project and vice versa Operating procedure 1 Select Project gt Library gt Export FB to Library Project The Export FB to Library Project screen is displayed Export FB to Library Project Select FB to export FB Selection o Oi Global Label Bese Globall POLI ya FE Pool fay FELD ayy FB_LD2 yy FESTI E E Structure R Benenden Element Gs ection Select FB and structure used in FE local label and _Dependent Element Selection A global label which selected in FE list Select the library project of output destination Library Project Selection Library Project Selection Project Browse Explanation 4 4 4 2 2 Exporting FBs to other project 4 2 Reusing FBs from Library Project 2 Select FBs global labels and structures to be exported to the target project from the FB List Click the
15. Project 4 9 4 4 Changing FB Instance Names 4 10 4 5 Deleting Unnecessary FB Data from Projects 4 11 4 6 Protecting FBs 4 13 4 7 Searching Replacing FB Instance Names 4 16 5 USING FB LIBRARIES 5 1 Installing FB Library 5 2 5 1 1 Obtaining FB Library nnana aana a 5 2 9 1 2 netapo FE LIDIA ssena et oh er eee a oe eee ee E a EE A E a E eee 5 2 5 2 Using FB Libraries 5 3 5 3 Displaying Reference Manual 5 5 5 4 Uninstalling FB Library 5 6 6 PROGRAM EXAMPLES USING FUNCTION BLOCKS 6 1 System Configuration of Program Examples 6 2 6 2 Processing of Program Examples 6 3 6 3 Creating Program Examples 6 4 APPENDIX Appendix 1 Character Strings that cannot be Used for Label Names and FB Data Names Instance Names App 2 Appendix 2 Appendix 3 INDEX Supported CPU modules Using FBs Created with GX Developer in GX Works2 App 5 App 6 E MANUALS Related manuals are separately issued according to the purpose of their functions in GX Works2 Related manuals The manuals related to this product are shown below Refer to the following tables when ordering required manuals 1 Operation of GX Works2 Manual name GX Works2 Version 1 Operating Manual Common Explains the system configuration of GX Works2 and the functions common to Simple project and Structured project such as parameter setting operation method for the online function Sold separately GX Works2 Version 1 Operating Manual Simple Project
16. Refresh Related Functions lt so a Remote Set Clock PLC User Data write Tithe Format PLE 9 Clear PLC Memory Operation Memory Arrange PLO Memory 3 1 5 Writing sequence programs to programmable controller CPU 3 1 Creating Sequence Programs with FBs 2 Select the target data Symbolic information must be selected If symbolic information is not written inconsistency may occur between the data on the project and the data written to the programmable controller CPU Module Narme Data Name OVERVIEW OF FUNCTION 2011 09 07 16 32 51 Uncompiled 2011 09 07 16 32 50 652 Bytes O Detail 2011 09 07 16 32 51 OO O E foal OOOO CREATING FUNCTION 3 Click the button o Pot P Writing target for symbolic information When symbolic information is selected the memory size for the symbolic information is required For QCPU Q mode LCPU the writing target for symbolic information can be changed to standard ROM or memory card other than program memory or device memory resulting that the capacity of program memory can be reserved Default writing target for symbolic information The default writing target for symbolic information can be set for each project Select Tool gt Options gt Symbolic Information and select a writing target from Setting for Writing of Symbolic Information to PLC USING FUNCTION WN EESAN Setting For Writing Symbolic Information to PLC il H
17. The following table shows the program data included in the symbolic information Item Included data Global labels POU Symbolic Programs information Local labels FBs Structures 3 18 3 1 5 Writing sequence programs to programmable controller CPU 3 2 Checking Operations of Sequence Programs 3 2 Checking Operations of Sequence Programs Execute the monitoring function to check the operation of the programs written to the programmable controller CPU FB programs can also be monitored Operating procedure Select Online gt Monitor gt Start Monitoring The monitoring starts Double click the FB instance to monitor the FB program T PRG R Write Monitor Executing MAIN 71 Step xo TC convesor_O1_1 B FB_EN E R Operatio FB is ru n switch nning Wl counter o_buzzer B 4 Number o Buzzer f boxes to be lo aded i_counter W o Double click the FB instance FB R Write Monitor Executing conveyor_01 MAIN conveyor_01_1 85 Step SEE FB_ENO Jo_conveyor 14 o_buzzer FB is ru Conveyor Buzzer nning counter_end Loading complete d FB_ENO S M412 o_conveyor timer FB is ru Conveyor 3 second nning measure mentista rt counter_end conveyor_end timer K3 tart _ ii latd_ _ oo immo m lt _ JJo_conveyor 3 second Loading Conveyor Conveyor measure complete driving mentista d ended rt i_sensor_01 FB_ENO counter_end DECP i_counter Sensor FB isru Loading Numbe
18. can be reduced using FB libraries There are FB libraries which support various devices such as CPU modules analog input output modules and counter modules FB libraries which support partner products are also supplied E Programming languages according to the intended use are selectable In Simple projects Ladder Diagram or Structured Text can be selected as a programming language for FBs The optimum programming language which meets the intended use can be selected to create FBs FXCPU Simple project supports only Ladder Diagram zZ O H O Z 5 LL Z Q m Q Z T S ogg L 0 250 Sim USING FB LIBRARIES N lt lt O O m zZ O H O Z 5 LL O lt D N W A lt L x f PROGRAM gt APPENDIX INDEX LE GX Works2 v 1 OVERVIEW OF FUNCTION BLOCKS 1 3 Labels A label is a character string which represents a device Using labels allows a program to be created without considering devices in the program Therefore a program with labels can be easily utilized even for a system with different module configuration lt Example of program with devices gt MO X0 I two HY M1 YO MOV D10 D100 X10 TO D20 KO D100 K1 BCD D100 D120 lt Example of program with labels gt Conversion_program_ON Operation_ready_ccompleted PS So tpt_enable Data_conversion_request Output_enable MOY Setting_value Setting_value_stored Conversion READY T
19. cursor to the FB instance and performing any of the following operations e Dm Enter e shirt double click 3 1 4 Converting compiling all sequence programs Convert compile all sequence programs to be executed on a programmable controller CPU Operating procedure 1 Select Compile gt Rebuild All 3 The following message is displayed Clear the check box if the duplicated coil check ladder program check and consistency pairing check are not performed after the compilation MELSOFT Series GX Works2 Caution When executing Rebuild All automatically assigned devices will be re evaluated and devices may change In that case values From the previous program will remain in the previously assigned devices For safety ensure that device assignments match by clearing all device memory latched data and File registers IV Check for duplicated coils perform consistency pair check and other ladder checks after Rebuild All is complete re you sure you want to Rebuild All 2 Click the button after reading and understanding the considerations described on the message All programs are converted compiled and the result is displayed on the Output window By double clicking the result errors warnings only the corresponding error location in the program is displayed Gt MELSOFT Series GX Works2 stratorDesktop tmp 0907 Project E 06 001 1 gxw FB Write conveyor_01 MAIN conveyor_01_1 85 Ste
20. in GX Works2 Note that GX Works2 and GX Developer differ in the following points Character strings that cannot be used for label names For unusable character strings with GX Developer refer to the following manual K GX Developer Version 8 Operating Manual Usable instructions with ST programs Instruction names differ between GX Developer ST and GX Works2 ST If compilation results in an error change the relevant part to the instruction name of GX Works2 For the ST instructions of GX Developer and GX Works2 refer to the following K GX Works2 Version 1 Operating Manual Common s ST instruction table for GX Works2 and GX Developer Alternatively select Use Dedicated Instruction for GX Developer GX IEC Developer under Tool gt Options gt Project Common Setting gt Other Project Dedicated Instruction Setting App 6 Appendix 3 Using FBs Created with GX Developer in GX Works2 Enable calling function block and using inline ST in the option setting Depending on the selection status of Enable calling function block and using inline ST in Enable calling function block and using inline ST under Tool Options Compile gt Basic Setting the program after compilation will differ When the option item is unselected the program after the compilation matches with GX Developer therefore calling function blocks created with Structured Text from ladder programs and calling function bloc
21. o_ buzzer Bit 2 Buzzer VAR_INPUT i_counter Word Signed iz Number of boxes to be loaded VAR counter Word Signed xa Remaining number of boxes VAR counter_end Bit a Loading completed conveyor_end Bit Conveyor driving ended timerl Word Signed i 3 second measurement start timer2 Word Signed 3 second measurement stop O 4 VAR VAR VAR Jelelelelelele lala fa fa Operating procedure Operating procedure i e Setthe items on the screen Describes the operating procedure of the function Item Description Maximum number of characters Select a label class from the list displayed by clicking cl F Section 2 3 2 Ladder 32 characters Input output input Enter a desired label name tput labels 16 charact Cape Kame For unusable characters refer to 3 App 1 ma ssi enaractors 32 characters Reference location Specify a data type from the Data Type Selection screen displayed by clicking 7 Section 2 3 4 128 characters It can also be entered directly leads to the refe pence location Constant Enter a constant value when VAR_CONSTANT is selected and reference manual ee for Class and simple type is selected for Data Type Comment 2 Enter a comment 1024 characters 128 characters 1 Anew line can be inserted in a cell by pressing the Cta Enter keys 2 Displa
22. the operation switch is pressed the conveyor starts to operate When conveying the set number of boxes is completed the conveyor stops Buzzer sound is produced for three seconds when the operation is started and stopped Turn the operation switch X0 ON The buzzer Y1 sounds for 3 seconds Operation of the conveyor YO is started The sensor X1 detects the conveyed boxes Count the number of conveyed boxes Has the set number of boxes been conveyed The buzzer Y1 sounds for 3 seconds again Operation of the conveyor YO is stopped OVERVIEW OF FUNCTION CREATING FUNCTION USING FUNCTION J BLOCKS EDITING FUNCTION MANAGING AND USING FB LIBRARIES EXAMPLES USING D FUNCTION BLOCKS PROGRAM APPENDIX INDEX La GX Works2 WT 6 PROGRAM EXAMPLES USING FUNCTION BLOCKS 6 3 Creating Program Examples This section explains how to set FB local labels and the examples of FB program and sequence program using FBs based on the system configuration and processing aforementioned E Setting FB local labels Set label names classes and data types as below VAR_INPUT Operation switch VAR_OUTPUT FB is running VAR_OUTPUT Normal end VAR_INPUT Number of boxes to be conveyed VAR Remaining number of boxes to be conveyed VAR conveying completed VAR Conveyor driving ended VAR 3 second measurement operation start VAR 3 second measurement operation stop Th
23. to check the usage of the imported FB library and the application of labels OVERVIEW OF FUNCTION Operating procedure Select an FB from the Project view Navigation 2 Right click and select Data Help from the shortcut Bact roeon nosse Global Device Comment H Global Label Z men u n Program Setting Te 1 84 Pou EE The reference manual of the selected FB data is displayed i tan WZ rogram a r Label ou E E FB_Pool it Th M Q644D_ErrorOperation Error operation FB Til M Q64AD_SetADConversion AD cnv G3 Tl M Q64AD_ReadADVal AD conversion Tl M Q64AD_SetAverage Averaging pri Tl M Q64AD_SetGainial Gain setting Fa Tl M Q64AD_SetOffsetval Offset settir Tl M Q64AD_ReadallaD al AD cny data Tt M 0644D_RequestSetting Operating Open Uncompiled Data Structured Data Types Local Device Comment Data Help Device Memory Device Initial Value Copy Delete Rename Write to CSV File Fe Property USING FUNCTION J BLOCKS Point Displaying reference manual from utilized FB A reference manual can be displayed from the utilized FB of the FB library on the program Select an FB on the project and press the key EDITING FUNCTION MANAGING AND 631 BLOCKS USING FB FUNCTION BLOCKS BSERNANES EXAMPLES USING PROGRAM gt APPENDIX INDEX E GX Works2 5 USING FB LIBRARIES 5 4 Unins
24. using the index setting because the operation of the index setting may be changed When the data name of import source data is overlapped When the data name of each import source FB global label or structure is overlapped the existing data in the target project is overwritten and deleted In this case change the data name before importing the data 2 e O Z 5 LL Z E Q m m Z lt L S oS L 0 ZET Sum USING FB LIBRARIES oL ZO HO al 2m Nz aE A H O CZ xD WL L ad O O aa A gt APPENDIX INDEX 4 2 3 Importing FBs from other project 4 7 LO GX Works2 v 4 MANAGING AND EDITING FUNCTION BLOCKS E Setting the conversion method for inapplicable instructions Set the conversion method when the FBs to be added contain instructions or devices which are not applicable to the target project Operating procedure 1 Click the Conversion Method Setting button on the Install screen Conversion Method Setting Conversion Method of Invalid Instructions and Devices Explanation Select conversion method when unavailable instructions or devices in the editing project exist in acquired ladder Mot convert Abnormal instruction will not be converted and discarded Convert to line statement 46normal instruction will be converted to line statement Convert to abnormal instruction code Abnormal instruction will be converted to abnormal instruction code Def
25. 1 4 Character strings that cannot be used App 2 Ladder editing mode cccccsseccsesececseeeenseseesseneeeneas 3 20 Local laDelS ssri 1 4 IV oerien e ce caeeeeeeinte ecsenp sense cieeeaeeweascorcicuiece 2 4 M Maximum number of input output labels 2 5 Wie a1 6 geeteteeneteet etiam sn ete rte ent ar erin pte ee cane ener eens 3 19 N Navigation WiINdOW sain cccntecesninctaneanteutcananiendeanecssnddenneccsoenc 1 9 O Output WINDOW asannnannnnnnnnsnnnnennnnernnsnrrnnnirsnnrnenrrnerrennrnnne 3 12 P password ages cesetcornie sce antecte nats aenostentecst eye sin ecaixeessastasedesencts 4 13 Program examples itt eee cavecsusueisttavsassupesunsentininatueetcde ats 6 1 Program size after compilation cceecceeeseeeeeeeeeeeeees 3 13 R Read from PLC oun cccccccesccccenseeceneeeceeeeceueeeseueeeseueeeseaaess 4 2 Rebuild All sescst cecivartncasendscstasdettdesdadccesdecasdeasandeoueseesveieuiees 3 12 ROUINO soes ean ce 3 2 S Selecting data types cccccssssceeccesseeecceseeeeceesseeeseeaes 2 7 Setting arrays for data type ccccceeccceeeeseeeeeeeeeeeeeseeeeees 2 8 3 18 3 17 Symbolic information Yedeces caeeeccdcecrcedeedeewssecxtdekcdenteedeerees Default writing target ccccccssssececeeeseeseeeseeeeees NOILONNA JO MAIAYSAO NR i va MV GING target ieie taonedenbets U 4 9 W 1 9 3 16 3 16 WOrK WINGOW ga
26. 2 m Latch selection field This item can be selected when the range of latch 1 or latch 2 is set on the 5 5 Z D LL Device Display the devices to be assigned automatically EXAMPLES USING PROGRAM Display whether the range of device assignment setting is in decimal or Lagi hexadecimal A Assignment Selection Select the device to be assigned automatically Multiple devices can be set j Start Assignment sat Enter the range of device points to be assigned automatically Range End x lt Q Total Points Display the total points of each device range for VAR and VAR_RETAIN 6 A Display the device point range set on the lt lt Device gt gt tab of PLC parameter a When the latch range is set display the device point range with the latch range PLC Parameter Device Setting Range Example When D O to 12287 latch D 5000 to 6000 are set on the lt lt Device gt gt tab of PLC parameter display range of D 0 to 12287 range of latch D 5000 to 6000 x lt U Q Z 2 3 5 Assigning devices automatically 2 9 LE GX Works2 v 2 CREATING FUNCTION BLOCKS E FXCPU Screen display Select Tool gt Device Label Automatic Assign Setting Device Label Automatic Assign Setting Step Flags Retentive 2046 Eaj to 4095 Eaj H Counters 100 mal 199 zal fz lt crel Operating procedure Select the device type and set the start and end addresses to be assigned automatically 2 10 2 3 5 Assigning devi
27. APPENDIX INDEX LO GX Works2 v 4 MANAGING AND EDITING FUNCTION BLOCKS 4 4 Changing FB Instance Names This section explains how to change the FB instance name of an FB pasted to a ladder program The global label or local label need to be registered changed to the same name as the changed FB instance name Operating procedure 1 Move the cursor to the FB instance Pal et a a x0 i conveyor_01_1 I i B FB_EN x Operatio n switch FB instance name B i sensor_01 Sensor 2 Select Edit gt Edit FB Instance The Edit FB Instance Name screen is displayed Edit FB Instance Hame fx o cancel i Change all Change Only Selection FB 3 Enter a new FB instance name and select Change All or Change Only Selection FB Edit FB Instance Name x conveyor_contral Cancel i Change all Change Only Selection FB 4 Click the button The FB instance name is changed When Change All is selected all the FB instances with the same name are changed When Change Only Selection FB is selected only the FB instance on the cursor position is changed P al cal alice i inact 4 Operatio n switch B i sensor_01 Sensor 5 Open the global label or local label setting screen and register change the label name to the same as the new FB instance name If the program is compiled without registering changing the label a compilation error occurs 4 5 Deleting Unnecessary
28. Batch Result Error Log Find In Entire Project Browse Find String Find Next Replace String All Find Replace Find Direction Option All Replace i From Top Match case Down Match whole word only Up Do not search comments in program Consecutive search with enter key 2 Enter an FB instance name to be searched for Find In and click the button or the 4lFind button When the button is clicked the cursor moves to the corresponding position When the All Find button is clicked the search result is displayed By double clicking the row in the search result the cursor jumps to the corresponding character string Find Replace Device Instruction String Open Close Contact Device Batch Result Error Log Find Result Error Logs 0 Find String conveyor _01_1 Find In Entire Project Place convevor O11 001 24 POU Progran haAlN Program 14 Stey convevor O11 001 2 POU Program halh Local Label Line 10 iil 5 earching in specified place has finished aN MELSOFT QS 5 USING FB LIBRARIES The FB Library is a collection of FBs and it is provided as MELSOFT Library This chapter explains how to use the FB Library For the overview of the FB Library refer to the following manual KL GX Works2 Version 1 Operating Manual Common Note that the FB Library is not supported by FXCPU LL O Wu gt x LU gt O FUNCTION CREATING FUNCTION USING F
29. CCESS x END_VAR FUNCTION END_ FUNCTION FUNCTION BLOCK END_FUNCTION_BLOCK STEP INITIAL_STEP END_STEP TRANSITION END_TRANSITION FROM UNTILWHILE App 2 Appendix 1 Character Strings that cannot be Used for Label Names and FB Data Names Instance Names Category Function name in application function Function block name in application function Symbol Date and time literal Others String that starts with K1 to K8 Address Statement in Ladder Diagram Common instruction Windows reserved word Character string pa e Label name Function names in application functions such as AND_E NOT _E pO Function block names in application functions such as CTD CTU pO bhs amp 4 tab character pe DATE pre eae DT TIME TIME_OF DAY TOD ACTION END_ACTION CONFIGURATION END CONFIGURATION CONSTANT F_EDGE R_EDGE AT PROGRAM WITH END_ PROGRAM TRUE FALSE READ_ONLY READ_WRITE RESOURCE END_RESOURCE ON TASK EN ENO BODY_CCE BODY_FBD BODY_IL BODY_LD BODY_SFC BODY_ST END_BODY END _PARAMETER_SECTION PARAM_FILE_PATH PARAMETER_SECTION SINGLE RETAIN INTERVAL Such as IX0 FB BLK START FB START FB END FB BLK END FB IN FB OUT FB_NAME INSTANCE_ NAME FB x INSTANCE COM1 COM2 COM3 COM4 COM5 COM6 COM7 COMB COM9 LPT1 LPT2 LP13 LPT4 LPT5 LPT6 LPT7 LPT8 x LPT9 AUX CON PRN NUL 14 Whether to handle a device name index
30. Data Types is selected 4 On the Data Type field select the data type structure or function block name 5 Click the button when the setting is completed The settings are displayed on the Data Type column on the Function FB Label Setting screen 2 3 4 Selecting data types 2T OVERVIEW OF FUNCTION CREATING FUNCTION USING FUNCTION J BLOCKS EDITING FUNCTION MANAGING AND m IL ad rave oo D_I EXAMPLES USING FUNCTION BLOCKS PROGRAM gt APPENDIX INDEX LE GX Works2 v 2 CREATING FUNCTION BLOCKS E Setting arrays for data type Define the data type as an array To define a data type as an array set the items of Array Element on the Data Type Selection screen 1 Click on the data type entry field on the Parc pneiselecnivn Function FB Label Setting screen The Data Type Selection screen is displayed Libraries 2 Select ARRAY under Array Element pon cE ca FLOAT Double Precision 3 Enter the number of elements for Element 4 Set the data type of the array element in the Retentive Timer Pointer same manner as setting the normal data type Facts i Simple Types Structured Data Types f Function Blocks Array Element I ARRAY Elernent 4 m To change the offset To change the offset Array start value Array end value to a value other than 0 edit the offset value by directly entering the array declaration in te
31. Data name Data name Label name Label name Ei sensor U1 Se Ole Wey counter o conveyor a alezi le The following are the representation of data types e B Bit W Word signed D Double word signed e E Single precision real e L Double precision real e S String 3 4 3 1 1 Pasting FBs to sequence programs 3 1 Creating Sequence Programs with FBs E When calling an FB within an ST program By entering an FB name in an ST program the FB can be called in the same manner as pasting an FB in a ladder program OVERVIEW OF FUNCTION Operating procedure e Enter an FB label name input variable and output variable in the ST program Values must be specified for entered input variable and output variable Note that entering of output variable can be omitted when a result of output variable is not required Example When the defined FB is TIMER CREATING FUNCTION Details of defined FB FB label name FB_ TIMER Input variable Setting value 1 second setting value 10 seconds setting value 100 seconds start stop Output variable In operation timer up 1 timer up 2 USING FUNCTION BLOCKS Data entering example Enter data in the ST program as shown below Device that assigns a value to FB label name Input variable an input variable FB_TIMER Setting value 1 second XO Setting value 10 seconds X1 Setting value 100 seconds X2 Start X3 Stop X4 In operation Y70
32. Dependent Element Selection A button to export the FBs or structures in the selected FBs at the same time OVERVIEW OF FUNCTION FEB Selection GOGUDH_FBs l IA Global Label HOS Structure OES STR_O1 CREATING FUNCTION USING FUNCTION EN BLOCKS a Denendent Element Seledinnia Select FB and structure used in FE local label and _Dependent Element Selection A global label which selected in FE list 3 Click the Browse button to select the export target project 4 Click the button The selected FBs global labels and structures are exported to the target project EDITING FUNCTION MANAGING AND Point Block password An FB with a block password cannot be exported Unlock the block password of the project being edited before export the FB The block password of FB is unset to the export target project Considerations for Indexing Setting for ZR Device FBs cannot be exported when the device set for Indexing Setting for ZR Device on the lt lt Device gt gt tab of PLC parameter is different between the target project and the project being edited Set the same setting for Indexing Setting for ZR Device before exporting FBs When an FB with the different start number of index register is exported check the program using the index setting because the operation of the index setting may be changed When the data name of output target data is overlapped When the data name of each e
33. E PER F a Device Data 3 Click the button FXCPU For FXCPU projects with labels created project data can be read from FX3U FX3UC version 3 00 or later only 4 2 4 2 1 4 2 Reusing FBs from Library Project Reusing FBs from Library Project This section explains how to reuse the created FBs in another project The created FB programs can be used as program assets in multiple projects by using the project files created in Simple project with labels as FB library Library project reusing procedure The following shows the procedure for reusing the FBs in the created library project to other project Operating procedure 1 Creating a library project Procedure Create a Simple project with labels Name and save the project Close the project 2 Exporting FBs to a library project Procedure Open the project that contains FBs to be reused Export FBs to the library project Reference GX Works2 Version 1 Operating Manual Common Jl Reference GX Works2 Version 1 Operating Manual Common Section 4 2 2 Jl 3 Acquiring FBs from the library project Procedure Open the project to which FBs are to be used Acquire the FBs from the library project Reference GX Works2 Version 1 Operating Manual Common Section 4 2 3 4 2 1 Library project reusing procedure OVERVIEW OF FUNCTION CREATING FUNCTION USING FUNCTION EN BLOCKS EDITING FUNCTION
34. ELSEC QIL Structured Programming Manual Application Functions Explains the specifications and functions of application functions that can be used in structured programs Sold separately MELSEC Q L Structured Programming Manual Special Instructions Explains the specifications and functions of special instructions such as module dedicated instruction PID control instruction and built in I O function dedicated instruction that can be used in structured programs Sold separately FXCPU Structured Programming Manual Device amp Common Explains the devices and parameters provided in GX Works2 for structured programming Sold separately FXCPU Structured Programming Manual Basic amp Applied Instruction Explains the sequence instructions provided in GX Works2 for structured programming Sold separately FXCPU Structured Programming Manual Application Functions Explains the application functions provided in GX Works2 for structured programming Sold separately Manual number Model code SH 080779ENG 13JU63 SH 080780ENG 13JU64 SH 080781ENG 13JU65 SH 080921ENG 13JU69 SH 080787ENG 13JZ22 SH 080788ENG 13JZ23 Manual number Model code SH 080782ENG 13JW06 SH 080783ENG 13JW07 SH 080784ENG 13JW08 SH 080785ENG 13JW09 JY997D26001 09R925 JY997D34701 09R926 JY997D34801 09R927 3 Operation of iQ Works Let s start iQ Works Version 2 SH 081261ENG Explains fun
35. ES Local Label p rog ram EF Y w i_counter o_buzzer B conveyor_U Number o uzzer f boxes FB data Bie ta aded Local Label a Work window FB instance Entity Cross Reference Information Condition Setting All Device Label Print Print Preview Entire project F Browse Ladder Symbol Device Label Find In Device Instruction Position Data Name Step No 1 Step No 4 Step No 9 Step No 12 Step No 15 Step No 16 Step No 17 Step No 18 Step No 19 EB conveyor_01_1 M conveyor_01_1 FB M8185 J conveyor_01_1 FB M8184 Ian conveyor_O1_1 i_s X1 W conveyor_01_1 0_ M8183 B conveyor 011 Lc D12285 60 all devices label cross reference information f Function Block E conveyor_01 Analyze and display current program after pressing Find Status bar _ gt English Simple QO6UDH 1 5 1 Main frame configuration ax FB component Element Selection window Docked window 1 5 Overview of Screen Configuration Display contents Title bar Display a project name Menu bar Display menu options for executing each function GX Works2 Version 1 Toolbar Display tool buttons for executing each function Operating Manual Simple Project parameter setting and monitoring GX Works2 Version 1 Bes on ant GX Works2 Version 1 Output Display compilation and check results errors and warnings Operating Manual Simple Project Display cross reference results
36. FB Data from Projects 4 5 Deleting Unnecessary FB Data from Projects This section explains how to delete FB data from a project FB instances and FB instance names registered to the global label or local label may be deleted at the same time Operating procedure 1 Select an FB to be deleted on the Project view Project CA Gai Sa ih A Parameter Intelligent Function Module Global Device Comment hia Global Label H Program Setting ae Program e MAIN ae Program H Local Label 2 Select Project gt Object Delete A confirmation message for deleting data is displayed MELSOFT Series GX Works A Do you want to delete the selected File 3 Click the button A message for selecting the deletion method is displayed MELSOFT Series GX Works d Do you want to delete the Function block icy Delete the Function black and the Function block in the import target program Delete only Function block OVERVIEW OF FUNCTION CREATING FUNCTION USING FUNCTION EN BLOCKS EDITING FUNCTION MANAGING AND mi L ad D Zo Nn D EXAMPLES USING FUNCTION BLOCKS O PROGRAM gt APPENDIX INDEX La GX Works2 WT 4 MANAGING AND EDITING FUNCTION BLOCKS 4 Select the deletion method and click the button The following are the targets to be deleted Deletion method Deletion target e FB data Delete the function block and the function
37. FOR THE PRODUCT 1 Mitsubishi programmable controller the PRODUCT shall be used in conditions 2 i where any problem fault or failure occurring in the PRODUCT if any shall not lead to any major or serious accident and ii where the backup and fail safe function are systematically or automatically provided outside of the PRODUCT for the case of any problem fault or failure occurring in the PRODUCT The PRODUCT has been designed and manufactured for the purpose of being used in general industries MITSUBISHI SHALL HAVE NO RESPONSIBILITY OR LIABILITY INCLUDING BUT NOT LIMITED TO ANY AND ALL RESPONSIBILITY OR LIABILITY BASED ON CONTRACT WARRANTY TORT PRODUCT LIABILITY FOR ANY INJURY OR DEATH TO PERSONS OR LOSS OR DAMAGE TO PROPERTY CAUSED BY the PRODUCT THAT ARE OPERATED OR USED IN APPLICATION NOT INTENDED OR EXCLUDED BY INSTRUCTIONS PRECAUTIONS OR WARNING CONTAINED IN MITSUBISHI S USER INSTRUCTION AND OR SAFETY MANUALS TECHNICAL BULLETINS AND GUIDELINES FOR the PRODUCT Prohibited Application Prohibited Applications include but not limited to the use of the PRODUCT in e Nuclear Power Plants and any other power plants operated by Power companies and or any other cases in which the public could be affected if any problem or fault occurs in the PRODUCT e Railway companies or Public service purposes and or any other cases in which establishment of a special quality assurance system is required by the Pu
38. Function Modulg Global Device Comme Global Label Global Program Setting S POU B Program MAI 4 FB_LENO o_conveyor 23 PruuT a Local Label Structured Data Types B Local Device Comment counter_end Device Memory Device Initial Yalue The FB data is copied to the project of the sequence program and displayed on the Project view When reusing FBs created with GX Developer in GX Works2 Open a project of GX Developer by selecting Project gt Open Other Data Open Other Project For considerations refer to K Appendix 3 Project Edit Find Replace Compile view Online Debug Diagnostics Tool wind PST i B G3 ARATTA Navigation q x Project h a Ap aA a4 Parameter NX Intelligent Function Module obal Device Comment Ay Program geehocal Label mered Data Types L Local Device Comment Device Memory Device Initial Yalue Project Ps Parameter Intelligent Function Module Global Device Comment lt gt Bp 2 A 8 Global Label Program Setting POU B Program MAIN ae Program F Local tice aa Device Memory Device Initial Yalue OVERVIEW OF FUNCTION CREATING FUNCTION USING FUNCTION mY BLOCKS EDITING FUNCTION MANAGING AND mi L Ma D Zg Nu D EXAMPLES USING FUNCTION BLOCKS PROGRAM gt
39. N FB is ru nning B i_sensor_01 Sensor W i_counter Number o f boxes to be lo aded o_conveyor B Conveyor o_buzzer B Buzzer English Simple 2 Select View Tile FB Horizontally TH MELSOFT Series GX Works2 strator Desktop tmp 0907 Project E 06 001 1 2xw Project Edit Find Replace Compile View Online Debug Diagnostics Tool Window Help i 96 B25 J es Aad OR BR El QO6LDI Host Station 15 36Step NU Move the cursor to the FB instance The sequence program and the FB program are displayed horizontally T PRG Write MAIN 36 Step 9 x1 2s B i_sensor_01 Sensor DO H W i_counter Number o f havoc Hh FB Write conveyor_01 MAIN conveyor_01_1 85 Step FB_ENO o_conveyor x0 conveypr_01_1 iN FB_ENO B FB is ru nning o_conveyor B Conveyor o_buzzer B Buzzer o_buzzer MANAGING AND PROGRAM USING FUNCTION A EESAN EDITING FUNCTION mi L ad D Zo Nn D FUNCTION BLOCKS EXAMPLES USING gt FB is ru Conveyor Buzzer x lt Q Z LL oO t d o counter_en lt x Loading complete d FB_ENO SM412 o_conveyor INCP timeri Conveyor English QO6UDH Host Station 14 85Step NU gt lt LL Q Z 3 1 3 Aligning sequence program and FB program 3 11 LO GX Works2 Z 3 USING FUNCTION BLOCKS o Poat Other display methods An FB program can also be displayed by moving the
40. N INTRODUCTION Thank you for purchasing the Mitsubishi integrated FA software MELSOFT series Before using the product thoroughly read this manual to develop full familiarity with the functions and performance to ensure correct use CONTENTS SAFETY PRECAUTIONS s taehen na cGanh oO ene Gooey Gee ee oo inkarda n ee een oe A 1 CONDITIONS OF USE FOR THE PRODUCT 3 uu enw ee oe ean ed ow ee a ee Gee mee eee ae 6 A 2 REVISIONS oo tage ak ee OEE EREET ee ee oe ee ee eee ee ee A 3 INTRODUCTION oti fine tance ere gees nea deed diab pee eh nearer eee eee eed were eases A 4 ONTENTS merei renne ick ea ou BER eh eee ae Bana y oe ee eo og eee es A 4 MANORS ion ean earn eget he eee Teck Ree perh BGR Oa easy GEES he E mayen A 7 GENERIC TERMS AND ABBREVIATIONS IN THIS MANUAL 00 A 15 TERN seeen ee RER EREE E ERA EERE A 16 1 OVERVIEW OF FUNCTION BLOCKS 1 1 Function Blocks FBs 1 2 1 2 Features of FBs 1 3 1 3 Labels 1 4 1 4 Programming Flow with FBs 1 5 1 4 1 FB creation procedure 2 2 a lt 2 anana Shae 4 Shwe Foe oS oS wee BS Se wos SES Gee Oy ee 1 5 1 4 2 Sequence program creation procedure using FBS 0 0 0 0 ees 1 7 1 5 Overview of Screen Configuration 1 8 1 5 1 Main frame configuration 0 0 ee eee eee eee 1 8 1 5 2 La abelsetting edilo ss wun dd noe sien tah owen eke bee p ee a ered eo eed i a E a 1 10 2 CREATING FUNCTION BLOCKS 2 1 Creating Projects for FBs 2 2 2 2 Creating New FB Data 2 3 2 3 S
41. ND mi L ad D Zo Nn D EXAMPLES USING FUNCTION BLOCKS O PROGRAM gt APPENDIX INDEX LO GX Works2 WwW 4 MANAGING AND EDITING FUNCTION BLOCKS 3 Enter a password and click the button On the Registration Status field of the Set Block Password screen Unlocked is displayed Set Block Password Set a password to Function block Function Block List POU Mame ay Count Mum Unlocked B Count Num _02 Password is unset oa Disable Lock Delete Password OK Cancel 4 Click the button The protection of the FB by the block password becomes effective when the project is saved and opened once again The lock marks are appended to the FB icons on the Project view se o o a a a eee a Count Mum i Wg Program oe ee i m L a ee ee E8 Count_Num_o2 W Program ig Local Label Structured Data Types HEA Local Device Comment Device Memory e Device Initial value o Point Changing block passwords To change a block password simply set a new password for the POU to which a block password has already been set However the block password must be unlocked before changing it 4 6 Protecting FBs mM Unlocking block passwords Unlock the block password Unlock of the block password is valid while the project is being opened The lock status is restored when the project is opened again OVERVIEW OF FUNCTION Operating procedure 1 Select Tool
42. NUAL The following are the generic terms abbreviations of such as software packages and programmable controller CPUs used in this manual Generic term and abbreviation GX Works2 GX Developer Personal computer Basic model QCPU High Performance model QCPU Process CPU Redundant CPU Universal model QCPU QCPU Q mode LCPU FXCPU SFC MELSOFT Library FB Description Generic product name for SWnDNC GXW2 E n version Generic product name for SWnD5C GPPW E SWnD5C GPPW EA SWnD5C GPPW EV and SWnD5C GPPW EVA n version Generic term for personal computers on which Windows operates Generic term for Q00J Q00 and Q01 Generic term for Q02 Q02H QO6H Q12H and Q25H Generic term for QO2PHCPU QO6PHCPU Q12PHCPU and Q25PHCPU Generic term for Q12PRHCPU and Q25PRHCPU Generic term for QOOUJ Q00U Q01U Q02U Q03UD QO3UDE QO3UDV Q04UDH Q04UDEH QO04UDV QO6UDH QO6UDEH QO6UDV Q10UDH Q10UDEH Q13UDH Q13UDEH Q13UDV Q20UDH Q20UDEH Q26UDH Q26UDEH Q26UDV Q50UDEH and Q100UDEH Generic term for Basic model QCPU High Performance model QCPU Process CPU Redundant CPU and Universal model QCPU Generic term for LO2S LO2S P L02 LO2 P LO6 LO6 P L26 L26 P L26 BT and L26 PBT Generic term for FXos FXo FXON FX1 FX1S FX1N FX1NC FXU FX2C FX2N FX2NC FX3S FX3G FX3GC FX3U FX3UC Generic term for MELSAP3 MELSAP L and FX series SFC Generic term for components FB library sample progr
43. O H O Z 5 LL EXAMPLES USING PROGRAM gt APPENDIX INDEX App 1 La GX Works2 WT APPENDIX Appendix 1 Character Strings that cannot be Used for Label Names and FB Data Names Instance Names Character strings used for application function names common instruction names special instruction names instructions etc are called reserved words These reserved words cannot be used for label names FB data names or FB instance names If the character string defined as a reserved word is used an error occurs during entry or compilation The following tables show character strings that cannot be used for FB data names FB instance names or label names O Applicable x Not applicable Category Character string Ba a oaile Label name VAR VAR_RETAIN VAR_ACCESS VAR_CONSTANT VAR _ CONSTANT RETAIN VAR_INPUT VAR_INPUT_RETAIN VAR_OUTPUT VAR_OUTPUT_RETAIN VAR_IN_OUT VAR_IN_EXT VAR_EXTERNAL Class identifier VAR_EXTERNAL_CONSTANT x x VAR_EXTERNAL_CONSTANT RETAIN VAR_EXTERNAL_ RETAIN VAR_GLOBAL VAR_GLOBAL_CONSTANT VAR_GLOBAL_CONSTANT_RETAIN VAR_GLOBAL_RETAIN BOOL BYTE INT SINT DINT LINT UINT USINT UDINT ULINT WORD DWORD LWORD ARRAY REAL LREAL TIME STRING TIMER COUNTER RETENTIVETIMER Data type POINTER Bit Word Unsigned Bit String 16 bit Double Word x x Unsigned Bit String 32 bit Word Signed Double Word Signed FLOAT Single Precision FLOAT Double Precision String T
44. O Start_No KO Setting_value_stored K1 BCD Setting_value_stored nalog_value Global labels and local labels There are two types of labels global labels and local labels e Global labels Global labels are shared among all sequence programs in a project A specific device can be assigned to a global label e Local labels Local labels are used only in a single sequence program They cannot be shared even if local labels with the same name are set for multiple sequence programs Different devices are assigned to local labels for each sequence program 1 4 Programming Flow with FBs 1 4 Programming Flow with FBs This manual explains the operating procedures with examples of FBs used on QCPU Q mode LCPU For the instructions and functions which are available for FXCPU refer to the following manuals FXCPU user s manuals and programming manuals 1 4 1 FB creation procedure Operating procedure 1 Creating a project for FBs Create a project with labels 2 Creating new FB data Create new FB data 3 Setting local labels Procedure Procedure Procedure Set local labels to be used for the FB program 4 Creating an FB program Create an FB program using labels 5 Converting FBs Conversion finalizes the edited FB program content Procedure Procedure Reference Section 2 1 Reference Section 2 2 Reference Section 2 3 Reference Section 2 4 Reference Section 2 5 1 4 1 FB creation pr
45. QO6UDV Q13UDV Q26UDV LO2S L06 L26 Addition Section 4 2 1 Correction GENERIC TERMS AND ABBREVIATIONS IN THIS MANUAL TERMS Section 1 5 1 Section 2 3 3 Section 2 6 Section 3 1 1 Section 3 1 2 Section 4 2 2 Section 5 2 Appendix 2 Modification Section 4 2 gt Section 4 2 2 May 2013 SH NA 080984ENG F Model Addition LO2S P LO6 P L26 P FX3s Correction GENERIC TERMS AND ABBREVIATIONS IN THIS MANUAL Section 2 3 3 Appendix 2 Sept 2013 SH NA 080984ENG G Addition Section 4 2 1 Section 4 2 2 Correction TERMS Section 4 2 3 Modification Section 4 2 1 gt Section 4 2 3 Section 4 2 2 Section 4 3 Section 4 3 to Section 4 6 Section 4 4 to Section 4 7 Dec 2013 H NA 080984ENG H Correction Section 2 1 Mar 2014 H NA 080984ENG I Correction Section 2 6 Appendix 3 Jun 2014 H NA O080984ENG J Correction Section 4 2 1 Section 4 2 2 Section 4 2 3 Appendix 3 Sept 2014 H NA O80984ENG K Correction Section 5 3 Mar 2015 H NA 080984ENG L Correction Section 4 4 1 The manual number is written at the bottom left of the back cover Japanese Manual Version SH 080983 N 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 2011 MITSUBISHI ELECTRIC CORPORATIO
46. Timer up 1 Y71 Timer up2 Y72 Poo Output variable Device that assigns a value to an output variable EDITING FUNCTION MANAGING AND N OL The output of the FB can be obtained by specifying the output variable name with a period OS suffixed to the FB name nm Enter an instruction to obtain the output after performing the FB call G ae A U LL A x Q im fo lt x in Q Z 3 1 1 Pasting FBs to sequence programs 3 5 LO GX Works2 v 3 USING FUNCTION BLOCKS 3 1 2 Creating input and output circuits of FB instances Create input and output circuits of the FB instance pasted to a sequence program OTNNENNNNNNNNNENENNNNNNNNNNNENNENNNNNNNNNNNENNENNNNNNENENNENENNg conveyor_01_1 B FB_EN FB_ENO B B i_sensor_01 FB_OK B W i_counter o_conveyor B Yo yi o_buzzer B Y1 Input circuit Output circuit Operating procedure 1 Select Compile gt Build The Confirm Build Method screen is displayed Confirm Build Method There is a program that has not been compiled Please choose one of the Following actions Just converts the program in the active window Does not compile Execute compile after conversion Compiles the entire project The compile process may take several minutes to complete e 2 Select Convert the selected program and click the button The ladder block is converted and lines are connected to the input labels and output l
47. UNCTION J BLOCKS 5 1 Installing FB Library 5 2 HOO EA U ZO 5 2 Using FB Libraries 5 3 E 92 5 3 Displaying Reference Manual 5 5 ZnO 5 4 Uninstalling FB Library 5 6 5 USING FB FUNCTION BLOCKS O RSECRNANGE EXAMPLES USING PROGRAM gt APPENDIX INDEX LE GX Works2 v 5 USING FB LIBRARIES 5 1 Installing FB Library Install the FB Library Log onto the personal computer to which the FB Library is to be installed as a user with Administrator privilege and install the FB Library 5 1 1 Obtaining FB Library Contact your local Mitsubishi representative to obtain the FB Library Point Compatible GX Works2 versions Install an FB library onto a personal computer on which GX Works2 Version 1 12N or a later is installed Since compatible GX Works2 versions differ according to FB libraries contact your local Mitsubishi representative for details 5 1 2 Installing FB Library Operating procedure 1 Decompress the installer file 2 Double click setup exe in the decompressed ASOT ey DEAD atalishi Wizard folder oe pile OS Gerlan B Install the file according to the instructions on the screen ee The FB Library and a reference manual are installed in the following folder e When the installation path of GX Works2 is C Program Files MELSOFT GPPW2 C Program Files MELSOFT GPPW2 MELSOF T Library 5 2 5 1 1 Obtaining FB Library Using FB Libraries Op
48. X INDEX LO GX Works2 Ww 5 USING FB LIBRARIES 4 Click the button sian The imported FB library is displayed on the Project view For the method for utilizing FBs refer to Chapter 3 Bt nn For the method for using FB libraries and the application of labels 2 ropes refer to the FB library reference manual Section 5 3 T even Program Local Label Ti M Q644D_Read llAD al AD cnv data read all CHs F M Q644D_RequestSetting Operating condition set re E Structured Data Types Pot P Editing FB libraries e Since a folder which contains FB library project files is for a system use do not change the folder name or delete the folder If the folder name is changed or the folder is deleted a system malfunction may occur In addition do not store GX Works2 project files or any other files For a location to which FB library project files are to be stored refer to K Section 5 1 2 e FB libraries whose name starts with M P are read only files They can be deleted but cannot be edited To edit a library copy or paste FB library data after importing the library Copying FB libraries FB library data can be copied or pasted even for projects with different programmable controller types as long as project types are identical FF a E 5 3 Displaying Reference Manual 53 Displaying Reference Manual This section explains how
49. a to a word type label For a ladder program a label does not allow digit specification K4i_Counter etc When transferring multiple bit data to a word type label use the BSET BRST instruction or the WOR WAND instruction to switch ON OFF the individual bits of the target word data lt For QCPU Q mode LCPU gt OVERVIEW OF FUNCTION Set 1 ON to the first bit of int_WordData int_FB_run int_BitArray 0 BSET int_YVvordData KO 9 BRST int_YYordData K5 Set 0 OFF to the fifth bit of int_WordData CREATING FUNCTION Set ON to the Oth bit and the 4th bit of int_WordData with the WOR instruction KL For the specification of the bit position refer to the following table lt For FXCPU gt int_FB_run int_BitArray 0 WOR __ int_YYordData CH int_YYordData WOR _ int_VYordData int_YYordData USING FUNCTION J BLOCKS WAND int_WordData CHOFFFDDint_WordData WAND int WordDeta CUQFEDEDint_ WordData Set OFF to the 1st bit and the 5th bit of int_WordData with the WAND instruction K For the specification of the bit position refer to the following table WOR instruction WAND instruction SUISSE a cman TOO EDITING FUNCTION MANAGING AND Oth bit CHo001 gt HFFFE 1st bit H0002 2nd bit H0004 HFFFB 3rd bit H0008 HFFF7 P M 11 4th bit CH0010 gt HFFEF of Z 5th bit H0020 as l Gth bit H00 40 HFFBF 7th bit H0080 HFF7F 6 op 8th bit H0100 HFEFF 28 9
50. abels of the FB instance conveyor_01_1 B FB_EN FB_ENO B B i_sensor_01 W i_counter o_conveyor B o_buzzer B 3 6 3 1 2 Creating input and output circuits of FB instances 3 1 Creating Sequence Programs with FBs 3 Enter elements to the input circuit Enter elements in the same manner as creating normal ladder programs Create a program meeting data type of input variable lt Bit type gt OVERVIEW OF FUNCTION conveyor_01_1 1 gt ia ier Symbol xo Exit Help Yi counter o_conveyor B CREATING FUNCTION o_buzzer B conveyor_01_1 USING FUNCTION A EESAN B FB_EN B i_sensor_01 Yi_counter o_conveyor B o_buzzer B EDITING FUNCTION MANAGING AND If the data type of input variable is not a bit type enter the device directly on the Enter Symbol screen lt Other than bit type gt conveyor_01_1 B FB_EN N Lu a Y a l USING FB B i_sensor_01 N lt lt O O m zZ O H O Z 5 LL O lt N N i A lt L gt X f PROGRAM 4 Enter elements to the output circuit in the same manner as the input circuit Edit the program other than FBs as necessary After finishing the editing convert compile the program gt APPENDIX INDEX 3 1 2 Creating input and output circuits of FB instances 3 7 ee GX Works2 WT 3 USING FUNCTION BLOCKS Point Number of contacts that can be created in inp
51. abl When output the value to DY device Connec able DY device can be connected DY device cannot be connected i p x device modify the program 1 The value of input side of device label is not changed l To make the value of device label of The value of input side and output i The operation result is returned Gaol Ged cne input side not to be changed modify the only to device label of the output local label setting of the FB 2 side EDITING FUNCTION MANAGING AND Value of I O variable I O variabil 7 ad th iaci th When connecting two or more contacts variable Connectable ee n E or comparison operation contact to FB comparison operation contact can comparison operation contact i i elements i i modify the local label settings of the be connected to input side cannot be connected to input side FB 3 USING FB LIBRARIES When connecting a constant to I O 6 Connection of A constant can be connected to A constant cannot be connected j J variable modify the local label settings N constant input side to input side Ox of the FB ZO ep i Fa Output FB to other device label once and then output it to DY in a rung other than the FB is used as follows a Sie x0 FB1 rae 2 B IN1 OUT1 B BITI 629 Xx A U LL 17 ee 2 Use VAR_INPUT and VAR_OUTPUT instead of VAR_IN_OUT as follows FB2_1 2 D100 WINOUT1 INOUTT AY H D200 FB2_1 2 D100 WAIN OUTTA D200
52. ams drawing data which provide easy operation of programmable controller related modules and GOTs and various devices that are connected to them Contact your local Mitsubishi representative to obtain components of MELSOFT Library Abbreviation for a function block A 16 E TERMS The following are the terms used in this manual Term Actual device Common instruction Special instruction Simple Project Description An actual device assigned to label after compiling a project with labels or a device that is not described using a label Generic term for sequence instructions basic instructions application instructions data link instructions multiple CPU dedicated instructions and multiple CPU high speed transmission dedicated instructions Generic term for module dedicated instructions PID control instructions socket communication function instructions built in I O function instructions and data logging function instructions Generic term for projects created using Ladder Diagram Sequential Function Chart Structured Text Without labels Generic term for projects created without selecting Use Label when creating new projects With labels Generic term for projects created with selecting Use Label when creating new projects Project without labels Project with labels Project with security Utilization Reuse Library project FB instance Global label Local label Structure Array Generic term fo
53. ault Cancel 2 Set the item on the screen Item Description Conversion Method of Invalid Instructions and Devices 3 Click the button The screen returns to the Install screen Select the conversion method for the inapplicable instruction 4 8 4 2 3 Importing FBs from other project 4 3 Copying FBs from Project FBs can be reused by starting another GX Works2 and copying and pasting the FBs from the source project to the target project This section explains how to reuse FBs in an existing project Operating procedure 1 Open the source project 4 3 Copying FBs from Project 2 Start another GX Works2 and open the target project If the programmable controller types differ between the two projects match the programmable controller type A programmable controller type can be changed by selecting Project gt Change PLC Type 3 Move the FB data in the source project to FB_Pool in the target project with the Target project ME MELSOFT Series GX Works2 Unset Project PRG Write MAIN 1 Step drag and drop operation Source project ME MELSOFT Series GX Works2 Strator Desktop tmp 090 Project E 06 001 Project Edit Find Replace Compile View Online Debug Diagnostics Tool wind pens __ 26 ne Oa Lisl ED a eh for dhe ee ee ae ee M a 4 S Local Label Setting MAIN PRG H PRG Write MAIN 363 oject counter ET CP Gy Gey i ath Parameter lt 4 Intelligent
54. ay Select Project view gt POU gt FB_Pool gt function block Local Label Fe Funct ons G Label setting Cc do l Cas labelName DataType Constant Comment 1 BARINPUT Fe En Bit a Operation switch 2 VARINPUT x iseso dee A e 3 AR OUTPUT eeno Bit FB eumig a WAR OUTPUT feo Bit Normal er 5 VARLOUTPUT we foconveyor Bit A eme 6 VARLOUTPUT obuze Bi a z VAR INPUT icone wordline P Number of boxes to be loaded e VAR counter Wodi a Reernaining number of boxes a AR fcounterend See o Leading completed 10 AR fcomveyorend ee o Conveyor driving ended qn paR oi wodi 3 second measurementfetant 12 AR i o wodi a 3 second measurementfetop 7 Operating procedure e Set the items on the screen Item Description Maximum number of characters Select a label class from the list displayed by clicking Class l 7 lt Section 2 3 2 e Ladder Diagram 32 Input output input output labels Enter a desired label name Label Name 16 For unusable characters refer to K5 Appendix 1 e Structured Text 32 Specify a data type from the Data Type Selection screen Data Types displayed by clicking _ lt Section 2 3 4 128 It can also be entered directly Enter a constant value when VAR_CONSTANT is selected for Class and simple type is selected for Data Type 12 Constant Comment 1024 1 Anew line can be inserted into a cell by pressing the ctl Enter ke
55. bel name Consecutive underscores _ cannot be used for a data name or a label name For Simple projects function names and function block names in common instructions and application functions can be used Appendix 2 Supported CPU modules Appendix 2 Supported CPU modules The following are the programmable controller CPUs with which the FBs can be used in GX Works2 Programmable controller series QCPU Q mode LCPU FXCPU Programmable controller type Basic model QCPU Q00J Q00 Q01 High performance model QCPU Q02 Q02H QO6H Q12H Q25H Process CPU Q02PH QO6PH Q12PH Q25PH Redundant CPU Q12PRH Q25PRH Universal model QCPU Q00UJ Q00U Q01U Q02U Q03UD QO3UDE QO03UDV Q04UDH QO4UDEH Q04UDV QO6UDH QO6UDEH QO6UDV Q10UDH Q10UDEH Q13UDH Q13UDEH Q13UDV Q20UDH Q20UDEH Q26UDH Q26UDEH Q26UDV Q50UDEH Q100UDEH LO2S LO2S P L02 LO2 P L06 LO6 P L26 L26 P L26 BT L26 PBT FX1S FX1N FX1NC FX2N FX2NC FX3S FX3G FX3GC FX3U FX3UC App 5 OVERVIEW OF FUNCTION CREATING FUNCTION USING FUNCTION J BLOCKS EDITING FUNCTION MANAGING AND USING FB LIBRARIES EXAMPLES USING FUNCTION BLOCKS PROGRAM gt APPENDIX INDEX LO GX Works2 v APPENDIX Appendix 3 Using FBs Created with GX Developer in GX Works2 FBs created with GX Developer can be used by selecting Open Other Project under Project gt Open Other Data and open the project
56. block l l ee O i e FB instance including input circuits and output circuits in the import target program l l l e FB instance names registered on the label setting editor Delete only function block e FB data 4 6 Protecting FBs 4 6 Protecting FBs Setting a block password protects created FB programs and disables browsing program contents The following operations are disabled when a block password is set Displaying and editing FB programs Editing FB local labels Copying data to other projects Operating procedure 1 Select Tool Block Password The Set Block Password screen is displayed Set Block Password Set a password to Function block Function Block List POU Name Registration Status Count Mum Password is unset ay Count_Num_Oz Password is unset Password Setting Disable Lock Delete Password n 2 Select an FB to be protected and click the Password Setting button The Change Block Password screen is displayed Change Block Password Change Block Password Please enter the password re enter the password to confirm and then click OK Please enter the password with 6 to 32 single byte characters numeric characters alphabets 4 2 a z single space and EPUB fe PD p Passwords are case sensitive Password Re enter Password cencel_ OVERVIEW OF FUNCTION CREATING FUNCTION USING FUNCTION EN BLOCKS EDITING FUNCTION MANAGING A
57. ces automatically 2 3 Setting Local Labels E Considerations of automatically assigned devices Considerations when changing automatically assigned devices All programs need to be compiled when the range of automatically assigned device is changed Compiling all programs changes the device assignment to labels Therefore device values set before the program change remain on the device assigned labels For QCPU Q mode LCPU reset the programmable controller CPU clear all device memories including latches clear all file registers then switch the programmable controller CPU to RUN for a precautionary measure GX Works2 Version 1 Operating Manual Common For the considerations for compiling all programs refer to the following manual GX Works2 Version 1 Operating Manual Simple Project Assigning devices with the Device Label Automatic Assign Setting function OVERVIEW OF FUNCTION CREATING FUNCTION Assign devices to labels with the Device Label Automatic Assign Setting function when a program is compiled GX Works2 Version 1 Operating Manual Simple Project The assigned devices can be checked with the cross reference function GX Works2 Version 1 Operating Manual Common Devices within the range set on the Device Label Automatic Assign Setting screen cannot be used in a program USING FUNCTION J BLOCKS Considerations when the multiple types of devices are assigned automat
58. creen tt Item Description a Select latch 1 or latch 2 3 Latch selection field Select when the range of latch 1 or latch 2 is set on the lt lt Device gt gt tab of 2 PLC parameters Gg oz Device Display the devices to be assigned automatically ro Digit Display whether the range of device assign setting is in decimal or hexadecimal A Assignment Selection Check the device to be assigned automatically Multiple devices can be set i Start Assignment Enter the range of device points to be assigned automatically Range End x Total Points Display the total points of each device range for VAR and VAR_RETAIN 8 Display the device point range set on the lt lt Device gt gt tab of PLC parameters a k PLC Parameter ae r nie oe eka Peer its oer the al range Device Setting Range xample Wi en D 0 to 12287 latch D C to 6000 are set on the l lt lt Device gt gt tab of PLC parameters display range of D 0 to 12287 range of latch D 5000 to 6000 S wW Section title z igs A 2 3 5 Assigning devices automatically 2 9 Clarifies the section of currently open page Screen display Select Project view gt POU gt FB_Pool gt Function Block gt Local Label Class Label Name Data Type Constant Comment VAR_INPUT FB_EN Bit a Operation switch VAR_INPUT i_sensor Bit on Sensor VAR_OUTPUT FB_ENO Bit a FB is running VAR_OUTPUT FB_OK Bit j Normal end VAR_OUTPUT o_conveyor Bit me Conveyor VAR_OUTPUT
59. damental methods for such as managing the system using MELSOFT Navigator and using 13JZ79 system labels for users inexperienced with GX Works2 Sold separately Pee The Operating Manuals are included on the CD ROM of the software package in a PDF file format Manuals in printed form are sold separately for single purchase Order a manual by quoting the manual number model code listed in the table above Purpose of this manual This manual explains the operations for creating sequence programs with function blocks FB in Simple project using the functions supported by GX Worksz2 Manuals for reference are listed in the following table according to their purpose For information such as the content and number of each manual refer to the list of Related manuals 1 Installation of GX Works2 and the USB driver GX Works2 Version 1 Purpose GX Works2 Installation Instructions Operating Manual Common Learning the operating environment and installation method Learning a USB driver installation Details method 2 Operation of GX Works2 GX Works2 Beginner s GX Works2 Version 1 Manual Operating Manual Purpose Simple Project i j Simple Structured eer P Structured bial Project Project Function Project Block Module Learning all functions of GX Works2 Learning the project types and available languages in GX Works2 Learning the basic operations and operating procedures when creating a simple projec
60. e USING FB LIBRARIES 5 poms gt Navigation ax H Local Label Setting MAIN PRG jn PRG Write MAIN 1 Step i Function FB Label Setting conveyor FB Write conveyor_01 0 x 4 Project Parameter 2 Intelligent Function Module Global Device Comment Global Label Program Setting S POU 3 Program ge MAIN screen is displayed on the work window 6 L E MELSOFT Series GX Works2 Unset Project FB Write conveyor_01 0 Step ME O i Project Edit Find Replace Compile View Online Debug Diagnostics Tool Window Help A X O DBAL E36 ne et ee A a ee aad a HeT T oy a Ete So Ft So 4 te re cto BS Mol dth d ath dib Bt Be Be afs cots ano Fro Ss Oh B RALE A GO EE A RAG 5 O Z D LL EXAMPLES USING PROGRAM gt 8 Program Local Label ij FB_Pool Gy conveyor _01 ae Program h Local Label t x lt O a Local Device Comment Z Device Memory LL E Device Initial Value A A x C Point Maximum number of data to be created Up to 800 FB data including other data types such as programs can be created x lt LU QO zZ La GX Works2 WT 2 CREATING FUNCTION BLOCKS 2 3 Setting Local Labels This section explains how to define labels to be used in an FB program 2 3 1 Setting labels on Function FB Label Setting screen Set items such as label classes label names and data types Screen displ
61. e following is a setting example displayed on the Function FB Label Setting screen CESES Label Name o DataType Constant Comment 1 AR INPUT eleen e o a Operation switch 2 vVARINPUT we fisensor BR e seo 3 WWARLOUTPUT Fe eno Bt FB umi a AR OUTPUT jeo Bi Norma end 5 vAR_OUTPUT mfo conveyor Bt S Conveyor 6 vAR_OUTPUT mfo buzzer BR Buzzer z VAR INPUT icone wordSioned P Number of boxes to be loaded e VAR counter Wodi Sa Remaining number of boxes a VAR fcunterend Bi Leading completed 10 AR fcomveyorend Bi Conveyor driving ended Sa VAR timer wodi 3 second measurerent start 12 AR timer online 3 second measurementfetop UncciIon PELLING 6 3 Creating Program Examples E FB program example Create an FB program using labels which have been set Chapter 2 Operation start FB EN counter_end O SET FB ENO Operatio Loading FB is ru nswitch complete nning d OVERVIEW OF FUNCTION 15 RST timer2 3 second measure ment sto p OZ ZO RST timer 1 3 second LO measure LUZ ment sta es rt OL MOY i counter counter Number o Remainin f boxes q number to be lo of boxe Z aded s O B O uzzer Zz lt Buzzer sound gt FB ENO o conveyor LL J 23 o_buzzer O FBistu Conveyor Buzzer Z O nning a counter_end 4 Loading Z complete O a ZO Iz Conveyor operation start after 3 second measurement 9 TA FB ENO SM412 o conveyor OL 44
62. ed with ZZ device as a reserved word depends on the parameter setting When Z device is specified for 32 bit index setting Not handled as a reserved word When ZZ device is specified for 32 bit index setting Handled as a reserved word x App 3 OVERVIEW OF FUNCTION CREATING MANAGING AND PROGRAM FUNCTION USING FUNCTION J BLOCKS EDITING FUNCTION USING FB LIBRARIES FUNCTION BLOCKS EXAMPLES USING gt APPENDIX INDEX Fee GX Works2 WT APPENDIX App 4 E Considerations for using labels In a function the same name as the function cannot be used for a label inapplicable character strings differ between label names and data names such as FB data names and structure names Therefore if a label name which contains an FB data name or structure name is set when setting a label of instance or structure an error may occur A space cannot be used A numeral cannot be used at the beginning of label name A label name is not case sensitive An error may occur at compilation when the same label names with different cases example AAA and aaa are declared In ST programs the same label name can be used for a global label and local label by setting the following option select Use the same label name in global label and local label under Tool Options gt Compile gt Basic Setting An underscore _ cannot be used at the beginning or end of la
63. eece assures 3 8 Compatible CPU Eee eee een eee eae ee eee eee App 5 MONS asec Si Sete pee Sete ees eee ese 3 12 Considerations of automatically assigned devices 2 11 o ENE E E ante ee ener ete tet nr pe 2 13 Converting compiling c cseccccccesseececceeeeecceuseeeceeaaeeess 3 12 Creating Projects for FBS sistcncensvcecgeussaninwdcobonicealacaveasdins 2 2 Creating Sequence program cccccsseeeeceesseeecseeeeeeeees 3 2 D Data name ou ceccecece ese eeeseeeeeeeseeeeeeeeeeeeeness 2 3 3 2 3 4 Character strings that cannot be used App 2 Data types Yous crcocantierantcmanecsecrerenensecanpnccapietaausecamadancumscisaeues 2 6 Device Label Automatic Assign Setting ccceceeeeees 2 9 Docking WINdOW sassacsrwiciatsequseastiosimesonsvadipentasaateneesasenivaaniis 1 9 E Element Selection WINdOW ccccccseeccceeeceeceeeeeseeeeeeaes 1 9 F ene re ee ee et ee ee ener ee ee eee 1 2 Create FBS eee ene ete ere ee eet oe 2 1 Creating New FB Data scciescssceccsesesncsnsenenctetesctuancaceees 2 3 Programming Flow with FBS ccccseeeeeeeeeeeeeees 1 5 F FOTSGUNG EEE TE E EE EE E 4 13 FB COMPOMOUL sfecc cect camiecaestenteseecetassdeccsedncssceasedeaiaoscanee 1 9 FO ecco a eee sete eee 1 9 DAEN x sctnaacaesaaentaateseniesncisaas E 4 11 FB instance cssccccsnsnssieneanecacsecenatcusvecdenecuiuecooneceneccusantesteesseen 1 9 Creating input and output circuits
64. er to the following manual K GX Works2 Version 1 Operating Manual Simple Project 2 5 Converting FBs 2 5 Converting FBs For FB programs in Ladder Diagram the edited content can be confirmed by converting the program OVERVIEW OF FUNCTION Operating procedure 1 Select Compile gt Build The Confirm Build Method screen is displayed Confirm Build Method There is 4 program that has not been compiled Please choose one of the Following actions CREATING FUNCTION Just converts the program in the active window Does not compile Execute compile after conversion Compiles the entire project The compile process may take several minutes to complete USING FUNCTION J BLOCKS e 2 Select Convert the selected program and click the button The edited content of the FB program is confirmed EDITING FUNCTION MANAGING AND PROGRAM gt mi L ad D Zo Nn D EXAMPLES USING FUNCTION BLOCKS O APPENDIX INDEX La GX Works2 WT 2 CREATING FUNCTION BLOCKS 2 6 Considerations when Creating FB Programs This section explains considerations for creating FB programs 1 2 3 4 Use of inline structured text in FB programs Function blocks using inline structured text programs cannot be used in function block programs Use of actual devices Using labels is recommended for creating FB programs If an FB program which uses actual devic
65. erating procedure Import the installed FB libraries to a project 1 Select Project gt Library Install The Install screen is displayed 2 Selecta library from Refresh FB List button FB List is updated Library List and click the 3 Select FBs to be imported from FB List 5 2 Using FB Libraries Import Library to Project Select a library to install Library Selection Library List es Explanation Refresh FB List Select FB to install FB Selection E MFB List sed in FB local label and in FB list Dependent Element Selection 4 Extended Setting Conversion Method Setting Import Library to Project Select a library to install Library Selection 7 Library List Jos4ap x Project Explanation A D converter module FB library Select FB to install FB Selection E d m FB List E mE Q644D A D converter module FB library 2 67 Pou a FB Pool iil M Q644D_Read4DVal A D conversion data read FB a M Q644D_Readall4DVal 4 D cnv data read All CHs FB E am M 064AD_Set DConversion D conversion enable disable FB g Oi M Q644D_SetAverage Averaging process setting FB Oi M Q644D_RequestSetting OP condition setting request FB Oia M Q644D_SetOffsetV al Offset setting FB al M G644D_SetGainVal Gain setting FB Oia M Q644D_ErrorOperation Error operation FB Oia M Q644D_ScalingOperation Scaling process
66. es X10 Y10 etc is used at multiple locations the program may not operate normally In addition if an FB program which uses actual devices for the OUT instruction is used at multiple locations duplicated coil is resulted Duplicated coil can be avoided with the SET RST instruction When using master control instructions When using a master control instruction in an FB program use the MC instruction and the MCR instruction together When using FBs for a sequence program to be executed multiple times in a single scan If an FB which contains a rising instruction falling instruction or an instruction that requires multiple scans before the execution completion is used in a sequence program to be executed multiple times in a single scan the program may not operate normally Item Description e Fixed cycle execution type program Program to be executed multiple times ina Interrupt program single scan e Subroutine program e FOR NEXT instruction program Instruction which requires multiple scans before the execution completion JP READ JP WRITE instruction SORT instruction SP FREAD SP FWRITE instruction etc Unusable instructions for FBs which are used for above programs Rising instruction LIP instruction such as MOVP instruction PLS etc Falling instruction PLF LDF ANDF ORF MEF FCALLP EFCALLP etc 2 6 Considerations when Creating FB Programs 5 When using index registers in FB programs When using i
67. etting Local Labels 2 4 2 3 1 Setting labels on Function FB Label Setting screen 2 0 0 0 cee 2 4 2 3 2 D o EE E E E E EA E E E ee EE E E E E E 2 5 20 Ecate METEEN PETERE EE EEEE heeded tee beet eke eee ea ee eae ee ae 2 6 2 3 4 Selecting data typeS 1 ee ee eee eee nett eee ena 2 7 2 350 Assigning devices automatically tc ai uw shin deena ein bi seat ee ee Ow Ws eee Soda woes 2 9 2 4 Creating FB Programs 2 12 2 5 Converting FBs 2 13 2 6 Considerations when Creating FB Programs 2 14 3 USING FUNCTION BLOCKS 3 1 Creating Sequence Programs with FBs 3 2 3 1 1 Pasting FBS to sequence programS 4 s 2 d o da eee ou ved oe bedsaci ede tour esas ewes 3 2 3 1 2 Creating input and output circuits of FB instances aaua aaa ce es 3 6 3 1 3 Aligning sequence program and FB program 2 0 eee 3 11 3 1 4 Converting compiling all sequence programs 0 0 eens 3 12 3 1 5 Writing sequence programs to programmable controller CPU 0 0005 3 16 3 2 Checking Operations of Sequence Programs 3 19 4 MANAGING AND EDITING FUNCTION BLOCKS 4 1 Reading FB Programs from Programmable Controller CPU 4 2 4 2 Reusing FBs from Library Project 4 3 4 2 1 Library project reusing procedure 0 ccc eee eee eens 4 3 4 2 2 Exporting FBs to other project ns wad aca es bee bw ee kee eX See ee ea ee ee ae ee 4 4 4 2 3 Importing FBs from other project 0 0 0 eee teens 4 6 4 3 Copying FBs from
68. fied click the Refresh FB List button and update FB List 4 6 4 2 3 Importing FBs from other project 4 2 Reusing FBs from Library Project 5 Select FBs global labels and structures to be imported to the editing project from the FB List Click the Dependent Element Selection A button to import the FBs or structures in the selected FBs at the same time OVERVIEW OF FUNCTION FEB Selection GO6UDH_FB Fl PAE Global Label poi Global FE Pool _ FB_LD 1 Structure OES STR_OI OES STR_O CREATING FUNCTION 7 i Benenden Element Selediania Select FB and structure used in FE local label and Dependent Element Selection global label which selected in FE list 6 Click the button The imported FBs global labels and structures are displayed on the project view For utilizing FBs refer to Chapter 3 USING FUNCTION EN BLOCKS Point Block passwords An FB with a block password cannot be imported Delete the block password of the source project before importing the FB Considerations of Indexing Setting for ZR Device FBs cannot be imported when the device set for Indexing Setting for ZR Device on the lt lt Device gt gt tab of PLC parameter is different between the source project and the project being edited Set the same setting for Indexing Setting for ZR Device and import FBs When an FB with the different start number of index register is imported check the program
69. gt APPENDIX INDEX App 7 LO GX Works2 v APPENDIX 3 Use VAR_INPUT and VAR_OUTPUT instead of VAR_IN_OUT as follows x0 xi x2 FB3_1 3 4 4 vo C d x0 x1 x2 FB3_1 3 4 4 vo 4 Use VAR_INPUT and VAR_OUTPUT instead of VAR_IN_OUT as follows FB4_1 2 K100 WAINOUT1 INOUTT AY H D100 FB4_1 2 K100 WINI OUT D100 a App 8 NOILONNA JO MAIAYSAO gt Wu A lt MELSOFT sy20149 0 NOILONN 4 ONILVANO sy2019 SSF NOILONN4 ONISN syoold LO NOILONN 4 ONILIGS aNY NI YNYN Saluvual CO s9019 NOILONnS lt L g4 ONISN ONISN SJIJNYXI WYN9OHd XIGNAddV f Index 1 La GX Works2 WT INDEX A Assigning devices automatically ccccecceeseeeeeeeeeeeeees 2 9 FE EEE E A 2 10 QCPU Q mode LOPU aaonsnnnnsnnnnnsnnnnsnrrrssnrrrrsrrreene 2 9 B IOC PASSION ose cece etsesasietert escent ace Saia aai iii 4 13 VSG UG itt sapernaacameuniicnctskasseeuviavadmadvcievesarienaeuactauaesiete 4 15 CNG poco esi reece E 4 13 OCI ee secetts sce cee E AES 4 15 C Calculating memory size FXCPU essssssssnssssnrrsesrrreen 3 15 Calculating memory size QCPU Q mode LCPU 3 13 Change Instance Function Block screen 005 3 20 Checking Operations of Sequence Programs 3 19 6 ool ee ee eee ee eee eee ee eee ee 2 5 COMED oo stecee es te E eee auteareesaaths ee
70. he type in text or selecting it on the Data Type Selection screen Operating procedure 1 Click p on the data type entry field on the Function FB Label Setting screen The Data Type Selection screen is displayed Data Type Selection Libraries Data Type Word Signed Double Word Signed FLOAT Single Precision FLOAT Double Precision Stringi32 Timer Counter Retentive Timer Fointer Type Class Simple Types Structured Data Types f Function Blocks Array Element ARRAY Element a 2 Selecta type for Type Class Item Description Simple Types Specify this to select a data type from basic types such as bit and word Specify this to select a data type from the defined structures Structured Data Types For details of structures refer to the following manual C GX Works2 Version 1 Operating Manual Simple Project Function Blocks Specify this to select a data type from the defined function blocks 3 On the Libraries field select the reference source such as the defined structure that is used as the data type Item Description lt ALL gt Browse data types structures and function blocks defined in the project and all libraries Browse data types structures and function blocks defined in the project lt PROJECT gt Not displayed when Simple Types is selected Browse function blocks of application functions Standard Lib Not displayed when Simple Types or Structured
71. hecked on the Memory Capacity Calculation Result screen OVERVIEW OF FUNCTION CREATING FUNCTION USING FUNCTION A EESAN Apply the FB to the program as an internal processing E Calculating memory size QCPU Q mode LCPU Data size required for writing a program to a programmable controller CPU can be checked on the Memory Capacity Calculation Result screen Excess of the capacity when writing a program to a programmable controller CPU can be prevented by checking the memory size EDITING FUNCTION MANAGING AND Operating procedure 71 Select Tool gt Confirm Memory Size The Confirm Memory Size screen is displayed mi L ad D Zo Nn D Confirm Memory Size Target Memory MEEME Memory Card Type THA Edit Data Parameter Program Select All Cancel All Selections Module NamefData Mame Title Target Detail Last Change Str EXAMPLES USING FUNCTION BLOCKS PROGRAM BIA Symbolic Information A abe Program Program File MM pera File list BH MAIN 2011 09 07 15 43 38 Di Paramete SSeS A PLC Network Remote Password Switch Setting 2011 09 07 15 43 38 x lt HEA Global Device Comment E cow COMMENT O Detal 2011 09 07 15 43 38 ai A lt L Necessary Setting Mo Setting Already Set 3 Set if itis needed Mo Setting Already Sek j cose x lt U QO zZ 3 1 4 Converting compiling all sequence programs 3 13 LO GX Works2 v 3 USING FUNCTION BLOCKS 2 Se
72. i nc enccds sect ele eters ewdaGinet av steeateanen IRAAN Write tO PLO se ae ee pete ce ee sere eon eens sy20149 CD NOILONNA ONILVANO Writing SEQUENCE programS ccccsssceeseseeeceseeeseeeess sy2019 SSF NOILONN4 ONISN syoold LO NOILONN 4 ONILIGS aNY NI YNYN Saluvual CO s9019 NOILONnS lt L g4 ONISN ONISN SJIJNYXI WYN9OHd XIGNAddV f Index 3 Microsoft Windows are trademarks or registered trademarks of Microsoft Corporation in the United States and other countries Ethernet is a trademark or registered trademark of Xerox Corporation All other company names and product names used in this manual are trademarks or registered trademarks of their respective companies SH NA 080984ENG L 1503 KWIX MODEL GXW2 VER1 O FB E MODEL CODE 13JU72 MITSUBISHI ELECTRIC CORPORATION HEAD OFFICE TOKYO BUILDING 2 7 3 MARUNOUCHI CHIYODA KU TOKYO 100 8310 JAPAN NAGOYA WORKS 1 14 YADA MINAMI 5 CHOME HIGASHI KU NAGOYA JAPAN When exported from Japan this manual does not require application to the Ministry of Economy Trade and Industry for service transaction permission Specifications subject to change without notice
73. ically QCPU Q mode LCPU Refer to Considerations of compilation GX Works2 Version 1 Operating Manual Simple Project Device types and setting ranges EDITING FUNCTION MANAGING AND The types of automatically assigned devices differ by the type of CPU The setting ranges depend on the number of device points set in PLC parameter For details of PLC parameter refer to the following manual GX Works2 Version 1 Operating Manual Common Considerations when displaying the Device Label Automatic Assign Setting screen When displaying the Device Label Automatic Assign Setting screen an error message may be displayed In this case terminate GX Works2 copy vsflex8n ocx stored in the folder of GX Works2 installation destination to C WINDOWS system32 for Windows XP and restart GX Works2 mi L ad rave oo mo EXAMPLES USING FUNCTION BLOCKS O PROGRAM gt APPENDIX INDEX 2 3 5 Assigning devices automatically 2 14 La GX Works2 v 2 CREATING FUNCTION BLOCKS 2 4 Creating FB Programs This section explains how to create an FB program using labels Labels set on the Function FB Label Setting screen and global labels can be used _ Operating procedure 1 Select Project view POU FB_Pool function block Program The FB editing screen is displayed 2 Create an FB program 4h FB Write conveyor_01 85 Step For the program creation method ref
74. igh Speed Mode Setting For Save Destination of Symbolic Information to PLE Program Memory Device Memory R Program Memory Device Memory EDITING FUNCTION MANAGING AND Memory Card SRAMI Memory Card ATA Standard ROM FXCPU e Symbolic information can be read from write to a programmable controller CPU in a project of FX3u FX3uc version 3 00 or later only e When a memory cassette to which the symbolic information has been written is used on an FXCPU other than FX3u FX3uUc version 3 00 or later the memory cassette can be used however the symbolic information cannot be read from the memory cassette When the symbolic information is written to a memory cassette on an FXCPU other than FX3U FX3uUc version 3 00 or later the symbolic information may be corrupted mi L ad D Zg Nn D EXAMPLES USING FUNCTION BLOCKS PROGRAM gt APPENDIX INDEX 3 1 5 Writing sequence programs to programmable controller CPU BaT La GX Works2 WT 3 USING FUNCTION BLOCKS E Symbolic information The symbolic information is data that store the program configuration such as labels and FBs To restore these data included in the symbolic information when reading a program from the programmable controller CPU write read the symbolic information to from the programmable controller CPU Data such as labels and FBs included in the symbolic information cannot be restored if only sequence programs are read
75. ign Setting Device Label Automatic Assign Setting Set a device range to automatically assign to labels Labels will be assigned From its way down the displayed device list when multiple devices are selected Device Assign as Range HARA Total Points Selection Start E Word Device USING FUNCTION gt VAR Range op lt O L E VAR_RETAIN Rang Latch Dtateh a0 O O m Latch selection amima fi el d E VAR Range 4 E VAR_RETAIN Range A Pointer ie VaR Range in hn ss TT 0 Latch TLtateh 10 1 eree VAR Range toon VAR_RETAIN Range EDITING FUNCTION MANAGING AND ee VAR Range i VAR_RETAIN Range Latch 1 Able to clear the value by using a latch clear Latch 2 Unable to clear the value by using a latch clear Clearing will be executed by remote operation or program Caution 1 Label nonassigned devices of the automatically assigned ones while compiling will be allotted the device that displayed at the lowest of the selected ones Ex Device will be assigned to ZR when D and ZR are selected 2 Changing the assignment target device may also change the processing speed since the arithmetic processing speed for R and ZR is difference from other devices lt lt Device gt gt tab of PLC parameter Cancel ae O Zg Operating procedure QO e Set the items on the screen 6 op Item Description Select latch 1 or latch
76. ime Timer Counter Retentive Timer Pointer ANY ANY_NUM ANY_BIT ANY_REAL ANY_INT ANY_ DATE x Data type hierarchy ANY_SIMPLE ANY16 ANY32 a x X Y D M T B C F L P V Z W I N U J K H E A SD SM SW SB FX FY DX DY FD TR BL SG VD ZR ZZ Character string recognized as device Device name Such as X0 x Numeral ST operator Oe LD LDN ST STN S 1 R R1 AND ANDN OR ORN XOR XORN ADD SUB MUL DIV GT GE EQ NE LE LT JMP x JMPC JMPCN CAL CALC CALCN RET RETC RETCN IL operator LDI LDP LDF ANI ANDP ANDF ANB ORI ORP ORF ORB MPS MRD MPP INV MEP MEF EGP EGF OUT H SET RST PLS PLF FF DELTA P SFT P MC MCR STOP PAGE NOP NOPLF Application instructions such as DMOD PCHK INC P Application instruction in GX MELSEC Q L Programming Manual Common Instructions Works2 MELSEC Q L Structured Programming Manual Common Instructions SFCP SFCPEND BLOCK BEND TRANL TRANO TRANA TRANC TRANCA TRANOA SEND TRANOC TRANOCA TRANCO TRANCOC STEPN STEPD STEPSC STEPSE STEPST STEPR STEPC STEPG STEPI STEPID STEPISC STEPISE STEPIST STEPIR TRANJ TRANOJ TRANOCJ TRANCJ TRANCOJ TRANCOCJ Device name SFC instruction RETURN IF THEN ELSE ELSIF END_IF CASE OF END_CASE FOR TO BY DO END_FOR WHILE END_WHILE REPEAT UNTIL END REPEAT EXIT TYPE ST code body END_TYPE STRUCT END _ STRUCT RETAIN VAR_A
77. indow and move to a desired position on the sequence program with the drag and drop operation OStep Local Label Setting MAIN PRG xI ar FB Write conveyor _01 123 5tep B Function FB Label Setting conveyor i SET Mo Parame ter g Intelligent Function Module Mo Global Label INCP D100 Program Setting S POU O Program xE 8 MAIN Y70 ab Program Local Label x3 Program Local Label G Structured Data Types Local Device Comment The Input FB Instance Name screen is displayed Input FB Instance Hame Local Labek MAIN convevor O1 1 Input FB Instance Name Local Label MAIN Local Label MAINI Global Labelialoball 3 Change the FB instance name if necessary When changing the name avoid creating the same name in the same program Ja 3 1 1 Pasting FBs to sequence programs 3 1 Creating Sequence Programs with FBs 4 Click the button The FB instance is displayed on the editing screen T st EJ i Local Label Setting MAIN PRG no FB Write conveyor_01 123 Step Bg Function FB Label Setting conveyor Project Parameter Intelligent Function Module H Global Label E Program Setting POU i B Program o E MAN Program i Local Label ay conveyor _01 OVERVIEW OF FUNCTION Local Label ii Structured Data Types as Local Device Comment H Device Memory i Device Initial Yalue CREATING FUNCTION USING FUNCTION
78. ion 1 Operating Manual Common KL GX Works2 Version 1 Operating Manual Simple Project 2 1 2 2 2 9 2 4 2 5 2 6 Creating Projects for FBs Creating New FB Data Setting Local Labels Creating FB Programs Converting FBs Considerations when Creating FB Programs LL O Wu gt ma LU gt O FUNCTION FUNCTION CREATING Go EE USING FUNCTION J BLOCKS EDITING FUNCTION MANAGING AND m L ad rave oo D_I EXAMPLES USING FUNCTION BLOCKS PROGRAM gt APPENDIX INDEX LO GX Works2 WwW 2 CREATING FUNCTION BLOCKS 2 1 Creating Projects for FBs This section explains how to create a project with labels for creating FBs Operating procedure 1 Select Project gt New O The New Project screen is displayed New Project Series OQCPU Q mode Type Qoo bd Project Type Simple Project I Use Label Language Ladder F cme 2 Set the items on the screen Item Description Series Select a programmable controller series for the project Tupe Select a programmable controller type programmable controller CPU model used for the project Project Type Select Simple Project Select the item Language Select a programming language to be used 3 Click the button A new project is created FE MELSOFT Series GX Works2 Unset Project PRG Write MAIN 1 Step Project Edit Find Replace Compile View Online Deb
79. isa VEEN Sees Manual Simple Project Note Enter the function of the output instruction Checking duplicated coils in the ladder programs When the same devices are used in the source ladder program and the target FB even if Check duplicated coil is selected under Program Editor gt Ladder SFC gt Enter ladder in the option setting the duplicated coils are not detected Check the duplicated coils in the source ladder program and the target FB by the Cross reference function The duplicated coils can be checked by clearing the item for Program Check under Tool Options Compile gt Basic Setting When using labels in a sequence program When using labels in a sequence program refer to the following manual K GX Works2 Version 1 Operating Manual Simple Project 3 8 3 1 2 Creating input and output circuits of FB instances 3 1 Creating Sequence Programs with FBs mM Considerations for using FBs 1 A single FB can be pasted to a single ladder block The output of an FB instance cannot be directly connect to the input of another FB instance When connecting FBs each other use a coil to initially receive the output of a single FB and then connect the contact of the coil to the input of the other FB OVERVIEW OF FUNCTION FB_DEC_1 PLUS2 Y j D200 FB_ADD_1 CREATING FUNCTION PLUS2 V H D200 78 D200 K399 _ eee 2 Wrapping lines cannot be created in the input and output circuits
80. ks created with Ladder Diagram from ST programs are enabled Alternatively when the option item is selected calling an inline structured text and calling FBs from FB program are enabled However the program after the compilation will be differ from that of GX Developer Modify the program as necessary The differences with GX Developer are as follows OVERVIEW OF FUNCTION CREATING FUNCTION Operation in GX Developer and Difference when option is not selected in GX Works2 Operation when the option is selected in GX Works2 Correction method Since an input output variable is Since a temporary variable is directly assigned to the argument Number of steps after assigned to the argument of FB of FB the number of steps after Check the influence of scan time due to compilation the number of steps will be the compilation will be decreased decrease the number of steps increased after compilation compared to that of GX Developer USING FUNCTION J BLOCKS When changing the value of an input variable in FB substitute the value to the label whose class is VAR inputvarable The value of an input variable can The value of an input variable i be changed in FB cannot be changed in FB Initial value of Initial value will be undefined ua VAE wie Melee When using the initial value initialize device label assigned to the Output output variable value argument the output variable in FB variable t
81. ls This manual explains FBs used in Simple projects In the operation examples Ladder Diagram is selected as a programming language but Structured Text can also be selected Note however that FXCPU Simple projects do not support Structured Text lt Before use of FB gt lt After use of FB gt Project A Project A Program 1 Program 1 r m a1 i oe eT P Program 2 E E Program 2 H T I Convert the FB repeatedly used ladder block to f a component Utilize FB k ooo i Project B Program 3 Project B Program 3 1 2 Features of FBs 1 2 Features of FBs E Creating programs efficiently OVERVIEW OF FUNCTION Converting a standard program into a component as a single block enables the program to be utilized easily As an easy utilization for a sequence program is possible the efficiency of creating a large scale program is improved In addition converting a program into a component improves program readability and eases editing and debugging E Consistency of program quality CREATING FUNCTION Converting a program into a component as an FB to utilize the program allows consistency of program quality without relying on the technological skills of the program developers In addition programming mistakes which may occur at the time of utilization can be prevented E Reducing program creation man hours with FB libraries USING FUNCTION J BLOCKS With QCPU Q mode LCPU man hours for creating a program
82. m 1 Not supported by FXCPU VAR_INPUT VAR_IN_OUT APPENDIX INDEX 2 3 2 Classes 2 5 Fe GX Works2 WT 2 CREATING FUNCTION BLOCKS 2 3 3 Data types Data types of label are shown in the following table Note that applicable data types differ according to the programming language O Applicable x Not applicable Programming language Data type Structured Text Word signed PO Double word signed i eS O Word unsigned 16 bit string O Double word unsigned 32 bit string Single precision real iL 2 O Double precision real 2 o o G O Retentive timer gt x ae ie For FXCPU this item is supported by FX2N FX2NC FX3S FX3G FX3GC FX3U and FX3uUC only 2 Supported by Universal model QCPU LCPU only re For FXCPU this item is supported by FX3U and FX3uC only 4 The data type cannot be used as input output labels when pasting an FB to a ladder program 5 For FXCPU this item is supported by FX1N FX1NC FX2N FX2NC FX3S FX3G FX3GC FX3U and FX3uc only For value ranges and details of each data type refer to the following manuals e QCPU Q mode LCPU KL CPU user s manuals Function Explanation Program Fundamentals MELSEC Q L Programming Manual Common Instruction e FXCPU i FXCPU user s manuals and programming manuals 2 6 2 3 3 Data types 2 3 Setting Local Labels 2 3 4 Selecting data types Selecting data type A data type can be specified by directly entering t
83. mmable controller to ensure that the whole system always operates safely Furthermore for the online operations performed from a personal computer to a programmable controller CPU the corrective actions against a communication error due to such as a cable connection fault should be predetermined as a system Startup Maintenance Instructions CAUTION The online operations performed from a personal computer to a running programmable controller CPU Program change when a programmable controller CPU is RUN operating status changes such as forced input output operation and RUN STOP switching and remote control operation must be executed after the manual has been carefully read and the safety has been ensured When changing a program while a programmable controller CPU is RUN it may cause a program corruption in some operating conditions Fully understand the precautions described in GX Works2 Version 1 Operating Manual Common before use The positioning test functions of OPR JOG inching or positioning data for QD75 LD75 positioning module must be executed with the programmable controller set to STOP after the manual has been carefully read and the safety has been ensured Specially when executing the function on the network system ensure the safety thoroughly since the machinery whose operation cannot be checked by an operator may be activated The operation failure may cause the injury or machine damage CONDITIONS OF USE
84. n 3 1 5 J4 N L a oe a l USING FB 5 Checking the operation Procedure Reference Monitor the operation of the sequence program written to the programmable controller CPU Section 3 2 N lt lt O O m zZ O H O Z 5 LL O lt D N W A lt L x lt f PROGRAM gt APPENDIX INDEX 1 4 2 Sequence program creation procedure using FBs RN LO GX Works2 v 1 OVERVIEW OF FUNCTION BLOCKS 1 5 Overview of Screen Configuration 1 5 1 Main frame configuration This section explains the screen configuration of the main frame basic screen of GX Works2 that is displayed when it is started up The following is an example of a screen on which a work window and docked windows are displayed Screen display Title bar EA RAA Works2 Untitled Project PRG Write MAIN 52 Step giles Edit Find Replace ace View Online Debug Diagnostics Tool Window Help Menu bar S A ERPE EE ep X Local Label Setting MAIN PRG 4s FB Write conveyor_01 MAIN cony conveyor_01_1 Parameter RI Toolbar Functio 1 gt gt X dt dub UTE ULE dh ef pH cFIO saFS saF6 saf i Element Selection Pall Parts X B FB_EN FB_ENO B Operaa FB is ru 4 Parameter n switc nning 2 Intelligent Function Module Navigation H i ea Global Label WI n d OW az Program Setting B i_sensor_01 o_conveyor B ensor Comveyor Sequence o gt EE
85. ndex registers in an FB program a Save program and a restore program are required to protect the index register values Through a method that the index register value is set to 0 when its value is temporarily saved an operation error which is detected by the consistency check of index modification whether if the device number exceeds the device range can be prevented OVERVIEW OF FUNCTION Example When the values of index registers Z1 and Z2 are temporarily saved in the FB program before the execution of the program and the saved values of the index registers are restored after execution of the program Save the index register values in index_reg_tmp before execution of the program lt Index register save CREATING FUNCTION index_reg_tmp Q index_reg_tmp 1 lt Index register clear Set the index MOY KO Z1 register values to o USING FUNCTION J BLOCKS lt Index register restoration gt index_reg_tmp 0 zZ index_reg_tmp 1 Z2 EDITING FUNCTION MANAGING AND Restore the values saved in index_reg_tmp after execution of the program to the index registers m L ad Ze DA mo pe EXAMPLES USING FUNCTION BLOCKS O PROGRAM gt APPENDIX INDEX LE GX Works2 v 2 CREATING FUNCTION BLOCKS 6 Specification of start I O numbers of intelligent function modules When accessing to the buffer memory or input output signals of an intelligent function module specif
86. ocedure OVERVIEW OF FUNCTION MANAGING AND PROGRAM CREATING FUNCTION USING FUNCTION J BLOCKS EDITING FUNCTION m LL ad rave oo mo FUNCTION BLOCKS O EXAMPLES USING gt APPENDIX INDEX LO GX Works2 WwW 1 OVERVIEW OF FUNCTION BLOCKS o Point Operations for created FBs e Reading programs from programmable controller CPU K Section 4 1 Utilizing FBs Section 4 2 Changing FB instance names K Section 4 4 Deleting FBs Section 4 5 Protecting FBs Section 4 6 Searching replacing FB instance names and labels Section 4 7 1 6 1 4 1 FB creation procedure 1 4 Programming Flow with FBs 1 4 2 Sequence program creation procedure using FBs O Operating procedure ite H YO Pasting FBs gt 5 Procedure Reference Paste FBs to the sequence program Section 3 1 1 Paste FBs of the FB Library to the sequence program Chapter 5 J4 2 Creating input output circuits of an FB instance CREATING FUNCTION Procedure Reference Create input and output circuits of the FB instance Section 3 1 2 Jl 3 Converting compiling a sequence program USING FUNCTION J BLOCKS Procedure Reference Convert compile the sequence program Section 3 1 4 J4 4 Writing a program to a programmable controller CPU EDITING FUNCTION MANAGING AND Procedure Reference Write the sequence program to the programmable controller CPU Sectio
87. p Project Edit Find Replace Compile view Online Debug Diagnostics Tool Window Help DEBA O hi Fe RRASA ERRAR SL n A l i Lbs Seb HES f FEl esto BS ho Hh de See Se Se ats aks ao bro BS A SB S Se EL ae PRG Write MAIN 28 Step Function FB Label Setting conveyor te con y 01 MA X 1b x p Local Label Setting MAIN PRG an FB Wri o_buzzer Structured Data Types timer Local Device Comment i 3 second i measure ment sta rt counter_end conveyor_end timer K3 o_conveyor 3 second Loading Conveyor measure complete driving ment sta d ended rt FB_ENO counter_end DECP i counter FB is ru Loading nning complete f boxes d to be lo aded ot been defined been defined eyor_01_1 compile failed Output window Error 3 Warning 0 CheckWaming 0 QO6UDH 14 855tep NL 3 12 3 1 4 Converting compiling all sequence programs 3 1 Creating Sequence Programs with FBs When a program is compiled with Compile Since only programs that are not compiled are subjected to compilation time required for compilation can be reduced For considerations of compilation refer to the following manual C GX Works2 Version 1 Operating Manual Simple Project Program size after compilation When compilation is executed the FB is applied to a program as an internal processing of a sequence program resulting in increase of the program size The program size can be c
88. program example for increased number of conveyors Converting conveyor control functions into components as FBs enables a sequence program to be easily altered when a conveyor which performs the same control is added 6 3 Creating Program Examples The additional conveyor operation switch sensor conveyor driving relay and buzzer are to be assigned X2 X3 Y2 and Y3 respectively In the program sample below the number of boxes to be conveyed with the additional conveyor is 12 Conveyor x0 conveyor_01_1 f 0 N OVERVIEW OF FUNCTION xI K6 i o_conveyor B Yo Conveyor CREATING FUNCTION o_buzzer B Y1 Buzzer Additional conveyor conveyor_01_2 36 USING FUNCTION J BLOCKS B i sensor Sensor W i_counter o_conveyor B Conveyor o_buzzer B Buzzer EDITING FUNCTION MANAGING AND 78 USING FB LIBRARIES EXAMPLES USING gt FUNCTION BLOCKS PROGRAM APPENDIX INDEX we GX Works2 6 PROGRAM EXAMPLES USING FUNCTION BLOCKS MEMO aN MELSOFT APPENDIX LL O Wu gt ma LU gt O FUNCTION CREATING FUNCTION USING FUNCTION J BLOCKS Appendix 1 Character Strings that cannot be Used for Label 6 Names and FB Data Names Instance Names App 2 ZO o gt Appendix 2 Supported CPU modules App 5 O 8 Appendix 3 Using FBs Created with GX Developer in GX Works2 App 6 USING FB LIBRARIES N lt lt O O m zZ
89. r Simple projects that do not use labels Generic term for Simple projects that use labels and Structured projects Generic term for projects whose securities are set To paste FB to a sequence program To use FB to other project A project to be used as an FB library An FB pasted to a sequence program A label which becomes effective for all program data when multiple program data items are created in a project A label which becomes effective only for each program data Set for each program data A data type which allows various device types bit device word device etc to be stored in single aggregate single data A data type which allows the same device type to be stored in a consecutive area VN MELSOFT SS 1 OVERVIEW OF FUNCTION BLOCKS This chapter explains features of FBs overview of labels and work flow for using FBs LL O gt A LUI gt FUNCTION CREATING FUNCTION USING FUNCTION J BLOCKS 1 1 Function Blocks FBs 1 2 Poa A ZO 1 2 Features of FBs 1 3 95 oS SE 1 3 Labels 1 4 lt a 1 4 Programming Flow with FBs 1 5 1 5 Overview of Screen Configuration 1 8 mia pei 6 2 DO A x Q im i INDEX ee GX Works2 WT 1 OVERVIEW OF FUNCTION BLOCKS 1 1 Function Blocks FBs An FB is designed to convert a ladder block which is used repeatedly in a sequence program into a component to be utilized in a sequence program FBs can be used in projects with labe
90. r o nning complete f boxes to be lo OVERVIEW OF FUNCTION CREATING MANAGING AND PROGRAM USING FUNCTION A EESAN FUNCTION EDITING FUNCTION mi L Q 0 ZF Nn D FUNCTION BLOCKS EXAMPLES USING gt APPENDIX INDEX LO GX Works2 WwW 3 USING FUNCTION BLOCKS Point Change Instance Function Block screen If monitoring is started on an FB program when FBs are used at multiple locations in a sequence program the Change Instance Function Block screen is displayed Select an instance The screen can also be displayed by activating the FB program s work window and selecting Online Monitor gt Change Instance Function Block Change Instance Function Block FE Instance List MAIN conveyor O1 1 MAIN conveyor O12 MAIN conveyor 01 3 MAIN conveyor _O1_4 MAIN conveyor O01 5 za Ladder editing mode with option setting When Use the Switching Ladder Edit Mode Read Write Monitor Monitor Write is selected in the option setting the ladder programs cannot be edited when Start Monitoring is executed Execute monitor write mode to edit the programs in the monitoring status K GX Works2 Version 1 Operating Manual Simple Project VN MELSOFT SY 4 MANAGING AND EDITING FUNCTION BLOCKS This chapter explains how to manage and edit FBs For the basic operations and screen details of GX Works2 refer to the following manual L GX Work
91. ram Os One cm ea HA 4 System Label Operation To reflect the changes of the table above to the Change Register Release system label database O gt Gh Notification Meum O GA Device Name Relation please save the project after compiling Local Label Setting screen Define labels that can be used only for each sequence program lt GX Works2 Version 1 Operating Manual Simple Project z Local Label Setting MAIN PRG ME Class Label Name Data Type a VAR conveyor_01_1 conveyor 01 z A T A E a Local Device Comment Device Memory Device Initial Value T Structured Data Types 4j4jajajajajajajajajajajajaja a Function FB Label Setting screen Define labels that can be used only for FBs lt 1 amp Function FB Label Setting conveyor_01 FB SEE Label Name Data Type Constant Comment VARINPUT v INPUT 5 EN Operation switch E _ INPUT lisens OOOO O O sensor o_conveyor eit Conveyor at o ooo o Pf Buzzer Sm Weds ore Remaining number of boxes counter_end Re esa Loading completed conveyor_end Bit J Conveyor driving ended timer WordSigned Cd Peco measurementfstart timer Woodsin Cd P second mearsrement stop I eS lll il 1 Section 2 3 1 10 1 5 2 Label setting editor VN MELSOFT y 2 CREATING FUNCTION BLOCKS This chapter explains how to create FBs For the basic operations of GX Works2 refer to the following manuals KL GX Works2 Vers
92. rchaser or End User e Aircraft or Aerospace Medical applications Train equipment transport equipment such as Elevator and Escalator Incineration and Fuel devices Vehicles Manned transportation Equipment for Recreation and Amusement and Safety devices handling of Nuclear or Hazardous Materials or Chemicals Mining and Drilling and or other applications where there is a significant risk of injury to the public or property Notwithstanding the above restrictions Mitsubishi may in its sole discretion authorize use of the PRODUCT in one or more of the Prohibited Applications provided that the usage of the PRODUCT is limited only for the specific applications agreed to by Mitsubishi and provided further that no special quality assurance or fail safe redundant or other safety features which exceed the general specifications of the PRODUCTs are required For details please contact the Mitsubishi representative in your region REVISIONS Nov 2011 SH NA 080984ENG A First edition Jan 2012 SH NA 080984ENG B Model Addition FX3GC Correction Section 4 1 May 2012 SH NA 080984ENG C Model Addition QO02PH QO6PH Q12PH Q12PRH Q25PH Q25PRH Correction GENERIC TERMS AND ABBREVIATIONS IN THIS MANUAL Section 1 5 1 Section 2 3 4 Section 3 1 1 Appendix 3 Sept 2012 SH NA 080984ENG D Correction GENERIC TERMS AND ABBREVIATIONS IN THIS MANUAL Section 2 6 Section 3 1 4 Appendix 2 Feb 2013 SH NA 080984ENG E Model Addition QO3UDV QO4UDV
93. rray 0 D1001 int_Write_Array 1 D1002 gt int_Write_Array 2 D1003 int_Write_Array 3 D1004 Transfer 6 int Write_Array 4 points with D1005 BMOV int_Write_Array 5 VN MELSOFT SS 3 USING FUNCTION BLOCKS This chapter explains how to create a sequence program with FBs For the basic operations and screen details of GX Works2 refer to the following manual L GX Works2 Version 1 Operating Manual Common LL O Wu gt ma LU gt O FUNCTION CREATING FUNCTION USING FUNCTION AERIS 3 1 Creating Sequence Programs with FBs 3 2 3 2 Checking Operations of Sequence Programs 3 19 EDITING FUNCTION MANAGING AND mi LL ad rave oo D_I EXAMPLES USING FUNCTION BLOCKS PROGRAM gt APPENDIX INDEX LO GX Works2 v 3 USING FUNCTION BLOCKS 3 1 Creating Sequence Programs with FBs This section explains how to create a sequence program using FBs as components 3 1 1 Pasting FBs to sequence programs E When calling an FB within a ladder program On the pasted FB instance label names of I O variables and their corresponding data types are displayed Paste FBs from the Project view of the Navigation window or from the Element Selection window to a sequence program When the FB is pasted an FB instance name is registered to the local label or the global label as a label Operating procedure 1 Select an FB from the Project view of the Navigation w
94. s2 Version 1 Operating Manual Common LL O wu gt Y LU gt O FUNCTION CREATING FUNCTION USING FUNCTION EN BLOCKS 4 1 Reading FB Programs from Programmable Controller 6 CPU 4 2 29 9r 4 2 Reusing FBs from Library Project 4 3 oS 25 4 3 Copying FBs from Project 4 9 4 4 Changing FB Instance Names 4 10 4 5 Deleting Unnecessary FB Data from Projects 4 11 3 as 4 6 Protecting FBs 4 13 zg 4 Searching Replacing FB Instance Names 4 16 6 o DO A x Q im f x lt O z LO GX Works2 v 4 MANAGING AND EDITING FUNCTION BLOCKS 4 1 Reading FB Programs from Programmable Controller CPU Read FB programs from a programmable controller CPU When reading FB programs read symbolic information with a project with labels using the Read from PLC function Before reading data set a communication route of a personal computer and programmable controller CPU with the connection destination setting For details of connection destination setting refer to the following manual L GX Works2 Version 1 Operating Manual Common Operating procedure 1 Select Online Read from PLC The Online Data Operation screen is displayed 2 Select Symbolic Information Module Name Data Mame Tithe Project Name Target Detail Last Change Target Memory 2011 09 08 12 05 46 4700 Bytes 0 ee RF PLCiNetwork Remote PasswordjSwite O 2011 09 08 12 05 46 652 Bytes 0 E
95. shown in the following table USING FUNCTION J BLOCKS Applicable number of labels in an FB program 6 Programming language of FB o Ladder Diagram 1 to 24 1 Including input output labels 1 to 24 1 Including input output labels 2T O Structured Text 0 to 253 2 Including input output labels zE A For input output labels each input label and output label is counted as one label Si 2 When pasting labels to a sequence program in Ladder Diagram the applicable number of input output labels is 1 to 24 including input output labels Each input label and output label is counted as one label 2 3 2 Classes 9 L rA Y a USING FB A class indicates the POU applicability and the usage of label Selectable classes differ according to the type of label setting editor 6 The following table shows the selectable classes on the Function FB Label Setting screen ox HO Class Description ant VAR An internal variable label that can be used for FB programs ar VAR_CONSTANT A constant label that can be used for FB programs Do VAR_RETAIN A latch type label that is used for FB programs mini A A label that is used for an input of FB program input label Its value cannot be changed in an FB program VAR_OUTPUT A label that is used for an output of FB program output label A label that can be used for both input and output with the same name input output label Its value can be changed in an FB progra
96. t APPENDIX INDEX 3 1 4 Converting compiling all sequence programs 3 15 LO GX Works2 wy 3 USING FUNCTION BLOCKS 3 1 5 Writing sequence programs to programmable controller CPU Write created data to a programmable controller CPU or a memory card Before writing data set a communication route of a personal computer and programmable controller CPU with the connection destination setting In addition set the programmable controller CPU to the STOP status For details of connection destination setting refer to the following manual K GX Works2 Version 1 Operating Manual Common Operating procedure 1 Select Online gt Write to PLC u The Online Data Operation screen is displayed Online Data Operation f verify Delete E PLC Module E inteligent Function Module Execution Target Datat Mo Title I Yes m Fi 3 p Option Edit Data Parameter Program Select All Cancel All Selections oy ile Stee Module Name Data Mame Last Change Target Memory a ELS Symbolic Information aaj Detail Phu gi MAIN ae 2011 09 07 16 32 51 O es ee 3 a O koe Tele MAIN Pp PLC Network Remote Passwordi Switch Setting 2011 09 07 16 32 50 Src aes O Detail 2011 09 07 16 32 51 Tt ee eee oo M M Necessary Settingi Mo Setting Already Set Set if it is neededi Mo Setting Already Set 3 Writing Size Free Volume Use Volume OBytes 4 088 676 7 324Bytes
97. t for the first time Learning the basic operations and operating procedures when creating a structured project for the first time Details Learning the operations of available functions regardless of project type Learning the functions and operation methods for programming Details 5S B Learning the operations and operating procedures when using function blocks FBs in Simple project Learning data setting methods for intelligent function module 3 Operations in each programming language For details of instructions used in each programming language refer to the section 4 and the section 5 on the following pages GX Works2 Version 1 Operating Manual Purpose Simple Structured Simple Structured Project Project Project Project L utline an fF B Diagram S Outing oe Details Ladder em f ES Diagram Sequential Function Chart Structured roject proj Structured Ladder Outing FBD Details Structured Text ouine 1 MELSAP3 and FX series SFC only GX Works2 Beginner s Manual Simple Sequential Project Function Chart Structured Text a ES A 10 All languages Using Ladder Diagram Using Sequential Function Chart Using Structured Ladder FBD or Structured Text 4 Details of instructions in each programming language for QCPU Q mode LCPU Purpose Learning details of programmable controller CPU error codes special relays and special registers
98. t the items on the screen Item Description Set the memory whose size is to be calculated and memory card type Taraet NiemoriMernion Card For details of the memory card application refer to the following manuals 7 y y K QCPU User s Manual Hardware Design Maintenance and Inspection yP K MELSEC L CPU Module User s Manual Hardware Design Maintenance and Inspection File list Select data whose size is to be calculated 3 Click the button The Memory Capacity Calculation Result screen is displayed lt For online calculation gt Memory Capacity Calculation Result Memory Capacity Information B Target Memory Display Option Program Memory Device Memory Display Unit Byte Step C WiP O Taat Taetre Filesize sze Use Volume QO Program MAIN 2672 2672 Parameter 652 652 Symbolic Information 4774 4780 Ta rget section System File 0 0 Calculation ____ fTotal Actual Size Available Size Sum total section Drive Capacity Memory status graph section Explanation of Graph GE Write Data GE System File Available Size HE Use Volume result section Detail Refresh CPU Serial No H11274000000000 Notes Available size shows the size after writing selected Filefs Please do not exceed the number of maximum files IF PLC write Fails though enough available memory exists please execute Arrange PLC Memory The offline calculation and online calculation can be switched
99. talling FB Library This section explains how to uninstall the installed FB Library using Windows XP as an example Operating procedure 1 Select Start gt Control Panel gt Add or Remove Programs 2 Select MELSOFT Library Module Model 3 Click the button Uninstall the FB Library according to the instructions on the screen lm MELSOFT 6 PROGRAM EXAMPLES USING FUNCTION BLOCKS This chapter explains program examples using FBs 6 1 System Configuration of Program Examples 6 2 6 2 Processing of Program Examples 6 3 6 3 Creating Program Examples 6 4 OVERVIEW OF O Z k lt L LL jad O USING FUNCTION EDITING FUNCTION MANAGING AND USING FB LIBRARIES EXAMPLES USING D FUNCTION BLOCKS PROGRAM APPENDIX INDEX LO GX Works2 v 6 PROGRAM EXAMPLES USING FUNCTION BLOCKS 6 1 System Configuration of Program Examples The following shows an example of system configuration This system controls the operations of a conveyor using a CPU module an input module and an output module Operation Buzzer O X0 Y1 USER B PASAS ae AeA eee ee eee RRN MITSUBISHI 0 E 5 Connect to the operation switch X0 and sensor X1 Connect to the conveyor driving relay YO and buzzer Y1 6 2 Processing of Program Examples 6 2 Processing of Program Examples When the number of boxes to be conveyed is set and
100. th bit H0200 HFDFF Sa Sz 10th bit H0400 HFBFF sid 11th bit H0800 HE7FE Oz tar 12th bit H1000 HEFFF 13th bit H2000 HDFFF A 14th bit H4000 HBFFF 15th bit H8000 H7 FFE x Q z Lu A ial lt x x lt Lu Q Z ee GX Works2 WT 2 CREATING FUNCTION BLOCKS 8 When handling multiple word data as an array Input output labels in an FB program do not allow an array to be used In the following method multiple data can be imported from a sequence program to an FB program Example When loading values for six points from D1000 A Set the following three labels in the label setting of FB program Set int_Write_Array as an array Class Label Name Data Type 1 W amp R_INPLUT FB_EN Bit Storage destination 2 Word Signed X Of D1000 3 Specification of the number 4 AB int White Amey ord Signed JO 5 AN of points to be imported 5 WAR_OUTPUT w FEOK CBS E VAR OUTPUT Bit Transferring destination of 7 VAR z o datai CB MRE WOA B In the sequence program save values for six points to D devices from D1000 D1000 D1001 D1002 D1003 D1004 D1005 C For the input of an FB instance specify D1000 FB_OK B FB_ERROR B D1000 f Wi_Write_Data Wii Num_YYvrite_Data D Using the BMOV instruction in the FB program transfer values for six points from the input variable i_Write_ Data to the array int_Write_Array _ _ _f emiov Vrite Data Int_Vvrite_Array Mum Yyrite Data D1000 i_Write_Data int_Write_A
101. tiple devices are selected z Assign Assignment Range PLC Parameter De Digit I Total Point evice PIS Selection Start a Points Device Setting Range Word Device E VAR Range M 6144 6144 O 12287 i O FFF ia VAR_RETAIN Rang p 2 oO zZ p 2 4 is VAR_RETAIN Range Latch 1 Pointer Timer VAR Range VAR_RETAIN Range Latch 1 Q Retentive Timer Jom WAR Range i WAR_RETAIN Range Latch 1 Counter VAR Range VAR_RETAIN Range Latch 1 _ MANAGING AND O1 EDITING FBS Latch 1 Able to clear the value by using a latch clear Latch 2 Unable to clear the value by using a latch clear Clearing will be executed by remote operation or program Caution 1 Label nonassigned devices of the automatically assigned ones while compiling will be allotted the device that displayed at the lowest of the selected ones Ex Device will be assigned to ZR when D and ZR are selected 2 Changing the assignment target device may also change the processing speed since the arithmetic processing speed for R and ZR is H difference from other devices Chapter heading n ou nw a f Og Index on the right of the page O ti d am number clarifies the chapter of pSraling mi heGeg uke nies currently open page Set the items on the s
102. ug Diagnostics Tool Window Help 7 E AEMET ae Ieee E 2ARTE EJA toc ee aes ee Li be AE Be io EFEFTTESEFI dk 5 aks ano Fo SFS DTL ES SP Existing projects FBs can be created in an existing project with labels For a project without labels select Project Change Project Type to change the project to a project with labels and create FBs 2 2 Creating New FB Data 2 2 Creating New FB Data This section explains how to create new FB data in a project with labels OVERVIEW OF FUNCTION Operating procedure 1 Select Project gt Object New CF The New Data screen is displayed Data Type Function Block v Data Name I conveyor_O1 CREATING FUNCTION Program Language Inherent Property IV Use Macrocode Use MC MCR F Use EN ENG cn USING FUNCTION J BLOCKS Z 2 Set the items on the screen ag a7 Item Description Or Te Data Types Select Function Block lt A LO au Enter a data name of an FB to be created with a maximum of 32 characters Data Name For unusable characters refer to Appendix 1 Select a programming language to be used The programming languages available for FB creation in Simple projects are Ladder Diagram and Structured Text FXCPU Simple projects support Ladder Diagram only 3 Click the button The newly created FB data is added under FB_ Pool on the Project view and the FB editing Program Languag
103. ut circuit and output circuit By setting Display Connection of Ladder Diagram the number of contacts occupied in input circuit or output circuit of an FB instance is determined as below Setting of tne numberof displayed Number of contacts in output circuit contacts 9 contacts 2 contacts 1 coil 11 contacts 3 contacts 1 coil 13 contacts 4 contacts 1 coil 17 contacts 6 contacts 1 coil 21 contacts 8 contacts 1 coil Instructions that exceed the number of occupied contacts cannot be entered When instructions cannot be placed by changing the number of displayed contacts the ladder block is not displayed properly For the setting of the number of displayed contacts refer to the following manual K GX Works2 Version 1 Operating Manual Simple Project Comment A comment can be entered on a program Statement Conveyor operation start after 3 second measurement B_ENG zE o_conveyor Note 44 INCP timer 3 second measure ment sta rt lt Conveyor operation start gt D l second Conveyor clock Device comment counter_end conveyor_end 73 timer K3 or 3 second Loading Conveyor measure complete driving mentista d ended Label i comment There are four types of comments as below Device comment Enter the function of the device PAE N ORIO ETA Manual Common Label comment Enter the function of the label Statement Enter the function of the ladder block A a
104. xport target FB global label or structure is overlapped the existing data in the target project is overwritten and deleted In this case change the data name before exporting the data a L a oe aa l USING FB oL ZO HO al 2m OD ud A O CZ xD WL lt x o O O aa A gt APPENDIX INDEX 4 2 2 Exporting FBs to other project 4 5 LO GX Works2 v 4 MANAGING AND EDITING FUNCTION BLOCKS 4 2 3 Importing FBs from other project Import the FBs which are created in other project to the project being edited using the Import Library to Project screen The global labels and the structures can be imported at the same time An FB whose PLC type is different from that of the project being edited can be imported However FBs created with QCPU Q mode LCPU project cannot be imported to FXCPU project and vice versa Operating procedure 1 Select Project gt Library Install The Import Library to Project screen is displayed Import Library to Project Select a library to install Library Selection Library List Explanation Refresh FB List Select FB to install FB Selection E FB List ane nee cal label and a c 2 Select Select Library Project from the Library List combo box 3 Click the Browse button and select the other project 4 Click the _BefreshFe ist button When the other project is modi
105. xt on the Function FB Label Setting screen Enter the array declaration ass beabelName ata Type OOO 1 MARLINPUT fi Setting BM 2 ad 2 VARINPUT wi Setting BB 3 MARINPUT fi Setting String To change the array to a two or three dimensional array When the programming language is ST a two or three dimensional array can be set Edit by directly entering the array declaration in text on the Function FB Label Setting screen Enter the array declaration ae Label Name Datatype O OO 1 WAR_INPUT z Bit 0 2 L iia 5 E 2 WAR_NPUT li Setting B 3 MAR_INPUT x AE ER Point A label whose class is VAR_CONSTANT An array cannot be set for the data type If an array is set an error occurs at compilation Offset values Minus values can be set for offset values Using arrays in ladder programs The labels of two or three dimensional array and structure array cannot be used in ladder programs 2 8 2 3 4 Selecting data types 2 3 Setting Local Labels 2 3 5 Assigning devices automatically Devices are automatically assigned to labels when a program is compiled The ranges of devices which are automatically assigned to labels can be changed on the Device Label Automatic Assign Setting screen Set the ranges not to overlap with devices used in a sequence program OVERVIEW OF FUNCTION E QCPU Q mode LCPU Screen display CREATING FUNCTION Select Tool gt Device Label Automatic Ass
106. y Hide using a program editor can be switched by selecting Display gt Comment Statement Note A 13 A 14 This manual also uses the following columns o Point This explains notes requiring attention or useful functions relating to the information given on the same page Symbols used in this manual The following shows the symbols used in this manual with descriptions and examples ME MELSOFT Series GX Works2 Unset Project PRG Write POU_01 1 Step Project Edit Find Replace Compile View Online Debug Diagnostics Tool Window Help fal 2 DB ALo M 106 E E eE ET ET E O Parameter Setting OOOO PLC Name PLC System PLCFile PLCRAS Boot File Program SFC Device 1 O Assignment Multiple CPU Setting Timer Limit Setting flew Saeed 1 100 ms 1ms 1000ms Common Pointer No P 2048 After 0 4095 High Speed 10 0 ms 0 1ms 100ms Points Occupied by Empty Slot fie Points RUN PAUSE Contacts x xX0 X1FFF System Interrupt Setting Interrupt Counter Start No C 0 768 PAUSE Xx X0 X1FFF Fixed Scan Interval 128 100 0 ms 0 S5ms 1000ms _ 129 40 0 ms 0 5ms 1000ms Remote Reset 130 20 0 ms 0 5ms 1000ms M Allow 131 10 0 ms 0 5ms 1000ms PL _ Menuname onamenubar OOOO Oooo Project Co em o _ a Em Keyboard key High Speed Interrupt Setting 000 E GENERIC TERMS AND ABBREVIATIONS IN THIS MA
107. y the start I O number using an index register Receiving the start I O number as an input variable enables a common FB to be used without changing the start I O numbers of the multiple intelligent function modules whose mounting positions differ Example 1 When accessing the input output signals of an intelligent function module Using an index register enables access to the input output signals of a target intelligent function module lt Sequence program gt index_reg_3 B FB_EN int_Flg_Opn1 6 Wii Start_lO_NO FB_OUT B END Specify the value of i_ Start_lO_NO lt FB program gt FB_EN MOV i Start_IO_NO Z1 MOV i_Start_IO_NO Z2 int_OPN_T O SET int_OPN_T 1 int OPN_T 0 int_Flg_Opn1 int_flg_Req 021 U0Z2 TES G10 int_Con_Flg int_Flg_Opn1 FB_EN O FE_OUT Access the input output signal using the index register Example 2 When accessing the buffer memory of an intelligent function module 1 Enter the start I O number of the target intelligent function module to the index register 2 Shift the value rightward 4 bits with the SFR instruction or use the quotient of the value divided by 16 FB_EN MOY i_Start_IO_NO 21 er SFR 22 K4 i SET int_OPN_T 0 int_OPN_T 0 int_Flg_Opnt int_fig_Req x021 H ET int OPN TII int_Flg_Opn FB_OUT Access the buffer memory 2 6 Considerations when Creating FB Programs 7 When transferring multiple bit dat
108. ys 2 Comments on a program editor can be displayed hidden by selecting View Comment Statement Note 2 4 2 3 1 Setting labels on Function FB Label Setting screen 2 3 Setting Local Labels Point Class setting When an item other than the class such as a label name and data type is set in a blank column VAR is automatically set for Class Change it if necessary Characters that cannot be used for label names Any of the following label names causes an error at compilation e A label name that includes a space e A label name that begins with a numeral e A label name which is same as the one used for devices For characters that cannot be used for label names refer to K Appendix 1 OVERVIEW OF FUNCTION When the local label setting of an FB is changed When the local label setting of an FB pasted to a sequence program is changed compile the program or all programs The change of input output label is applied to the sequence program to which the FB is pasted at compilation Note that the change is not applied when the FB instance name is not registered in the global label setting or local label setting CREATING FUNCTION E Maximum number of input output labels The maximum number of input output labels which can be used in an FB program differs according to the programming language When setting input output labels with local label setting of FB set within the number of the input output labels

Download Pdf Manuals

image

Related Search

Related Contents

MAGISTER OPOSICIONES AL PROFESORADO Francés TEMA 16  D-20 FR. Deel 1    2120 - Chromalox  contraste de fases en torreta turret phase contrast  guide d`utilisation de l`ordinateur guida di funzionamento con pc  EpiFiles™ - Mode d`emploi pour les utilisateurs  

Copyright © All rights reserved.
Failed to retrieve file