SYSMAC CP Series CP1H/CP1L CPU Unit · PDF filePROGRAMMING MANUAL Cat. No. W451-E1-03 SYSMAC...

1175
PROGRAMMING MANUAL Cat. No. W451-E1-03 SYSMAC CP Series CP1H-X40D@-@, CP1H-XA40D@-@, CP1H-Y20DT-D CP1L-L14D@-@, CP1L-L20D@-@, CP1L-M30D@-@, CP1L-M40D@-@ CP1H/CP1L CPU Unit

Transcript of SYSMAC CP Series CP1H/CP1L CPU Unit · PDF filePROGRAMMING MANUAL Cat. No. W451-E1-03 SYSMAC...

  • Cat. No. W451-E1-03

    PROGRAMMING MANUAL

    SYSMAC CP SeriesCP1H-X40D@-@, CP1H-XA40D@-@, CP1H-Y20DT-DCP1L-L14D@-@, CP1L-L20D@-@, CP1L-M30D@-@, CP1L-M40D@-@

    CP1H/CP1L CPU Unit

  • SYSMAC CP SeriesCP1H-X40D@-@, CP1H-XA40D@-@, CP1H-Y20DT-D

    CP1H CPU UnitsCP1L-L14D@-@, CP1L-L20D@-@, CP1L-M30D@-@, CP1L-M40D@-@

    CP1L CPU UnitsProgramming ManualRevised May 2007

  • iv

  • Notice:OMRON products are manufactured for use according to proper proceduresby a qualified operator and only for the purposes described in this manual.

    The following conventions are used to indicate and classify precautions in thismanual. Always heed the information provided with them. Failure to heed pre-cautions can result in injury to people or damage to property.

    !DANGER Indicates an imminently hazardous situation which, if not avoided, will result in death orserious injury. Additionally, there may be severe property damage.

    !WARNING Indicates a potentially hazardous situation which, if not avoided, could result in death orserious injury. Additionally, there may be severe property damage.

    !Caution Indicates a potentially hazardous situation which, if not avoided, may result in minor ormoderate injury, or property damage.

    OMRON Product ReferencesAll OMRON products are capitalized in this manual. The word Unit is alsocapitalized when it refers to an OMRON product, regardless of whether or notit appears in the proper name of the product.

    The abbreviation Ch, which appears in some displays and on some OMRONproducts, often means word and is abbreviated Wd in documentation inthis sense.

    The abbreviation PLC means Programmable Controller. PC is used, how-ever, in some CX-Programmer displays to mean Programmable Controller.

    Visual AidsThe following headings appear in the left column of the manual to help youlocate different types of information.

    Note Indicates information of particular interest for efficient and convenient opera-tion of the product.

    1,2,3... 1. Indicates lists of one sort or another, such as procedures, checklists, etc.

    OMRON, 2005All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, orby any means, mechanical, electronic, photocopying, recording, or otherwise, without the prior written permission ofOMRON.

    No patent liability is assumed with respect to the use of the information contained herein. Moreover, because OMRON is con-stantly striving to improve its high-quality products, the information contained in this manual is subject to change withoutnotice. Every precaution has been taken in the preparation of this manual. Nevertheless, OMRON assumes no responsibilityfor errors or omissions. Neither is any liability assumed for damages resulting from the use of the information contained inthis publication.

    v

  • Unit Versions of CP-series CPU Units

    Unit Versions A unit version has been introduced to manage CPU Units in the CP Seriesaccording to differences in functionality accompanying Unit upgrades.

    Notation of Unit Versions on Products

    The unit version is given to the right of the lot number on the nameplate of theproducts for which unit versions are being managed, as shown below.

    Confirming Unit Versions with Support Software

    The methods used to confirm the unit version for the CP-series CP1H andCP1L CPU Units are somewhat different.

    CP1H CPU Units

    CX-Programmer version 6.1 or higher can be used to confirm the unit versionusing one of the following two methods. (See note.)

    Using the PLC Information Using the Unit Manufacturing Information

    Note CX-Programmer versions lower than version 6.1 cannot be used to confirmunit versions for CP1L CPU Units.

    CP1L CPU Units

    CX-Programmer version 7.1 or higher can be used to confirm the unit versionusing the PLC Information. (See note.) The Unit Manufacturing Informa-tion cannot be used.

    Note CX-Programmer versions lower than version 7.1 cannot be used to confirmunit versions for CP1L CPU Units.

    CP1H-XA40DR-A

    CPU UNIT

    Lot No. 28705 0000 Ver.1.0

    OMRON Corporation MADE IN JAPAN

    Unit version (Example for Unit version 1.0)

    Lot No.

    CP-series CPU Unit Product nameplate

    vi

  • PLC Information

    Procedure When the Device Type and CPU Type Are Known

    1,2,3... 1. If you know the device type and CPU type, select them in the Change PLCDialog Box, go online, and select PLC - Edit - Information from themenus. The following Change PLC Dialog Box will be displayed.

    Example for CP1H

    Example for CP1L

    vii

  • 2. Click the Settings Button and, when the Device Type Settings Dialog Boxis displayed, select the CPU type.

    Example for CP1H

    Example for CP1L

    viii

  • 3. Go online and select PLC - Edit - Information

    The PLC Information Dialog Box will be displayed.

    Example for the CP1H

    Unit version

    ix

  • Example for the CP1L

    Use the above display to confirm the unit version of the CPU Unit.

    Procedure When the Device Type and CPU Type Are Not Known

    This procedure is possible only when connected directly to the CPU Unit witha serial connection.

    If you don't know the device type and CPU type but are connected directly tothe CPU Unit on a serial line, select PLC - Auto Online to go online, and thenselect PLC - Edit - Information from the menus.

    The PLC Information Dialog Box will be displayed and can be used to confirmthe unit version of the CPU Unit.

    Unit version

    x

  • Unit Manufacturing Information (CP1H CPU Units Only)

    1,2,3... 1. In the IO Table Window, right-click and select Unit Manufacturing infor-mation - CPU Unit.

    Unit version

    xi

  • 2. The following Unit Manufacturing information Dialog Box will be displayed.

    Use the above display to confirm the unit version of the CPU Unit connectedonline.

    Using the Unit Version Labels

    The following unit version labels are provided with the CPU Unit.

    These labels can be attached to the front of previous CPU Units to differenti-ate between CPU Units of different unit versions.

    Unit version

    Ver. 1.0

    Ver. 1.0

    Ver.

    Ver.

    These Labels can be used to manage differences in the available functions among the Units. Place the appropriate label on the front of the Unit to show what Unit version is actually being used.

    xii

  • TABLE OF CONTENTS

    PRECAUTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii1 Intended Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiv

    2 General Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiv

    3 Safety Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiv

    4 Operating Environment Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxvi

    5 Application Precautions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxvii

    6 Conformance to EC Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxx

    SECTION 1Programming Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    1-1 Programming Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    1-2 Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

    1-3 Checking Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

    1-4 Introducing Function Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

    SECTION 2Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

    2-1 Programming with Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

    2-2 Using Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

    2-3 Interrupt Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

    2-4 CX-Programmer Operations for Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

    SECTION 3 Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

    3-1 Notation and Layout of Instruction Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

    3-2 Sequence Input Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

    3-3 Sequence Output Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113

    3-4 Sequence Control Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132

    3-5 Timer and Counter Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168

    3-6 Comparison Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209

    3-7 Data Movement Instructions . . . . . . . .