Getting Started Guide: Cp1L Cpu Unit
Getting Started Guide: Cp1L Cpu Unit
W07E-EN-02
Notice:
OMRON products are manufactured for use according to proper procedures by a qualified operator and only for the purposes described in this manual. The following conventions are used to indicate and classify precautions in this manual. Always heed the information provided with them. Failure to heed precautions can result in injury to people or damage to property.
DANGER
Indicates an imminently hazardous situation which, if not avoided, will result in death or serious injury. Additionally, there may be severe property damage. Indicates a potentially hazardous situation which, if not avoided, could result in death or serious injury. Additionally, there may be severe property damage. Indicates a potentially hazardous situation which, if not avoided, may result in minor or moderate injury, or property damage.
WARNING
Caution
Visual Aids
The following headings appear in the left column of the manual to help you locate different types of information. Note Indicates information of particular interest for efficient and convenient operation of the product. 1,2,3... 1. Indicates lists of one sort or another, such as procedures, checklists, etc.
Trademarks
Windows is a registered trademark of Microsoft Corporation in the United States and other countries. SYSMAC is a registered trademark of OMRONs Programmable Controllers. Other brand and product names are trademarks or registered trademarks of their respective owners.
OMRON, 2007
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, or by any means, mechanical, electronic, photocopying, recording, or otherwise, without the prior written permission of OMRON. No patent liability is assumed with respect to the use of the information contained herein. Moreover, because OMRON is constantly striving to improve its high-quality products, the information contained in this manual is subject to change without notice. Every precaution has been taken in the preparation of this manual. Nevertheless, OMRON assumes no responsibility for errors or omissions. Neither is any liability assumed for damages resulting from the use of the information contained in this publication.
TABLE OF CONTENTS
PRECAUTIONS ............................................................... 9
1 2 3 4 Intended Audience.................................................................................................... General Precautions................................................................................................. Safety Precautions ................................................................................................... Application Precautions ............................................................................................ 10 10 10 10
Appendix ........................................................................ 95
A-1 A-2 A-3 A-4 Channel/Relay Numbers .......................................................................................... 96 Instructions ............................................................................................................. 101 Inner Workings of CP1L ......................................................................................... 105 CP1L Programming Examples ............................................................................... 114
Related Manuals
The following manuals are used for the CP-series CPU Units. Refer to these manuals as required.
Cat. No. Manual name W462 SYSMAC CP Series CP1L CPU Unit Users Manual Description Explains the system configuration, installation, wiring, I/O allocation, pulse/counter functions, and expansion unit connections in details. Also provides information on errors, troubleshooting, maintenance, and inspection. Provides the following information on the CP Series: Programming instructions Programming methods Tasks File memory Functions Use this manual together with the CP1H Programmable Controllers Operation Manual (W450). Provides information on installing and operating the CX-Programmer for all functions except for function blocks.
W451
W446
LIMITATIONS OF LIABILITY
OMRON SHALL NOT BE RESPONSIBLE FOR SPECIAL, INDIRECT, OR CONSEQUENTIAL DAMAGES, LOSS OF PROFITS OR COMMERCIAL LOSS IN ANY WAY CONNECTED WITH THE PRODUCTS, WHETHER SUCH CLAIM IS BASED ON CONTRACT, WARRANTY, NEGLIGENCE, OR STRICT LIABILITY. In no event shall the responsibility of OMRON for any act exceed the individual price of the product on which liability is asserted. IN NO EVENT SHALL OMRON BE RESPONSIBLE FOR WARRANTY, REPAIR, OR OTHER CLAIMS REGARDING THE PRODUCTS UNLESS OMRON'S ANALYSIS CONFIRMS THAT THE PRODUCTS WERE PROPERLY HANDLED, STORED, INSTALLED, AND MAINTAINED AND NOT SUBJECT TO CONTAMINATION, ABUSE, MISUSE, OR INAPPROPRIATE MODIFICATION OR REPAIR.
Application Considerations
SUITABILITY FOR USE
OMRON shall not be responsible for conformity with any standards, codes, or regulations that apply to the combination of products in the customer's application or use of the products. At the customer's request, OMRON will provide applicable third party certification documents identifying ratings and limitations of use that apply to the products. This information by itself is not sufficient for a complete determination of the suitability of the products in combination with the end product, machine, system, or other application or use. The following are some examples of applications for which particular attention must be given. This is not intended to be an exhaustive list of all possible uses of the products, nor is it intended to imply that the uses listed may be suitable for the products: Outdoor use, uses involving potential chemical contamination or electrical interference, or conditions or uses not described in this manual. Nuclear energy control systems, combustion systems, railroad systems, aviation systems, medical equipment, amusement machines, vehicles, safety equipment, and installations subject to separate industry or government regulations. Systems, machines, and equipment that could present a risk to life or property. Please know and observe all prohibitions of use applicable to the products. NEVER USE THE PRODUCTS FOR AN APPLICATION INVOLVING SERIOUS RISK TO LIFE OR PROPERTY WITHOUT ENSURING THAT THE SYSTEM AS A WHOLE HAS BEEN DESIGNED TO ADDRESS THE RISKS, AND THAT THE OMRON PRODUCTS ARE PROPERLY RATED AND INSTALLED FOR THE INTENDED USE WITHIN THE OVERALL EQUIPMENT OR SYSTEM.
PROGRAMMABLE PRODUCTS
OMRON shall not be responsible for the user's programming of a programmable product, or any consequence thereof.
Disclaimers
CHANGE IN SPECIFICATIONS
Product specifications and accessories may be changed at any time based on improvements and other reasons. It is our practice to change model numbers when published ratings or features are changed, or when significant construction changes are made. However, some specifications of the products may be changed without any notice. When in doubt, special model numbers may be assigned to fix or establish key specifications for your application on your request. Please consult with your OMRON representative at any time to confirm actual specifications of purchased products.
PERFORMANCE DATA
Performance data given in this manual is provided as a guide for the user in determining suitability and does not constitute a warranty. It may represent the result of OMRON's test conditions, and the users must correlate it to actual application requirements. Actual performance is subject to the OMRON Warranty and Limitations of Liability.
PRECAUTIONS
This section provides general precautions for using the CP-series Programmable Controllers (PLCs) and related devices. The information contained in this section is important for the safe and reliable application of Programmable Controllers. You must read this section and understand the information contained before attempting to set up or operate a PLC system. 1 2 3 4 Intended Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . General Precautions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Safety Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Application Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 10 10 10
Intended Audience
Intended Audience
This manual is intended for the following personnel, who must also have knowledge of electrical systems (an electrical engineer or the equivalent). Personnel in charge of installing FA systems. Personnel in charge of designing FA systems. Personnel in charge of managing FA systems and facilities.
General Precautions
The user must operate the product according to the performance specifications described in the operation manuals. Before using the product under conditions which are not described in the manual or applying the product to nuclear control systems, railroad systems, aviation systems, vehicles, combustion systems, medical equipment, amusement machines, safety equipment, and other systems, machines, and equipment that may have a serious influence on lives and property if used improperly, consult your OMRON representative. Make sure that the ratings and performance characteristics of the product are sufficient for the systems, machines, and equipment, and be sure to provide the systems, machines, and equipment with double safety mechanisms. This manual provides information for programming and operating the Unit. Be sure to read this manual before attempting to use the Unit and keep this manual close at hand for reference during operation.
WARNING It is extremely important that a PLC and all PLC Units be used for the
specified purpose and under the specified conditions, especially in applications that can directly or indirectly affect human life. You must consult with your OMRON representative before applying a PLC System to the above-mentioned applications.
Safety Precautions
Caution When power is ON or has just been turned OFF, do not touch the power supply, I/O terminals, or the surrounding areas. Doing so may result in burns. After turning the power OFF, wait for the unit to cool down sufficiently before touching it. Caution Secure the AC power supply line to the terminal block with a 0.5Nm of torque. Loosening the screw may result in a fire or malfunction. Caution Before starting online editing, confirm that the extension of cycle time will have no adverse effects. Otherwise, input signals may not be read.
Application Precautions
Caution Confirm that the facility will not be affected by changing to MONITOR or RUN mode.
10
1
1
CP1L Overview
CP1L Overview
12
1
CP1L Overview
13
1
CP1L Overview
CPU unit has 24 input points and 16 output points. CP-series expansion I/O units can be used to add I/O points, up to a total of 160 I/O points.
14
1
CP1L Overview
(1)
Memory cassette slot Used to attach a memory cassette (15). Memory cassettes can be used to store backups for CP1L programs, parameters, and data memory. They also allow you to copy data to other CP1L units without using a programming tool (software). Peripheral USB port Used for connection to a computer. Computers can be used for programming and monitoring. Analog adjuster Rotate to adjust the value for auxiliary area A642CH to within the 0 to 255 range. Use to change timer and counter settings without using a programming tool (software). External analog settings input connector Takes an external input between 0 and 10V, and changes the value for auxiliary area A643CH to a value between 0 and 256. This input is not isolated. DIP switches Used for settings such as write-permission on user memory, automatic transfers from memory cassettes, and tool bus use. For details, refer to 2-1 Part Names and Functions of CP Series CP1L CPU Unit User's Manual (W462). Battery Maintains the internal clock and RAM contents while the power supply is OFF.
(2)
(3)
(4)
(5)
(6)
15
(7)
1
CP1L Overview
Operation indicators Indicates the operating status of CP1L. Indicated statuses include power status, operating mode, errors, and peripheral USB communication status. Power supply, ground, and input terminal block Used to connect the power supply line, ground line, and input lines. Input indicators Lit when the corresponding input terminal contact is ON.
(8) (9)
(10) Option board slot Used to install an RS-232C option board (16) or an RS-422A/485 option board (17). 14/20-point I/O units may have 1 serial communication option board installed. 30/40/60-point I/O units may have up to 2 serial communication option boards installed. (11) Expansion I/O unit connector Used to connect CP-series expansion I/O units and expansion units. 14/20point I/O units may have 1 expansion unit connected. 30/40/60-point I/O units may have up to 3 expansion units connected. (12) Output indicators Lit when the corresponding output terminal contact is ON. (13) External power supply and output terminal block External power supply terminal: Units that use AC power supply have a 24VDC external power supply terminal with a maximum capacity of 300mA.This can be used as a service power supply for input devices. Output terminals: Used to connect output lines. (14) DIN track mounting pin Used for mounting unit to a DIN track. (15) Memory cassette (optional) Used to store data from the built-in flash memory. Insert into memory cassette slot (1). (16) RS-232C option board Insert into option board slot (10). (17) RS-422A/485 option board Insert into option board slot (10).
16
Indicator Statuses
This section describes the operating statuses of CP1L as displayed by the operation indicators.
1
CP1L Overview
Power is ON. Power is OFF. CP1L is executing a program in either RUN or MONITOR mode. Operation is stopped in PROGRAM mode, or stopped due to a fatal error. A fatal error (including FALS execution) or a hardware error (WDT error) has occurred. CP1L operation will stop, and all outputs will be turned OFF. A non-fatal error (including FAL execution) has occurred. CP1L operation will continue. Operation normal. The output OFF bit (A500.15) has turned ON. All outputs will be turned OFF. Operation normal. Communication (either sending or receiving) is active on the peripheral USB port. Any other state. User program, parameter, or data memory is being written to or read from the built-in flash memory (backup memory). User program, parameter, data memory, DM defaults, or comment memory is being written to or read from the memory cassette. User programs, parameters, and data memory are being restored following a PLC power-on. Note: Do not turn the PLC power supply OFF while this indicator is lit. Any other state.
Blinking Not lit INH (Yellow) PRPHL (Yellow) BKUP (Yellow) Lit Not lit Blinking Not lit Lit
Not lit
17
1
CP1L Overview
18
2-3 I/O Allocation for the Shutter Control System ....................... 24 2-4 Example Ladder Program ..................................................... 26
2
2
Designing Systems
Designing Systems
Note Circuit configurations, wiring methods, and programs provided in this manual
are given strictly as examples. When constructing an actual system, check the specifications, performance, and safety of each component by referring to the respective manuals.
20
I/O allocation
Allocate relay numbers to sensors and switches
2
Designing Systems
Refer to 3-2 Mounting onto DIN Tracks and 3-3 Wiring Devices.
Writing programs
Enter ladder programs in CX-Programmer Compile Save Edit
Refer to 4-2 Creating a Ladder Program, 4-3 Using CX-Programmer, 4-5 Inputting Programs, 4-6 Saving/ Loading Programs, and 4-7 Editing Programs.
Online debugging
Monitor power Force-set/force-reset commands Online Editing
21
2
Designing Systems
2-2-1 Operation
This section defines the operation of a shutter control system.
A car approaches the shutter. When a sensor detects 3 headlight flashes within 5 seconds, the shutter opens. The shutter can also be opened, closed, and stopped with buttons.
When a sensor detects full car entrance into the garage, the shutter closes. When pulling the car out of the garage, use the buttons to operate the shutter.
22
PLC
CP1L (14-point I/O unit with AC power supply)
2
Designing Systems
Inputs
Shutter OPEN button : PB1 Shutter STOP button : PB2 Shutter CLOSE button : PB3 Car detection sensor : SEN1 Headlight detection sensor : SEN2 Limit switch, turned ON when shutter is fully open : LS1 Limit switch, turned ON when shutter is fully closed : LS2
Outputs
Contact for activating the shutter escalation motor : MO1 Contact for activating the shutter de-escalation motor : MO2
23
2
Designing Systems
Inputs
Device OPEN button STOP button CLOSE button Car detection sensor Light detection sensor Upper limit LS Lower limit LS Contact PB1 PB2 PB3 SEN1 SEN2 LS1 LS2 Address 0.00 0.01 0.02 0.03 0.04 0.05 0.06
Outputs
Device Escalation motor De-escalation motor Contact MO1 MO2 Address 100.00 100.01
24
2
Designing Systems
03 02 01 00
6 outputs
15 0 CH 100 CH
14
13
12
11
10
09
08
07
06
05
04
Allocate
On 14-point I/O units, 8 inputs, from 0.00 to 0.07 (bits 00 to 07 on 0CH), are allocated to the input terminal block. Also, 6 output relays, from 100.00 to 100.05 (bits 00 to 05 on 100CH), are allocated to the output terminal block. Unused upper bits on the input channel (bits 08 to 15) cannot be used as a work area. Unused upper bits on the output channel (bits 06 to 15) , however, can be used.
25
2
Designing Systems
T0000 Timer
TIM Work area 0.04 CNT Light detection sensor T0000 Timer C0000 Counter A200.11 P_First_Cycle First cycle flag C0000 Counter 0.00 OPEN button 100.00 Escalation motor 0.02 CLOSE button 100.01 De-escalation motor 0.03 Car detection sensor 0.01 STOP button 0.05 Upper limit LS 100.01 100.00 0000 Counter #3 0000 Timer #50
100.00
Escalation motor
26
Installation Location
3
Mounting and Wiring
Do not install in the following locations: Locations subject to ambient temperature lower than 0C or higher than 55C. Locations subject to dramatic temperature changes, causing possible condensation. Locations subject to relative humidity lower than 10%RH or higher than 90%RH. Locations subject to corrosive or flammable gases. Locations subject to excessive dust, salt, or metal powder. Locations subject to shock or vibration. Locations exposed to direct sunlight. Locations subject to water, oil, or chemical reagent splashes. Shield the system sufficiently when installing in the following locations: Locations subject to static electricity and other forms of noise. Locations subject to strong electromagnetic fields. Locations subject to possible radioactive exposure. Locations in close proximity to close to power lines.
Temperature Control
The ambient operating temperature for CP1L is 0 to 55C. The following precautions apply. Provide adequate space for air flow. Do not install above equipment, which generates significant heat (i.e. heaters, transformers, high-capacity resistors). If the ambient temperature is to exceed 55C, install a cooling fan or air conditioner.
28
3
Mounting and Wiring (1) (2) (3) Control panel Fan Louver
I/O terminals, or the surrounding areas. Doing so may result in burns. After turning the power OFF, wait for the unit to cool down sufficiently before touching it.
200mm min.
CP1L
200mm min.
Properly ground the mounting plate between the unit and the mounting surface.
29
Mounting
For heat dissipation, mount CP1L in the orientation shown below.
3
Mounting and Wiring
External Dimensions
DIN Track
Secure the DIN track onto the control panel, using at least 3 screws. Use M4 screws at intervals of 210mm (6 holes) or less. Screw torque is 1.2Nm. For details on installing CP1L, refer to SECTION 3 Installation and Wiring of CP Series CP1L CPU Unit Users Manual (W462).
30
1.
3
Mounting and Wiring
2.
Hook the rear panel of CP1L onto the DIN track (1), as shown.
3.
31
Protective Label
3
Mounting and Wiring
Wire scraps may be scattered during wiring. To prevent them from entering the unit, leave the protective label (adhered on the top surface of the unit) on until wiring is done. When wiring is complete, remove the label to ensure proper heat dissipation.
4 1
NC NC NC NC
6.2mm max.
(1) Power supply terminal Supply 100 to 240VAC voltage at 50/60Hz. The acceptable supply voltage range is 85 to 264VAC. Use separate circuits for the power supply circuit and the motor circuit, in order to prevent voltage drops due to starting currents and inrush currents from other equipment. Use a twisted-pair of power supply cables to prevent noise from the power supply line. Adding a 1:1 isolating transformer will further reduce electrical noise.
32
In consideration of voltage drops and allowable current, use the thickest electrical wire possible. (2) LG LG is a functional ground terminal (noise-filtered neutral terminal). To resolve errors and electrical shocks caused by noise, short the LG and GR terminals for a class D grounding (ground resistance of 100 or less). (3) GR GR is a protective ground terminal. To prevent electrical shocks, use a dedicated ground line (2mm2 or thicker) for a class D grounding (ground resistance of 100 or less). To prevent electrical shocks and noise, always ground the terminal with class D grounding (ground resistance of 100 or less). If the power supply has a grounded phase, connect the grounded phase to the L2/N terminal. Do not share the ground line with other equipment, or connect it to building structure beams. The results may be unfavorable. (4) Recommended crimp terminal When wiring the AC power supply, use ring-type crimp terminals to prevent unintended disconnection.
WARNING Secure the AC power supply line to the terminal block with 0.5Nm of torque.
3
Mounting and Wiring
(1) (2)
33
Wiring Inputs
1.
Wire the inputs as shown, while referring to 2-3 I/O Allocation for the Shutter Control System.
3
Mounting and Wiring
Wiring Outputs
1.
Wire the outputs as shown, while referring to 2-3 I/O Allocation for the Shutter Control System.
For details on wiring, refer to 3-5-4 I/O Wiring for CPU Units with 14 I/O Points of CP Series CP1L CPU Unit Users Manual (W462).
34
Turning Power ON
Supply power to CP1L, and then check the status with the indicators.
1. 2. 3. 4.
Turn the power OFF for all components (escalation motor, de-escalation motor, etc.). Turn the power ON for CP1L. Wait 2 seconds for the CP1L to initialize. Check the indicators on CP1L. If [POWER] and [RUN] are lit, CP1L is operating normally.
3
Mounting and Wiring
Note When CP1L is turned ON, it will go into RUN mode automatically.
5.
35
3
Mounting and Wiring
Note Battery Using a battery The battery maintains the internal clock and retained regions of I/O memory while the power supply is OFF. If no battery is installed, or if the installed battery is running low, the internal clock will stop, and data in the retained regions of I/O memory will be lost. Data such as user programs and PLC system settings are not lost even when the power is OFF and no battery is installed. For details on replacing the battery, refer to 10-2 Replacing User-servicable Parts of CP Series CP1L CPU Unit Users Manual (W462). Battery-free operation If there is no need to reference the PLC clock and RAM data, CP1L can be used without a battery (battery-free operation). For details, refer to 6-5 Battery-free Operation of CP Series CP1L CPU Unit Users Manual (W462).
36
Creating Programs
4
Creating Programs
CX-Programmer is a programming tool (software) for creating the ladder programs that are to be executed by CP1L. In addition to programming functions, it also offers other useful functions for CP1L setup and operation, such as debugging programs, address and values display, PLC setup and monitoring; and remote programming and monitoring via the network. CX-Programmer can be run on computers running Windows 98 SE, Me, NT 4.0 (SP6a), 2000 (SP3 or later), or XP. For details on installing CX-Programmer, refer to 1-1 Installation of CXProgrammer of CX-Programmer Introduction Guide (R132). For details on using CX-Programmer, refer to CX-Programmer Operation Manual (W446).
38
4
Creating Programs
39
1.
Turn the power ON for CP1L and the computer. Using a USB cable (2), connect the peripheral USB port (3) on CP1L to a USB port on the computer (1).
4
Creating Programs
2.
When the computer detects CP1L, the following message will be displayed.
The Found New Hardware Wizard dialog box will be displayed. This screen will be used to install the USB driver. Note The programming console is not available for CP1L.
3.
On the Found New Hardware Wizard dialog box, select [No, not this time], and click [Next]. Depending on computer environment, the Found New Hardware Wizard dialog box may not be displayed. If it is not displayed, proceed to step 4.
40
4.
Select [Install from a list of specific location (Advanced)], and click [Next].
4
Creating Programs
5.
Confirm that [Include this location in the search] is checked, and that [C:\Program Files\OMRON\CX-Server\USB\Win2000_XP\Inf] is displayed in the location field. Click [Next]. Driver installation will begin. When the installation is complete, a dialog box will be displayed, confirming that installation is complete.
41
4
Creating Programs
6.
42
Confirming Installation
Confirm that the driver has been installed properly.
1. 2. 3. 4. 5.
On the desktop, select [Start], and then right-click [My Computer]. A context menu will be displayed. Select [Properties]. The System Properties dialog box will be displayed. Select the Hardware tab, and click [Device Manager]. The Device Manager dialog box will be displayed. Double-click [Universal Serial Bus controllers]. Confirm that [OMRON SYSMAC PLC Device] is displayed. If so, the USB driver has been installed successfully.
4
Creating Programs
6.
Close the Device Manager dialog box, and then the System Properties dialog box. If [OMRON SYSMAC PLC Device] is not displayed, reinstall the USB driver. For details on reinstalling the USB driver, refer to 1-3-1 Connecting with a Commercially Available USB Cable of CP Series CP1L CPU Unit Users Manual (W462).
43
4-2-1 Operation
The ladder program to be created will open and close a garage shutter. For details on the example application, refer to 2-2-1 Operation.
4
Creating Programs
1 3
The component functions and operations will be defined in detail below. (1) Push-buttons: The shutter can be opened, closed, and stopped with buttons. The OPEN and CLOSE buttons will continue operating the shutter even when they are not held down. A self-maintaining bit is used to achieve this. (2) Limit switches: When the shutter is fully opened or fully closed, it will be stopped by a limit switch. When the shutter is opening, the de-escalation motor will be interlocked to prevent damage. (3) Light detection sensor: A light detection sensor detects light from headlights pointed at the garage. When 3 headlight flashes are detected by a counter instruction, the shutter escalation motor is activated. After the first headlight flash, a timer is activated by a timer instruction. After 5 seconds, a reset command is given to the counter instruction. The present value of the counter instruction is retained even when CP1L is powered OFF. To prevent malfunction, a reset command is given to the counter instruction when CP1L is powered ON.
44
4
Creating Programs (1) Car detection sensor: A car detection sensor will detect full car entrance into the garage, and activate the shutter de-escalation motor. (2) Push-buttons: When pulling the car out of the garage, use the buttons to operate the shutter. When pulling the car out of the garage, a differentiated up contact should be used as the car detection sensor, so that the shutter does not close immediately upon fully opening. A ladder program will be set forth hereafter based on the description above.
45
4
Creating Programs
*1 Refer to Inputting Contacts of 4-5-2 Inputting Contacts. *2 Refer to Inputting OR Circuits of 4-5-2 Inputting Contacts. *3 Refer to Inputting Closed Contacts of 4-5-2 Inputting Contacts. *4 Refer to 4-5-3 Inputting Output Coils. TIM
Light detection sensor T0000 Timer C0000 Counter A200.11 P_First_Cycle First cycle flag *7 C0000 Counter 0.00 OPEN button 100.00 Escalation motor 0.02 CLOSE button 100.01 De-escalation motor 0.03 Car detection sensor *8 0.01 STOP button 0.05 Upper limit LS 100.01
0000 Counter *6 #3
*5 Refer to 4-5-4 Inputting Timers. *6 Refer to 4-5-5 Inputting Counters.. *7 Refer to 4-5-6 Inputting Auxiliary Areas.
100.00
46
4
Creating Programs
Note
For details on installing CX-Programmer, refer to Chapter 1 Overview and Installation of CX-One of CX-One Introduction Guide (R145).
47
Main Window
1 2
4
Creating Programs
3 4 5 7
6 8 9 10
Title bar Displays the data file name, created in CX-Programmer. Main menu Used to select CX-Programmer functions. Toolbars Displays icons for frequently used functions. Place the mouse cursor over an icon to display the corresponding function name. Select View - Toolbars from the main menu to show/hide toolbars. Drag the toolbars to change their position. Project tree / (6) Project workspace Used to manage programs and settings. Drag & drop items to copy the data. Select [View] - [Windows] - [Workspace] from the main menu to show/hide the workspace. Section Programs can be split into and managed as multiple parts. Diagram workspace Used to create and edit ladder programs. I/O comment bar Displays the name, address/value, and I/O comment for the variable selected by the mouse cursor.
(4)
48
(9)
Output window Select [View] - [Windows] - [Output] from the main menu to show/hide the output window. Displays the following information: Compile: Displays program check results. Find Report: Displays search results for contacts, instructions, and coils. Transfer: Displays errors which occurred while loading a project file.
(10) Status bar Displays information such as PLC name, offline/online status, and active cell position. If an online connection error or other errors occur and are recorded by the error log while online, a blinking red error message will be displayed. Select [View] - [Windows] - [Status Bar] from the main menu to show/hide the status bar.
4
Creating Programs
Diagram Workspace
Rung number Program address Rung header If a rung is incomplete, a red line will be displayed to the right of its rung header. Bus bar
(4)
Information Window
Displays basic shortcut keys used in CX-Programmer. Select [View] - [Windows] - [Information Window] from the main menu to show/hide the information window.
49
1.
4
Creating Programs
While using CX-Programmer, press the [F1] key. The help window will be displayed.
1.
On the desktop, select [Start] - [All Programs] - [OMRON] - [CX-One] - [CXProgrammer] - [CX-Programmer Help]. CX-Programmer Help will be displayed.
50
From CX-Programmer
1.
Select [Help] - [Help Contents] from the main menu. CX-Programmer Help will be displayed.
4
Creating Programs
51
From CX-Programmer
1.
Select [Help] - [Instruction Reference] - [CS/CJ-Series and CP-Series] from the main menu. CP-Series PLC Instruction Sets will be displayed.
4
Creating Programs
1.
While creating a ladder program instruction, click [Instruction Help] on the New Instruction dialog box. CP-Series PLC Instruction Sets will be displayed.
Note
52
1.
Select [File] - [New] from the main menu. The Change PLC dialog box will be displayed.
4
Creating Programs
2.
53
3.
Click [Settings]. The Device Type Settings dialog box will be displayed.
4
Creating Programs
4.
Select the CPU from the CPU Type drop-down list. Click [OK]. The Device Type Settings dialog box will be closed.
54
5.
4
Creating Programs
The Change PLC dialog box will be closed. Main window for the new project will be displayed.
If [USB] is not displayed for Network Type, refer to 4-1-2 Connecting to a Computer and Installing the USB Driver and confirm that the USB driver has been installed properly.
55
Inputting Contacts
1.
Press the [C] key. The New Contact dialog box will be displayed.
4
Creating Programs
2.
Input address "4". Press the [Enter] key. "4" is entered. The Edit Comment dialog box will be displayed.
3.
Input "Light detection sensor" as the I/O comment. Press the [Enter] key. A contact representing input from the light detection sensor will be displayed on the ladder program.
56
Inputting OR Circuits
1.
Place the cursor on the program. Press the [Enter] key. A space for inserting an OR circuit will be created.
4
Creating Programs
2.
Press the [W] key. The New Contact OR dialog box will be displayed.
3.
Input address "W0". Press the [Enter] key. "W0" is entered. The Edit Comment dialog box will be displayed.
4.
Input "Work Area" as the I/O comment. Press the [Enter] key. An OR circuit representing the work area contact will be displayed.
57
1.
4
Creating Programs
2.
With the cursor in the up position, press the [/] key. The New Closed Contact dialog box will be displayed.
3.
4.
Input "Timer" as the I/O comment. Press the [Enter] key. An AND circuit representing the timer closed contact will be displayed.
58
1.
Press the [O] key. The New Coil dialog box will be displayed.
4
Creating Programs
2.
Input address "W0". Press the [Enter] key. "W0" is entered. The Edit Comment dialog box is displayed with the I/O comment already entered.
3.
An output coil for the work area will be displayed on the ladder program.
59
4.
Press the down arrow key 2 times. When the cursor is positioned on the next rung, the current rung input is complete.
4
Creating Programs Next, input a timer instruction. Note Duplicated Coils Do not duplicate coils. If the same address is specified for multiple outputs, only the rung closer to the END instruction will be valid. This is because programs are executed sequentially from top to bottom. Invalid rungs caused by duplicated coils will be detected by CX-Programmer as an error. E.g. A program with duplicated coils
60
4
Creating Programs
2.
Press the [I] key. The New Instruction dialog box will be displayed.
3.
Input timer instruction "TIM 0 #50". Press the [Enter] key. "TIM 0 #50" is entered. The Edit Comment dialog box is displayed with the I/O comment already entered. "TIM 0 #50" indicates a 5.0 second delay timer, with a timer completion flag of T0000.
61
4.
4
Creating Programs
5.
Press the down arrow key 3 times. When the cursor is positioned on the next rung, timer instruction input is complete.
62
4
Creating Programs
2.
Press the [I] key. The New Instruction dialog box will be displayed.
3.
"CNT 0 #3" is entered. The Edit Comment dialog box is displayed with the I/O comment already entered. "CNT 0 #3" indicates a decrementing counter starting at count 3, with a counter completion flag of C0000.
63
4.
4
Creating Programs Next, input a reset input for the counter instruction. The timer contact (TIM 0000) will be used as the reset input.
5.
64
6.
4
Creating Programs
7.
Press the down arrow key 2 times. When the cursor is positioned on the next rung, counter instruction input is complete.
65
1.
Press the [W] key. Input an OR circuit contact "C0000". Then, press the [Enter] key while the Edit Comment dialog box is up. For details on inputting a contact, refer to 4-5-2 Inputting Contacts.
4
Creating Programs
2.
Press the [Enter] key. A space for inserting an OR circuit will be created.
66
3. 4. 5.
Press the left arrow key. Press the [W] key. The New Contact OR dialog box will be displayed. Input address "A20011". Press the [Enter] key.
4
Creating Programs
67
4
Creating Programs
2. 3. 4. 5.
Press the [Enter] key. A space for inserting an OR circuit will be created. Press the [W] key. The New Contact OR dialog box will be displayed. Input address "3". Press the [Enter] key. The Edit Comment dialog box will be displayed. Input "Car detection sensor" as the I/O comment. Press the [Enter] key. A contact representing input from the car detection sensor will be displayed as an OR circuit.
6.
Double-click contact "003". The Edit Contact dialog box will be displayed.
68
7.
Click [Detail].
8.
4
Creating Programs
69
4
Creating Programs
1.
Select [PLC] - [Compile All PLC Programs] from the main menu.
The compilation is started. When the compilation is complete, program check results will be displayed in the output window.
2.
If an error has been detected, double-click the error message in the output window. The cursor is moved to where the error was detected. Correct the error.
70
1.
Select [File] - [Save As] from the main menu. The Save CX-Programmer File dialog box will be displayed.
4
Creating Programs
2.
Specify the save location, and input a file name. Click [Save]. The CX-Programmer project file will be saved.
71
1.
Select [File] - [Open] from the main menu. The Open CX-Programmer Project dialog box will be displayed.
4
Creating Programs
2.
Specify the save location and file. Click [Open]. The CX-Programmer project file will be opened, and the saved programs will be displayed.
72
1.
4
Creating Programs
73
2.
Double-click the address for which you wish to input or edit the I/O comment. The I/O comment field will become editable. Input or edit the I/O comment.
4
Creating Programs
1.
Double-click the rung header for the rung you wish to add a comment to. The Rung Properties dialog box will be displayed.
2.
On the General tab, input the comment into the comment field.
74
3.
Close the Rung Properties dialog box. The entered rung comment will be displayed on the ladder program.
4
Creating Programs
Deleting Contacts/Instructions
1.
Rungs
Place the cursor on a contact or on an instruction. Press the [Delete] key. The selected contact or instruction will be deleted.
1.
2.
75
1. 2.
Position the cursor at the starting point of the vertical line. Hold down the [Ctrl] key, and press the up/down arrow key. Horizontal lines can be created in the same manner.
4
Creating Programs Note (1) Starting point (2) Cursor Creating a line from right to left: Hold down the [Ctrl] key and press the left arrow key. Creating a line from left to right: Hold down the [Ctrl] key and press the right arrow key. Creating a line from bottom to top: Hold down the [Ctrl] key and press the up arrow key. Creating a line from top to bottom: Hold down the [Ctrl] key and press the down arrow key. Repeating the process over an existing connection line will delete it.
1. 2. 3.
Place the cursor on a contact or an instruction. Hold down the [Ctrl] key and press the [C] key. The selected contact or instruction will be copied to the clipboard. Move the cursor to where you wish to paste. Hold down the [Ctrl] key and press the [V] key. The contact or instruction on the clipboard will be pasted.
Rungs
1. 2. 3.
Click the rung header of the rung you wish to copy. The whole rung will be selected. Hold down the [Ctrl] key and press the [C] key. The selected rung will be copied to the clipboard. Move the cursor to the rung where you wish to paste. Hold down the [Ctrl] key and press the [V] key. The rung on the clipboard will be pasted.
76
1. 2.
In CX-Programmer, open the program to be transferred. Select [PLC] - [Work Online] from the main menu. A dialog box will be displayed to confirm going online.
5
Transferring and Debugging Programs
3.
When the system goes online, the ladder section window will turn light grey.
Online status is one in which the computer and CP1L are connected. To execute a program created with CX-Programmer on CP1L, the program will need to be transferred. For details on transferring programs, refer to 5-1-3 Transferring Programs.
78
Note
If the system fails to go online, check the PLC type setting and communication settings. To check the settings, double-click [NewPLC1[CP1L]Offline] in the project tree. For details on the settings, refer to 4-5-1 Creating New Projects.
1. 2.
In CX-Programmer, open an existing project. For details on opening a project, refer to 4-6-3 Loading Programs. Double-click [PLC Clock]. The PLC Clock dialog box will be displayed.
5
Transferring and Debugging Programs
3.
Select [Options] - [Set PLC Clock] from the menu. The Set PLC Clock dialog box will be displayed.
79
4.
Set the date and time. Click OK. The Set PLC Clock dialog box will be closed.
5
Transferring and Debugging Programs
5.
Select [File] - [Exit] from the menu. The clock on CP1L is now set.
1.
Select [PLC] - [Operating Mode] - [Program] from the main menu. A dialog box will be displayed to confirm the operating mode change.
80
2.
The operating mode will be displayed on the title bar and on the project tree.
5
Transferring and Debugging Programs
81
The following table lists the status and available operations for each mode.
Operating Mode Program status I/O refreshing External I/O status I/O memory Non-holding memory Holding memory I/O memory monitoring Operations from CX-Programmer Program monitoring Program transfer Compiling PLC setup Changing program Force-setting/Force-resetting Changing timer/counter SV Changing timer/counter PV Changing I/O memory PV From PLC To PLC PROGRAM Stopped Execute OFF Cleared Held OK OK OK OK OK OK OK OK OK OK OK RUN Running Execute Depends on program Depends on program OK OK OK X X X X X X X X MONITOR Running Execute Depends on program Depends on program OK OK OK X X X OK OK OK OK OK
5
Transferring and Debugging Programs
1.
Select [PLC] - [Transfer] - [To PLC] from the main menu. The Download Options dialog box will be displayed.
82
2.
5
Transferring and Debugging Programs
Note
For details on the transfer options, refer to SECTION 9 Transferring/Monitoring/ Debugging Programs of CX-Programmer Operation Manual (W446).
3.
Click [Yes].
The transfer will begin. The Download dialog box will be displayed.
83
4.
5
Transferring and Debugging Programs
Caution
Confirm that the facility will not be affected by changing to MONITOR or RUN mode.
1.
Select [PLC] - [Operating Mode] - [Run] from the main menu. A dialog box will be displayed to confirm the operating mode change.
2.
Click [Yes]. The system will change to RUN mode and begin operating.
84
5-2-1 Monitoring
Displaying Conduction Status
The conduction status of the program rungs will be displayed. This will allow you to confirm program execution.
1. 2.
Change CP1L to the MONITOR operating mode. Select [PLC] - [Monitor] - [Monitoring] from the main menu.
5
Transferring and Debugging Programs
85
5
1
(1)
Window divider
Drag the window divider to split the diagram workspace. The workspace can be split in up to 4 sections.
86
1. 2. 3.
Select [PLC] - [Monitor] - [Monitoring] from the main menu. Select [View] - [Windows] - [Watch] from the main menu. Input an address. The I/O value will be displayed. For Boolean values, "0" indicates OFF.
5
Transferring and Debugging Programs Note Input the address as the channel followed by a period and the bit. For example, "0 CH 04 bit" should be input as "0.04". You can input addresses by dragging & dropping items from the diagram workspace to the watch window. Select the rung header to input all addresses included in the rung.
87
5
Transferring and Debugging Programs
5-2-2 Force-Setting/Force-Resetting
CX-Programmer can control inputs, independent of inputs from I/O devices. Use this function to force input conditions and output conditions during test runs. Note Before force-setting/force-resetting/releasing or setting/resetting, confirm that the facility will not be affected. The force-setting procedure is as follows.
1. 2.
Change CP1L to the MONITOR or PROGRAM operating mode. Place the cursor on the contact to force-set.
88
3.
5
Transferring and Debugging Programs Force-set will be set. The contact will be marked with the force-set symbol.
Note
Select [On] to force the contact ON, and [Off] to force the contact OFF. To undo the force-set/force-reset, select [Cancel]. The following areas can be force-set/force-reset: CIO area (I/O area, data link area, CPU bus unit area, special I/O area, and work area), work area (WR), timer completion flag, holding area (HR), counter completion flag
89
1. 2.
Change CP1L to the MONITOR or PROGRAM operating mode. Double-click the timer setting to be changed. The Set Timer/Counter Value dialog box will be displayed.
5
Transferring and Debugging Programs
3.
Input the new value. Click [OK]. The timer setting will be updated.
5-2-4 Searching
Address Reference Tool
The address reference tool displays which instructions are using the address being pointed to with the cursor. It also allows jumping to another instruction with the same address. The address reference tool will display the following items: Address at the cursor position Variables (local, global) Program name, section name Program address (step) Instruction using the address
90
1.
Select [View] - [Windows] - [Address Reference Tool] from the main menu. The address reference tool will be displayed.
5
Transferring and Debugging Programs
2.
91
A list of used addresses will be displayed. Click an address to display the program being used.
5
Transferring and Debugging Programs
Ladder Backtracking
This function is used to backtrack the ladder, to determine why a contact does not turn ON, for example.
1.
2.
Press the [Space] key. The cursor will be moved to the source output for the contact.
92
Caution
Before starting online editing, confirm that the extension of cycle time will have no adverse effects. Otherwise, input signals may not be read. Note that if CP1L is running in MONITOR mode, changing the program via editing online may cause the cycle time to become longer and/or failure to read input signals. When making large changes, when moving or copying rungs, or when inserting or deleting block programs, edit offline, then transfer the program.
Note
1. 2. 3.
Change CP1L to the MONITOR or PROGRAM operating mode. Click the rung header of the rung you wish to edit. Select [Program] - [Online Edit] - [Begin] from the main menu. The grey shading in the diagram workspace will disappear, and the program becomes editable.
5
Transferring and Debugging Programs
4.
93
5.
Select [Program] - [Online Edit] - [Send Changes] from the main menu. The edited rungs will be transferred to CP1L.
5
Transferring and Debugging Programs
Note
94
Appendix
This section briefly explains channel and relay numbers, instructions, and the inner workings of CP1L. This section also provides examples of applications utilizing CP1L functions such as pulse functions, communication functions, and special instructions.
Appendix
A-1 Channel/Relay Numbers
In CP1L, channel (CH) numbers and relay numbers are specified as described below. Each channel consists of 16 bits. Hence, relay numbers are expressed as [channel number] + [bit number (00 to 15)]. Relay numbers are used to handle contacts. Channel numbers are mainly used as operands for special instructions when processing data by the channel. Note In CX-Programmer (abbreviated as CX-P below), upper bits of channel numbers and relay numbers are not displayed if their value is 0. For example, 0000CH will be displayed as 0. Relay numbers are displayed as a channel number followed by a period and a bit number. The bit number ranges in value from 00 to 15.
Area I/O area 1:1 link area CIO area Serial PLC link area Work area Work area Holding area Auxiliary area DM area Timer Counter Channel In CX-P 00 to 199 3000 to 3063 CH 3100 to 3189 CH 3800 to 6143 CH W000 to W511 CH H000 to H511 CH A000 to A959 CH D00000 to D32767* T000 to T511 C000 to C511 0 to 199 3000 to 3063 3100 to 3189 3800 to 6143 W000 to W511 H000 to H511 A000 to A959 D0 to D32767* T0 to T511 C000 to C511 00000 to 19915 300000 to 306300 310000 to 318915 380000 to 614300 W00000 to W51115 H00000 to H51115 A00000 to A95915 T000 to T511 C000 to C511 Relay In CX-P 0.00 to 199.15 3000.00 to 3063.00 3100.00 to 3189.15 3800.00 to 6143.00 W0.00 to W511.15 H0.00 to H511.15 A0.00 to A959.15 T0000 to T0511 C0000 to C0511
A
Appendix
*For 14/20-point I/O units: D0 to D9999, D32000 to D32767. Note The work words in CIO Area may be assigned to new functions in future versions of the CPU Units. Be sure to use the work words in W000 to W511CH first.
96
14 2
2
13 2
1
12 2
0
10 2
2
09 2
1
08 2
0
07 2
3
06 2
2
05 2
1
04 2
0
03 2
3
02 2
2
01 2
1
00 20 0
A
Appendix
Constants Notation
Constants used in CP1L instructions are represented as follows.
Notation #0000 to 9999 (BCD) #0000 to FFFF (Hex) &0 to 65535 Content/Purpose Timer/counter values, BCD arithmetic instruction, etc. Comparison data for comparison instructions, transfer data, BIN arithmetic instructions, etc. Unsigned decimal notation (Available in certain special instructions only. Can be loaded into CX-Programmer by converting to and from hex digits.)
Differentiated Instructions The instruction is executed only once (i.e. on 1 cycle only) when the execution condition turns ON. The instruction name is prefixed with an "@". Example
W00001 @MOV (021) H020 D00020 When work area W00001 switches from OFF to ON, data in holding area H020CH is transferred to DM D00020.
Some instructions cannot be specified as a differentiated instruction (with the "@" prefix). If such is the case, use the UP(521)/DOWN(522) or DIFU(013)(differentiated UP)/DIFD(014)(differentiated DOWN) instructions.
97
Condition Flags
Condition flags are used to reflect the processing results during or after the execution of instructions. Whether a flag is used or not will depend on the instruction. These flags are used in ladder programs as contacts.
Name Error flag Label ER In CX-P P_ER Function Turns ON when an instruction handling BCD data attempts to execute using non-BCD data. Turns ON when an operand value specified by the instruction is invalid (e.g. a value outside the work area). Turns ON when unauthorized access is attempted on an area that is not meant to be accessed. Turns ON when the number of digits is increased or decreased as a result of executing an arithmetical instruction. Data shift instructions and some arithmetical instructions may handle the carry as part of their processing. Turns ON when data comparison returns an "equal". Turns ON when data becomes 0 as a result of calculations or transfers. Turns ON when data comparison returns an "unequal". Turns ON when data comparison returns "data1>data2". Turns ON when data comparison returns "data1>=data2". Turns ON when data comparison returns "data1<data2". Turns ON when data comparison returns "data1=<data2". Turns ON when the MSB becomes 1 as a result of calculations. Turns ON when the calculation result overflows. Turns ON when the calculation result underflows. Remains ON at all times. Used as an execution condition for instructions that cannot be connected directly to the bus bar. Remains OFF at all times.
AER
P_AER
A
Appendix
Carry flag
CY
P_CY
Equals flag
P_EQ
Unequal flag Greater than flag Greater than or equals flag Less than flag Less than or equals flag Negative flag Overflow flag Underflow flag Always ON flag
OFF
P_OFF
98
Clock Pulses
Clock pulses are contacts that turn ON/OFF at a fixed time interval.
Name 0.02s clock pulse Label 0.02s In CX-P P_0.02s
0.02s
Function
0.01s 0.01s
0.1s
P_0.1s
0.1s
0.05s 0.05s
0.2s
P_0.2s
0.2s
0.1s
0.1s 1.0s
A
Appendix
1min
1s
P_1s
0.5s
0.5s
1min
P_1min
30s
30s
Note
To enter a clock pulse or condition flag into CX-Programmer, first enter a contact, then press the [P] key to select from the drop-down list.
99
I/O Areas
Input area Output area 0.00 to 99.15 (100 CHs) 100.00 to 199.15 (100 CHs)
With CP1L, the first 1 or 2 channel(s) of the input and output areas, starting at 0CH and 100CH, respectively, are reserved by the CPU unit. As expansion I/O units and expansion units are connected to the CPU unit, input and output areas are assigned 1 channel at a time, in the order of connection. Number of Reserved Channels and Expansion (I/O) Units
CPU unit Input area Reserved CH Output area Number of Expansion (I/O) Units Allowed 0 1 1 3 3 3
A
Appendix
10-point I/O unit 14-point I/O unit 20-point I/O unit 30-point I/O unit 40-point I/O unit 60-point I/O unit
100 CH 100 CH 100 CH 100 CH, 101 CH 100 CH, 101 CH 100 CH, 101 CH, 102 CH
For example, when using a 40-point I/O unit, input areas 0CH and 1CH, and output areas 100CH and 101CH are assigned to the internal I/O of the CPU unit. If expansion (I/O) units are connected to the CPU unit, input areas 2CH and later, and output areas 102CH and later, will be assigned in order. When the CPU unit is powered ON, input and output channels are automatically allocated to the input and output areas of the expansion (I/O) units after the connections are checked. Changes to the connection order of the units will result in inconsistencies with the ladder program. Be sure to review the ladder program when changing the unit connection order.
100
A-2 Instructions
A-2 Instructions
CP1L has a rich instruction set. This section explains how to use the instructions, and gives some basic instructions.
A
Appendix
101
A-2 Instructions
A
Appendix
RESET
RSET
KEEP RELAY
KEEP(011)
Note
When programming in CX-Programmer, there is no need to think of contacts and coils (OUTs) as instructions. They can be written into the program by simply selecting the corresponding symbols.
102
A-2 Instructions
000001
000003
Note
There is no limit on the number of contacts that can be connected by AND/AND NOT instructions.
OR / OR NOT Instructions
Use for contacts connected in parallel.
000000 Bus bar 000004
A
Appendix
000001
000005
Note
There is no limit on the number of contacts that can be connected by OR/OR NOT instructions.
Note
Do not use coils with the same relay number for OUT and OUT NOT simultaneously. Doing so will result in a "duplicated coil" program error.
103
A-2 Instructions
000000
A
Appendix Note Note
000001
000102
In the above example, relay coil 000102 is turned ON by the SET condition and OFF by the RSET condition. Holding areas and auxiliary areas turned ON by SET instructions will retain the ON status even when power is interrupted or when operation is stopped.
~
000103
000200
000000
000001
000102 Ignored
In the above example, relay coil 000103 is turned ON by the set condition and OFF by the reset condition. While the reset input is ON, the set input will be ignored. Holding areas and auxiliary areas turned ON by KEEP instructions will retain the ON status even when power is interrupted or when operation is stopped.
104
CPU unit R AM
3
User program
7 1
Flash memory Memory cassette User program Comment memory FB program memory
A
Appendix
8
3 3 3
5 2
DM area
1 6 3
Built-in outputs
(1) Transfer of programs and parameter data Data in RAM is automatically backed up to the built-in flash memory when changes are made, for example, from the CX-Programmer. When the unit is powered ON, data is transferred from the built-in flash memory to RAM. (2) Transfer of DM defaults data When initiated from CX-Programmer, DM defaults are transferred from RAM to the built-in flash memory. According to PLC setup, DM defaults are transferred from the built-in flash memory to RAM when the unit is powered ON. (3) Transfer of data between flash memory and memory cassette When initiated from CX-Programmer, data is transferred from RAM or the built-in flash memory to the memory cassette. When the unit is powered ON, data is transferred from the memory cassette to the built-in flash memory.
SYSMAC CP1L Getting Started Guide
105
(4) User program The ladder program is stored in this memory (RAM) area. The ladder program can be saved, edited, or opened from CX-Programmer. (5) I/O memory This is the memory (RAM) area the user program writes to and reads from. Some parts of the I/O memory are cleared when the power is interrupted. Other parts are maintained. There are also parts, which are used for data exchange with PLC units, and other parts, which are only used internally. There are 2 ways to exchange data with other units: once each execution cycles, or only when instructed. (6) Parameter areas In addition to I/O memory area, which is used as instruction operands by the user, there is also a separate memory area that can be manipulated only from CX-Programmer. This is the parameter area. The parameter area stores PLC setup data. [PLC Setup] PLC setup is the configuration data used by the user to provide a software definition of the basic specifications of the CPU unit. These consist of parameters such as serial port settings and minimum cycle time settings. For details on configuring PLC setup, refer to CX-Programmer Operation Manual (W446). (7) Built-in flash memory CP1L CPU units have built-in flash memory. Data is automatically backed up to the built-in flash memory as they are written to the user program area or the parameter area (PLC setup, routing table) by methods other than programmed instructions, i.e. when transferred or edited using CX-Programmer or PT, or when transferred from the memory cassette. The next time the unit is powered ON, user memory (user program or parameter area) will automatically be transferred back from the built-in flash memory to RAM. By using CX-Programmer, data in the DM area of the I/O memory can also be saved to the built-in flash memory. This saved data can be set as defaults for the DM area, and can be automatically written back into the DM area when the unit is powered ON next. Symbol table, comment file, and program index file can be stored in the comment memory portion of the flash memory. When a project is transferred from CX-Programmer to the CPU unit, program information for the function block will automatically be saved to the flash memory. (8) Memory cassette Memory cassettes can store programs, data memory contents, PLC setup data, and I/O comments from CX-Programmer. Data stored in the memory cassette can be loaded automatically when the unit is powered ON.
A
Appendix
106
Initialize hardware memory and system work. Power ON (initialization) Detect connected units. processes Execute automatic start-up transfer from memory cassette. Clear I/O memory. Check user memory (UM). Force-set/force-reset.
A
Appendix
Overseeing processes
Check for battery error. Monitor DIP switches. Check I/O bus. Check user program memory.
Cycle time Program execution During execution: Execute user program. Error processing: Turn outputs OFF (For bus errors, reset unit) When an error occurs: Clear I/O memory area (except when executing FALS instructions)
I/O refresh *
Perform cyclic data exchange on the following units: CP-series expansion I/O units *I/O refresh is performed in PROGRAM mode also.
Peripheral services
Services only executed on event occurrence: Peripheral USB port service Serial port service Communication port service Built-in flash memory access service Memory cassette access service Online editing
107
I/O Refreshing
I/O refreshing refers to cyclic data transfers between a preset area of the memory and an external source. It involves the following refreshing processes.
Target Unit Type CPU units built-in I/O CP-series expansion I/O unit, expansion unit Max. Data Exchange Input: 2 CH Output: 2 CH Fixed; dependent on unit Data Exchange Area I/O area I/O area
I/O refreshing is performed without interruption within a single cycle. Furthermore, I/O refreshing is always performed after program execution. I/O refreshing can be performed for CP1Ls built-in normal I/O and CP-series expansion (I/O) units at one of the following 3 timings: Cyclic refreshing Execution by instructions with immediate refresh variation Execution by an IORF instruction
A
Appendix
Cyclic Refreshing
I/O refreshing is performed after all instructions in the executable tasks have been executed. This is the standard method for I/O refreshing.
E ND
Task
E ND Cycle E ND
Task
I/O refresh
108
A
Appendix
Note
1. 2.
3.
Immediate refreshing is possible on the built-in I/O area only. For CP-series expansion (I/O) units, use the IORF instruction. Bit-specific instructions: The channel (16 bits) containing the specified bit will be refreshed. Channel-specified instruction: The specified channel (16 bits) will be refreshed. Inputs and S (source) operands: The input is refreshed immediately before executing the instruction. Outputs and D (destination) operands: The output is refreshed immediately after executing the instruction.
D1: Starting CH number D2: Ending CH number I/O channel data between D1 and D2 will be refreshed.
Note
IORF instructions take a relatively long time to execute. The execution time will increase as the number of channels being refreshed increases. Hence, the total cycle time may be extended. It should be noted that the total cycle time may be increased significantly. For details, refer to SECTION 4 Instruction Execution Times and Number of Steps of CP Series CP1H/CP1L CPU Unit Programming Manual (W451).
109
Peripheral Services
Peripheral services are event services that occur on an irregular basis, such as monitoring and setup on PT, and online editing (editing programs under execution) and monitoring on CX-Programmer. It involves processing of service requests both to and from external devices. In the CP-series, most of the services use the FINS command. Each service is allocated with a fixed amount of time specified by the system, and is executed every cycle. If the services processing completes within the allocated time, no processing is performed during the remaining time.
Service Type Peripheral USB port service Serial port service Content Processes unscheduled requests received as FINS or Host Link commands from CX-Programmer, PT, or from a host computer via a peripheral USB port or serial port (i.e. requests for program transfer, monitoring, forcedset/reset, or online editing). Processes unscheduled requests issued by the CPU unit via a serial port (non-solicited communications). Executes serial communication by SEND, RECV, and CMND instructions. Uses internal logic ports 0 to 7 as communication ports. Executes instructions in the background, using internal logic ports 0 to 7 as communication ports. Processes reading and writing of data from and to the built-in flash memory. Processes reading and writing of data from and to the memory cassette.
A
Appendix Note
Communication port service
Service time is separately allocated for the peripheral USB port, serial port, and communication port services. By default, 4% of the preceding cycle time will be allocated. If services take several cycles for execution, and are delayed, allocate a fixed amount of time (as opposed to percentage) to each service. To do this, use [Set time to all events] under PLC Settings.
110
Cycle Time
CPU units process data in cycles starting with Overseeing processes and ending with Peripheral services.
A
Appendix
Program execution
Details Processes program execution (execution of instructions). The processing time is the sum of individual instruction execution times. Processing Time and Variation Factors Sum of instruction execution times
For details, refer to SECTION 4 Instruction Execution Times and Number of Steps of CP Series CP1H/CP1L CPU Unit Programming Manual (W451).
I/O Refreshing
Details CP-series Expansion I/O Units and Expansion Units Each unit is refreshed. Outputs (from the CPU unit to the expansion units) are refreshed first, followed by the inputs (from the expansion units to the CPU unit). Processing Time and Variation Factors I/O refresh time for each unit is multiplied by the number of units used
For details on I/O refresh time, refer to 2-7 Computing the Cycle Time of CP Series CP1L CPU Unit Users Manual (W462).
111
Peripheral Services
Details Peripheral USB port service Serial port service Processing Time and Variation Factors Processing time for these services will vary depending on the PLC settings. If a cycle time has not been specified, service will be executed using 4% of the preceding cycle time calculated by "cycle time calculation". If a cycle time has been specified, service will be executed for the specified time. Execution will take at least 0.1ms, regardless of whether a cycle time has been specified or not. If the ports are not connected, the servicing time will be 0ms. If a cycle time has not been specified in the PLC settings, service will be executed for 4% of the preceding cycle time calculated by "cycle time calculation". If a cycle time has been specified, service will be executed for the specified time. Execution will take at least 0.1ms, regardless of whether the cycle time has been specified. If no communications ports are used, the servicing time will be 0ms. Built-in flash memory accessing service Memory cassette accessing service Processing time for these services will vary depending on the PLC settings. If a cycle time has not been specified, service will be executed using 4% of the preceding cycle time calculated by "cycle time calculation". If a cycle time has been specified, service will be executed for the specified time. Execution will take at least 0.1ms, regardless of whether the cycle time has been specified. If there is no access, the servicing time will be 0ms.
A
Appendix Note
1.
2. 3.
The cycle time will vary depending on the following factors. Type and number of instructions in the user program (all cyclic tasks and additional tasks executable during the cycle, and interrupt tasks of which execution condition are satisfied) Type and number of CP-series expansion I/O units and expansion units connected (use of protocol macro, and max. number of transmission data channels within messages) "Minimum cycle time" specified in the PLC settings Use of peripheral USB ports and serial ports "Fixed peripheral servicing time" specified in the PLC settings The cycle time is not affected by the number of tasks in the user program. The cycle time is only affected by cyclic tasks that are READY within the cycle. When changing from MONITOR to RUN mode, the cycle time will be extended by approx. 10ms (this will not, however, make the cycle time too long).
112
0.04ms
A
Appendix
The following conditions apply: CP1L 14-point I/O unit is used. No expansion units are used. No connections are made, i.e. with CX-Programmer.
113
A
Appendix
Analog values can be digitized according to the external analog settings input (0 to 10V, resolution: 256). Converted values are sent to the auxiliary area (A643CH). This function is useful for changing settings based on inputs such as change in outside temperature or feedback from a variable resistor. An example using input from a variable resistor is shown below.
Operation Overview
A photoelectric sensor is placed in front of a gate. When the sensor detects a car, the gate is opened. When the car passes the gate, the sensor is turned OFF.
Photoelectric sensor
CP1L
Gate
When a set amount of time passes after the sensor is turned OFF, the gate is closed.
Sensor input Contact 0.00 Gate output Contact 100.00 Open
The time until the gate closure will be adjusted with by a variable resistor connected to CP1L.
Adjustment range (Min. 2.0s to Max. 27s)
Variable resistor
114
DC24V
A
Appendix
Gate
P_On BCD A643 D0 +B #20 D0 D1 100.00 0.00 TIM Gate Photoelectric sensor 0010 D1
(A): To set a minimal value of 2sec, first convert the external analog input value A643 to a BCD value of D0, increment it by 20BCD/2sec, and then store it as D1. (B): TIM will act as a decrementing ON timer with 0.1sec intervals.
115
The maximum input voltage is 11VDC. Do not apply voltages any greater.
A
Appendix
Analog adjuster
116
0.00
T0010
100.00
Gate
Gate P_On BCD A642 D0 +B #20 D0 D1 100.00 0.00 TIM Gate Photoelectric sensor 0010 D1
A
Appendix
(A): To use the analog adjuster on CP1L for setting the timer in the example application, change auxiliary area A643 in the ladder program to A642.
Operation Overview
Products moving at high speeds are detected by a sensor and counted.
Product Sensor
117
Signals that are shorter than the scan time must be read and counted. When 100 signals have been counted, a counting completed signal will be output.
30 s min. Sensor input Contact 0.04 BCD counter instruction C0000 Set Value Present Value 100 100 98 97 1 0
99
A
Appendix
Contact C0000 Counter reset Input contact 0.01 Count complete Contact 100.00
Quick-response inputs can read short signals that are shorter than the cycle time. However, as with any other input, the full cycle time will be used for ladder processing. For accelerated processing unaffected by the scan time, use interrupt inputs. The input can only be counted once during each cycle time, regardless of how many times the input occurs. To count the input multiple times within each cycle time, use a high-speed counter.
CP1L
118
PLC Setup
On the PLC Settings dialog box, set the sensor input (0.04) to [Quick].
1. 2.
Open the CX-Programmer main window. Double-click [Settings] in the project tree.
A
Appendix The PLC Settings dialog box will be displayed.
3.
119
4.
On the IN0 drop-down list for Interrupt Input, select [Quick]. While the sensor input contact is 0.04, setup is performed for [IN0] since the interrupt input / quick-response input setting is set to 0.
A
Appendix
5. 6.
Close the PLC Settings dialog box. To apply changes made to the PLC settings, turn the PLC power ON.
C0000
100.00
Count complete
120
Operation Overview
Moving product (i.e. IC chips) will be inspected for curvatures and bends. Use interrupt inputs if the normal cycle time cannot provide fast enough processing.
Sensor input (interrupt) Product
A
Appendix
Sensor input 3
Interrupt tasks will be executed when the sensor input (interrupt) changes from OFF to ON.
Sensor input (interrupt input 0) Contact 0.04 Sensor input 1 Contact 0.00 Sensor input 2 Contact 0.01 Sensor input 3 Contact 0.02 RESET input Contact 0.05 PASS output Contact 100.00 NG output Contact 100.01 NG output sensor input 1 Contact 100.02 NG output sensor input 2 Contact 100.03 NG output sensor input 3 Contact 100.04
121
A
Appendix
PASS output 100.00 NG output 100.01
CP1L
NG output sensor input 3 100.04 NG output sensor input 2 100.03 NG output sensor input 1 100.02
PLC Setup
Set contact 0.04 to be [Interrupt].
1. 2. 3.
Open the PLC Settings dialog box. Click the Built-in Input tab. On the IN0 drop-down list for [Interrupt Input], select [Interrupt]. While the sensor input contact is 0.04, setup is performed for [IN0] since the interrupt input setting is set to 0.
4. 5.
Close the PLC Settings dialog box. To apply changes made to the PLC settings, turn the PLC power ON.
122
100 #0 100.02 SET NG output sensor input 1 100.03 100.01 Allow interrupt
A
Appendix
NG output sensor input 3 0.05 RSET RESET input 100.00 RSET 100.01 RSET 100.02 RSET 100.03 RSET 100.04
123
When interrupt input 0 (contact 0.04) turns ON, the following "interrupt task 140" will be executed once. Assignment of interrupt tasks to interrupt inputs is fixed. Interrupt input 0 will always execute interrupt task 140.
0.00 0.01 0.02 SET Sensor input 1 Sensor input 2 Sensor input 3 0.00 SET Interrupt task 140 Sensor input 1 0.01 SET Sensor input 2 100.03 NG output sensor input 2 100.02 NG output sensor input 1 100.00 PASS output
A
Appendix
124
1.
Right-click [NewPLC1[CP1L]Offline] in the project tree. Select [Insert Program] from the pop-up menu. [NewProgram2(Unassigned)] will be added to the bottom of the project tree.
A
Appendix
2.
Right-click [NewProgram2(Unassigned)]. Select [Properties] from the pop-up menu. The Program Properties dialog box will be displayed.
125
3.
Click the General tab. Select [Interrupt Task 140] from the Task type dropdown list.
o
A
Appendix
4. 5.
Close the Program Properties dialog box. Select [Section1] under [NewProgram2(Int 140)].
6.
Input the ladder program for the interrupt. To display the main ladder program, double-click [Section1] under [NewProgram1(00)] in the project tree.
126
Operation Overview
In this example, a fountain will be controlled. The fountain is to be activated according to the following schedule: Mon thru Fri: 17:30 to 20:30 Sat, Sun: 10:00 to 21:15
CP1L
A
Appendix
Fountain
CP1L
127
Fountain pump
>=(325) A354 #6
A
Appendix
(A): Turned ON for Monday thru Friday (i.e. when A354 [day] is less than or equal to [Friday]), from 17:30 (when A351 [hh:mm:ss] becomes equal to the value set in D0 [17:30:00]) until 20:30 (when A351 [hh:mm:ss] becomes equal to the value set in D10 [20:30:00]). (B): Turned ON for Saturday and Sunday (i.e. when A354 [day] is greater than or equal to [Saturday]), from 10:00 (when A351 [hh:mm:ss] becomes equal to the value set in D20 [10:00:00]) until 21:15 (when A351 [hh:mm:ss] becomes equal to the value set in D30 [21:15:00]). >=DT and <DT are time comparison instructions.
128
7 D0 -
6 -
5 4 1
2 0
0 Set D0=0038Hex Compare seconds Compare minutes Compare hours Mask days Mask months Mask years
1 1
0 0
A
Appendix
Compare highlighted data 15 A351 A352 A353 Minute Day Year 9 7 Second Hour Month 0 S2 :D100 S2+1:D101 S2+2:D102 15 00 9 7 00 13 0
129
DM Area Setup
The following values are set into the DM area as BCD.
Channel D0 D1 D2 D10 D11 D12 D20 D21 D22 Value 3000 0017 0000 3000 0020 0000 0000 0010 0000 1500 0021 0000 Content 30min 00sec 17hr 30min 00sec 20hr 00min 00sec 10hr 15min 00sec 21hr -
A
Appendix
1. 2.
Open the CX-Programmer main window. Double-click [Memory] in the project tree.
130
3.
Double-click [D] in the data area workspace. The PLC data table will be displayed.
A
4.
Input the values for the DM addresses.
Appendix
5. 6.
Click [Save in Project]. The settings will be saved. Transfer the data from the computer to CP1L. 1)Confirm that the computer is online with CP1L. 2)Select [Online] - [Transfer to PLC] from the menu. The Transfer to PLC dialog box will be displayed. 3)Select the area and its region for the transfer. Click [Transfer to PLC]. The data will be transferred.
131
Operation Overview
A
Appendix
A sheet feeder will be regulated to feed constant lengths in a given direction, i.e. for vacuum packing of food products.
Motor Speed Motor: Start Contact 0.02 Motor: Run Contact 100.00 Motor: Slow Contact 100.01 Normal stop position Contact 100.02 Error stop position Contact 100.03 3550 3500 High-speed counter 3000 measurement pulse (Pulse) (A270)
Ladder program turns the high-speed software reset (A531.00) ON upon motor startup
While the pulse count is between 3500 and 3550, normal stop position (100.02) will be ON. When the pulse count exceeds 3550, error stop position (100.03) will be ON.
132
A
Appendix
CP1L-L14DR-A
Motor run 100.00 Motor slow 100.01 Error stop position 100.03 Indicator Normal stop position 100.02 Indicator
Inverter, etc.
Note
Use the external power supply for input devices only. (It cannot be used to power output devices.)
133
PLC Setup
High-speed counter 0 will be enabled.
1. 2.
Open the PLC Settings dialog box. Click the Built-in Input tab.
A
Appendix
3. 4. 5. 6. 7. 8.
Check the [Use high speed counter 0] checkbox for High Speed Counter 0. Select [Linear mode] for [Counting mode]. Select [Software reset(comparing)] from the Reset drop-down list. Select [Differential phase input] from the Input Setting drop-down list. Close the PLC Settings dialog box. To apply changes made to the PLC settings, turn the PLC power ON.
134
Programming Example 1
Use comparison instructions to compare counter values. The program can be created easily by using comparison instructions to compare counter values.
Ladder Program
Counter values are used to start/slow/stop the motor.
0.02
Stop motor
A531.00 100.00
Motor run
Motor run 100.01 >=(325) A270 #0BB8 >=(325) A270 #0DAC Stop motor Motor slow W0.00 When high-speed counter (A270) reaches 3000 (0BB8 Hex), the motor decelerates. When high-speed counter (A270) reaches 3500 (0DAC Hex), the motor is stopped.
A
Appendix
After motor stops, check the stop position. W0.00 0.02 W0.01
Start motor
Motor stopped 100.02 >=(325) <(310) A270 #0DDE Normal stop position 100.03 >=(325) A270 #0DDE Error stop position Stop position is normal if the high-speed counter (A270) is between 3500 (0DAC Hex) and 3550 (0DDE Hex). Stop position is in error if the high-speed counter (A270) is greater than 3550 (0DDE Hex).
Motor stopped
A270 #0DAC
135
Programming Example 2
Use a CTBL (register comparison table) instruction to execute an interrupt process when the target value is achieved. Slowing and stopping are executed as interrupt tasks, allowing high-speed processes to be executed without affecting the cycle time.
Ladder Program
Use a CTBL instruction to execute interrupt tasks when the target position is reached.
0.02 RSET Start motor W0.02 A531.00 Software reset for high-speed counter 0 Reset "motor stopped"
A
Appendix
After motor stops, check the stop position. W0.02 >=(325) Motor stopped A270 #0DAC <(310) A270 #0DDE >=(325) A270 #0DDE Interrupt task 04 P_On
CTBL(882) #0 #0 D600 SET 100.00 Set "motor run" Specification for high-speed counter 0 Start comparison with target Lower CH of comparison table
Stop position is normal if the high-speed counter (A270) is between 3500 (0DAC Hex) and 3550 (0DDE Hex). Normal stop position 100.02
100.03
Stop position is in error if the high-speed counter (A270) is greater than 3550 (0DDE Hex).
When the PV of the high-speed counter matches target value 1 (3000), interrupt task 04 will be executed.
SET 100.01
136
When the PV of the high-speed counter matches target value 2 (3500), interrupt task 05 will be executed.
P_On RSET Reset "motor run" 100.00 Interrupt task 05 RSET Reset "motor slow" 100.01
DM Area Setup
The comparison table for the CTBL (register comparison table) instruction should be allocated to DM D600 through D606.
Channel D600 D601 D602 D603 D604 D605 D606 Value 0002 0BB8 0000 0004 0DAC 0000 0005 Target value 2: Interrupt task No.5 Target value 1: Interrupt task No.4 Target value 2: 3500 BCD (DAC Hex) Content Items compared: 2 Target value 1: 3000 BCD (BB8 Hex)
A
Appendix
Operation Overview
The following example is for a single-axis handling machine that is used to transfer product. Origin search will be executed, followed by positioning operations to points A and B.
Point A Origin Point B
137
Origin Search
An accurate origin search that makes use of various I/O signals (origin proximity input signal, origin input signal, positioning completed signal, error counter reset output, etc.) can be executed with a single instruction.
Origin proximity input Contact 0.02
Origin input Contact 0.06 Pulse frequency Search high speed 10kHz Search acceleration ratio 2000Hz/4ms Search deceleration ratio 2000Hz/4ms Search proximity speed 1000Hz CW
A
Appendix
CCW
Origin Search Method Search direction Detection method Search operation Operating mode
Description Origin search is executed in the CW direction. Reads the first origin input signal after an OFF-ON-OFF sequence of the origin proximity input signal. Reverses direction on a limit input, and continues the origin search. Executes an error counter reset output when the origin is detected. Positioning completed input will not be used.
Positioning
Common settings for the positioning operations are as follows: Target frequency 50kHz Acceleration/deceleration ratio 2000Hz/4ms Initial frequency 0Hz
2
CCW Point A -1000 Origin Point B CW 100000
1 3
(1) After completion of the origin search, the equipment will be positioned to point A (-1000) by absolute pulse specification (absolute coordinate system). (2) After positioning to point A, the equipment will be positioned to point B (100000) by absolute pulse specification (absolute coordinate system). (3) Positioning of points A and B are repeated. Because absolute pulse specification is used, the positioning SV for (3) will be the same as for (1).
138
NO contact
NO contact
NO contact
+ 24VDC
A
R7D series
Appendix
CN1
1 2 3 4 8 9 CW CW CCW CCW ECRST ECRST
CP1L-L14DT
6 10 11
RUN Z ZCOM
Hood FG Indicator Point A positioning complete 100.02 Point B Origin search positioning complete complete 100.05 100.03
*Insert a resistance of 1.6 to 2.2k , so that the current is within the 7 to 15mA range. *For a 20/30/40-point CPU, the origin proximity input (pulse 0) will be 0CH10bit.
139
PLC Setup
Specify the settings for pulse output 0.
1. 2. 3.
Open the PLC Settings dialog box. Click the Pulse Output 0 tab. Set the following settings.
A
Appendix
Base Settings Item Undefined Origin Limit Input Signal Operation Limit Input Signal Search/Return Initial Speed Speed Curve Setting Hold Always NO 0pps Trapezoidal Origin Search Item Use define origin operation Search Direction Detection Method Search Operation Operating Mode Origin Input Signal Proximity Input Signal Search High Speed Search Proximity Speed Search Compensation Value Search Acceleration Ratio Search Deceleration Ratio Positioning Monitor Time Setting Use CW Methd 0 Invers 1 Mode 1 NO NO 10000pps 1000pps 0 2000 2000 0ms
4. 5.
Close the PLC Settings dialog box. To apply changes made to the PLC settings, turn the PLC power ON.
140
Origin search ORG instruction Pulse output 0 Origin search function CW/CCW pulse output method Positioning PLS2 instruction Pulse output 0 Absolute pulse specification Position data setup table Initial frequency setting
A
Appendix
@PLS2(887) Positioning to point A #0 #1 D0 D6 0.05 @PLS2(887) Positioning to point B #0 #1 D10 D6 Output flags for origin search and positioning completion. 0.03 0.04 0.05
Positioning PLS2 instruction Pulse output 0 Absolute pulse specification Position data setup table Initial frequency setting
W0.00
Positioning to point A
Positioning to point B
A280.06
Positioning to point B A280.03 100.02 Point A positioning complete Pulse output complete
0.05
0.03
0.04
W0.02
Positioning to point A A280.03 100.03 Point B positioning complete Pulse output complete
141
A
Appendix
142
COMM
COMM
CP1L
A
Appendix
To perform serial communication on CP1L, install an optional serial communication board (RS232C or RS422A/485). 14/20-point I/O units can have 1 optional serial communication board installed. 30/40-point I/O units can have up to 2 boards installed. The Modbus-RTU easy master function allows for easy communication with components connected via a serial connection board.
15 D32300 D32301 Describe Modbus-RTU commands in the DM fixed allocation words. Communication can then be enabled by simply turning ON the software switch A640 CH bit 00. D32302 D32303 08 07 Slave address FUNCTION code Communication data bytes Communication data 00
Modbus-RTU easy master function execution switch A640 CH bit 00 (for port 1)
In the DM fixed allocation words for Modbus-RTU easy master, allocate the slave address, function, and data to the Modbus slave device. After the allocations have been made, Modbus-RTU commands can be sent by turning the software switch ON. Received responses are automatically stored in the DM fixed allocation words. Note Modbus-RTU easy master execution bits and DM Fixed Allocation words depend on unit type, 14/20-point I/O units or 30/40-point I/O units. For details, refer to CP Series CP1L CPU Unit User's Manual (W462).
143
Operation Overview
A bobbin winder on a spinning machine will be used for in the following example. The rotation speed of the bobbin winder must be made variable as the thread is wound, so that the speed at which the thread is pulled stays constant.
CP1L
A
Appendix
Speed
Slow rotation
50.00Hz Stooped
Contact A ON (W0.00)
Contact Z ON (W0.15)
The target speed is achieved based on input from multiple contacts. Acceleration and deceleration is modified by the acceleration and deceleration of an inverter.
System Configuration
CP1L and CIMR-V7 (an OMRON inverter) are connected by RS485 for frequency and start/stop control.
Wiring Example
CP1L CP1W-CIF11
COMM
RDA RDB+ SDASDB+ FG -
CIMR-V7
RS485 50m or less Symbol SS+ RR+ Control circuit terminal block (communication terminals)
1 2 3 4 5
144
CP1W-CIF11 Setup
Set the DIP switches as follows.
(Rear panel) CPU unit connector Operation setup DIP switches
No. 1
ON/OFF ON
Content Terminating resistance present 2-wire type 2-wire type Always OFF Enabled Enabled
2 3 4 5 6
ON ON OFF ON ON
A
Appendix
CIMR-V7 Setup
Set the DIP switches as follows. SW2-1: ON (terminating resistance present) Terminating resistance for RS422/ 485 communication Next, set the parameters as follows:
No. n003 n004 n019 n020 n151 n152 Name Operation command Frequency command Acceleration time 1 Deceleration time 1 RS-422/485 communication Timeout detection RS-422/485 communication Frequency commands and monitoring RS-422/485 communication Slave address RS-422/485 communication Baud rate RS-422/485 communication Parity RS-422/485 communication Transmission wait time RS-422/485 communication RTS control Value 2 6 5.0 5.0 1 1 Comments RS-422/485 communication enabled Frequency commands from RS-422/485 communication enabled Acceleration time (sec) Deceleration time (sec) Detection enabled, detect errors, stop deceleration after deceleration time 1 (Default) Select unit for communication of frequency commands data and frequency monitoring data. Unit: 0.01Hz (Default). Slave address (slave node number), unit 1 Communication baud rate (communication speed): 9600bps (Default) Even parity Sets the response wait time for request messages received from the master. 10ms (Default). RTS control enabled (Default)
1 2 0 10 0
145
PLC Setup
Configure serial port 1.
1. 2. 3.
Open the PLC Settings dialog box. Click the Serial Port 1 tab. Set the following settings.
A
Appendix
Item Communication Settings Baud Format Mode Response Timeout Custom 9600bps 8, 1, E Serial Gateway Mode 0 (Default) Setting
4.
146
#0000 D32306
MOV(021)
Stop operation when communication starts. Operation command (0: Stop) Frequency command 00.00Hz
Contact A
#0117 D32306
MOV(021)
A
Appendix
Contact B
#0115 D32306
MOV(021)
Contact C
#0113 D32306
MOV(021)
Contact Z
#0000 D32306
MOV(021)
#0000 D32307 Start Modbus communication 1 second after executing ladder program. Continue Modbus communication. P_On
TIM
Modbus-RTU easy master function execution bit A640.01 Modbus-RTU easy master function execution normal flag
147
A640.01
A640.02
(A): Turn the A640.00 execution flag ON to send command data D32300 and later. For details, refer to DM Area Setup on the next page.
A
Appendix
Bits 07 to 00 15 to 08 07 to 00 15 to 08 15 to 00 15 to 00 Command
Setting Slave address (00 to F7 Hex) Reserved (must be 00 Hex) FUNCTION code Reserved (must be 00 Hex) Number of communication data bytes (0000 to 005E hex) Communication data (max. 94bytes)
(B): When a command has been sent successfully, A640.01 execution normal flag is turned ON, and data is stored to responses D32350 and later.
Channel Serial Port 1 D32350 D32351 D32352 D32353 D32354 to D32399 07 to 00 15 to 08 07 to 00 15 to 08 07 to 00 15 to 08 15 to 00 15 to 00 Response Slave address (01 to F7 Hex) Reserved (must be 00 Hex) FUNCTION code Reserved Error code Reserved (must be 00 Hex) Number of response bytes (0000 to 03EA Hex) Response data (max. 92bytes) Bits Setting
(C): When a communication error occurs, A640.02 execution error flag is turned ON, and the error code is stored to D32352.
148
DM Area Setup
DM Fixed Allocation Words for Modbus-RTU Easy Master DM settings from D32300 to D32305 are set before the execution of the ladder program. D32306 and D32307 do not need to be set explicitly. They are modified by MOV instructions, and are used to change, start, and stop frequency commands.
Serial Port 1: Command Setting Slave address D32300 00 01 FUNCTION Communication code data bytes D32301 00 10 D32302 00 09 D32303 00 01 Communication data: D32303 to Max. D32349
Address Value
D32304 00 02
D32305 04 00
D32306 01 02 02
D32307 58 58
00
00 Data for next register (e.g. set 60.0Hz (0258 Hex) for No.0002 [frequency command])
A
Appendix
Data for starting register (e.g. set 0001 Hex for No.0001 [operation command (see below)]) Attached data size in bytes: 4 (4 bytes from lower D32305 to upper D32307) Number of registers data is written to: 2 (2 data: No.0001 and No.0002 on register 2) Register No. for starting data write:0001 (start writing to inverter at register No.0001)
For number of bytes, use 9 bytes from upper D32303 to upper D32307
Operation Command (Register No.0001 Hex) allocation and details for Inverter CIMR-V7
Bit No. 0 1 2 3 4 5 6 7 8 9 10 11 to 15 Setting Operation command (1: Start) Normal/reversed rotation (1: Reversed) External error (1: EF0) Error reset (1: Error reset) Multifunction input 1 (1: ON) Multifunction input 2 (1: ON) Multifunction input 3 (1: ON) Multifunction input 4 (1: ON) Multifunction input 5 (1: ON) Multifunction input 6 (1: ON) Multifunction input 7 (1: ON) (Unused)
For this example, only operation command (No.0 bit) will be used. With Modbus-RTU easy master function, CRC-16 checksums do not need to be set in the DM area, since they are calculated automatically.
149
A
Appendix
FB
CP1L
*FB used in this example. Note Documentation (PDF file) on Smart FB Library functions can be found in the [FBL] - [omronlib] - [Inverter] - [INVRT] - [Serial] folder. For details on the Smart FB Library, refer to this file.
150
Function Blocks
Function blocks are programming elements (templates) that group a set of processes (functions) into a single block. The user can define a function block in advance, and then use it by simply inserting it into a program and setting its I/O. Create and save standard program sections as function blocks. The function blocks can then be placed in a program, and be easily reused by simply setting the I/O parameters.
[Device 1 Control]
A1 B1 X1 Inputs An Bn Program elements Processing (algorithm) An
[Device n Control]
Bn Xn Outputs Xn TIM n #0100 Tn Yn Yn Zn Zn
TIM 1 #0100 T1 Y1 Z1
A
Appendix
Take a ladder program for "Device 1 Control". Replace the program I/Os with parameters. Save the algorithm as a template. The template is defined as a function block (FB).
[Device 1 Control] Define as function block
Device Control EN A B ENO X Y Z A2 B2 P On A1 B1
Device Control
EN
A B
ENO
X Y Z
X1 Y1 Z1
[Device 2 Control]
P On
Device Control
EN
A B
ENO
X Y Z
X2 Y2 Z2
Insert function block instance into ladder program Set I/O parameters
The defined function block can be used in ladder programs as function block instances.
151
Operation Overview
The example for A-4-7 Using Inverters for Speed Control (1) will be used again.
60.00Hz 55.00Hz Speed 50.00Hz Stopped Contact A ON (W0.00)
Contact Z ON (W0.15)
The target speed is achieved based on input from multiple contacts. Acceleration and deceleration is modified by the acceleration and deceleration of an inverter.
A
Appendix
System Configuration
The system configuration for A-4-7 Using Inverters for Speed Control (1) will be used again. CP1L and CIMR-V7 (an OMRON inverter) are connected by RS485 for frequency and start/stop control.
CP1L CIMR-V7
COMM
RD-A RDB+ SD-A SDB+ FG
RS485
In this FB library example, capacity of the user memory may exceed 5K steps. For this reason, since a memory capacity error may occur on a 14/20-point CP1L (with a user memory of 5K steps), use a 30/40-point CP1L (with a user memory of 10K steps) for this example For details on wiring, and on the settings for CP1W-CIF11, CIMR-V7, and CP1L, refer to System Configuration of A-4-7 Using Inverters for Speed Control (1).
152
_INV002_Refresh (BOOL) EN
Specify host unit Serial port No. Scan list MV/RV type Interval I/F area type I/F area No. Message area type Message area No.
_INV060_Stop (BOOL) EN (INT) Inverter No. NodeNo Start (BOOL) Execute (WORD) Area type AreaID (INT) Area No. AreaNo (BOOL) ENO (BOOL) Done (BOOL) Error (WORD) ErrorID
(INT) UnitSelect (INT) PortNo (DWORD) Scanlist (DWORD) ModelTypeMV (UINT) IntervalCount (WORD) AreaID (INT) AreaNo (WORD) MSGAreaID (INT) MSGAreaNo
(BOOL) ENO (BOOL) BUSY (INT) NodeAddr (BOOL) Error (WORD) ErrorID
Inverter No. Start Frequency Rotation direction Utilization area type Utilization area No.
A
Specifies start signal, rotation direction, and frequency in Hz. Decelerates an operating axis to a stop.
Required for communication with the inverter. 1 FB is used for each PLC serial port. 1 "Status refresh" FB will be used for a serial port, even if the serial port has multiple inverters connected. Issues communication commands to inverters. Processes communication errors. Assigns priorities when multiple commands are issued.
Appendix
153
Ladder Program
W0.00
MOV(021)
Contact A
#1770 D100 Frequency command 60.00Hz(1770 Hex) Rotation direction Normal (0)
MOV(021)
#0 D2
W0.01
MOV(021)
A
Appendix
Contact B
#157C D100 Frequency command 55.00Hz(157C Hex) Rotation direction Normal (0)
MOV(021)
#0 D2 W0.02
MOV(021)
Contact C
#1388 D100 Frequency command 50.00Hz(1388 Hex) Rotation direction Normal (0)
MOV(021)
#0 D2
154
P_On FLT(452) D100 D101 Convert frequency command (D100) from BIN to floating point
Divide frequency by 100 to achieve 0.01Hz increments. Store value in FB (MOV V)(D0). E.g. 6000/100=60.00Hz
A
Appendix
Start
Stopped
Reset data interface work area between FBs when operation is started. P_First_Cycle
BSET(071)
#0 D9000 D9100
Note
155
MoveV P_On Always ON flag &1 Inverter slave unit 1 W1.00 Start D0 Frequency D2 Direction *1 P_DM DM area specification &9000 _INV032_MoveVelocityHz (BOOL) (BOOL) EN ENO (BOOL) (INT) Velocity NodeNo (BOOL) (BOOL) Execute Command Aborted (REAL) (BOOL) Velocity Error (INT) (WORD) Direction ErrorID (WORD) AreaID (INT) AreaNo Decelerate to stop
A
Appendix
(BOOL) EN (INT) Always ON flag &1 NodeNo Inverter slave unit 1 (BOOL) W1.01Stopped Execute (WORD) *1 P_DM AreaID DM area (INT) specification AreaNo &9000
P_On
*1 Refresh _INV002_Refresh P_First_Cycle (BOOL) EN First cycle flag #CCCC PLC used: select CP1L &1 Select serial port #00000002 Inverter slave unit used #00000000 Inverter CIMR-V7 &10 Interval counter *1 P_DM DM area specification &9000 P_DM DM area specification &9100 (INT) UnitSelect (INT) PortNo (DWORD) Scanlist (DWORD) ModelTypeM V (UINT) IntervalCount (WORD) AreaID (INT) AreaNo (WORD) MSGAreaID (INT) MSGAreaNo (BOOL) ENO (BOOL) BUSY (INT) NodeAddr (BOOL) Error (WORD) ErrorID W9 INV error code W7.00 Communicating W8 Inverter slave unit communicating or done communicating Set the same area to use as FB data interface.
Inverter slave unit used (Unit address : 1) 31 3 2 1 0 BIT 0 0 0 1 0 0 2 Inverter (CIMR-V7:0, CIMR-F7:1) 31 3 2 1 0 BIT 0 0 0 0 0 0 0
156
1.
Select [File] - [Function Block] - [Load Function Block from File] from the main menu. The Select CX-Programmer Function Block Library File dialog box will be displayed.
A
Appendix
2.
Select the [FBL] - [omronlib] - [Inverter] - [INVRT] - [Serial] folder. A list of FB library files for serial communication with inverters will be displayed.
157
3.
Select [_INV002_Refresh12.cxf]. Click [Open]. _INV002_Refresh is added under [Function Blocks] in the project tree.
A
Appendix
4. 5.
Place the cursor at the position where the _INV002_Refresh FB is to be inserted. Select [Insert] - [Function Block Invocation] from the main menu.
158
6.
Input a name for FB Instance. Press the [Enter] key. The named FB instance will be displayed.
A
Appendix
7. 8.
Connect an input contact to the FB. Set the I/O parameters for the FB. 1) Place the cursor next to an FB parameter. Press the [Enter] key. The New Parameter dialog box will be displayed. 2) Input the parameter. Press the [Enter] key.
159
Operation Overview
Current temperature information is exchanged by boilers. This setup may be used to adjust boiler temperatures according to the other boiler conditions, or to monitor the boilers from a single location.
Boiler A Boiler B Boiler C
A
Appendix
COMM
RDA RDB+ SDASDB+ FG -
COMM
RDA RDB+ SDASDB+ FG -
COMM
RDA RDB+ SDASDB+ FG -
1CH,2CH
1CH,2CH
1CH,2CH
1 2 3 4 5
160
No. 1 2 3 4 5 6
Setting Presence of terminating resistance 2/4-wire selection 2/4-wire selection RS control for RD SD control for RD
Content Terminating resistance present for PLCs at the ends. 2-wire type 2-wire type Always OFF Disabled Enabled
A
Appendix
PLC Setup
Configure serial port 1.
1. 2. 3.
Open the PLC Settings dialog box. Click the Serial Port 1 tab. Set the following settings.
161
Item Communication Settings Baud Format Mode Link Words PLC Link Mode NT/PLC Link Max PLC Link Unit No.
Boiler A (Master)
4.
A
Appendix
Programming Example
Serial PLC links are used for program-free linking of data in the serial PLC link areas. The ladder program transfers the data to be linked to the data link area.
Boiler A CP1L (Master) 0CH 1CH 2CH Input area A_Temperature data 0 A_Temperature data 1 Boiler B CP1L (Slave No.0) Input area B_Temperature data 0 B_Temperature data 1 Boiler C CP1L (Slave No.1) Input area C_Temperature data 0 C_Temperature data 1
100CH
Output area
Output area
Output area
3100CH 3101CH
3129CH 3189CH
162
Ladder Program
Boiler A CP1L (Master) P_On XFER(70) #2 1 3100 Boiler B CP1L (Slave No.0) P_On XFER(70) #2 1 3110 Boiler C CP1L (Slave No.1) P_On XFER(70) #2 1 3120
A
Appendix
163
A
Appendix
164
Index
Numerics 20-point I/O unit. . . . . . . . . . . . . . . . . . . 13 30-point I/O unit. . . . . . . . . . . . . . . . . . . 13 40-point I/O unit. . . . . . . . . . . . . . . . . . . 14 A address reference tool. . . . . . . . . . . . . . 90 analog adjuster . . . . . . . . . . . . . . . 15, 116 auxiliary area . . . . . . . . . . . . . . . . . . . . . 66 B basic I/O processing instruction . . . . . 102 battery . . . . . . . . . . . . . . . . . . . . . . . . . . 15 battery-free operation . . . . . . . . . . . . . . 36 built-in flash memory . . . . . . . . . . . . . . 106 built-in I/O area . . . . . . . . . . . . . . . . . . 109 C calendar timer . . . . . . . . . . . . . . . . . . . 127 changing timer setting . . . . . . . . . . . . . . 90 channel . . . . . . . . . . . . . . . . . . . . . . . . . 96 clock . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 clock pulse. . . . . . . . . . . . . . . . . . . . . . . 99 closed contact . . . . . . . . . . . . . . . . . . . . 58 compile . . . . . . . . . . . . . . . . . . . . . . . . . 70 condition flag . . . . . . . . . . . . . . . . . . . . . 98 connecting CX-Programmer and CP1L. 39 connecting to a computer . . . . . . . . . . . 40 connection line . . . . . . . . . . . . . . . . . . . 76 contact. . . . . . . . . . . . . . . . . . . . . . . . . . 56 counter instruction . . . . . . . . . . . . . . . . . 63 CPU unit . . . . . . . . . . . . . . . . . . . . 14, 105 CX-Programmer . . . . . . . . . . . . . . . . . . 38 cycle time . . . . . . . . . . . . . . . . 93, 94, 111 cyclic refreshing. . . . . . . . . . . . . . . . . . 108 D data memory (DM) . . . . . . . . . . . . . . . . 15 debug . . . . . . . . . . . . . . . . . . . . . . . . . . 85 deleting contacts and coils . . . . . . . . . . 75 device type . . . . . . . . . . . . . . . . . . . . . . 53 diagram workspace . . . . . . . . . . . . . 48, 49 differentiated up contact . . . . . . . . . . . . 68 DIN track . . . . . . . . . . . . . . . . . . . . . . . . 30 DIP switch . . . . . . . . . . . . . . . . . . . . . . . 15 E editing rung . . . . . . . . . . . . . . . . . . . . . . END instruction . . . . . . . . . . . . . . . . . . . error. . . . . . . . . . . . . . . . . . . . . . . . . . . . expansion unit . . . . . . . . . . . . . . . . . . . . 75 69 17 16 external analog settings input . . . . 15, 114 external dimension . . . . . . . . . . . . . . . . 30 F first cycle flag. . . . . . . . . . . . . . . . . . . . . 66 force-set/force-reset . . . . . . . . . . . . . . . 88 function block . . . . . . . . . . . . . . . . . . . 151 G going online . . . . . . . . . . . . . . . . . . . . . . 78 H help . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 high-speed counter . . . . . . . . . . . . . . . 132 I I/O allocation . . . . . . . . . . . . . . . . . . . . . 24 I/O area . . . . . . . . . . . . . . . . . . . . . . . . 100 I/O comment . . . . . . . . . . . . . . . . . . . . . 73 I/O comment bar . . . . . . . . . . . . . . . . . . 48 I/O refreshing. . . . . . . . . . . . . . . . . . . . 108 information window . . . . . . . . . . . . . . . . 49 inputting contact . . . . . . . . . . . . . . . . . . 56 inputting output coil . . . . . . . . . . . . . . . . 59 instruction . . . . . . . . . . . . . . . . . . . 51, 101 instructions reference . . . . . . . . . . . . . . 51 interlock . . . . . . . . . . . . . . . . . . . . . . . . . 44 interrupt function . . . . . . . . . . . . . . . . . 121 L ladder backtracking . . . . . . . . . . . . . . . . 92 ladder program . . . . . . . . . . . . . . . . 44, 46 loading program . . . . . . . . . . . . . . . . . . 72 M main menu. . . . . . . . . . . . . . . . . . . . . . . 48 main window . . . . . . . . . . . . . . . . . . . . . 48 Modbus-RTU easy master function. . . 143 monitoring . . . . . . . . . . . . . . . . . . . . . . . 85 mounting CP1L . . . . . . . . . . . . . . . . . . . 31 O online editing . . . . . . . . . . . . . . . . . . . . . operating mode . . . . . . . . . . . . . . . . . . . operation indicator. . . . . . . . . . . . . . . . . option board . . . . . . . . . . . . . . . . . . . . . OR circuit. . . . . . . . . . . . . . . . . . . . . . . . 93 80 17 16 57
165
Index PLC setup . . . . . . . . . . . . . . . . . . 106, 119 power supply voltage. . . . . . . . . . . . . . . 32 precautions . . . . . . . . . . . . . . . . . . . . . . . 9 program check. . . . . . . . . . . . . . . . . . . . 70 programming . . . . . . . . . . . . . . . . . . . . . 38 project . . . . . . . . . . . . . . . . . . . . . . . . . . 53 project tree . . . . . . . . . . . . . . . . . . . . . . 48 project workspace . . . . . . . . . . . . . . . . . 48 pulse signal . . . . . . . . . . . . . . . . . . . . . 137 Q quick-response input . . . . . . . . . . . . . . 117 R relay. . . . . . . . . . . . . . . . . . . . . . . . . . . . relay number . . . . . . . . . . . . . . . . . . . . . rung comment . . . . . . . . . . . . . . . . . . . . rung header . . . . . . . . . . . . . . . . . . . . . . 96 96 74 49
S saving program . . . . . . . . . . . . . . . . . . . 71 scan time . . . . . . . . . . . . . . . . . . . 118, 121 search . . . . . . . . . . . . . . . . . . . . . . . . . . 90 section . . . . . . . . . . . . . . . . . . . . . . . . . . 48 serial communication. . . . . . . . . . . . . . 143 setting the clock. . . . . . . . . . . . . . . . . . . 79 Smart FB Library . . . . . . . . . . . . . . . . . 150 special instruction . . . . . . . . . . . . . . . . 101 starting CX-Programmer . . . . . . . . . . . . 47 T test run . . . . . . . . . . . . . . . . . . . . . . . . . timer instruction . . . . . . . . . . . . . . . . . . . title bar. . . . . . . . . . . . . . . . . . . . . . . . . . toolbar . . . . . . . . . . . . . . . . . . . . . . . . . . transferring program . . . . . . . . . . . . . . . turning power on . . . . . . . . . . . . . . . . . . 85 61 48 48 82 35
U USB driver . . . . . . . . . . . . . . . . . . . . . . . 40 USB port . . . . . . . . . . . . . . . . . . . . . . . . 15 W watch window . . . . . . . . . . . . . . . . . . . . 87 wiring ground line . . . . . . . . . . . . . . . . . 32 wiring input . . . . . . . . . . . . . . . . . . . . . . 34 wiring output . . . . . . . . . . . . . . . . . . . . . 34 wiring power line . . . . . . . . . . . . . . . . . . 32 writing relay coil. . . . . . . . . . . . . . . . . . 103
166