SAFETY PRECAUTION (Always read these instructions before using the products.) When designing the system, always read the relevant manuals and give sufficient consideration to safety. During the exercise, pay full attention to the following points and handle the product correctly. [EXERCISE PRECAUTIONS] WARNING Do not touch the terminals while the power is on to prevent electric shock. Before opening the safety cover, make sure to turn off the power or ensure the safety. Do not touch the movable portion.
REVISIONS *The textbook number is written at the bottom left of the back cover. Print date *Textbook number Revision Oct., 2012 SH-081123ENG-A First edition This textbook 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 textbook.
CONTENTS CHAPTER 1 1.1 1.2 1.3 1.4 1.
CHAPTER 4 SEQUENCE AND BASIC INSTRUCTIONS -PART 1- 4- 1 to 4-42 4.1 List of Instruction Explained in this Chapter ···················································································· 4- 1 4.2 Differences between OUT and SET / RST ································································ 4- 4 4.3 Measuring Timer ····························································································································· 4- 5 4.
CHAPTER 6 HOW TO USE OTHER FUNCTIONS 6- 1 to 6-36 6.1 Test Function at Online ··················································································································· 6- 1 6.1.1 Turning on and off the device "Y" forcibly ················································································ 6- 2 6.1.2 Setting and resetting the device "M"························································································· 6- 4 6.1.
CHAPTER 8 SIMULATION FUNCTION 8- 1 to 8- 4 8.1 Simulation Function························································································································· 8- 1 8.2 Starting/Stopping Simulation ··········································································································· 8- 1 8.3 Debugging with Example Program·································································································· 8- 2 8.3.
4.25 Application example of data shift························································································App.-41 4.26 Example of operation program calculating square root of data··········································App.-44 4.27 Example of operation program calculating n-th power of data···········································App.-45 4.28 Program using digital switch to import data········································································App.-46 4.
INTRODUCTION This textbook explains the programmable controller, the program editing methods with GX Works2, the sequence instructions and the application instructions for understanding the MELSEC-Q series programming. The multiple CPU system is available for the MELSEC-Q series with multiple CPU modules, but this textbook explains the case in which one CPU module is used. The related manuals are shown below.
CHAPTER 1 BASICS OF PROGRAMMABLE CONTROLLER 1.1 Program If a programmable controller is assumed as a control ladder, it can be described by an input ladder, output ladder, and internal sequential operation.
Internal Sequential Operation The following shows the signal flow of the internal sequential operation of figure 1.1. 1) When the sensor turns on, the coil of the input relay X6 is magnetized. 2) Magnetizing the coil of the input relay X6 conducts the normally open contact X6 and magnetizes the coil of the output relay Y74. (As the timer is not magnetized at this time, the normally closed contact remains conducted.
The internal sequential operation can be regarded as the program of the programmable controller. The program is saved in the program memory as similar to the instruction list X6 Step number T1 Y74 0 Y74 Instruction word Device 0 LD X6 1 OR Y74 2 ANI T1 K30 3 OUT Y74 4 T1 4 LD Y74 10 END Y74 X6 5 ANI X6 6 OUT T1 K30 10 END (a) Ladder diagram Repeat operation (b) Instruction list (program list) Figure 1.
1.2 Program Processing Procedure The operation process is executed in series from the start step of the program memory left to right and top to bottom (in the order of 1), 2) ... 17)) in a ladder block unit as shown below.
1.3 MELSEC-QnUD Module Configuration (1) Universal model The Universal model QCPU is used for a training in this textbook, therefore, "QCPU" indicates "Universal model QCPU" unless otherwise noted. (2) Basic configuration of a programmable controller system The following figure shows an actual programmable controller configuration.
Base Unit Power supply CPU CPU Extension base unit (Requiring a power supply module) Power supply Q33B Power supply Q35B Q38B Q312B Power supply Power supply Power supply With 12 I/O modules CPU With eight I/O modules Power supply With five I/O modules CPU With three I/O modules Power supply Main base unit (Not requiring a power supply module) Q52B (For two modules) Q63B Q55B Q65B Q68B Q612B Power supply CPU With 12 I/O modules CPU With eight I/O modules Power supply Multip
Power Supply Module Module name Input Output Q61P 100V to 240VAC 5VDC 6A Q62P 100V to 240VAC 5VDC 3A, 24VDC 0.6A 24VDC 5VDC 6A Q63P 100V to 120V/AC200 to Q64P(N) 5VDC 8.
Memory Card A QCPU equips a built-in memory as standard for storing parameters and programs, therefore, the programs can be executed without a memory card. The memory cards are required for the situations in the table below. Type Description Data can be written or changed within the memory capacity.
The memory of the Universal model QCPU consists of the following blocks.
POINT Secure backup by long-term storage Programs and parameter files are automatically backed up to the program memory (Flash ROM) which does not require a battery backup. This prevents a loss of the program and parameter data due to the flat battery. The battery backup time is also reduced significantly. In addition, the important data (such as device data) can be backed up to the standard ROM to prevent a loss of the data due to the flat battery in case of consecutive holidays.
1.4 External I/O Signal and I/O Number (1) Wiring of I/O devices The signals output from the external input devices are substituted by the input numbers which are determined by the installation positions and terminal numbers of the connected input module and used in a program. For the operation results output (coil), use the output numbers which are determined by the installation position and the terminal number of the output module to which the external output module is connected.
(2) I/O numbers of a main base unit The I/O numbers of I/O modules which are attached to a main base unit are assigned as follows. This configuration applies to both I/O modules and intelligent function modules.
(3) I/O numbers of an extension base unit Connect an extension base unit when the number of slots of the main base unit is insufficient. The I/O numbers are assigned as follows in the initial setting. This configuration applies to both I/O modules and intelligent function modules.
1.
CHAPTER 2 OPERATING GX Works2 GX Works2 is a programming tool for designing, debugging, and maintaining programs on Windows®. GX Works2 has improved functionality and operability, with easier-to-use features compared to existing GX Developer. Main functions of GX Works2 GX Works2 can manage programs and parameters in units of projects for each programmable controller CPU. Programming Programs can be created in a Simple project in a similar way with existing GX Developer.
Monitoring/debugging Created sequence programs can be written to the programmable controller CPU and device values at operation can be monitored online/offline. Programs can be monitored and debugged. Diagnostics The current error status and error history of the programmable controller CPU can be diagnosed. With the diagnostics function, the recovery work is completed in a short time.
2.1 Features of GX Works2 This section explains the features of GX Works2. (1) Project types in GX Works2 In GX Works2, the project type can be selected from either of Simple project or Structured project. (a) Simple project The Simple project creates sequence programs using instructions for Mitsubishi programmable controller CPU. Programs in a Simple project can be created in a similar way to existing GX Developer.
(2) Enhanced use of program assets Projects created with existing GX Developer can be utilized in a Simple project. Utilizing the past assets improves the efficiency of program design. Project created with GX Developer Can be used in GX Works2. (3) Sharing Program Organization Unit (POU) registered as libraries In a Structured project, programs, global labels, and structures frequently used can be registered as user libraries.
(4) Wide variety of programming languages The wide variety of programming languages available with GX Works2 enables to select the optimum programming language according to control.
(b) The screen layout can be customized to the user's preference The docking windows enable to change the screen layout of GX Works2 without restriction. Screen layout can be changed without restriction.
2.1.1 MELSOFT iQ Works MELSOFT iQ Works integrates the engineering software (GX Works2, MT Developer2, and GT Designer3). Sharing the design information such as the system design and programming in the whole control system improves the efficiency of program design and efficiency of programming, which reduces costs.
[Purpose of the engineering environment] ERP (Enterprise Resource Planning) MES (Manufacturing Execution System) Engineering environment Controller and HMI Network 1) Integrating development environment which was independent of each device 2) Sharing the design information in whole development phases (system designing, programming, test/startup, and operation/maintenance) POINT is a FA integrated concept of MITSUBISHI ELECTRIC.
2.2 2.2.
1) Title bar Title bar displays the name of the active project. Resizes or terminates GX Works2. Displays the name and the path of the project. Maximizes or restores GX Works2. Minimizes GX Works2. Terminates GX Works2. 2) Menu bar Menu bar is the most frequently used item when operating GX Works2. Click the menu bar to select a variety of functions from the drop-down menu. 3) Toolbar Toolbar equips buttons to easily access the commonly-used functions. This enables a quicker operation.
2.2.2 Ladder editor This section explains the screen display of the GX Works2 ladder editor and its basic operations. (1) Edit screen (2) Changing the display size of the edit screen The display size of the edit screen can be changed. 1) Click [View] → [Zoom]. The Zoom dialog box is displayed. Change the display size according to the selected zoom ratio. Change the display size according to the specified zoom ratio.
(3) Changing the text size on the edit screen The text size displayed on the edit screen can be changed. 1) Select [View] → [Text Size] → [Bigger]/[Smaller]. The text size is changed one step at each setting within the range of 10 steps. (4) Displaying/hiding comments Device comments (label comments), notes, and statements can be displayed and hidden. 1) Select [View] → [Comment]/[Statement]/[Note]. POINT Displaying/hiding comments Comments also can be displayed or hidden by the following operation.
(5) Setting the number of rows and columns for displaying comments The option setting allows switching the number of rows and columns for displaying a device comment. 1) Click [Tool] → [Option]. The Options screen is displayed. 2) Click "Program Editor" → "Ladder" → "Comment". The screen for setting Device Comment Display Format is displayed. Comments can be displayed or hidden by this setting in addition to by the method described on the previous page.
(From the previous page) Set the number of display rows in the range from 1 to 4. Set the number of display columns to 5 or 8.
(6) Setting the number of contacts to be displayed in ladder programs The option setting allows switching the number of contacts to be displayed in a single row. 1) Click "Program Editor" → "Ladder" → "Ladder Diagram" in the Options screen. The screen for setting Display Format for the ladder diagram is displayed. Set the number of contacts to be displayed in a single row to 9 or 11 contacts.
(7) Switching the label name display and device display The display of a program that uses labels can be switched between the label name display and device display. If label comments or device comments are set, the corresponding comments are displayed. Devices assigned by the compilation can be checked by switching the program display from the label name display to the device display. 1) Click [View] → [Device Display]. The screen for setting Display Format for the ladder diagram is displayed.
(8) Hiding a ladder block The ladder block after the ladder conversion can be hidden. The ladder block in which the statements are set is hidden with the statements displayed. (a) Hiding a ladder block 1) Move the cursor to the ladder block to be hidden. 1) Move the cursor! 2) Click [View] → [Non-Display Ladder Block].
(From the previous page) 3) The selected ladder blocks are hidden. The ladder block is hidden. (b) Canceling the hidden ladder block. 1) Move the cursor to the hidden ladder block displayed in gray. 1) Move the cursor! 2) Click [View] → [Display Ladder Block].
(From the previous page) 3) The hidden ladder blocks are displayed. The hidden ladder blocks are displayed. POINT Displaying/hiding ladder blocks • Multiple ladder blocks also can be displayed and hidden. • All ladder blocks can be displayed and hidden by the operation of [View] → [Display All Ladder Block]/[Non-Display All Ladder Block]. • Ladder blocks also can be displayed and hidden by Right-click → [Displaying/hiding ladder blocks].
2.2.3 Project This section explains the configurations of a project that is displayed in a tree format in the Project view. The display contents differ according to the programmable controller type and the project type. The following is an example for a Simple project of QCPU (Q mode). < Simple project (without labels) > Set various parameters. Make settings for the intelligent function modules. Set global device comments. Set an execution type of each program. Create programs.
1) One project per GX Works2 One GX Works2 can edit only one project unit. To edit two or more projects at a time, run as many GX Works2 as the number of projects. 2) Device comments Device comment of GX Works2 is categorized into global device comment and local device comment. Comment type Number of comments Description A device comment created automatically when a new project is created. Global comment 1 Global comments are set to use common device comment data among multiple programs.
2.3 2.3.1 Operation Before Creating Ladder Program Starting up GX Works2 1) Click the button. 2) Select [All Programs]. 3) Select [MELSOFT Application]. 4) Select [GX Works2]. 3) Select! 5) Click! 2) Select! Put the mouse cursor over the items to select the menu. (Clicking or double-clicking the mouse is not required.) 5) Click [GX Works2]. 4) Select! 1) Click! 6) GX Works2 starts up. 6) GX Works2 starts up.
2.3.2 Creating a new project 1) Click on the toolbar or select [Project] → [New Project] ( Ctrl + N ). 1) Click! 2) Click the "Project Type" list button. 2) Select! 3) The "Project Type" list is displayed. Select "Simple Project". 3) Click and select! 4) Click the "PLC Series" list button. 5) The "PLC Series" list is displayed. Select "QCPU (Q mode)".
(From the previous page) 6) Click the "PLC Type" list button. 7) The "PLC Type" list is displayed. Select "Q06UDH". 8) Click! 8) Click the OK button. 6) Click! 7) Click and select! 9) A new project is opened.
2.4 Preparation for Starting Up CPU Setting switches and formatting the built-in memory are required before writing a program to the CPU. Connect or set the connectors and the switches of (1) to (3) shown below. (The figures below are example of Q06UDHCPU.) Q06UDHCPU (2) (3) (1) (1) Connecting a battery Connect the battery since the lead wire of the battery connector is disconnected at the factory shipment. (2) Setting the switches Set the RUN/STOP/RESET switch to the STOP position.
(4) Setting the connection destination This section explains how to set the connection destination for accessing the programmable controller CPU. 1) Click "Connection Destination" in the view selection area on the navigation window. 1) Click! 2) The Connection Destination view is displayed. Double-click "Connection1" in Current Connection. 2) Double-click! The Transfer Setup dialog box is displayed. 3) Double-click "Serial USB" of PC side I/F.
(From the previous page) 6) The PLC side I/F Detailed Setting of PLC Module dialog box is displayed. Select "QCPU (Q mode) " and click the OK button. 6) Click! 7) Click the 7) Click! 2 - 27 OK button.
(5) Formatting the built-in memory of the CPU This section explains how to format the program memory of the QCPU. 1) Click [Online] → [PLC Memory Operation] → [Format PLC Memory]. 1) Click! 2) The Format PLC Memory dialog box is displayed. Select "Program Memory" from the Target Memory drop-down menu. 2) Select the target memory. 3) Click the Execute 4) Click the Yes button. 3) Click! button to start formatting. 4) Click! 5) When format is completed, the dialog box on the left is displayed.
(6) Clearing all the device memory from the CPU This section explains how to clear the device memory of the QCPU. 1) Click [Online] → [PLC Memory Operation] → [Clear PLC Memory]. 1) Click! 2) The Clear PLC Memory dialog box is displayed. Check that "Clear Device's whole Memory" is checked. 2) Check. 3) Check "Include Latch". 3) Check. 4) Click the Execute 5) Click the device. Yes button.
(7) Clearing the error history in the CPU This section explains how to clear the error history data stored in the QCPU. 1) Click [Diagnostics] → [PLC Diagnostics]. 1) Click! 2) The PLC Diagnostics dialog box is displayed. Click the Clear History button. 3) The confirmation dialog box is displayed. Click the Yes button. 4) Click the box.
(8) Setting the clock on the programmable controller CPU Setting a year, month, date, time, minute, second, and day of the week to the clock on the programmable controller CPU is available. To use the clock function, use GX Works2 or a sequence program. Set or read the clock data in GX Works2. 1) Click [Online] → [Set Clock] to display the Set Clock dialog box. 1) Click! 2) Enter a year, month, date, time, minute, second, and day of the week in the Set Clock dialog box.
2.5 2.5.1 Creating Ladder Program Creating a ladder program using the function keys Follow the steps below to create the ladder program A ladder program to be created as shown on the left. X2 X0 Y70 Y70 X3 Y71 1) Press the F5 key to open the Enter Symbol window. Enter "X2". If any other key is pressed by mistake, press the 2) Press "Enter"! Esc 1) Enter "X2"! key and retype. 2) Press the Enter key to confirm the entry. • The OK or Exit button also can be used to confirm or cancel the entry.
(From the previous page) 9) The entered symbol ( 9) The symbol is displayed! Y70 ) is displayed. 10) Press the F6 key, and enter "Y70". 11) Press "Enter"! 10) Enter "Y70"! 11) Press the Enter key to confirm the entry. Y70 12) The entered symbol ( 12) The symbol is displayed! 13) Move the cursor! ) is displayed. Y70 13) Move the cursor to the symbol under 15) Press "Enter"! . 14) Press the F5 key, and enter "X3". 14) Enter "X3"! 15) Press the Enter key to confirm the entry.
2.5.2 Creating a ladder program using the tool buttons Follow the steps below to create the ladder program A ladder program to be created as shown on the left. X2 X0 Y70 Y70 X3 Y71 1) Click on the toolbar to open the Enter Symbol window. Enter "X2". If any other button is pressed by mistake, click the 1) Click , then enter "X2". 2) Click! Exit button. 2) Click the OK button to confirm the entry. X2 3) The entered symbol ( 3) The symbol is displayed! 4) Click 4) Click , then enter "X0".
(From the previous page) 9) The entered symbol ( 9) The symbol is displayed! 10) Click 11) Click! 11) Click the Y70 ) is displayed. on the toolbar, and enter "Y70". OK button. 10) Click , then enter "X0". Y70 12) The entered symbol ( 12) The symbol is displayed! ) is displayed. Y70 13) Move the cursor to the symbol under . 13) Move the cursor! 14) Click 14) Click , then enter "X3". 15) Click! 15) Click the on the toolbar, and enter "X3". OK button.
2.6 Converting Program (Ladder Conversion) 1) Click [Compile] → [Build] ( F4 ). 1) Click! 2) The ladder program has been converted. If an error occurs during a conversion, the cursor will automatically move to the defective point of the ladder program. Check the point and correct the program as necessary.
2.7 Writing/Reading Data to/from Programmable Controller CPU (1) Writing data to the CPU 1) Suppose that the ladder program (sequence program) has been created with GX Works2 to proceed to the next step. 2) Set the RUN/STOP/RESET switch on the CPU to STOP. 2) Set the switch to "STOP"! on the toolbar or click [Online] 3) Click → [Write to PLC]. 3) Click! 4) From the "PLC Module" tab, click to select the program and parameter to write to the CPU.
(From the previous page) 7) The progress dialog box is displayed. 8) The message "Completed" is displayed when the writing is completed. Click Close . 8) Click! 9) Click the box.
(2) Reading data from the CPU 1) Click on the toolbar or click [Online] → [Read from PLC]. 1) Click! 2) Select a program to be read by clicking on data! 2) Select the target memory! 2) From the "PLC Module" tab, click to select the program and parameter to read from the CPU. Or click Parameter + Program to select the target program and parameter. Select "Program Memory/Device Memory" for "Target Memory". 3) Click Execute to accept the selection.
2.8 Monitoring Ladder Program Status 1) Suppose that the ladder program (sequence program) has been written into the programmable controller CPU to proceed to the next step. 2) Set the RUN/STOP/RESET switch on the CPU to RESET once (for about one sec.), return it to STOP, then set it to RUN. 2) Set the switch to "RUN"! 3) Click on the toolbar or click [Online] → [Monitor] →[Start Monitoring]. 3) Click! 4) Selecting another menu ends the monitor mode.
(1) In the monitor mode, the Monitor Status dialog box shown below is displayed regardless of the monitor status. 1) 2) 3) 4) 5) 1) Connection status Displays the connection status between a programmable controller CPU and personal computer in which the simulation function is started. 2) RUN/STOP status Displays the programmable controller CPU status operated by the key switch on the programmable controller CPU or the remote operation from GX Works2. 3) ERR.
(3) Ladder conversion during the monitoring This section explains the procedure to convert Y70 into Y72 during the monitoring. 1) Double-click ( Y70 ). 1) Double-click! 2) The Enter Symbol window is displayed. Enter "Y72". 3) Press the 2) Enter "Y72"! Enter 4) Double-click ( Y70 key. ) and change "Y70" to "Y72". 4) Enter "Y72"! 5) Click [Compile] → [Build] ( F4 ). 5) Click! 6) The conversion is completed.
2.9 Diagnosing Programmable Controller CPU 1) Click [Diagnostics] → [PLC Diagnostics]. 1) Click! 2) The PLC Diagnostics screen is displayed.
Item 1) 2) Description Monitor Status Connection Channel List Displays the current monitor status. Displays the connection route which has been set. For single CPU system Displays the operation status and switch status of the programmable controller CPU. For multiple CPU system Displays the operaton status and the switch status of CPU No. 1 to No. 4. 3) CPU operation status 4) Image of programmable controller CPU Perform online operations of the programmable controller CPU.
2.10 Editing Ladder Program 2.10.1 Modifying a part of the ladder program This section explains how to modify a part of the ladder program shown on the left. (OUT Y71 → OUT Y72) A ladder program to be created X2 X0 Y70 Y70 Y72 X3 Y71 1) Confirm that "Ovrwrte" is shown at the lower-right portion of the screen. 1) Check! If "Insert" is shown on the screen, click the Ins key to change the display to "Ovrwrte". If "Insert" is shown on the screen, contacts or coils are added to the diagram.
(From the previous page) 3) The Enter Symbol window is displayed. 3) The Enter Symbol window is displayed! 4) Click the edit box and enter "Y72". 5) Click the 4) Enter "Y72"! OK button to accept the change. 5) Click! 6) The modified diagram is displayed! 6) The modified ladder program is displayed. 7) To convert the edited ladder program, click [Compile] → [Build] ( F4 ).
2.10.2 Drawing/deleting lines (1) Drawing lines This section explains how to add a line to the ladder program shown on the left. A ladder program to be created X2 X0 Y70 Y70 Y73 X3 Y72 1) Click ( Alt + F10 ) on the toolbar. 1) Click! 2) Drag the mouse from the start position to the end position. 2) Drag! A vertical line is created to the left of the cursor. 3) A line is created when the left button of the mouse is released.
(From the previous page) 4) Click 5) Click the 4) Click , then enter "Y73"! on the toolbar, and enter "Y73". OK button. 5) Click! 6) The entered symbol ( 6) The symbol is displayed! Y73 ) is displayed. 7) To convert the edited ladder program, click [Compile] → [Build] ( F4 ).
(2) Deleting lines Perform the following steps to delete the line from the ladder shown on the left. A ladder program to be created X2 X0 Y70 Y70 Y73 X3 Y72 1) Click ( Alt + F9 ) on the toolbar. 1) Click! 2) Drag the mouse from the start position to the end position. 2) Drag! 3) The line is deleted when the left button of the mouse is released. The line drawn for the END instruction cannot be removed.
2.10.3 Inserting/deleting rows (1) Inserting rows This section explains how to add a row to the ladder program shown on the left. A ladder program to be modified X7 Y77 X2 X0 Y70 Y70 X3 Y72 1) Click on any point of the row to move the cursor. 1) Click to move the cursor! A new row is inserted above the row selected with the cursor. 2) Right-click on any point on the ladder program creation screen to display the menu.
(From the previous page) 3) Select the [Edit] → [Insert Row] ( Shift + Ins ). 3) Click! 4) A new row is inserted above the selected row. 4) A new row is inserted! 5) Click on the toolbar to open the Enter Symbol window. Enter "X7". 6) Click the 5) Click , then enter "X7"! 6) Click! (To the next page) 2 - 51 OK button to accept the entry.
(From the previous page) X7 7) The entered symbol ( 7) The symbol is displayed! 8) Click 8) Click , then enter "Y77"! 9) Click the 9) Click! on the toolbar, and enter "Y77". OK button. 10) The entered symbol ( displayed. 10) The symbol is displayed! ) is displayed. Y77 ) is 11) To convert the edited ladder program, click [Compile] → [Build] ( F4 ).
(2) Deleting rows This section explains how to delete the row from the ladder program shown on the left. A ladder program to be modified X7 Y77 X2 X0 Y70 Y70 X3 Y72 1) Click on any point of the row to be deleted to move the cursor. 1) Click to move the cursor! 2) Right-click on any point on the ladder program creation screen to display the menu.
(From the previous page) 3) Select the [Edit] → [Delete Row] ( Shift + Del ). 3) Click! 4) The selected row is deleted. 4) The row is deleted! 5) To convert the edited ladder program, click [Compile] → [Build] ( F4 ).
2.10.4 Cutting/copying ladder program This section explains how to copy and cut the ladder program shown on the left. A ladder program to be modified X7 Y77 X2 X0 Y70 Y70 1) Click on the start point of the ladder program to be cut to move the cursor. Range of cut or copy 1) Click to move the cursor! 2) Drag the mouse over the ladder to specify the area. The selected area is highlighted.
(From the previous page) 4) Click on the start point of the ladder program to be copied to move the cursor. 5) Drag the mouse over the ladder to specify the area. The selected area is highlighted. Click the step numbers and drag the mouse vertically to specify the area in ladder block units. 6) Click 6) Click on the toolbar or select [Edit] → [Copy] ( Ctrl + C ) to copy the specified area. ! 7) Click any ladder block to move the cursor to the ladder.
(From the previous page) 8) Click on the toolbar or select [Edit] → [Paste] ( Ctrl + V ) to paste the cut or copied area. 8) Click! 9) The cut or copied ladder is pasted.
2.11 Verifying Data This section explains how to verify the open project against the data on the programmable controller CPU. The verification function is used to compare the contents of two projects or to locate program changes made in the programs. 1) Click [Online] → [Verify with PLC]. 1) Click! 2) The Online Data Operation dialog box is displayed. Click the Parameter + Program button. 3) Click the 2) Click! Execute button.
2.12 2.12.1 Saving Ladder Program Saving newly-created or overwritten projects on the toolbar or select [Project] 1) Click → [Save] ( Ctrl + S ). Saving the existing project is completed at this step. 1) Click! (Only when a newly-created project is saved) 2) Specify the location to store the project. 3) Set a workspace name. 4) Set a project name. 2) Specify the location to store the project! 5) Set a title as necessary. 4) Set a project name! 6) Click the Save button to accept the entry.
POINT • Workspace Workspace enables GX Works2 to manage several projects with one name. • When the save destination exists When the save destination (workspace and project) exists, the folder where the workspace is saved can be specified in "Workspace/Project List". • Number of the characters for a workspace name, project name, and title Specify a workspace name, project name, and title within 128 characters each.
2.13 Reading the saved project 1) Click on the toolbar or select [Project] → [Open] ( Ctrl + O ). 1) Click! 2) Specify the location where the project to be read is stored. 3) Double-click the workspace to be read. 3) Double-click! 4) Click the project to be read. 4) Click! 5) Click the button to start reading the specified project. 5) Click! Each confirmation dialog box below is displayed in the following cases; (When another project has been open) Yes ·········Terminates the project.
2.14 Opening Projects in Different Format This section explains how to open a project created with GX Developer in GX Works2. 1) Click [Project] → [Open Other Data] → [Open Other Project]. 2) The Open Other Project dialog box is displayed. Specify the project and click the Open button. 2) Click! 3) The message on the left is displayed. Click the Yes button. 4) The project created with GX Developer is read.
POINT • Status after a project in a different format are opened When a project in a different format is opened, the project is in the uncompiled status. Compile all programs in the project before executing online operations such as writing data and monitoring. When a compile error occurs, correct the corresponding program according to the programming manual. 2.15 Saving Projects in Different Format This section explains how to save a Simple project of GX Works2 in the GX Developer format.
MEMO 2 - 64
CHAPTER 3 DEVICE AND PARAMETER OF PROGRAMMABLE CONTROLLER 3.1 Device A device is an imaginary element for programming in the programmable controller CPU, as well as the components (such as contacts and coils) that compose a program. X6 T2 Y74 Y Type X Y M L B F V SM SB FX FY T(ST) C D W R SD SW FD Z 74 Device No.
Type FD Function register Z Index register N Nesting P Pointer I J U K Interruption pointer Network No. specification device I/O No. specification device Decimal constant Description Remark Register for the exchange data between a subroutine call source and a subroutine program Register for modification to the devices (X, Y, M, L, B, F, T, C, D, W, R, K, H, and P) Shows the nesting (nested structure) of the master control.
3.2 Parameter The parameters are basic setting values applied to a programmable controller in order to control objects as planned. The parameters are divided into the PLC parameter, network parameter, and remote password as shown below. * A shaded area in the following table indicates the items to be set in this textbook. Item PLC name PLC system Sets a label (name and application) of a programmable controller CPU. Comment Sets a comment for the label of a programmable controller CPU.
Item Boot option Boot file Boot file setting Sets the startup mode and startup condition of an SFC program and the output mode at block stop Device points Latch (1) start/end Latch (2) start/east PLC parameter RESET/L.CLR switch or a remote latch clear operation. Sets the latch range (start device number/end device number) not clearable with the RESET/L.CLR switch or a remote latch clear operation. Sets the range (start device number/end device number) of devices used as a local device.
• When GX Works2 starts, it employs the preset values as the parameters. These values are called the default (initial values). • The programmable controller can run with those values unchanged, however, modify them within a specified range as necessary.
MEMO 3-6
CHAPTER 4 SEQUENCE AND BASIC INSTRUCTIONS -PART 14.1 List of Instruction Explained in this Chapter This chapter explains the sequence instructions and basic instructions as shown below. Instruction symbol Instruction Function Drawing (devices to be used) (Name) OUT Out MC Master control symbol Function Drawing (devices to be used) (Name) CJ Coil output Specifies a bit of a bit device or word device. Specifies a bit of a bit device or word device.
"Introduction: PLC Course" covers the instructions shown below. The conventional A series also support them. Refer to "MELSEC-Q/L Programming Manual Common Instruction" for more details. Instruction symbol (Name) LD Load LDI Load inverse AND And ANI And inverse OR Or Instruction symbol (Name) Function Starting a logical operation Starting to operate a normally open Specifies a bit of a bit device contact or word device.
The instructions listed below are intended for the Q series and not supported by the A series. Some of them are explained in "Q Programming Applied Course". Refer to "MELSEC-Q/L Programming Manual Common Instruction" for more details.
4.2 Differences between OUT and SET / RST Project name Program name QB-1 MAIN OUT instruction X0 0 Y70 • The OUT instruction turns the specified device on when the input condition turns on, and turns the device off when the condition turns off.
4.3 Measuring Timer Project name Program name QB-3 MAIN K30 X5 T0 0 Timer setting value (time limit: 3.0sec.) T0 Y70 5 T0 7 Y71 *: OUT T is a 4-step instruction. [Timing chart] • The timer contact operates delaying by a set time after the coil is energized. (On delay timer) • The timer setting range is from K1 to K32767. Low-speed (100ms) timer 0.1 to 3276.7sec. High-speed (10ms) timer 0.01 to 327.67sec.
4.4 Counting by Counter Project name Program name QB-4 MAIN K12 X1 C20 0 Set value in counter C20 Y72 5 X7 RST 7 C20 *: OUT C is a 4-step instruction. [Timing chart] Contact X1 Coil C20 1 2 3 (Current value of counter) 11 12 0 Contact C20, coil Y72 Contact X7 (input of RST instruction) • The counter counts when an input signal rises. • After the count, the subsequent input signals are not counted.
Project name Program name QEX1 MAIN Ladder example When the conveyor belt operation start switch (X0) is turned on, the buzzer (Y70) beeps for three seconds and the conveyor belt (Y71) starts to operate. The conveyor belt automatically stops when the sensor (X1) detects that six packages have passed through. Sensor (X1) Conveyor Motor Control panel Operating panel Operation Buzzer (X0) (Y70) MC (Y71) Create the following ladder and check that it operates properly.
Operating Procedure (1) Creating a new project (a) Click on the toolbar. Click (b) The New Project dialog box is displayed. Set "Project Type" to "Simple Project", "PLC Series" to "QCPU (Q mode)", and "PLC Type" to "Q06UDH". Then click the OK button. Click (c) If the project in preparation exists, the confirmation dialog box for saving the project is displayed. Click the No button. Click (d) The screen shifts to the new project creation mode.
(2) Creating a program [Using the keyboard] F5 X Shift + F5 0 C F7 0 M 0 F4 Conversion [Using the tool buttons] Enter "X0" after clicking . (a) Click Click on the toolbar to open the Enter Symbol window. (b) Enter "X0" with the keyboard and click the Enter "C0" after clicking . OK on the toolbar to open the (c) Click Click button. Enter Symbol window. (d) Enter "C0" with the keyboard and click the Enter "M0" after clicking . OK button.
(3) Writing the project to the programmable controller (a) Write the created ladder to the memory on the programmable controller. Set the RUN/STOP switch of the CPU to STOP. Click on the toolbar. The Online Data Operation dialog box is displayed. Click (b) Click the Parameter + Program button. Checkboxes for the target program and the target parameter displayed in the window are automatically marked ( ). (c) Click the Execute button.
(d) If parameters have been already written, the confirmation dialog box for overwriting the parameters is displayed. Click the Yes button. Click (e) The Write to PLC dialog box is displayed. (f) If a program has already been written, the confirmation dialog box for overwriting the program is displayed. Click the Yes button.
(g) Writing the program to the programmable controller is finished.
(4) Monitoring the ladder Monitor the ladder. Hold the RESET/STOP/RUN switch on the CPU at the RESET position for one second or more, then set the switch to RUN. (a) Click on the toolbar. Click (b) The ladder (write) screen is used to monitor the ladder. Operation Practice 1) 2) 3) Turning on the push button switch (X0) turns on Y70 and starts T0 at the same time. When the timer T0 counts three seconds (time-out), Y70 turns off and Y71 turns on at the same time.
4.5 PLS Pulse (turns on the specified device for one scan at rising edge of an input condition.) PLF Pulf (turns on the specified device for one scan at falling edge of an input condition.) Project name Program name 1 X0 0 PLS M5 PLF M0 2 X1 3 1 QB-5 MAIN • The PLS instruction turns on the specified device only for one scan when the execution command is turned on from off.
Application • The instructions can be used in the standby program that waits for the operation condition. Execution command X0 PLS M0 SET M5 M0 M5 Y70 Execution condition K50 TO TO RST M5 [Timing chart] X0 (trigger) M0 M5 Y70 (operation) 5sec.
• The instructions can be used for a program that detects passage of moving objects. After the passage of a product is detected, the next process for the product is started. X0 PLF M0 SET Y70 M0 Product Sensor Y70 Sensor (Detection of input from X0) Conveyor [Timing chart] X0 M0 Y70 Other Useful Ways of PLS and PLF Part 1 • The instructions can be used for a program that executes the output operation for a set period of time when the input signal changes from on to off.
Other Useful Ways of PLS and PLF Part 2 • The program for the repeated operation such as switching on/off status alternately by pressing the push button switch can be made with the instructions. If the PLS instruction is used in the above program, the rising edge caused when the push button switch is pressed triggers the program. If the PLF instruction is used, the falling edge caused when the switch is released is the trigger.
Project name Program name QEX2 MAIN Ladder example Create the following ladder and check that it operates properly. 0 3 X2 M0 PLS X0 M0 Y70 Y70 7 10 X3 M1 PLF X1 M1 Y71 Y71 [Timing chart] X2 M0 PLS Y70 X0 X3 M1 PLF Y71 X1 REFERENCE The following is a timing chart of a lockup ladder programmed using the OUT instruction. Compare this with the lockup ladder created using the PLS instruction.
Operating Procedure The following procedures are the same as the Operating Procedure in section 4.4. (1) Creating a new project (2) Creating a program (3) Writing the project to the programmable controller (4) Monitoring the ladder Operation Practice • Turning on X2 turns on Y70, and turning on X0 turns off Y70. (Even when X2 stays on, turning on X0 turns off Y70.) • Turning on X3 turns on Y71, and turning on X1 turns off Y71.
Master Control MC MCR (Start) Master Control Reset (End) Project name Program name QB-8 MAIN X7 0 MC NO M98 X2 Y70 3 X3 Y71 5 7 MCR NO • The above program is a basic one. • MC N M to MCR N (indicated as "MC to MCR" hereafter.) The available nesting (N) numbers for "MC to MCR" are from N0 and N14. • The scan time skipped by "MC to MCR" hardly changes. The device status of the program skipped by "MC to MCR" becomes as follows; All the devices in the OUT instruction are turned off.
Nested "MC to MCR" Program Example • The MC and MCR instructions can be nested as shown below. Project name Program name 0 2 N0 5 10 QB-9 MAIN X5 Y70 X2 MC N0 M6 M6 X6 K5 C0 X3 MC N1 M7 1 N1 13 M7 X7 K100 TO 18 19 MCR N1 X8 Y71 21 22 24 N0 27 MCR N0 X0 SET Y72 X4 MC N0 M8 2 M8 X1 N0 c RST Y72 29 30 N1 N0 b a MCR N0 X9 Y73 3 32 M6 Y74 d 1 • The "MC to MCR" program a is nested under the "MC to MCR" program b . (It is called "nested structure".
Project name Program name QEX3 MAIN Ladder example The following program switches between manual and automatic operations using the MC and MCR instructions. • When the manual operation is selected by turning off X7; 1) Turning X2 sets the system to the low-speed operation mode. 2) Turning X3 sets the system to the high-speed operation mode. • When the automatic operation is selected by turning on X7, the system operates in the low-speed mode for 3sec. after X0 is turned on.
Operating Procedure The following procedures are the same as the Operating Procedure in section 4.4. (1) Creating a new project (2) Creating a program (3) Writing the project to the programmable controller (4) Monitoring the ladder Operation Practice • The manual operation is selected by turning off the X7 switch. When the X2 switch is turned on, Y71 lights and the low-speed operation is executed. To select the high-speed operation, turn on the X3 switch. Y72 lights and the high-speed operation starts.
4.7 FEND / CJ / SCJ / CALL / RET Project name Program name 4.7.1 FEND QB-10 MAIN F end FEND FEND is a 1-step instruction. • Use the FEND instruction as the END instruction under the following conditions; 1) When a sequence program must be executed and terminated in each program block. For example, use the FEND instruction with the CJ and SCJ instructions.
Project name Program name QEX6 MAIN Ladder example Create the following ladder with GX Works2 and write it to the CPU of the demonstration machine. Then check that the FEND instruction operates properly. 0 3 X3 CJ X4 Y70 5 P10 6 P10 FEND X5 Y72 Operating Procedure The following procedures are the same as the Operating Procedure in section 4.4.
Operation Practice Verify the operation of the ladder, which was created with GX Works2 and written to the CPU of the demonstration machine, by monitoring the ladder on the screen. 0 3 X3 CJ X4 Y70 5 P10 6 P10 FEND X5 Y72 9 END (1) When X3 is off (a) The operation is executed from 0 to FEND. (b) Turning on or off X4 turns on or off Y70. (c) Turning on or off X5 does not change Y72. (2) When X3 is on (a) The program jumps to the pointer P10 by the CJ instruction.
4.7.2 CJ SCJ (Conditional jump: instantaneous execution condition jump) (S conditional jump: execution condition jump after one scan) 1 X0 CJ 0 P10 2 X1 SCJ 3 X0 P10 X1 6 Y70 FEND 9 Pointer P10 X3 10 Y71 1 • The CJ instruction instantaneously executes a program jumping it to the specified address (pointer number) when the execution command is on. When the command is off, the program is not jumped.
NOTE • The pointer numbers available for both CJ and SCJ instructions are P0 to P4095. • Use the FEND instruction as shown below when a program using the CJ and SCJ instructions must be concluded in each program block. (Refer to section 4.7.1 for FEND.
Project name Program name QEX4 MAIN Ladder example Create the following ladder with GX Works2 and write it to the CPU of the demonstration machine. Then check the difference between the CJ and SCJ instructions. 0 3 6 P10 9 10 X0 X1 X0 X1 CJ P10 SCJ P10 Y70 FEND X3 Y71 Operating Procedure The following procedures are the same as the Operating Procedure in section 4.4.
Operation Practice (1) When X0 and X1 are off, the CJ and SCJ instructions are not executed. Therefore, Y70 is on. (2) When X0 is turned on, the CJ instruction is executed and the program jumps to P10. Therefore, Y70 remains on.
4.7.3 CALL(P) Call Executing a subroutine program Return RET M0 0 M5 CALL P10 CALL P10 X2 50 Sequence program FEND 103 1 P10 X1 2 Y70 104 Subroutine program 157 1 2 RET • The above program is a basic style to execute the subroutine program using the CALL and RET instructions. Keep this structure, otherwise an error occurs and the programmable controller stops. • A subroutine program consists of the ladders for executing the same data many times in one program.
Nesting • The CALL (P) instructions can be nested up to 16 levels. Sequence program 0 Subroutine program Subroutine program Subroutine program Subroutine program Subroutine program P1 P2 P3 P4 P5 CALL P3 CALL P1 CALL P5 CALL P4 CALL P2 RET RET RET RET RET FEND The following ladder circuit shows the above nested program.
Project name Program name QEX5 MAIN Ladder example Create the following ladder with GX Works2 and write it to the CPU of the demonstration machine. Then check that the CALL and RET instructions operate properly. 0 3 5 P10 6 X2 CALL X3 P10 Y70 FEND X4 Y71 RET 9 Operating Procedure The following procedures are the same as the Operating Procedure in section 4.4.
Operation Practice Verify the operation of the ladder, which was created with GX Works2 and written to the CPU of the demonstration machine, by monitoring the ladder on the screen. 0 3 X2 CALL X3 Y70 5 P10 6 P10 FEND X4 Y71 9 RET 10 END (1) When X2 is off (a) The operation is executed from 0 to FEND. (b) Turning on or off X3 turns on or off Y70. (c) Turning on or off X4 does not change Y71.
Project name Program name 4.8 4.8.1 QTEST1 MAIN Exercise Exercise 1 LD to NOP When X0 turns on, Y70 is self-maintained, and Y74 and Y77 flicker alternately every 0.5sec. When X1 turns on, Y70 turns off and flickering of Y74 and Y77 also stops. [Timing chart] X0 Y70 TO Y74 T1 Y77 X1 0.5sec. 0.5sec. 0.5sec. 0.5sec. Create the following program with GX Works2 filling in the blanks check the operation using the demonstration machine.
Project name Program name 4.8.2 QTEST2 MAIN Exercise 2 SET, RST When X0 is turned on, Y70 starts to flicker at one-second intervals and stops the flickering for five seconds after flickering 10 times, then restarts flickering. The flickering of Y70 can be stopped by turning on X1. Create the following program with GX Works2 filling in the blanks check the operation using the demonstration machine.
Hint (1) The following shows the timing chart of the program. X0 M0 X1 Restart Contact T0 1sec. Contact T1 Y70 1sec One scan 1sec. 1sec. 5sec. Contact C0 Counter of C0 1. 2. 10. 1. 2.0. (2) The following shows the basic flickering ladder and its timing chart. [Ladder] T1 [Timing chart] K10 T0 T0 Contact T0 1sec. K10 T1 Start Contact T1 1sec. One scan REFERENCE • The flickering ladder can be created using the special relay that generates clock as shown below.
Project name Program name 4.8.3 QTEST3 MAIN Exercise 3 PLS, PLF Y70 starts to switch between ON and OFF alternately when X0 is turned on, and turning off X0 triggers Y71 to operate in the same way as Y70 does. [Timing chart] X0 Y70 Y71 Create the following program with GX Works2 filling in the blanks check the operation using the demonstration machine. 0 5 X0 M0 Y70 1) M0 2) M1 Y70 M0 Y70 11 M1 Y71 Y71 M1 Y71 1) 2) 4 - 38 .
Project name Program name 4.8.4 QTEST4 MAIN Exercise 4 CJ, CALL, RET, FEND Y70 and Y71 flicker for 0.5sec. alternately when X7 is off, and when X7 is on, Y72 and Y73 flicker for 1.0sec. alternately. Turning on X0 resets the currently flickering Y70 to Y73. Fill in the blanks . Then, check the operation using the demonstration machine.
Hint 1) 2) 3) 4) 5) 6) START X7 ON? Y N P0 Y72,Y73 Reset Y70,Y71 Y72,Y73 1-sec. flickering 0.5-sec.
Answers for the exercises in Chapter 4 Exercise No.
MEMO 4 - 42
CHAPTER 5 BASIC INSTRUCTION -PART 25.1 Notation of Values (Data) The programmable controller CPU converts all input signals into ON or OFF signals (logical 1 or 0, respectively) to store and process them. Therefore, the programmable controller executes the numeric operation using the numeric values stored with the logical 1 or 0 (binary numbers = BIN). In daily life, a decimal number is regarded as the most commonly and the easiest system.
Binary (BIN) The binary number system consists of two symbols: 0 and 1 which represent the order and size (amount). After a digit reaches 1, an increment is reset to 0 and the next digit (to the left) is incremented. The two digits 0 and 1 are called bits. Binary Decimal 0 0 1 1 10 2 11 3 100 4 101 5 110 6 111 7 1000 8 … … The following example explains how to convert a binary number into a decimal number. "10011101" The diagram below shows the binary number with the powers of two.
Hexadecimal The hexadecimal number system consists of 16 symbols: 0 to 9 and A to F which represent the order and size (amount). After a digit reaches F, an increment is reset to 0 and the next digit (to the left) is incremented.
Binary Coded Decimal (BCD) The binary-coded decimal is "a numerical system using a binary number to represent a decimal number". A decimal number 157, for example, is expressed as shown below. 2 1 0 Digit number 1 5 7 Decimal (100) (10) (1) 0001 842 0101 8 1 2 4 Power of digit 0111 1 8 BCD Binary bit weights 4 2 1 In BCD, decimal numbers 0 to 9999 (the biggest 4-digit number) can be represented by 16 bits. The diagram below shows the bit weights of BCD.
How to convert the decimal number into the binary number In the example below, a decimal number 157 is converted into the binary number.
Numerical values used by MELSEC-Q series programmable controller ● Usually, 8 bits are called 1 byte, and 16 bits (2 bytes) are called 1 word. 1 bit 1 0 0 1 1 1 0 1 1 0 1 1 byte 0 0 0 0 0 0 0 0 1 0 0 1 1 1 word (2 byte) 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 ● Registers of each word device in the MELSEC-Q series programmable controller consist of 16 bits.
BCD (binary coded decimal) BIN (binary) 00000000 00000000 00000000 00000000 0 0000 00000000 00000001 00000000 00000001 1 0001 00000000 00000010 00000000 00000010 2 0002 00000000 00000011 00000000 00000011 3 0003 00000000 00000100 00000000 00000100 4 0004 00000000 00000101 00000000 00000101 5 0005 00000000 00000110 00000000 00000110 6 0006 00000000 00000111 00000000 00000111 7 0007 00000000 00001000 00000000 00001000 8 0008 00000000 00001001 00000000 00001001 9 0009
System configuration and I/O number of demonstration machine Output module CPU module Input module Power supply module Base unit Q38DB Q61P QCPU Vacant slot QX QY Q64 Q62 42 42P AD DAN (64 (64 (16 (16 points) points) points) points) X0 to X3F USB cable Y40 to Y7F Peripheral device I/O panel Y6F Y77 Y76 Y75 Y74 Y73 Y72 Y71 Y70 Y7F Y7E Y7D Y7C Y7B Y7A Y79 Y78 X7 X6 X5 X4 X3 X2 X1 X0 Y60 X3F ON X30 1 9 4 2 Y5F X2F Y50 Y4F Y40 X20 4 1 3 6 MELSEC-Q OFF XF XE XD
5.2 5.2.1 Transfer Instruction MOV (P) Project name QB-11 Program name MAIN 16-bit data transfer X7 K50 T0 0 T0 K1500 T0 C10 X1 13 RST C10 S D MOV T0 D0 MOVP C10 D1 MOVP K157 D2 X2 18 1 X3 21 2 X4 24 3 X5 27 1 MOVP H4A9D D3 ● When the input condition turns on, the current value of the timer T0 is transferred to the data register D0. S ... Source, D ... Destination ● The current value of T0 is stored in the register in binary (BIN code).
3 ● When the input condition turns on, the hexadecimal number 4A9D is transferred to the data register D3. H4A9D (4) (A) (9) (D) 32768 16384 8192 4096 2048 1024 512 256 128 64 32 16 8 4 2 1 D3 0 1 0 0 1 0 1 0 1 0 0 1 1 1 0 1 Hexadecimal numbers Binary numbers Bit weights Difference between MOV and MOVP The P of MOVP stands for a pulse. Input condition MOV Data is transferred every scan while the input condition is on. MOVP Data is transferred only one scan after the input condition turns on.
Check The CPU is running. The inputs X2, X3, X4, X5, and X7 are on. Monitor the contents of the data registers D0 to D3. • After writing the data to the programmable controller, click [Online] → [Monitor] → [Device/Buffer Memory Batch]. The Device/Buffer Memory Batch Monitor dialog box is displayed. • Enter "D0" in the Device Name column of the Device/Buffer Memory Batch Monitor dialog box and press the Enter key. Enter "D0". Press the Enter key after entering the device.
Current values of a timer and counter are monitored. (They are changing.) Indicates that a decimal number 157 (K157) is stored. This is a decimal number equivalent to a hexadecimal 4A9D. Indicates the word devices in the on/off of the bit units.
• Click the Display Format button. • Change the display of the numerical value in the monitor to the hexadecimal notation. • Select "HEX" for the device batch monitoring. [Device/Buffer Memory Batch Monitor screen] • Change the display of the numerical value in the monitor to the binary notation. Select "Word Multi-point" in Monitor Format for the device batch monitoring.
Project name QEX7 Program name MAIN Ladder example Create the following ladder with GX Works2 and write it to the CPU of the demonstration machine. Then check that the MOV instruction works properly. 0 5 X0 MOV K200 D0 MOV D0 D1 X1 RST D0 RST D1 Operating Procedure The following procedures are the same as the Operating Procedure in section 4.4.
Operation Practice Check that "200" is displayed under both D0 and D1 on the monitor screen when X0 on the control panel of the demonstration machine is turned on. 0 X0 MOV K200 D0 MOV D0 D1 200 200 5 200 X1 10 RST D0 RST D1 END When X0 turns on, the current values of D0 and D1 become 200.
QB-12 MAIN BCD → BIN data conversion instruction BIN (P) Operations to read and write data after step 35 X7 K50 T0 T0 0 K1500 T0 C10 S D BINP K4X20 D5 MOV K4X20 D6 X0 30 X0 34 Check the difference from the BIN instruction. • When the input condition is turned on, the data in the device specified in S is recognized as a BCD code, converted into binary (BIN code), and transferred to the device specified in D .
K4X20 Word devices D (data register), T (timer current value), and C (counter current value) consist of 16 bits (1 word), and data is basically transferred among the units of one device. Collecting 16 bit devices (such as X, Y, and M) means processing the word device. The device numbers allocated to the bit devices must be in consecutive order. In the bit device, data are processed in units of four.
QB-13 MAIN BIN → BCD data conversion instruction BCD (P) X7 K50 T0 T0 0 K1500 T0 C10 S D BCD T0 K2Y40 BCD C10 K4Y50 X6 37 When the input condition is turned on, the data in the device specified in S is recognized as a binary (BIN code), converted into a binary coded decimal (BCD code), and transferred to the device specified in D .
Displayable Range with BCD Instruction The displayable range of data with the BCD instruction (to be converted from BIN into BCD) is between 0 and 9999. Any data which is outside the range causes an error. (Error code 4100: OPERATION ERROR) To display a timer current value more than 9,999, use the DBCD instruction. The instruction can handle 8-digit values (up to 99,999,999).
Project name QEX8 Program name MAIN Ladder example Create the following ladder with GX Works2 and write it to the CPU of the demonstration machine. Then check that the BCD instruction works properly. 0 X0 C0 BCD 8 C0 X1 K10 K2Y40 RST C0 Operating Procedure The following procedures are the same as the Operating Procedure in section 4.4.
5.2.4 Example of specifying digit for bit devices and transferring data Program example Process When the destination data D is a word device S X3X2X1X0 D K1X0 1 1 0 1 MOVP K1X0 D0 Becomes 0.
5.2.
Input condition BMOVP S D n D0 D32 K16 BMOV When the input condition is turned on, the BMOV instruction transfers the data in the devices starting from the device specified in S to the devices starting from the device specified in D in batch (the numbers of source devices and target devices are specified by n ). Example The BMOV instruction executes the following operation when X5 is turned on.
Operation Practice Write the program on the previous page to the CPU, then run the CPU. Follow the procedures below to execute the device batch monitoring. The contents of D0 to D47 can be monitored. Write the program to the programmable controller Click [Online] → [Monitor] → [Device/Buffer Memory Batch]. Enter "D0" in the Device/Buffer Memory Batch Monitor dialog box and press the Enter key. Click the Display Format button and select "Word Multi-point" for Monitor Format. → Click the OK button.
Reference If D is a bit device, the operation becomes as follows; FMOV instruction Input condition As D specifies a two-digit number, these data are ignored. FMOV S D n D0 K2Y40 K4 S D D0 (Example: when the content is 365) D Y4F Y48 0 1 1 0 1 1 0 1 Y47 Y40 0 1 1 0 1 1 0 1 n 0 0 0 0 0 0 0 1 0 1 1 0 1 1 0 1 D 4 devices (K4) D Y5F Y58 0 1 1 0 1 1 0 1 Y57 Y50 0 1 1 0 1 1 0 1 Among the device of Y40 to Y5F, the devices specified as "1" are output first.
Project name QEX9 Program name MAIN Ladder example Create the following ladder with GX Works2 and write it to the CPU of the demonstration machine. Then check that the FMOV instruction works properly. 0 5 X0 X1 FMOV K200 D0 K5 FMOV K0 D0 K5 Operating Procedure The following procedures are the same as the Operating Procedure in section 4.4.
5.3 Project name QB-15 Program name MAIN Comparison Operation Instruction Size comparison K100 X3 SM413 (2-sec.
Operation Practice Write the program to the CPU. Turn on X3 and X4. C10 starts to count. (one count every two sec.) The current counter value is displayed on the digital display (Y40 to Y4F). Make sure that the devices Y70 to Y76 turn on as follows. The range where Y70 to Y76 turn on Y70 Output Y71 Y72 Y73 Y74 Y75 Y76 012345 10 15 20 25 30 35 40 45 50 Count (the current value of the counter C10) Differences between > and > = > K50 C10 equals to 49. >= K50 C10 equals to 50.
Project name QEX10 Program name MAIN Ladder example Read the following ladder and write it to the CPU of the demonstration machine. Then check that the > and < instructions work properly. 0sec. ≤ T0 < 3sec. → Y70: ON, 2.7sec. < T0 < 3.3sec. → Y71: ON, 3sec. < T0 ≤ 6sec. → Y72: ON Y70:ON T0: 0 0 2 8 2.8 3.1 3.2 6.0 sec. SET M0 T0 T0 K60 M10 K30 T0 14 < K27 T0 < K30 SM400 T0 29 3.0 M0 M10 > 25 2.
● The Open dialog box is displayed. Specify the save destination. ● Double-click the displayed workspace "SCHOOL". Double-click ● Click "QEX10" and click the Open button. Click Click The following procedures are the same as the Operating Procedure in section 4.4.
Operation Practice Turn on X0 and check that the program works properly.
5.4 5.4.1 Arithmetic Operation Instruction +(P) BIN 16-bit data addition -(P) BIN 16-bit data subtraction S D +P K5 D0 S1 S2 D D0 K100 D1 X2 0 X3 4 1 +P Project name QB-16 Program name MAIN 1 2 ● Every time the input condition is turned on, the content of the device specified in D is added to the content of the device specified in S and the result is stored in the device specified in D .
Project name QB-17 Program name MAIN X4 0 MOVP K1000 D2 S D -P K10 D2 S1 S2 D D2 K50 D3 X5 3 X6 7 3 -P 3 4 ● Every time the input condition is turned on, the content of the device specified in S is subtracted from the device specified in D and the result is stored in the device specified in D . S D D2 (Input condition) First ON Second ON Third ON 1000 (example) 990 980 D - (10) → - 10 10 10 → → → D2 990 980 970 The content of D2 is changed.
Project name QEX11 Program name MAIN Ladder example Create the following ladder with GX Works2 and write it to the CPU of the demonstration machine. Then check that the addition and subtraction instructions operate properly. X0 BINP K4X30 D0 0 BINP K4X20 D1 +P D0 D1 X1 BINP K4X30 D0 10 BINP K4X20 D1 -P 20 D1 K0 26 D1 K0 D0 DBCD D1 D1 K5Y40 Y70 DMOVK0 K5Y40 Operating Procedure The following procedures are the same as the Operating Procedure in section 4.4.
Operation Practice (1) When X0 is turned on, the data in X30 to 3F and X20 to 2F are added, and the result is output to Y40 to Y53. (2) When X1 is turned on, the data in X30 to 3F is subtracted from the data in X20 to 2F, and the result is output to Y40 to Y53. When the result is a negative value, Y70 is turned on and Y40 to Y53 are cleared to 0.
5.4.2 * (P) BIN 16-bit data multiplication / (P) BIN 16-bit data division Project name QB-18 Program name MAIN X0 0 X2 3 *P X3 7 1 /P MOVP K2000 D0 S1 S2 D K30 D0 D10 S1 S2 D D0 K600 D20 1 2 ● When the input condition is turned on, the content of the device specified in S1 is multiplied by the content of the device specified in S2 and the result is stored in the device specified in D .
2 ● When the input condition is turned on, the content of the device specified in S1 is divided by the content of the device specified in S2 and the result is stored in the device specified in D . S1 S2 D0 2000 K600 600 D = D20 3 Quotient D21 200 Remainder and The remainder is stored to D21, which is the next device number. The quotient is stored to D20, which is specified in the program. Values after the decimal point of the operation result are ignored.
● How to monitor 32-bit integral number data When the operation result of the multiplication instruction is outside the range from 0 to 32,767, the result cannot be displayed properly even though the number is regarded as 16-bit integral number and the contents of the lower register are monitored in ladder. To monitor those numbers properly, follow the procedures below. • Click the Display Format button on the Device/Buffer Memory Batch Monitor dialog box and select "32bit Integer" of "Display".
Project name QEX12 Program name MAIN Ladder example Create the following ladder with GX Works2 and write it to the CPU of the demonstration machine. Then check that the multiplication and division instructions operate properly. X0 0 *P BINP K4X30 D0 BINP K4X20 D1 D0 D1 DBCDP D10 13 D10 K8Y40 X1 /P BINP K4X30 D0 BINP K4X20 D1 D0 D1 D20 BCDP D20 K4Y50 BCDP D21 K4Y40 Operating Procedure The following procedures are the same as the Operating Procedure in section 4.4.
Operation Practice (1) When X0 is turned on, the data in X20 to X2F is multiplied by the data in X30 to 3F, and the result is output to Y40 to 5F. (2) When X1 is turned on, the data in X30 to X3F is divided by the data in X20 to 2F. The quotient is output to Y50 to 5F, and the remainder is output to Y40 to 4F.
32-bit data instructions and their necessity The minimum unit in the data memory of the Q-series programmable controller is 1 word which consists of 16 bits. Therefore, in general, data is processed in 1-word basis at the transfer, comparison, and arithmetic operation. The Q-series programmable controller can process data in 2-word (32-bit) basis. In that case, "D" is added at the head of each instruction to indicate that the instruction is regarded as 2-word. The following shows the examples.
Whether the data is processed in 2-word (32-bit) basis or not depends on the size of the data. In the following cases, 2-word instructions must be used. 1) When the data size exceeds the range (-32768 to 32767) in which data can be processed as 1-word DMOV S D K50000 D0 D1 D0 50000 50,000 Stored in two adjacent devices.
5.4.4 Project name QB-19 Program name MAIN Calculation examples for multiplication and division including decimal points (when the multiplication or division is used) Example 1 Calculation example to determine a circumference Digitalswitch value (K4X30) × 3.14 → (Circular constant) Integral part and Decimal part (K2Y48) (K8Y50) • Programming method Handle the circular constant as 314 (3.14 × 100), and divide the result by 100 afterward.
5.5 5.5.1 Index Register and File Register How to use index register Z The index register (Zn) is used to indirectly specify the device number. The result of an addition of data in the index register and the directly specified device number can be specified as the device number. Example D0Z0 → Can be interpreted as D (0+Z0) Device number For example, when Z0 is 0, the device number becomes D0. when Z0 is 50, the device number becomes D50. Z0 to Z19 can be used as the index register.
Application Example • Write the data to the data register with number which is specified with the digital switch. Project name Index register Program name MAIN K3000 T2 0 T2 X0 5 BINP K2X20 Z0 MOVP T2 D0Z0 • Check the operation of the ladder executing the device batch monitoring. The operation procedure is the same as the one in section 5.2.1. Set any two-digit number in the digital switch column (X27 to X20) and turn on X0.
5.5.2 How to use file register R The file register (R) consists of 16 bits as well as the data register (D). Set the file register in the standard RAM of the QCPU or a memory card (SRAM card and Flash card). The file register to be stored in the Flash card can be read from the program only. The data cannot be changed with the program. Stores parameters, programs, device comments, and device initial values. (File registers cannot be stored.
(From the previous page) 3) The Q Parameter Setting dialog box is displayed. Click the PLC File tab. 3) Click! 4) Check the "Use the following file" check box and select "Memory Card (RAM) (Drive 1)" for "Corresponding Memory". Enter the following items in "File Name" and "Capacity". 4) Select! [Setting contents] File Name :R Capacity : 32 5) After the setting is completed, click the button. End 5) Click! 6) The message on the left is displayed.
(From the previous page) 7) Click [Online] → [Write to PLC] to display the Online Data Operation dialog box. Select "Parameter" in the PLC Module tab. 7) Select! 8) Click the data. Execute button to write the 8) Click! • To clear the file register data with the program, write the following program. For the operation procedure, refer to section 4.4. Turning on X0 can write the data, and turning on X1 can clear the data.
5.6 External Setting of Timer/Counter Set Value and External Display of Current Value The timer and counter can be specified by K (decimal constant) directly or by D (data register) indirectly. In the program shown below, the external digital switch can change the set value.
Operation Practice (1) External setting of the timer set value and display of the current value • Set the timer set value in the digital switch (X20 to 2F), and turn on the switch X0. • When the switch X4 is turned on, Y70 turns on after the time specified with the digital switch. (For example, Y70 turns on after 123.4sec. when 1 2 3 4 is set.) • The digital display (Y40 to 4F) displays the current value of the timer T10.
5.7 5.7.1 Project name QTEST5 Program name MAIN Exercise MOV Exercise 1 Transfer the eight input statuses (X0 to X7) to D0 once then output them to Y70 to Y77. (For example, Y70 turns on when X0 turns on.) X0 X1 X2 X3 X4 X5 X6 X7 Y70 Y71 Y72 Y73 Y74 Y75 Y76 Y77 Create the following program with GX Works2 filling in the blanks Then, check the operation using the demonstration machine. .
5.7.2 Exercise 2 Project name QTEST6 Program name MAIN BIN and BCD conversion Output the number of times that X1 is turned on on the display connected to Y40 to Y4F in BCD. As a precondition, the set value of the counter (C0) can be input with the digital switch (X20 to X2F) and the setting will be available by turning on X0. Create the following program with GX Works2 filling in the blanks Then, check the operation using the demonstration machine. .
5.7.3 Exercise 3 Project name QTEST7 Program name MAIN FMOV Create a program in which turning on X0 turns on the 64 outputs Y40 to Y7F and turning off X0 turns off the 64 outputs Y40 to Y7F. Create the following program with GX Works2 filling in the blanks Then, check the operation using the demonstration machine. . X0 FMOV K255 0 1) 2) X0 FMOV 5 K2Y40 3) K8 Hint CPU (Output card) 255 1 1 1 1 1 1 1 1 Y40 Y41 Y42 Y43 The constant is output from the CPU in the binary notation.
5.7.4 Exercise 4 Project name QTEST8 Program name MAIN Comparison instruction Using the two BCD digital switches, execute the calculation of (A - B) and display the result on the BCD digital display (Y40 to Y4F). (X30 to X3F) (X20 to X2F) A B (Y40 to Y4F) Displays the result of the calculation of A - B on the BCD display of Y40 to Y4F. When the result is a negative number, make sure that the display displays 0 and the LED of Y70 turns on. Fill in the blanks .
5.7.5 Exercise 5 Project name QTEST9 Program name MAIN Addition and subtraction instructions Create a program that: 1) Imports the values specified by the digital switches (X20 to X2F) to D3 and D2 (32-bit data) when X0 is turned on, adds them to D1 and D0, and displays the result on the displays (Y40 to Y5F). 2) Imports the values specified by the digital switches (X20 to X2F) to D5 and D4 when X1 is turned on, subtracts them from D1 and D0, and displays the result.
5.7.6 Exercise 6 Project name QTEST10 Program name MAIN Multiplication and division instructions Create a program that: 1) Sets data for multiplication and division when X0 is turned on. 2) Multiplies the value specified by the digital switches X20 to X27 by the value specified by the digital switches X30 to X37 in binary when X2 is turned on. 3) Divides the value specified by the digital switches X30 to X37 by the value specified by the digital switches X20 to X27 in binary when X3 is turned on.
5.7.7 Exercise 7 Project name QTEST11 Program name MAIN D-multiplication and D-division Create a program that: 1) Multiplies the value set by the 5-digit digital switches (X20 to X33) by 1,100 in binary when X2 is turned on. When the result is 99,999,999 or less, it is displayed on the displays (Y40 to Y5F). 2) Divides the value set by the 8-digit digital switches (X20 to X3F) by 40,000 in binary when X3 is turned on. When X4 is on, the quotient is displayed on the displays (Y40 to Y5F).
Answers for the exercises in Chapter 5 Exercise Answer No.
CHAPTER 6 HOW TO USE OTHER FUNCTIONS 6.1 Test Function at Online As a preparation, follow the procedure below. Project name Program name X6 X1 0 For details on the operation method, refer to chapter 2. Y70 Y70 X4 K1500 TO 0 M10 4 BCD TO X6 1) Read a project with GX Works2. 2) Write the parameter and program of the read project to the CPU (programmable controller). (The CPU must be stopped.) K4Y50 0 T1 13 QEX14 MAIN Y74 Y74 Y74 3) Set GX Works2 to the monitor mode.
6.1.1 Turning on and off the device "Y" forcibly Stop the CPU before this operation. 1) Click [Debug] → [Modify Value]. 1) Click! 2) Enter "Y70"! 2) The Modify Value dialog box is displayed. Enter "Y70" in the "Device/Label" list box. 3) Click the ON or OFF on or off "Y70" forcibly. button to turn 3) Click! Check with demonstration machine 1) Confirm that the on and off statuses on the Execution Result area switches according to the clicking of the ON or OFF button.
POINT The test function during ladder monitoring of GX Works2 is also available for setting and resetting contacts, changing current values, and outputting forcibly word devices. Double-clicking a contact (pressing the Enter key) holding the Shift key in the ladder monitoring screen of GX Works2 switches the contact open or close forcibly. To display the Modify Value dialog box, double-click a word device (press the Enter key) holding the Shift key in the ladder monitoring screen of GX Works2.
6.1.2 Setting and resetting the device "M" Activate the CPU before this operation. 1) Click [Debug] → [Modify Value]. 1) Click! 2) The Modify Value dialog box is displayed. Enter "M10" in the "Device/Label" list box. 2) Enter "M10"! 3) Click the ON reset "M10". or OFF button to set or 3) Click! Check with demonstration machine X4 M10 4 K1500 T0 K4 BCD T0 Y50 (Monitor screen when M10 is set) Turn off X4 and check the following.
6.1.3 Changing the current value of the device "T" Activate the CPU before this operation. 1) Click [Debug] → [Modify Value]. 1) Click! 2) The Modify Value dialog box is displayed. Enter "T0" in the "Device/Label" list box. 2) Enter "T0"! 3) Select! 3) Select "Word[Signed]" from the "Data Type" list box. 4) Enter "1000"! 4) Enter "1000" in the "Value" column. 5) Click! 5) After the setting is completed, click the Set button to change the current value of T0 to 1000 forcibly.
6.1.4 Reading error steps Activate the CPU before this operation. 1) Click [Diagnostics] → [PLC Diagnostics]. 1) Click! 2) The PLC Diagnostics dialog box is displayed. Click the Error JUMP button to jump to the highlighted sequence program step number where the selected error occurred. • An error number is displayed if an error occurred. • "No Error" is displayed if no error occurred.
6.1.5 Remote STOP and RUN Activate the CPU before this operation. 1) Click [Online] → [Remote Operation]. 1) Click! 2) The Remote Operation dialog box is displayed. Select "STOP" from the list in the Operation area. 3) After the setting is completed, click the Execute button. 2) Select! 3) Click! 4) The message "Do you want to execute the operation(STOP)?" is displayed. Click the Yes button. The operation of the CPU stops. 4) Click! 5) Select "RUN" in step 2), and perform steps 2) to 4) again.
6.2 Forced I/O Assignment by Parameter Settings 1) Double-click "Parameter" in the project list. 1) Double-click! 2) "PLC Parameter", the "Network Parameter" folder, and "Remote Password" are displayed. Double-click the "PLC Parameter". 2) Double-click! 3) The Q Parameter Setting dialog box is displayed. Click the "I/O Assignment" tab. 3) Click! 4) Select! 4) Select "Input" from the list box of the "Type" column. 5) Enter "QX42" in the "Model Name" column.
Check with demonstration machine Stop the CPU and click on the toolbar. The Online Data Operation dialog box is displayed. Click the parameter of the currently edited data, and click the Execute button to write only the parameters to the CPU. Then, activate the CPU and check the following. 1) The current value of the timer T0 disappears from the digital display (Y50 to Y5F). Then, the LEDs of Y70 to Y77 start flashing until the set values of Y70 to Y77 reach each set device value.
6.3 How to Use Retentive Timers When an input condition is turned on, the coil is energized. Then the value of a retentive timer starts increasing. When the current value reaches the set value, the retentive timer goes time-out and the contact turns on. When the input condition is turned off during the increasing, the coil is de-energized but the current value is kept. When the input condition is turned on again, the coil is re-energized and the current value is accumulated.
(From the previous page) 3) The Q Parameter Setting dialog box is displayed. Click the "Device" tab. 3) Click! 4) Click "Device Points" in the "Retentive Timer" row, and enter "32". 5) After the setting is completed, click the End button.
6.4 Device Batch Replacement 6.4.1 Batch replacement of device numbers This section explains how to replace Y40 to Y7F (64 devices) with Y20 to Y5F (64 devices) in batch. 1) Click [Find/Replace] → [Device Batch Replace]. 1) Click! 2) The Find/Replace dialog box is displayed. Enter "Y40" in the "Find Device" column. 3) Enter "Y20" in the "Replace Device" column. 2) Enter "Y40"! 4) Enter "64" in the "Points" column.
6.4.2 Batch change of specified devices between normally open contacts and normally closed contacts This section explains how to change the normally open contacts of the specified devices to the normally closed contact and vice versa in batch. 1) Click [Find/Replace] → [Change Open/Close Contact]. 1) Click! 2) The Find/Replace dialog box is displayed. Enter "X4" in the "Replace Device" list box. 3) After the setting is completed, click the All Replace button.
6.5 Online Program Change This function is used to write programs to the CPU that is running. Activate the CPU before this operation. 1) Change the ladder. (In the example, change "X1" to "X0".) 1) Change the ladder! 2) After the change, click [Compile] → [Online Program Change]. 2) Click! 3) The dialog box for "Caution" is displayed. Click the Yes button to accept the change. 3) Click! 4) The message "Online change has completed." is displayed. Click the button.
6.6 Registering Devices This section explains how to register multiple devices or labels in one screen and to monitor them at the same time. 1) Click [View] → [Docking Window] → [Watch(1 to 4)]. * In this example, select "1". 1) Click! 2) The Watch 1 window is displayed. Select a row to be edited. Enter "T0" in the Device Label column. 2) Enter "T0"! 3) The input device or label is registered. 4) Click [Online] → [Watch] → [Start Watching].
6.7 How to Create Comments Project name Program name The following is an example of a printed out ladder with comments. Use the keyboard to input the program above or read it from a folder on the desktop.
(1) Flowchart of when creating comments Set the device range on which comments are attached.* Double-click the comment file on the workspace. Create comments. When attaching comments to other devices Save the project. Read and confirm the ladder with comments *: This procedure is necessary for specifying the device comment range. POINT Comments are used for displaying functions or applications of each device. Up to 32 characters are available.
(2) Creating comments 1) Double-click "Global Device Comment" in the project list. The Device Comment screen is displayed. 1) Double-click! 2) Click a comment area and enter a comment as shown on the left. 2) Enter comments! 3) Enter "Y70" in the "Device Name" list box. 3) Enter "Y70"! 4) Press the Enter key. 5) Enter comments! 5) Click a comment area and enter a comment as shown on the left.
(From the previous page) 6) Enter "M1" in the "Device Name" list box. 6) Enter "M1"! 7) Press the Enter key. 8) Enter comments! 8) Click a comment area and enter a comment as shown left. 9) Enter "T0" in the "Device Name" list box. 9) Enter "T0"! 10) Press the 11) Enter comments! Enter key. 11) Click a comment area and enter a comment as shown left. 12) Enter "C2" in the "Device name" list box. 12) Enter "C2"! 13) Press the Enter key.
(3) Saving comments 1) Click [Project] → [Save As]. 1) Click! 2) The Save As dialog box is displayed. Specify (or select) a workspace name and click the Save button.
(4) Displaying a ladder with comments on GX Works2 screens 1) Click [View] → [Comment]. 1) Click! 2) Comments are displayed on the ladder screen.
POINT In addition to device comments, statements and notes can be created on the ladder screen. • Statement : Comment for explaining functions or applications for the ladder block. Up to 64 characters are available. • Note : Comment for explaining functions or applications for outputs and commands. Up to 32 characters are available. Statement Note • Creating statements Click and double-click a symbol where a comment is to be attached. The Enter Line Statements dialog box is displayed.
6.8 Setting Security for Projects This section explains how to set security for projects to protect the projects and the data in the projects. Setting security restricts accesses to projects. Also, setting security prevents data such as POUs, device comments, and parameters, which are created by the user, from erroneous modifications or disclosures to unauthorized users. POINT Access levels and access authority Setting an access level to each user restricts accesses to each data.
6.8.1 Setting and resetting security for projects This section explains how to set security for an open project and how to reset the security. (1) Setting security for projects Set a security for a project. Once security is set for a project, user authentication is required when the project is opened again. 1) Click [Project] → [Security] → [User Management]. 1) Click! 2) The Use Addition dialog box is displayed. Enter the following items.
6.8.2 Managing (adding, deleting, and changing) users This section explains how to manage the registered statuses of users for a project with security and how to add, delete, and change users. This function is available only when a user logs in a project with the access level of "Administrators" or "Developers". [Displaying the User Management screen] 1) Click [Project] → [Security] → [User Management]. 1) Click! 2) The User Management dialog box is displayed.
[Adding users] Add a user to a project with security. A user whose access level is higher than that of the login user cannot be added. 1) Click the Add... button on the User Management screen. 1) Click! 2) The User Addition dialog box is displayed. Enter the following items. User Name Access Level Password Re-enter Password 2) Enter items! : Developers : Developers(Level3) : Developers : Developers 3) After entering them, click the OK button. 3) Click! 4) The user (Developers(Level3)) is added.
[Changing user information] Change the access level of the user added on the previous page from "Developers(Level3)" to "Users". The information of the login user and of a user whose access level is higher than that of the login user cannot be changed. 1) Select the user name "Developers". 2) Click the Change button. 1) Select! 2) Click! 3) The Change User Data dialog box is displayed. Select "Users" from the "Access Level" list box. 3) Select! 4) After selecting it, click the OK button.
[Changing passwords] Change the password of a user selected in the list on the User Management screen. The password of the login user and of a user whose access level is higher than that of the login user cannot be changed. To change the password of the login user, click [Project] → [Security] → [Change Password]. 1) Select the user name "Developers". 2) Click the Password Setup button. 1) Select! 2) Click! 3) The Change Password dialog box is displayed. Enter the following items.
6.8.3 Logging in projects A user authentication is required for opening a project with security. 1) Enter items! 1) When a project with security is opened, the User Authentication screen is displayed. Enter a user name and a password for log-in, and click the OK button. Enter the following user name and password, which are set in section 6.8.1. 1) Click! User Name Password : MITSUBISHI : MITSUBISHI 2) The project is displayed.
6.8.4 Changing access authority for each access level This section explains how to set an authorization of displaying and saving data for each access level. The access authority of access levels higher than that of the login user cannot be changed. When the access level of the current login user is "Users", the access authority cannot be changed. 1) Click [Project] → [Security] → [Data Security Setting]. 1) Click! 2) The Data Security Setting dialog box is displayed.
6.9 Sampling Trace Function This function is used to acquire data at the specified timing to find how device values change during program operation and to trace the changes displayed in time series. For details of the sampling trace function, refer to the manuals of each CPU module. In this example, the device value at an error occurrence is acquired. Project name Program name TRACE MAIN As a preparation, follow the procedure below. 1) Click the "PLC RAS" tab on the Q Parameter Setting dialog box.
(1) Setting the sampling trace 1) Click [Debug] → [Sampling Trace] → [Open Sampling Trace]. 1) Click! 2) The Sampling Trace screen is displayed. 3) Click [Debug] → [Sampling Trace] → [Trace Setting].
(From the previous page) 4) The Trace Setting dialog box is displayed. Select "Standard RAM" from the "Target Memory" list box. 5) Click! 4) Select! 5) Click the Condition Setting tab. 6) Check "Detail Setting" in the Trigger Condition Setting area and click the Setting Change button.
(From the previous page) 7) The Detail Setting - Trigger Condition dialog box is displayed. Set the following items. In this example, set error occurrence as trigger condition. 7) Enter item and set! Device/Label : SM0 Condition : -P8) Click the 8) Click! End Setting button. 9) The Detail Setting - Trigger Condition dialog box disappears. Click the End Setting button to close the Trace Setting dialog box. 10) Set devices to be traced on the Sampling Trace screen as shown on the left.
(2) Starting the sampling trace 1) Click [Debug] → [Sampling Trace] → [Start Trace]. 1) Click! 2) The message shown on the left is displayed. Click the Yes button. 3) The Trace Data Storage Status screen is displayed when the sampling trace is started. After confirming that the total data reaches 100%, operate digital switches to generate an error. 4) The trace result is displayed on the Sampling Trace screen.
(3) Checking the trace result 1) Scroll the trend graph screen to the trigger point to check the device value at an error occurrence. POINT Saving trace data to a personal computer Click [Debug] → [Sampling Trace] → [Export CSV Data]. The following dialog box is displayed. After entering a file name, click the Save button.
CHAPTER 7 7.1 PROGRAMMING INTELLIGENT FUNCTION MODULE Intelligent Function Module (1) Intelligent function module type On programmable controller CPUs (hereinafter referred to as QCPUs), some functions are not supported or are limited in use. Intelligent function modules support those functions instead of QCPUs. Therefore users need to select an intelligent function module that is appropriate for the purpose involved. QCPUs are compatible with QCPU-compatible intelligent function modules.
Data Communication between Intelligent Function Modules and CPUs An intelligent function module and a CPU exchange mainly two formats of data. Bit data ------------Signals that use input Xs and output Ys Word data --------16-bit data or 32-bit data QCPU Internal configuration of the intelligent function module Figure 7.2 X/Y Function CPU Input X Output Y (Bit data) External I/F Device memory such as X, Y, M, T, C, D (Programmable controller CPU) Program 7.
7.2.1 I/O signals to CPUs For 1-bit signals exchanged between a QCPU and an intelligent function module, input Xs and output Ys are used. Xs and Ys here do not mean external I/Os but symbols that are used in a sequence program to exclusively represent I/O signals of intelligent function modules. Also note that I/O numbers are assigned according to the slot where the intelligent function module is installed.
7.2.2 Data communication with intelligent function modules Data is transmitted or received in 16-bit or 32-bit units. Intelligent function modules have a buffer memory to store those data.
7.3 Communication with Intelligent Function Module 7.3.1 Communication methods with intelligent function modules The following table shows the communication methods between a QCPU and an intelligent function module. Table 7.2 Communication method with intelligent function modules Communication Function method Initial setting, Performs initial settings and auto refresh settings of intelligent function modules.
Intelligent Function Module System in Demonstration Machine Use an A/D or D/A converter module to convert analog signals/digital data that are input with the volume or digital switch on the demonstration machine. D/A converter module A/D converter module QX QY Q64 Q62 42 42P AD DAN slot (16 (64 (64 (16 points) points)points) points) (Channel 1) V X/Y90 to X/Y9F X/Y80 to X/Y8F Y40 to Y7F Q61P QCPU Vacant X0 to X3F 7.
7.5 7.5.1 Q64AD Analog/Digital Converter Module Names of parts The following explains the parts of Q64AD. For details, refer to the User's Manual. Q64AD Q64AD 1) RUN 2) ERROR V+ V- C H 1 I+ SLD V+ V- C H 2 I+ SLD V+ V- C H 3 I+ SLD V+ 10 11 12 13 V- C H 4 1 2 3 4 5 6 7 8 9 I+ SLD A.G. 14 15 16 17 (FG) A/D 0-±10V 0-20mA No. Name and 18 Description appearance Indicates the operation status of the A/D converter module.
A/D conversion characteristics (1) A/D conversion characteristics on voltage inputs (For analog input range from -10 to 10V in a standard resolution mode) 4000 Digital output 0 2003 2002 2001 2000 -4000 -10V 0 Analog input voltage Figure 7.12 10V 5.0025V 2.5mV 5.0000V Digital output value 2004 Input voltage A/D conversion characteristics (voltage input) A/D converter modules convert analog values input from other devices to digital quantities so that CPUs can operate those values.
7.5.3 List of I/O signals and buffer memory assignment (1) List of I/O signals The following shows a list of the I/O signals for the A/D converter modules. Note that I/O numbers (X/Y) shown in this section and thereafter are the values when the start I/O number for the A/D converter module is set to 0. Signal direction: CPU ← A/D converter module Device No. (input) Signal name Signal direction: CPU → A/D converter module Device No.
(2) Buffer memory assignment (Q64AD) This section explains the assignment of the Q64AD buffer memory. POINT Do not write data to the system areas or areas to which writing data from a sequence program is disabled. Doing so may cause malfunction.
Buffer memory assignment (Q64AD) (2/2) Address Description Hexadecimal Decimal 18H 24 ... ... 1DH 29 Default System area - Read/ *1 write - 1EH 30 CH1 Maximum value 0 R/W 1FH 31 CH1 Maximum value 0 R/W 20H 32 CH2 Maximum value 0 R/W 21H 33 CH2 Maximum value 0 R/W 22H 34 CH3 Maximum value 0 R/W 23H 35 CH3 Maximum value 0 R/W 24H 36 CH4 Maximum value 0 R/W 25H 37 CH4 Maximum value 0 R/W 26H 38 ... ...
7.5.4 Adding or setting intelligent function module data This section explains how to set the intelligent function module data. After an intelligent function module is added to a project, the data settings (parameters and switch settings) of the intelligent function module can be set. 1) Click [Project] → [Intelligent Function Module] → [New Module]. 1) Click! 2) The New Module dialog box is displayed. 3) Set the A/D converter module setting as follows.
(From the previous page) 6) Double-click Switch Setting. 6) Double-click! 7) Set! 7) The Switch Setting screen is displayed. Set Input range for CH1 to "0 to 10V". 8) Click the OK button. 8) Click! 9) Double-click Parameter. 9) Double-click! 10) The Parameter screen is displayed. Set "A/D conversion enable/disable setting" for CH2 to CH4 to "1:Disable". (Only CH1 is used.
(From the previous page) 11) Double-click Auto_Refresh. 11) Double-click! 12) The Auto_Refresh screen is displayed. Set Digital output value for CH1 to "D10". 12) Set! 13) Click [Project] → [Intelligent Function Module] → [Intelligent Function Module Parameter List].
(From the previous page) 14) Check that "Setting Exist" is checked in Initialization (Count) and Auto Refresh (Count) for Q64AD in the Intelligent Function Module Parameter List dialog box. 15) Click the 15) Click! 7 - 15 Close button.
7.5.5 Exercise with the demonstration machine (1) Sequence program The sequence program executes a sampling processing on analog voltages input through CH1 of Q64AD, and then converts the analog values to digital values. Set the start XY of Q64AD to 80 as explained before.
7.6 7.6.1 Q62DAN Digital/Analog Converter Module Names of parts The following explains the parts of Q62DAN. For details, refer to the User's Manual. Q62DAN 1) 2) 3) No. Name and Description appearance Indicates the operation status of the D/A converter module. 1) RUN LED ON : In normal operation Flicker : In offset/gain setting mode OFF : 5V power failure or watchdog timer error occurred Indicates errors and the status of the D/A converter module.
D/A conversion characteristics (1) D/A conversion characteristics on voltage outputs (For analog output range from -10 to 10V in a standard resolution mode) Analog output voltage Analog output voltage 10V 0 -10V - 4000 0 5.0025V 2.5mV 5.0000V 2000 20012002 2003 2004 4000 Digital input Digital input value Figure 7.14 D/A conversion characteristics (current output) D/A converter modules convert digital quantities that are input from a QCPU into analog values, and then output them.
7.6.3 List of I/O signals and buffer memory assignment (1) List of I/O signals The following shows a list of the I/O signals for the D/A converter modules. The following explanation is mentioned based on the Q68DAVN, Q68DAIN, Q68DAV and Q68DAI with 8-channel analog output (CH1 to CH8). Note that I/O numbers (X/Y) shown in this section and thereafter are the values when the start I/O number for the D/A converter module is set to 0.
(2) Buffer memory assignment (Q62DAN) This section explains the assignment of the Q62DAN buffer memory. POINT Do not write data to the system areas or areas to which writing data from a sequence program is disabled. Doing so may cause malfunction.
7.6.4 Adding or setting intelligent function module data 1) Click [Project] → [Intelligent Function Module] → [New Module]. 1) Click! 2) The New Module dialog box is displayed. 3) Set the A/D converter module setting as follows. Module Type : Analog Module Module Name : Q62DAN Mounted Slot No. : 4 (Specify start XY address: 0090) 4) Click! 4) Click the OK button. 3) Set! 5) The specified intelligent function module data are added to the Project window.
(From the previous page) 6) Double-click Switch Setting. 6) Double-click! 7) The Switch Setting screen is displayed. Set Output range for CH1 to "0 to 5V". 7) Set! 8) Click the OK button. 8) Click! 9) Double-click Parameter. 9) Double-click! 10) The Parameter screen is displayed. Set "D/A conversion enable/disable setting" for CH1 to "0:Enable". (Only CH1 is used.
(From the previous page) 11) Double-click Auto_Refresh. 11) Double-click! 12) The Auto_Refresh screen is displayed. Set Digital value for CH1 to "D30". 12) Set! 13) Click [Project] → [Intelligent Function Module] → [Intelligent Function Module Parameter List].
(From the previous page) 14) Check that "Setting Exist" is checked in Initialization (Count) and Auto Refresh (Count) for Q62DAN in the Intelligent Function Module Parameter List dialog box. 15) Click the 15) Click! 7 - 24 Close button.
7.6.5 Exercise with the demonstration machine (1) Sequence program The sequence program converts values of the digital switches to analog signals. Set the start XY to 90 and the digital value for CH1 to D30 for Q62DAN as explained before.
MEMO 7 - 26
CHAPTER 8 SIMULATION FUNCTION 8.1 Simulation Function The simulation function is for debugging a sequence program using the virtual programmable controller on a personal computer. The created sequence program can be immediately debugged without connecting a programmable controller CPU. NOTE Safety and handling precautions of the simulation function 1) The simulation function simulates the actual programmable controller CPU to debug a created sequence program.
8.3 Debugging with Example Program Use the following example for exercise.
8.3.1 Monitoring and testing device status This section explains how to monitor device status, turn bit devices on/off forcibly, and change word device values. (1) Turning bit devices on/off forcibly In the example operation below, "X0" is forcibly turned on. 1) Click [Debug] → [Modify Value]. 1) Click! 2) The Modify Value dialog box is displayed. Input "X0" to the "Device/Label" list box. 2) Enter "X0"! 3) Click the on.
(2) Changing the word device value In the example operation below, the word device value "C0" is changed to "5". 1) Click [Debug] → [Modify Value]. 1) Click! 2) Enter "C0"! 2) The Modify Value dialog box is displayed. Input "C0" to the "Device/Label" list box. 3) Select! 3) Select the "Word[Signed]" from the "Data Type" list box. 4) Enter "5"! 5) Click! 4) Input "5" to the "Value" column. 5) After the setting is completed, click the Set button to forcibly change the current value of C0 to 5.
CHAPTER 9 MAINTENANCE Typical Trouble The following bar graph shows the ratio of faulty parts and causes of programmable controller errors. [Source: Inspection made by JEMA (The Japan Electrical Manufacture's Association)] Figure 9.1 Faulty parts on programmable controllers (multiple answers allowed) (%) 80 Collected from 223 factories 73.1 60 40 34.1 20.6 20 19.3 14.3 9.4 0.9 No answer Others Memory Communication CPU Power supply I/O Peripheral device 2.7 0 Figure 9.
Maintenance To keep programmable controllers in the best operating condition, conduct the following daily inspection and periodic inspection. (1) Daily inspection The following table lists the items that must be inspected daily. Table 9.1 Daily inspection Item Inspection item Inspection contents Judgment criterion Measures 1 Installation of base unit Check that fixing The screws and screws are not loose cover must be and the cover is not installed securely. dislocated. Retighten the screws.
(2) Periodic inspection The following table lists the items that must be inspected one or two times every half year to a year. When the equipment has been relocated or modified, or wiring layout has been changed, perform this inspection. Table 9.
Service Life of Output Relay The output relays of the modules are consumed by the switching operation. A relay which is directly mounted on the print board of the output module is required to be replaced the output module itself after the consumption. 1000 500 200 Limit number of switching (unit: 10,000) 9.4 100 50 20 10 DC30V t=0ms 5 DC100V t=7ms DC24V t=7ms 2 1 0.1 0.2 0.5 1 2 Switching current (unit: A) AC100V COS =0.7 AC200V COS AC100V COS =0.7 =0.35 AC200V COS =0.
9.5 Spare Product Alternative products are easily purchased through Mitsubishi service centers or local Mitsubishi representatives in Japan. Thus the alternative products can be prepared even after an accident. However, note that for foreign-related products such as exported products, alternative products must be sent beforehand. Considering the following tips at design work makes the maintenance easier. (1) Easily replaceable type Replacing building block-type modules is easy.
(7) Spare product Table 9.3 Spare products Product name Quantity Remark Storage lives of lithium batteries are about five years. 1 Battery One or two Therefore, the stock should not be kept all the time but batteries should be purchased when required. However, keep stock of one or two for accidental situation. Note that I/O modules tend to be faulty during a test 2 I/O module One per each operation. module type Also note that the contacts of output modules are consumed in long-term use.
9.6 Using Support Equipment The following shows examples of support equipment in which programmable controller-used systems or devices automatically notify a detected failure or operation status to an operator or maintenance personnel during an automatic control operation. Displaying an error using a commercial lamp 1. Connect the error lamp to the output module of the programmable controller so that the lamp flashes when an error is detected.
3. Displaying the contents of the detected error on the screen The errors details of the programmable controller can be displayed on an external CRT screen, plasma screen, and liquid crystal screen. Screen display Starting first step in progress Arm Conveyor Error occurred! 00070 MELSEC-Q supports a wide variety of GOTs (Graphic Operation Terminals).
APPENDIX Appendix 1 I/O Control Mode The CPU supports two types of I/O control modes; the direct mode and refresh mode. Appendix 1.1 Direct mode In the direct mode, input signals are imported to a programmable controller every time they are input and treated as input information. The operation results of a program are output to the output data memory and the output modules. The following diagram shows the flow of I/O data in the direct mode.
Appendix 1.2 Refresh mode In the refresh mode, all changes caused in an input module are imported to the input data memory in a programmable controller CPU before every scan. The data in the data memory is used for an operation. The operation results made in a program for output (Y) are stored to the output data memory at every operation. All the data stored in the output data memory is batch-output to the output module after the execution of the END instruction.
Appendix 1.3 Comparisons between the direct mode and refresh mode In the example ladder given below, turning on input X0 turns on output Y70. Item Direct mode Refresh mode DX0 X0 Y70 1. Ladder example Y70 Program execution Program execution Input instruction (LD X0) Input instruction (LD X0) Output instruction (OUT Y70) Output instruction (OUT Y70) 0 2.
Appendix 2 Special Relay The special relay (SM) is an internal relay whose application is fixed in the programmable controller. For this reason, the special register cannot be used in the same way as other internal registers are used in sequence programs. However, the bit of the special relay can be turned on or off as needed to control the CPU module. The following shows how to read the items in the list.
Appendix 3 Special Register The special register (SD) is an internal register whose application is fixed in the programmable controller. For this reason, the special register cannot be used in the same way as other internal registers are used in sequence programs. However, data can be written to the special register to control the CPU module as needed. Data is stored in binary format if not specified. The following shows how to read the items in the list.
Appendix 4 Appendix 4.1 Application Program Example Flip-flop ladder (1) Y70 turns on when X0 is turned on, and turns off when X1 is turned on. X0 0 SET Y70 RST Y70 X1 2 (2) When X2 is turned on, Y71 turns off if Y70 is on, and turns on if Y70 is off. This flip-flop operation is repeated. X2 Project name QA-16 Program name MAIN K5 T1 T0 0 K5 T0 T1 6 Y70 T0 Y71 12 X02 Contact T0 Contact T1 Y70 Y71 App.
(3) The flip-flop operation starts when X2 is turned on. In this operation, Y70 turns on if the timer T0 is on, and Y71 turns on if the timer T1 is on. (Cycle: 10sec.) X2 Project name QA-17 Program name MAIN K50 T1 T0 0 T1 T0 PLS 7 M0 Y70 M0 RST 11 T1 K50 T0 T1 16 T1 T1 Y71 22 PLS M1 RST T0 M1 26 X2 Contact T0 Contact T1 Y70 Y71 App.
Appendix 4.2 One shot ladder (1) Output starts and continues for a certain time after the input X1 is turned on. (Time for the input being on must be longer than the set time limit.) K70 X1 0 T15 T15 Y75 X1 Normally closed contact T15 Y75 Set time limit 7sec. (2) When the input X0 is turned on momentarily, Y76 turns on for a certain time. X0 T16 K100 0 T16 Y76 Y76 (3) Output starts and continues for a certain time when the input X0 is switched from on to off.
Appendix 4.3 Long-time timer (1) Necessary time is obtained by connecting timers in serial. 0 5 11 K30000 3000.0sec. T9 K20000 T10 2000.0sec. X2 T9 T10 Y72 Turns on after time limit elapses X2 Normally open contact T9 Normally open contact T10 Y72 3000sec. 2000sec. 5000sec. (2) Necessary time is obtained by using timers and counters. Time limit of timer Set value of counter = Long-time timer (note that accuracy of timers are accumulated.
Appendix 4.4 Off delay timer MELSEC-Q does not provide off delay timers. Configure an off delay timer as follows. (1) The timer T6 starts operating when X5 is turned off. Y70 K8 X5 T6 0 X5 T6 Y70 6 Y70 X5 Coil T6 Normally closed contact T6 Y70 Set time limit 0.8sec. (2) Turning on X5 momentarily sets the operation ready. The timer T8 starts operating when X6 is momentarily turned on. X5 T8 Y71 0 Y71 X6 K41 Y71 T8 4 M45 M45 X5 X6 Coil T8, M45 Normally closed contact T8 Y71 Set time limit 4.
Appendix 4.5 On delay timer (momentary input) An on delay timer of a programmable controller operates easily with a continuous input. A relay M must be used with a momentary input. 0 X1 X2 10 QA-19 Program name MAIN T4 T4 K62 M50 Timer starts after X1 turns on, and continues to be activated. Y70 Turns on 6.2sec. later Y71 Turns off 6.2sec. later T4 M50 8 Project name X1 X2 T4,M50 Y70 Y71 Set time limit 6.2sec.
Appendix 4.6 ON-OFF repeat ladder In an ON-OFF repeat ladder, Y70 turns on when X1 is turned on, and turns off when X1 is turned on again. X1 0 FF Appendix 4.7 Y70 Preventing chattering input The timer is set so that it starts output when the input keeps being on for 0.2sec. K2 X0 T1 0 T1 M1 5 M1 turns on when X0 keeps being on for 0.2sec. or longer. Therefore, use M1 instead of X0 when creating a program. App.
Appendix 4.8 Ladders with a common line The following ladder cannot be operated as it is. To make such ladders controllable, use master control instructions (MC, MCR) in the program.
Appendix 4.9 Time control program The time value is set in the two digits of a digital switch. The currently elapsed time is displayed on Y40 to Y47 while the outputs Y70 to Y72 turn on after the set time limit has elapsed. This operation is repeated. 0 3 7 16 21 Digital switch for setting time Display for current time 59 26 0.1sec. units Programmable controller X20 to 27 Y40 to 47 Push button for reading time X3 Turns on when current Y70 value is less than 2sec.
Appendix 4.10 Clock ladder The clock data such as hour, minute, and second is output to a digital display. 0 5 10 15 24 33 38 Project name QA-3 Program name MAIN T1 T0 T0 T1 T1 C11 RST C12 RST C13 SM400 47 seconds K2Y40 Tens digit 18 Ones digit minutes K2Y48 Tens digit 0.5-sec.
Appendix 4.10.1 Clock function (supplement) The following ladder displays the time setting set in GX Works2 to the Q demonstration machine. Project name App.
App.
Appendix 4.11 Starting - operation of electrical machinery operation. After the operation time has Turning on the start switch starts the elapsed, the operation mode is activated through an arc interlock state. 0 X0 X1 Y70 9 13 18 Y70 Y72 Y70 Y71 Program name MAIN Y71 K5 T6 T5 T6 QA-20 Y70 K20 T5 Y72 T5 Project name Y72 Y72 Start X0 Stop X1 Operation Y70 Y71 operation operation Y72 T5 = 2sec. T6 = 0.5sec. Arc interlock App.
Appendix 4.12 Displaying elapsed time and outputting before time limit The following ladder outputs the time elapsed in the timer on the LED display, and indicates that the set time limit has been reached. This system can also be applied to counters. Elapsed time display (Four digits of BCD) Output module Y6C to 6F X2 Y68 to 6B Starts when turned on Stops when turned off 0 Y64 to 67 Y60 to 63 × 100 × 10 ×1 × 0.
Appendix 4.13 Retentive timer The input X2 switches between on and off continuously. The on-time of X2 is accumulated and Y72 turns on according to this accumulated value n.
Appendix 4.14 Switching timer set value externally (1) With an external switch, a value to be set in one timer can be selected from three patterns; 1sec., 10sec., and 100sec. A timer is activated and reset with a push button switch. 1sec. SC 10sec. 100sec. PB Starts timer PB Resets timer Input power supply 0 3 6 9 11 12 OL Indicates the timer is in operation. X0 Y70 X1 RL Indicates the timer has gone time out.
Appendix 4.15 Setting counters externally With an external digital switch having 4 digits, a counter can be set remotely and their current values are displayed in 4 digits. In addition to every count-up, the timer outputs data when it reaches a value 100 short of the set value and a value 50 short of the set value. Note that a setting error is indicated if the set value of the counter is less than 100.
0 2 4 12 24 X0 X1 M0 M0 X5 BIN > Y70 K100 Project name QA-4 Program name MAIN SET M0 RST M0 K4X20 D0 Reads set value Y70 Outputs error when set value is 100 or less D0 MOV D0 D1 - K100 D1 MOV D0 D2 - K50 D2 C0 Setting Set value -100 (100 short of set value) Y71 Set value -50 (50 short of set value) ON during operation Y71 28 31 Y71 MC N0 X3 M3 C0 C1 C2 44 45 58 62 64 66 X1 M0 BCD C1 MCR N0 RST C0 RST C1 RST C2 C0 D0 D1 D2 K4Y60 Y72 C2 Y73 C0
Appendix 4.16 Measuring operation time Setting an operation time to a control target is useful for judging the timing of a component replacement and lubrication. The timer ST and data register D must have a backup power source so that they can continue operating at a power failure. With the contents of D31 (in one hour units) displayed externally, the program can work as an operation timer.
Complement Appendix 4.18 Application example of (D) C M L (P) The following explains how to obtain absolute values of negative values -32768 or smaller (to -2147483648, 32 bit data).
Program showing divided value of 4-digit BIN value to 4 places of decimals (1) Example 1 The program displays the operation result using a dividend and a divisor which are individually specified in two 4-digit digital switches on two 4-digit displays (integral part and decimal part).
Sequence program of example 1 The FOR-NEXT instruction is executed to divide each decimal place individually and 4 decimal places are displayed in K4Y40.
(2) Example 2 In example 2, D0 is divided by D1 to obtain D5 in 4 decimal places. The dividend D0 is multiplied with 10000. The result of the dividing calculation using this multiplied value is converted to a BCD value and output to an external digital display. 0 K4Y60 K4Y50 K4Y40 D7, remainder of a decimal number D6, integral number in 4 digits D5, decimal number in 4 digits X0 Project name QA-6 Program name MAIN BINP K4X30 D0 BINP K4X20 D1 MOVP K0 App.
Appendix 4.20 Carriage line control The following is an example of a sequence control using a carriage to convey works (materials). Series of operations performed in one cycle is as follows; A work is set on the carriage, the carriage moves forward, the carriage stops at the forward limit, the arm pushes the work to the other conveyor side, and the carriage moves back to the backward limit.
0 X0 Y70 M2 Project name QA-10 Program name MAIN Y70 X1 X3 M1 Y71 X2 PLS M1 SET Y71 RST Y71 SET Y73 K30 T0 RST Y73 SET Y74 RST Y74 SET Y72 RST Y72 Y73 T0 Y74 X4 Y72 X3 M2 Timing chart Start button X0 Switch (LS work present) X1 Switch (LS forward limit) X2 Switch (LS backward limit) X3 Switch (LS open complete) X4 Operation indicator Y70 Carriage moves forward. Y71 Carriage moves back. Y72 Push Y73 Push back Y74 3sec App. - 30 Operation indicator Carriage moves forward.
Appendix 4.21 Compressor sequential operation using ring counters This system provides pressure control using three compressors. A pressure shortage is detected by the three pressure switches. The number of compressors operating simultaneously depends on the degree of shortage. To equal the number of usages of each compressor, compressors are activated according to the set order.
Operation explanation (1) The pressure switches (X2, X3, and X4) are initially off. In this state, turning on the start switch (X0) activates the three compressors all together, and when sufficient pressure is obtained (X2, X3, and X4 turn on), the three compressors stop. This is the basic operation of this system.
0 X0 X1 Project name QA-11 Program name MAIN M0 During operation Y73 Indicates pressure status Y74 Pressure shortage "Minor" Y75 Pressure shortage "Medium" Y76 Pressure shortage "Major" PLS M1 Turns on M9 at startup PLS M2 Shifts by pressure shortage "Minor" SET M9 RST M9 RST M12 RST M11 RST M10 SFT M13 SFT M12 SFT M11 SFT M10 RST M13 SET M10 Returns shift to M10 Y70 Compressor A Y71 Compressor B Y72 Compressor C M0 4 6 X4 X4 X3 X4 Y76 Y75 Pressure shor
After the basic operation, one compressor is activated in reaction to pressure shortage detected. To use the three compressors equally, they are activated according to the set order. This control is enabled by the 3-stage ring counter (ring-shaped shift registers) M10 to M12. A shift signal is generated when pressure shortage is detected (X04 switches from on to off). Compressor A X0, Start X1, Stop SET M9 RST M10 B M11 C M12 X4, (PX3) OFF Shift operation X4 M10 M11 M12 App.
Appendix 4.22 Application example of positioning control The following is an example of a positioning system with a pulse generator that outputs pulses per motor, brake, and unit of distance. In this system, a command value is set with the digital switch, and this set command value is compared with the current value at start-up to determine in which direction, forward or reverse, the motor rotates.
Appendix 4.23 Application example using index Z (1) The number of manufactured products is counted every day in one month cycle, and the resulting number is stored to the corresponding register of the date (D1 to D31). (2) The planned number of products to be manufactured is inputted with the external digital switch. Production stops when this number is accomplished. (3) The date is also specified with the external digital switch.
0 = K0 K4X20 16 (0.1-sec.
Appendix 4.24 Application example of FIFO instruction Manual coating work and its working time can be stored and duplicated by machinery later.
Operation pattern from manual to automatic operation Coating bath Teaching panel Cleaning machine X00 = Manual right moving button X01 = Manual left moving button X02 = Manual cleaning button X03 = Recording data button X05 = Reading data button X06 = Automatic operation button X07 = Operation stop button Y73 = Automatic operation indication LED Y70 = Conveyor, Moving right Y71 = Conveyor, Moving left Y72 = Conveyor, Cleaning Start moving to right (X00 = ON) Stop moving to right (X00 = OFF) Start clean
Project name QA-9 Program name MAIN SM403 FMOV 0 X6 X7 > 5 D10 M2 K0 D0 K50 Resets data to 0 only once at RUN Y73 Outputs to automatic operation indication LED (Automatic operation mode is also indicated.
Appendix 4.25 Application example of data shift Works are conveyed along with their code numbers, and the data register of the processing machinery is analyzed to machine the work according to its code number.
0 X0 X1 Project name QA-12 Program name MAIN Y70 During operation D30 Imports code number K6 Shifts code number Y70 4 8 12 SM400 (always ON) MOV X2 Y70 K1X20 DSFLP D30 = K1 D30 M1 = K2 D30 M2 = K3 D30 M3 = K4 D30 M4 = K5 D30 M5 = K6 D30 M6 = K7 D30 M7 = K8 D30 M8 = K1 D31 M11 = K2 D31 M12 = K3 D31 M13 = K4 D31 M14 = K5 D31 M15 = K6 D31 M16 = K7 D31 M17 = K8 D31 M18 = K1 D32 M21 = K2 D32 M22 = K3 D32 M23 = K4 D32
135 Y70 = K1 D33 M31 = K2 D33 M32 = K3 D33 M33 = K4 D33 M34 = K5 D33 M35 = K6 D33 M36 = K7 D33 M37 = K8 D33 M38 = K1 D34 M41 = K2 D34 M42 = K3 D34 M43 = K4 D34 M44 = K5 D34 M45 = K6 D34 M46 = K7 D34 M47 = K8 D34 M48 = K1 D35 M51 = K2 D35 M52 = K3 D35 M53 = K4 D35 M54 = K5 D35 M55 = K6 D35 M56 = K7 D35 M57 = K8 D35 M58 Machinery D 176 Y70 Machinery E 217 Y70 Machinery F App.
Appendix 4.26 Project name QA-14 Program name MAIN Example of operation program calculating square root of data The data stored in D5 is calculated to its square root and the result is stored in D6 and D7. 0 X0 MOVP K4X20 D5 Sets data BSQR D6 Square root operation Square root (integral part) Square root (decimal part) D5 MOVP D7 K4Y50 MOVP D6 K4Y60 Results of square root operation are stored as follows.
Appendix 4.27 Project name QA-15 Program name MAIN Example of operation program calculating n-th power of data A value stored in D10 is calculated to its n-th power ("n" is a value stored in D14) and the result is stored in D10.
Appendix 4.
Appendix 4.29 Displaying number of faults and fault numbers using fault detection program The following program sequentially displays the number of turned-on bit devices (such as X, M, and F) among many bit devices being used continuously, together with their device numbers. [Application example] When M or F is used as an output device of a fault detection program, use the following program to obtain a certain fault number from the faults.
0 4 8 12 16 20 24 28 32 36 40 44 48 73 80 95 X20 Project name QA-31 Program name MAIN F3 X24 F5 X28 F8 X2C F13 X30 F33 X34 F35 Faulty circuit X38 F37 X3C F39 X4 F1 X5 F11 X6 F16 X7 F40 X2 M200 DSUMP K8F1 D0 MOVP D0 D10 DSUMP K8F33 D0 +P D0 D10 BCDP D10 K4Y40 SET M400 RST M700 PLS M500 SET M700 SET M200 RST M600 MOV K0 Z0 DMOV K8F1 D0 DMOVP K8F33 D0 X000 M200 M400 M500 M600 App.
103 M100 M200 DROR D0 SM700 BCD 120 125 SET M100 INC Z0 Z0 X1 M700 K1 K4Y60 PLS M300 RST M100 M300 < K0 D10 BCD K1 D10 D10 K4Y40 144 = K32 Z0 SET M600 150 = K50 Z0 RST M200 MOVP K0 164 Searches for ON devices shifting 32-bit data to right M800 K4Y60 PLS M800 RST M400 Searches for next ON devices Resets when search is finished (1) Searching for ON devices DSUMP K8F1 D0 DSUMP K8F33 D0 32 bits F F 3231 F F F F 4 3 2 1 S before execution (K8F1) 1 1 1 0 0 1 0
F 16 Transferred by the MOVP instruction F 1 1 1 0 0 0 0 1 1 1 1 1 1 0 0 0 1 D0 D10 16 16 1 1 1 0 0 1 0 0 1 0 0 1 0 0 0 1 F 32 F 48 F 17 F 33 D0 0 0 0 1 1 1 0 0 0 0 1 1 0 0 0 1 Added by a +P instruction 7 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 0 F 64 F F 50 49 D10 23 Number of ON inputs among X20 to 5B (2) Searching for ON devices shifting 32-bit data to right DROR DMOV K8F1 D0 DMOV K8F33 D0 D0 F F 32 31 F 3 F 2 F 1 1 0 0 1 1 K1 F 0 32 bits DMOV instruction D1,D0 1 1 1 0 0 D1 (16
Appendix 5 Memory and File to be Handled by CPU Module Data to be stored in memories The following table lists the data and drive numbers which can be stored in the program memory, standard RAM, standard ROM, and memory card. Memory CPU module built-in memory Memory card (ROM) card (RAM) File name and Item Program Standard Remarks Standard SRAM card memory *1 Drive 0 RAM Flash card ATA card extension ROM *1 Drive 3 *1 Drive 4 *1 *1 Drive 1 Drive 2 Parameter PARAM.
Memory capacities and necessity of formatting The following tables list the memory capacities and necessity of formatting of each memory.
Appendix 6. Comparison with GX Developer (changes) (1) Supported CPU modules The following table lists the CPU modules that are supported in GX Works2.
(2) Unsupported features The following table lists the features that are not supported in GX Works2. Use GX Developer, GX Simulator, or GX Configurator for the following features.
(3) Supported project types The following table lists the project types that are supported in GX Works2. Project type Simple project (without labels) Description This is the equivalent of the "Do not use label" project of GX Developer. 1) When a project created in the "Do not use label" of GX Developer is read with GX Works2, the project becomes the Simple project (without labels).
(4) Programming languages supported by each project type The following table lists the programming languages that are supported by each project type of GX Works2.
(b) Using SFC (MELSAP3) language Before using the SFC (MELSAP3) language in GX Works2, review the following precautions. Function Description (differences between GX Developer and GX Works2) GX Developer Change block number GX Works2 It is enabled by the "copy and paste" Each block data is displayed in the Project function in block list. window, and the block number can be changed in the property of each block data.
(d) Using function blocks Before using function blocks in GX Works2, review the following precautions. Function Description Use function blocks created with ladder Function blocks created with ladder can be used for ladder program, ST program, and SFC program operation outputs.
(7) Using device initial values Before using device initial values in GX Works2, review the following precautions. Function Maximum amount of device initial value data to be created Restriction of device number Write to PLC/read from PLC IC memory card write/read Description (differences between GX Developer and GX Works2) GX Developer GX Works2 Only one set of data can be created. Up to 800 sets of data can be created.
(9) Using monitor/debug function Before using the monitor/debug function in GX Works2, review the following precautions. Function Entry device monitor Device batch monitoring Buffer batch monitoring Monitor and test intelligent function modules Description The "entry device monitor" function is now a docking window as a "watch" function so that it can be displayed without overlapping with the program editor.
(13) Compatibility with GX IEC Developer For the compatibility between GX IEC Developer and GX Works2, review the following precautions. Function Open projects in other formats Description Function names of ST language are different between GX IEC Developer and GX Works2. Compile the program and correct errors. Before using GX IEC Developer user libraries which a password is set to, cancel the password in GX IEC Developer.
Appendix 7 Customizing Shortcut Keys Shortcut keys of each function can be customized. Customized shortcut keys can be registered as a template and utilized. Screen display Select [Tool] → [Key Customize]. Item Shortcut Key Category Command Current Key Press the keys to assign Description Select a category from the group list categorized by window. Select a function name whose shortcut key is to be changed. Displays the shortcut key assigned to the selected command.
Screen button Assigns the shortcut key. The assigned shortcut key is displayed in "Current Key". Deletes the shortcut key selected in "Current Key". The Enter Template Name screen is displayed. Register the assigned shortcut keys as a template with a name. The registered template is displayed in "Template". The selected template of shortcut keys is applied. Deletes a template selected in "Template". Imports a pre-saved template file (*.gks) and adds it to "Template".
Indexing In the Universal model QCPU (excludes Q00UJCPU), expanding the index register to 32 bits enables the indexing for all the file register areas. SM400 ZR0 ZR1 ZR32767 ZR32768 Area to which indexing can be used of Universal model QCPU Serial number access format file register Conventional area to which indexing can be used Appendix 8 DM0V K1042431 Z0 M0V D0 ZR0Z0 To index the serial number access format file register (ZR) with 32-bit, use the index register (Z).
(c) Device for which indexing can be used Indexing can be used only for the devices shown below. • ZR: Serial number access format file register • D: Extended data register • W: Extended link register (d) Usable range of index registers The following table shows the usable range of index registers for indexing with 32-bit index registers. For indexing with 32-bit index registers, the specified index register (Zn) and the next index register of the specified register (Zn+1) are used.
(2) When specifying the 32-bit indexing using "ZZ" specification (a) One index register can specify 32-bit indexing using "ZZ" specification such as "ZR0ZZ4". The following shows the 32-bit indexing with "ZZ" specification. M0 DMOVP K100000 Z4 Stores 100000 at Z4 and Z5.
(e) The following shows an example of the 32-bit indexing with "ZZ" specification and the actual processing device.
Appendix 9 FB Appendix 9.1 FB FB is an abbreviation for a Function Block that is designed to convert a ladder block, which is used repeatedly in a sequence program, into a component (FB) to be utilized in a sequence program. This not only increases the efficiency of program development but also reduces programming mistakes to improve program quality. Converted into a component FB Figure App. 9.1 Converting a sequence program into a component Appendix 9.1.
Appendix 9.1.2 Advantages of using FBs This section introduces advantages of creating programs by using FBs. (1) Easy programming A sequence program can be created simply by pasting FBs. This significantly reduces the program development man-hours. (FB libraries provided by Mitsubishi Electric Corporation. makes programming easier.) Only select an FB from the Selection window and drag and drop it to paste.
(3) Reusing Converting a standard program into a component allows the program to be reused any number of times. As a result, operations such as copying a sequence program and modifying a device, which have often been required in the past, will be unnecessary.
(5) Protecting assets By setting up a block password, the created FB can be protected so that it cannot be viewed. Convert the program into an FB and protect it with a password. Sequence program related to the technical know-how Appendix 9.1.3 FB Libraries An FB library is a collection of FBs that are usable in GX Works2 (Simple project). Using an FB library enables easy setting and operation of MELSEC-Q/L modules and partner products.
FBs for partner products Vision sensor FB RFID FB Laser displacement sensor FB CC-Link Ethernet Vision sensor RFID Laser displacement sensor Partner product family (1) FB library lineup FB libraries include "FBs for MELSEC-Q/L modules" and "FBs for partner products". (2) How to obtain FB libraries FB libraries can be obtained from Mitsubishi Electric FA site. URL http://www.mitsubishielectric.co.jp/fa/index.
Appendix 9.1.4 Development tool GX Works2 (Simple project) ver 1.12N or later is required to develop sequence programs using FBs. POINT Depending on the FB library, supporting versions of GX Works2 may differ. For details, refer to the download page of each FB. Appendix 9.1.5 FB specifications and precautions The following specifications and precautions must be understood prior to using FBs. 1. An FB cannot be used in another FB. 2.
Appendix 9.2 Creating a program by using an FB library This section explains the procedure to create a program by using an FB library. Appendx 9.2.1 Programs to be created This section explains how to use an FB library with an example of importing an analog value from an analog input module. Example) Reading an analog value to D10 from the analog input module (Q64AD) when the switch (X2) is turned on. The program can easily be created by using an FB library as follows.
Appendix 9.2.2 Preparations prior to use of FB libraries Before using an FB library, contact your distributor to obtain it. (FB libraries will not be installed when installing GX Works2.) The following explains operation procedures using the FB library for Q64AD as an example. 1) As the file obtained from your distributor is a zip format file, unzip "q64ad_v100a.zip". 2) Double-click "setup.exe" in "q64ad_v100a". Double-click! 3) The screen for installation is displayed.
Appendix 9.2.3 Importing an FB library to projects This section explains how to import an FB library for analog input module (Q64AD) to be pasted to the program into a project. Create a new project before the following operation. (refer to section 2.3.2) 1) Click [Project] → [Library] → [Install]. 1) Click! 2) The Install dialog box is displayed. 3) Select! 4) Click! 5) Check! 3) Select "Q64AD"from Library List. 4) Click the Refresh FB List button. 5) Check the library to import.
Appendix 9.2.4 Pasting FBs Drag and drop FBs to be pasted to the program window from the Project view or Selection window. (Drag and drop from the Project view is possible from GX Works2 1.24A or later.) Operating Procedure 1) Paste "M+Q64AD_ReadADVal" to the program window. Selection window From the Selection window or Project view, drag and drop an FB to the place where the FB will be pasted. Project window 2) The Input FB Instance Name dialog box is displayed.
Appendix 9.2.5 Setting names of the pasted FBs When an FB library is pasted to the program window, a dialog to input a name of the pasted FB (FB instance name) is displayed. Instance name is a name to distinguish the FB. A temporary name is automatically set to the instance name. To use the name as it is, close the dialog by clicking OK . Make sure that the same name does not exist in the same program when changing the name. In this section, the default is used.
Appendix 9.2.6 Creating input and output ladders Create the input ladder section and the output ladder section of the pasted FB to complete the program. Refer to the following figure and enter the information. FB execution command FB is running: ON Normal end: ON Module mounting XY address: 80 Channel number: 1 Error end: ON Stores the error code. Stores the analog value. Appendix 9.2.7 Performing conversion/compilation Conversion/compilation is required to execute the completed program.
Appendix 9.2.8 Writing sequence programs For the procedure to write sequence programs, refer to section 2.7 (1) "Writing data to the CPU". Appendix 9.2.9 Operation check For the procedure to check the operation of the created program, refer to section 2.8 Monitoring Ladder Program Status. Turn on the switch (X2) and confirm that the analog value is read. Turn on the switch (X10). The current analog value is displayed.