Baixe o app para aproveitar ainda mais
Prévia do material em texto
EI O 00 00 00 42 67 .0 1 www.schneider-electric.com SQL Gateway EIO0000002417 04/2020 Modicon M241 Logic Controller User Guide 06/2021 EIO0000004267.01 06/2021 2 Table of Contents Part I1 Modicon M241 Logic Controller - Programming Guide. . . . . . . . . PLC System Library Guide. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Part II 3 Modicon M241 Logic Controller - High Speed Counting HSC Library Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Part III 4 Modicon M241 Logic Controller - PTOPWM Library Guide. . . . . . Part IV 5 Modicon M241 Logic Controller - Hardware Guide. . . . . . . . . . . . Part V 6 Modicon TMC4 Cartridges - Programming Guide. . . . . . . . . . . . . Part VI 7 Modicon TMC4 Cartridges - Hardware Guide. . . . . . . . . . . . . . . . . Part VII 2 Modicon M241 Logic Controller - System Functions and Variables Modicon M241 Logic Controller Programming Guide EIO0000003059.03 04/2021 www.se.com Legal Information The Schneider Electric brand and any trademarks of Schneider Electric SE and its subsidiaries referred to in this guide are the property of Schneider Electric SE or its subsidiaries. All other brands may be trademarks of their respective owners. This guide and its content are protected under applicable copyright laws and furnished for informational use only. No part of this guide may be reproduced or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), for any purpose, without the prior written permission of Schneider Electric. Schneider Electric does not grant any right or license for commercial use of the guide or its content, except for a non-exclusive and personal license to consult it on an "as is" basis. Schneider Electric products and equipment should be installed, operated, serviced, and maintained only by qualified personnel. As standards, specifications, and designs change from time to time, information contained in this guide may be subject to change without notice. To the extent permitted by applicable law, no responsibility or liability is assumed by Schneider Electric and its subsidiaries for any errors or omissions in the informational content of this material or consequences arising out of or resulting from the use of the information contained herein. © 2021 Schneider Electric. All rights reserved. Table of Contents Safety Information ......................................................................................7 About the Book...........................................................................................8 About the Modicon M241 Logic Controller ..................................................13 M241 Logic Controller Description........................................................13 How to Configure the Controller .................................................................17 How to Configure the Controller ...........................................................17 Libraries ..................................................................................................19 Libraries.............................................................................................19 Supported Standard Data Types ................................................................20 Supported Standard Data Types ..........................................................20 Memory Mapping......................................................................................21 Controller Memory Organization...........................................................21 RAM Memory Organization..................................................................22 Non-Volatile Memory Organization .......................................................23 Relocation Table .................................................................................26 Tasks.......................................................................................................28 Maximum Number of Tasks .................................................................28 Task Configuration Screen...................................................................28 Task Types .........................................................................................30 System and Task Watchdogs ...............................................................32 Task Priorities .....................................................................................33 Default Task Configuration...................................................................35 Controller States and Behaviors ................................................................36 Controller State Diagram .....................................................................36 Controller State Diagram ...............................................................36 Controller States Description ...............................................................39 Controller States Description..........................................................39 State Transitions and System Events ...................................................42 Controller States and Output Behavior ............................................42 Commanding State Transitions ......................................................45 Error Detection, Types, and Management .......................................51 Remanent Variables ......................................................................52 Controller Device Editor ............................................................................54 Controller Parameters .........................................................................54 Communication Settings......................................................................55 PLC Settings ......................................................................................56 Services.............................................................................................56 Ethernet Services ...............................................................................57 Users Rights ......................................................................................58 Embedded Inputs and Outputs Configuration..............................................67 Embedded I/Os Configuration..............................................................67 Expert Functions Configuration..................................................................71 Expert Functions Overview..................................................................71 Counting Function...............................................................................73 Pulse Generators Embedded Function .................................................74 Cartridge Configuration .............................................................................76 TMC4 Cartridge Configuration .............................................................76 Expansion Modules Configuration..............................................................77 EIO0000003059.03 3 TM4/TM3/TM2 Expansion Module Configuration ...................................77 TM3 I/O Configuration General Description...........................................78 TM3 I/O Bus Configuration ..................................................................81 Optional I/O Expansion Modules ..........................................................82 Ethernet Configuration ..............................................................................85 Ethernet Features, Functions and Services...........................................85 Presentation .................................................................................85 IP Address Configuration ...............................................................86 Modbus TCP Client/Server ............................................................90 Web Server ..................................................................................91FTP Server ................................................................................. 101 FTP Client .................................................................................. 102 SNMP ........................................................................................ 102 Controller as a Target Device on EtherNet/IP................................. 103 Controller as a Slave Device on Modbus TCP ............................... 119 Changing the Modbus TCP Port ................................................... 123 Firewall Configuration ....................................................................... 124 Introduction ................................................................................ 124 Dynamic Changes Procedure....................................................... 125 Firewall Behavior ........................................................................ 126 Firewall Script Commands ........................................................... 128 Industrial Ethernet Manager .................................................................... 131 Industrial Ethernet............................................................................. 131 DHCP Server ................................................................................... 134 Fast Device Replacement.................................................................. 134 Serial Line Configuration ......................................................................... 135 Serial Line Configuration ................................................................... 135 Machine Expert Network Manager ..................................................... 136 Modbus Manager.............................................................................. 137 ASCII Manager ................................................................................. 140 Modbus Serial IOScanner.................................................................. 141 Adding a Device on the Modbus Serial IOScanner............................... 142 Adding a Modem to a Manager .......................................................... 147 CANopen Configuration .......................................................................... 149 CANopen Interface Configuration....................................................... 149 J1939 Configuration................................................................................ 152 J1939 Interface Configuration ............................................................ 152 OPC UA Server Configuration ................................................................. 155 OPC UA Server Overview.................................................................. 155 OPC UA Server Configuration............................................................ 155 OPC UA Server Symbols Configuration .............................................. 157 OPC UA Server Performance ............................................................ 158 Post Configuration .................................................................................. 161 Post Configuration Presentation......................................................... 161 Post Configuration File Management.................................................. 162 Post Configuration Example .............................................................. 163 Connecting a Modicon M241 Logic Controller to a PC ............................... 166 Connecting the Controller to a PC ...................................................... 166 SD Card................................................................................................. 169 Script Files ....................................................................................... 169 SD Card Commands ......................................................................... 169 4 EIO0000003059.03 Firmware Management ........................................................................... 175 Updating Modicon M241 Logic Controller Firmware............................. 175 Updating TM3 Expansion Modules Firmware ...................................... 177 Compatibility .......................................................................................... 180 Software and Firmware Compatibilities............................................... 180 Appendices .............................................................................................. 181 How to Change the IP Address of the Controller ........................................ 182 changeIPAddress: Change the IP address of the controller .................. 182 Functions to Get/Set Serial Line Configuration in User Program ................. 184 GetSerialConf: Get the Serial Line Configuration ................................. 184 SetSerialConf: Change the Serial Line Configuration ........................... 185 SERIAL_CONF: Structure of the Serial Line Configuration Data Type ................................................................................................ 186 Controller Performance ........................................................................... 188 Processing Performance ................................................................... 188 Glossary ................................................................................................... 189 Index ......................................................................................................... 199 EIO0000003059.03 5 Safety Information Safety Information Important Information Read these instructions carefully, and look at the equipment to become familiar with the device before trying to install, operate, service, or maintain it. The following special messages may appear throughout this documentation or on the equipment to warn of potential hazards or to call attention to information that clarifies or simplifies a procedure. Please Note Electrical equipment should be installed, operated, serviced, and maintained only by qualified personnel. No responsibility is assumed by Schneider Electric for any consequences arising out of the use of this material. A qualified person is one who has skills and knowledge related to the construction and operation of electrical equipment and its installation, and has received safety training to recognize and avoid the hazards involved. The addition of this symbol to a “Danger” or “Warning” safety label indicates that an electrical hazard exists which will result in personal injury if the instructions are not followed. This is the safety alert symbol. It is used to alert you to potential personal injury hazards. Obey all safety messages that follow this symbol to avoid possible injury or death. DANGER indicates a hazardous situation which, if not avoided, will result in death or serious injury. ! DANGER WARNING indicates a hazardous situation which, if not avoided, could result in death or serious injury. WARNING! CAUTION indicates a hazardous situation which, if not avoided, could result in minor or moderate injury. CAUTION! NOTICE is used to address practices not related to physical injury. NOTICE EIO0000003059.03 7 About the Book About the Book Document Scope The purpose of this document is to help you program and operate your Modicon M241 Logic Controller with the EcoStruxure Machine Expert software. NOTE: Read and understand this document and all related documents, page 8 before installing, operating, or maintaining your Modicon M241 Logic Controller. The Modicon M241 Logic Controller users should read through the entire document to understand its features. Validity Note This document has been updated for the release of EcoStruxureTM Machine Expert V2.0. The technical characteristics of the devices described in the present document also appear online. To access the information online, go to the Schneider Electric home page www.se.com. The characteristics that are described in the present document should be the sameas those characteristics that appear online. In line with our policy of constant improvement, we may revise content over time to improve clarity and accuracy. If you see a difference between the document and online information, use the online information as your reference. Related Documents Title of Documentation Reference Number EcoStruxure Machine Expert - Programming Guide EIO0000002854 (ENG) EIO0000002855 (FRE) EIO0000002856 (GER) EIO0000002858 (SPA) EIO0000002857 (ITA) EIO0000002859 (CHS) Modicon M241 Logic Controller - Hardware Guide EIO0000003083 (ENG) EIO0000003084 (FRE) EIO0000003085 (GER) EIO0000003086 (SPA) EIO0000003087 (ITA) EIO0000003088 (CHS) Modicon TM2 Expansion Modules Configuration - Programming Guide EIO0000003432 (ENG) EIO0000003433 (FRE) EIO0000003434 (GER) EIO0000003435 (SPA) EIO0000003436 (ITA) EIO0000003437 (CHS) Modicon TM3 Expansion Modules Configuration - Programming Guide EIO0000003119 (ENG) EIO0000003120 (FRE) 8 EIO0000003059.03 https://www.se.com https://www.se.com/en/download/document/EIO0000002854 https://www.se.com/en/download/document/EIO0000002855 https://www.se.com/en/download/document/EIO0000002856 https://www.se.com/en/download/document/EIO0000002858 https://www.se.com/en/download/document/EIO0000002857 https://www.se.com/en/download/document/EIO0000002859 https://www.se.com/en/download/document/EIO0000003083 https://www.se.com/en/download/document/EIO0000003084 https://www.se.com/en/download/document/EIO0000003085 https://www.se.com/en/download/document/EIO0000003086 https://www.se.com/en/download/document/EIO0000003087 https://www.se.com/en/download/document/EIO0000003088 https://www.se.com/en/download/document/EIO0000003432 https://www.se.com/en/download/document/EIO0000003433 https://www.se.com/en/download/document/EIO0000003434 https://www.se.com/en/download/document/EIO0000003435 https://www.se.com/en/download/document/EIO0000003436 https://www.se.com/en/download/document/EIO0000003437 https://www.se.com/en/download/document/EIO0000003119 https://www.se.com/en/download/document/EIO0000003120 About the Book Title of Documentation Reference Number EIO0000003121 (GER) EIO0000003122 (SPA) EIO0000003123 (ITA) EIO0000003124 (CHS) Modicon TM3 Bus Coupler - Programming Guide (EcoStruxure Machine Expert) EIO0000003635 (ENG) EIO0000003636 (FRA) EIO0000003637 (GER) EIO0000003638 (SPA) EIO0000003639 (ITA) EIO0000003640 (CHS) Modicon TM4 Expansion Modules - Programming Guide EIO0000003149 (ENG) EIO0000003150 (FRE) EIO0000003151 (GER) EIO0000003152 (SPA) EIO0000003153 (ITA) EIO0000003154 (CHS) Modicon TMC4 Cartridges - Programming Guide EIO0000003107 (ENG) EIO0000003108 (FRE) EIO0000003109 (GER) EIO0000003110 (SPA) EIO0000003111 (ITA) EIO0000003112 (CHS) Modicon M241 Logic Controller - PLCSystem Library Guide EIO0000003065 (ENG) EIO0000003066 (FRE) EIO0000003067 (GER) EIO0000003068 (SPA) EIO0000003069 (ITA) EIO0000003070 (CHS) Modicon M241 Logic Controller - HSC Library Guide EIO0000003071 (ENG) EIO0000003072 (FRE) EIO0000003073 (GER) EIO0000003074 (SPA) EIO0000003075 (ITA) EIO0000003076 (CHS) Modicon TM3 Expert I/O Modules - HSC Library Guide EIO0000003683 (ENG) EIO0000003684 (FRE) EIO0000003685 (GER) EIO0000003686 (SPA) EIO0000003687 (ITA) EIO0000003688 (CHS) EIO0000003689 (POR) EIO0000003690 (TUR) EIO0000003059.03 9 https://www.se.com/en/download/document/EIO0000003121 https://www.se.com/en/download/document/EIO0000003122 https://www.se.com/en/download/document/EIO0000003123 https://www.se.com/en/download/document/EIO0000003124 https://www.se.com/en/download/document/EIO0000003635 https://www.se.com/en/download/document/EIO0000003636 https://www.se.com/en/download/document/EIO0000003637 https://www.se.com/en/download/document/EIO0000003638 https://www.se.com/en/download/document/EIO0000003639 https://www.se.com/en/download/document/EIO0000003640 https://www.se.com/en/download/document/EIO0000003149 https://www.se.com/en/download/document/EIO0000003150 https://www.se.com/en/download/document/EIO0000003151 https://www.se.com/en/download/document/EIO0000003152 https://www.se.com/en/download/document/EIO0000003153 https://www.se.com/en/download/document/EIO0000003154 https://www.se.com/en/download/document/EIO0000003107 https://www.se.com/en/download/document/EIO0000003108 https://www.se.com/en/download/document/EIO0000003109 https://www.se.com/en/download/document/EIO0000003110 https://www.se.com/en/download/document/EIO0000003111 https://www.se.com/en/download/document/EIO0000003112 https://www.se.com/en/download/document/EIO0000003065 https://www.se.com/en/download/document/EIO0000003066 https://www.se.com/en/download/document/EIO0000003067 https://www.se.com/en/download/document/EIO0000003068 https://www.se.com/en/download/document/EIO0000003069 https://www.se.com/en/download/document/EIO0000003070 https://www.se.com/en/download/document/EIO0000003071 https://www.se.com/en/download/document/EIO0000003072 https://www.se.com/en/download/document/EIO0000003073 https://www.se.com/en/download/document/EIO0000003074 https://www.se.com/en/download/document/EIO0000003075 https://www.se.com/en/download/document/EIO0000003076 https://www.se.com/en/download/document/EIO0000003683 https://www.se.com/en/download/document/EIO0000003684 https://www.se.com/en/download/document/EIO0000003685 https://www.se.com/en/download/document/EIO0000003686 https://www.se.com/en/download/document/EIO0000003687 https://www.se.com/en/download/document/EIO0000003688 https://www.se.com/en/download/document/EIO0000003689 https://www.se.com/en/download/document/EIO0000003690 About the Book Title of Documentation Reference Number Modicon M241 Logic Controller PTO/PWM - Library Guide EIO0000003077 (ENG) EIO0000003078 (FRE) EIO0000003079 (GER) EIO0000003080 (SPA) EIO0000003081 (ITA) EIO0000003082 (CHS) EcoStruxure Machine Expert - FtpRemoteFileHandling Library Guide EIO0000002779 (ENG) EIO0000002780 (FRE) EIO0000002781 (GER) EIO0000002783 (SPA) EIO0000002782 (ITA) EIO0000002784 (CHS) EcoStruxure Machine Expert - SnmpManager Library Guide EIO0000002797 (ENG) EIO0000002798 (FRE) EIO0000002799 (GER) EIO0000002801 (SPA) EIO0000002800 (ITA) EIO0000002802 (CHS) EcoStruxure Machine Expert - Manage a Cyclic Task Interval - Toolbox_Advance Library Guide EIO0000000946 (ENG) EIO0000000947 (FRE) EIO0000000948 (GER) EIO0000000950 (SPA) EIO0000000949 (ITA) EIO0000000951 (CHS) EcoStruxure Machine Expert - Modem Functions - Modem Library Guide EIO0000000552 (ENG) You can download these technical publications and other technical information from our website at www.se.com/ww/en/download/ . 10 EIO0000003059.03 https://www.se.com/en/download/document/EIO0000003077 https://www.se.com/en/download/document/EIO0000003078 https://www.se.com/en/download/document/EIO0000003079 https://www.se.com/en/download/document/EIO0000003080 https://www.se.com/en/download/document/EIO0000003081 https://www.se.com/en/download/document/EIO0000003082 https://www.se.com/en/download/document/EIO0000002779 https://www.se.com/en/download/document/EIO0000002780 https://www.se.com/en/download/document/EIO0000002781 https://www.se.com/en/download/document/EIO0000002783 https://www.se.com/en/download/document/EIO0000002782 https://www.se.com/en/download/document/EIO0000002784 https://www.se.com/en/download/document/EIO0000002797 https://www.se.com/en/download/document/EIO0000002798 https://www.se.com/en/download/document/EIO0000002799 https://www.se.com/en/download/document/EIO0000002801 https://www.se.com/en/download/document/EIO0000002800 https://www.se.com/en/download/document/EIO0000002802 https://www.se.com/en/download/document/EIO0000000946 https://www.se.com/en/download/document/EIO0000000947 https://www.se.com/en/download/document/EIO0000000948 https://www.se.com/en/download/document/EIO0000000950 https://www.se.com/en/download/document/EIO0000000949 https://www.se.com/en/download/document/EIO0000000951 https://www.se.com/en/download/document/EIO0000000552https://www.se.com/ww/en/download/ About the Book Product Related Information WARNING LOSS OF CONTROL • The designer of any control scheme must consider the potential failure modes of control paths and, for certain critical control functions, provide a means to achieve a safe state during and after a path failure. Examples of critical control functions are emergency stop and overtravel stop, power outage and restart. • Separate or redundant control paths must be provided for critical control functions. • System control paths may include communication links. Consideration must be given to the implications of unanticipated transmission delays or failures of the link. • Observe all accident prevention regulations and local safety guidelines.1 • Each implementation of this equipment must be individually and thoroughly tested for proper operation before being placed into service. Failure to follow these instructions can result in death, serious injury, or equipment damage. 1 For additional information, refer to NEMA ICS 1.1 (latest edition), "Safety Guidelines for the Application, Installation, and Maintenance of Solid State Control" and to NEMA ICS 7.1 (latest edition), "Safety Standards for Construction and Guide for Selection, Installation and Operation of Adjustable-Speed Drive Systems" or their equivalent governing your particular location. WARNING UNINTENDED EQUIPMENT OPERATION • Only use software approved by Schneider Electric for use with this equipment. • Update your application program every time you change the physical hardware configuration. Failure to follow these instructions can result in death, serious injury, or equipment damage. Terminology Derived from Standards The technical terms, terminology, symbols and the corresponding descriptions in this manual, or that appear in or on the products themselves, are generally derived from the terms or definitions of international standards. In the area of functional safety systems, drives and general automation, this may include, but is not limited to, terms such as safety, safety function, safe state, fault, fault reset, malfunction, failure, error, error message, dangerous, etc. Among others, these standards include: Standard Description IEC 61131-2:2007 Programmable controllers, part 2: Equipment requirements and tests. ISO 13849-1:2015 Safety of machinery: Safety related parts of control systems. General principles for design. EN 61496-1:2013 Safety of machinery: Electro-sensitive protective equipment. Part 1: General requirements and tests. ISO 12100:2010 Safety of machinery - General principles for design - Risk assessment and risk reduction EIO0000003059.03 11 About the Book Standard Description EN 60204-1:2006 Safety of machinery - Electrical equipment of machines - Part 1: General requirements ISO 14119:2013 Safety of machinery - Interlocking devices associated with guards - Principles for design and selection ISO 13850:2015 Safety of machinery - Emergency stop - Principles for design IEC 62061:2015 Safety of machinery - Functional safety of safety-related electrical, electronic, and electronic programmable control systems IEC 61508-1:2010 Functional safety of electrical/electronic/programmable electronic safety- related systems: General requirements. IEC 61508-2:2010 Functional safety of electrical/electronic/programmable electronic safety- related systems: Requirements for electrical/electronic/programmable electronic safety-related systems. IEC 61508-3:2010 Functional safety of electrical/electronic/programmable electronic safety- related systems: Software requirements. IEC 61784-3:2016 Industrial communication networks - Profiles - Part 3: Functional safety fieldbuses - General rules and profile definitions. 2006/42/EC Machinery Directive 2014/30/EU Electromagnetic Compatibility Directive 2014/35/EU Low Voltage Directive In addition, terms used in the present document may tangentially be used as they are derived from other standards such as: Standard Description IEC 60034 series Rotating electrical machines IEC 61800 series Adjustable speed electrical power drive systems IEC 61158 series Digital data communications for measurement and control – Fieldbus for use in industrial control systems Finally, the term zone of operation may be used in conjunction with the description of specific hazards, and is defined as it is for a hazard zone or danger zone in the Machinery Directive (2006/42/EC) and ISO 12100:2010. NOTE: The aforementioned standards may or may not apply to the specific products cited in the present documentation. For more information concerning the individual standards applicable to the products described herein, see the characteristics tables for those product references. 12 EIO0000003059.03 About the Modicon M241 Logic Controller About the Modicon M241 Logic Controller Introduction This chapter provides information about the Modicon M241 Logic Controller and devices that EcoStruxure Machine Expert can configure and program. M241 Logic Controller Description Overview The M241 Logic Controller has various powerful features and can service a wide range of applications. Software configuration, programming, and commissioning is accomplished with the EcoStruxure Machine Expert software described in detail in the EcoStruxure Machine Expert Programming Guide and the M241 Logic Controller Programming Guide, page 8. Programming Languages The M241 Logic Controller is configured and programmed with the EcoStruxure Machine Expert software, which supports the following IEC 61131-3 programming languages: • IL: Instruction List • ST: Structured Text • FBD: Function Block Diagram • SFC: Sequential Function Chart • LD: Ladder Diagram EcoStruxure Machine Expert software can also be used to program these controllers using CFC (Continuous Function Chart) language. Power Supply The power supply of the M241 Logic Controller is 24 Vdc or 100...240 Vac. Real Time Clock The M241 Logic Controller includes a Real Time Clock (RTC) system (see Modicon M241 Logic Controller, Hardware Guide). Run/Stop The M241 Logic Controller can be operated by the following: • A hardware Run/Stop switch. • A Run/Stop operation by a dedicated digital input, defined in the software configuration. For more information, refer to Configuration of Digital Inputs, page 67. • An EcoStruxure Machine Expert software command. Memory This table describes the different types of memory: EIO0000003059.03 13 About the Modicon M241 Logic Controller Memory Type Size Used to RAM 64 Mbytes, of which 8 Mbytes available for the application execute the application. Non-volatile 128 Mbytes save the program and data in case of a power interruption. Embedded Inputs/Outputs The following embedded I/O types are available, depending on the controller reference: • Regular inputs • Fast inputs associated with counters • Regular sink/source transistor outputs • Fast sink/source transistor outputs associated with pulse generators • Relay outputs Removable Storage The M241 Logic Controllers include an embedded SD card slot. The main uses of the SD card are: • Initializing the controller with a new application • Updating the controller and expansion module firmware, page 175 • Applying post configuration files to the controller, page 161 • Storing recipes files • Receiving data logging files • Backup Data Logging File, page 25 Embedded Communication Features The following types of communication ports are available, depending on the controller reference: • CANopen Master • Ethernet • USB Mini-B • Serial Line 1 • Serial Line 2 Expansion Module and Bus Coupler Compatibility Refer to the compatibility tables in the EcoStruxure Machine Expert - Compatibility and Migration User Guide. M241 Logic Controller Reference Digital Inputs Digital Outputs Communication Ports Terminal Type Power supply TM241C24R 6 regular inputs (1) 8 fast inputs (counters) (2) 6 2A relay outputs 4 source fast outputs (pulse generators)(3) 2 serial line ports 1 USB programming port Removable screw terminal blocks 100...240 Vac TM241CE24R 6 regular inputs (1) 8 fast inputs (counters) (2) 6 2A relay outputs 4 source fast outputs (pulse generators) (3) 2 serial line ports 1 USB programming port Removable screw terminal blocks 100...240 Vac 14 EIO0000003059.03 About the Modicon M241 Logic Controller Reference Digital Inputs Digital Outputs Communication Ports Terminal Type Power supply 1 Ethernet port TM241CEC24R 6 regular inputs (1) 8 fast inputs (counters) (2) 6 2A relay outputs 4 source fast outputs (pulse generators)(3) 2 serial line ports 1 Ethernet port 1 CANopen master port 1 USB programming port Removable screw terminal blocks 100...240 Vac TM241C24T 6 regular inputs (1) 8 fast inputs (counters) (2) Source outputs 6 regular transistor outputs 4 fast outputs (pulse generators) (3) 2 serial line ports 1 USB programming port Removable screw terminal blocks 24 Vdc TM241CE24T 6 regular inputs (1) 8 fast inputs (counters) (2) Source outputs 6 regular transistor outputs 4 fast outputs (pulse generators) (3) 2 serial line ports 1 USB programming port 1 Ethernet port Removable screw terminal blocks 24 Vdc TM241CEC24T 6 regular inputs (1) 8 fast inputs (counters) (2) Source outputs 6 regular transistor outputs 4 fast outputs (pulse generators) (3) 2 serial line ports 1 USB programming port 1 Ethernet port 1 CANopen master port Removable screw terminal blocks 24 Vdc TM241C24U 6 regular inputs (1) 8 fast inputs (counters) (2) Sink outputs 6 regular transistor outputs 4 fast outputs (pulse generators) (3) 2 serial line ports 1 USB programming port Removable screw terminal blocks 24 Vdc TM241CE24U 6 regular inputs (1) 8 fast inputs (counters) (2) Sink outputs 6 regular transistor outputs 4 fast outputs (pulse generators) (3) 2 serial line ports 1 USB programming port 1 Ethernet port Removable screw terminal blocks 24 Vdc TM241CEC24U 6 regular inputs (1) 8 fast inputs (counters) (2) Sink outputs 6 regular transistor outputs 4 fast outputs (pulse generators) (3) 2 serial line ports 1 USB programming port 1 Ethernet port 1 CANopen master port Removable screw terminal blocks 24 Vdc TM241C40R 16 regular inputs (1) 8 fast inputs (counters) (2) 12 2A relay outputs 4 source fast outputs (pulse generators) (3) 2 serial line ports 1 USB programming port Removable screw terminal blocks 100...240 Vac TM241CE40R 16 regular inputs (1) 8 fast inputs (counters) (2) 12 2A relay outputs 4 source fast outputs (pulse generators) (3) 2 serial line ports 1 USB programming port 1 Ethernet port Removable screw terminal blocks 100...240 Vac TM241C40T 16 regular inputs (1) 8 fast inputs (counters) (2) Source outputs 12 regular transistor outputs 4 fast outputs (pulse generators) (3) 2 serial line ports 1 USB programming port Removable screw terminal blocks 24 Vdc TM241CE40T 16 regular inputs (1) Source outputs 2 serial line ports Removable screw terminal blocks 24 Vdc EIO0000003059.03 15 About the Modicon M241 Logic Controller Reference Digital Inputs Digital Outputs Communication Ports Terminal Type Power supply 8 fast inputs (counters) (2) 12 regular transistor outputs 4 fast outputs (pulse generators) (3) 1 USB programming port 1 Ethernet port TM241C40U 16 regular inputs (1) 8 fast inputs (counters) (2) Sink outputs 12 regular transistor outputs 4 fast outputs (pulse generators) (3) 2 serial line ports 1 USB programming port Removable screw terminal blocks 24 Vdc TM241CE40U 16 regular inputs (1) 8 fast inputs (counters) (2) Sink outputs 12 regular transistor outputs 4 fast outputs (pulse generators) (3) 2 serial line ports 1 USB programming port 1 Ethernet port Removable screw terminal blocks 24 Vdc (1) The regular inputs have a maximum frequency of 1 kHz. (2) The fast inputs can be used either as regular inputs or as fast inputs for counting or event functions. (3) The fast transistor outputs can be used either as regular transistor outputs, as reflex outputs for counting function (HSC), or as fast transistor outputs for pulse generator functions (FreqGen / PTO / PWM). Delivery Content The following figure presents the content of the delivery for a M241 Logic Controller: 1 M241 Logic Controller Instruction Sheet 2 M241 Logic Controller 3 Lithium carbon monofluoride battery, type Panasonic BR2032. 16 EIO0000003059.03 How to Configure the Controller How to Configure the Controller Introduction This chapter shows the default configuration of a project. How to Configure the Controller Introduction First, create a new project or open an existing project in the EcoStruxure Machine Expert software. Refer to the EcoStruxure Machine Expert Programming Guide for information on how to: • add a controller to your project • add expansion modules to your controller • replace an existing controller • convert a controller to a different but compatible device Devices Tree The Devices tree presents a structured view of the hardware configuration. When you add a controller to your project, a number of nodes are added to the Devices tree, depending on the functions the controller provides. Item Use to Configure... DI Embedded digital inputs of the logic controller DQ Embedded digital outputs of the logic controller Counters Embedded counting functions (HSC) Pulse_Generators Embedded pulse generator functions (PTO/PWM/FreqGen) Cartridge_x Cartridges inserted into the logic controller EIO0000003059.03 17 How to Configure the Controller Item Use to Configure... IO_Bus Expansion modules connected to the logic controller COM_Bus Communications bus of the logic controller Ethernet_x Embedded Ethernet, serial line, or CANopen communications interfaces NOTE: Ethernet and CANopen are only available on some references. Serial_Line_x CAN_x Applications Tree The Applications tree allows you to manage project-specific applications as well as global applications, POUs, and tasks. Tools Tree The Tools tree allows you to configure the HMI part of your project and to manage libraries. 18 EIO0000003059.03 Libraries Libraries Introduction This chapter describes the default libraries of the Modicon M241 Logic Controller. Libraries Introduction Libraries provide functions, function blocks, data types and global variables that can be used to develop your project. The Library Manager of EcoStruxure Machine Expert provides information about the libraries included in your project and allows you to install new ones. For more information on the Library Manager, refer to the Functions and Libraries User Guide. Modicon M241 Logic Controller When you select a Modicon M241 Logic Controller for your application, EcoStruxure Machine Expert automatically loads the following libraries: Library name Description IoStandard CmpIoMgr configuration types, ConfigAccess, Parameters and help functions: manages the I/Os in the application. Standard Contains functions and function blocks which are required matching IEC61131-3 as standard POUs for an IEC programming system. Link the standard POUs to the project (standard.library). Util Analog Monitors, BCD Conversions, Bit/Byte Functions, Controller Datatypes, Function Manipulators, Mathematical Functions, Signals. PLCCommunication SysMem, Standard. These functions facilitate communications between specific devices. Most of them are dedicated to Modbus exchange. Communication functions are processed asynchronously with regard to the application task that called the function. (See EcoStruxure Machine Expert, Modbus and ASCII Read/Write Functions, PLCCommunication Library Guide). M241 PLCSystem Contains functions and variables to get information and send commands to the controller system. (See Modicon M241 Logic Controller, System Functions and Variables, PLCSystem Library Guide). M241 HSC Contains function blocks and variables to get information and send commands to theFast Inputs/ Outputs of the Modicon M241 Logic Controller. These function blocks permit you to implement HSC (High Speed Counting) functions on the Fast Inputs/Outputs of the Modicon M241 Logic Controller. (See Modicon M241 Logic Controller, High Speed Counting, HSC Library Guide). M241 PTOPWM Contains function blocks and variables to get information and send commands to the Fast Inputs/ Outputs of the Modicon M241 Logic Controller. These function blocks permit you to implement PTO (Pulse Train Output) and PWM (Pulse Width Modulation) functions on the Fast Outputs of the Modicon M241 Logic Controller. (See Modicon M241 Logic Controller, PTOPWM, Library Guide). Relocation Table Allows you organization of data to optimize exchanges between the Modbus client and the controller, by regrouping non-contiguous data into a contiguous table of registers. See Relocation Table, page 26. EIO0000003059.03 19 Supported Standard Data Types Supported Standard Data Types Introduction This chapter provides the different IEC data types supported by the controller. Supported Standard Data Types Supported Standard Data Types The controller supports the following IEC data types: Data Type Lower Limit Upper Limit Information Content BOOL FALSE TRUE 1 Bit BYTE 0 255 8 Bit WORD 0 65,535 16 Bit DWORD 0 4,294,967,295 32 Bit LWORD 0 264-1 64 Bit SINT -128 127 8 Bit USINT 0 255 8 Bit INT -32,768 32,767 16 Bit UINT 0 65,535 16 Bit DINT -2,147,483,648 2,147,483,647 32 Bit UDINT 0 4,294,967,295 32 Bit LINT -263 263-1 64 Bit ULINT 0 264-1 64 Bit REAL 1.175494351e-38 3.402823466e+38 32 Bit STRING 1 character – 1 character = 1 byte WSTRING 1 character – 1 character = 1 word TIME 0 4294967295 32 Bit For more information on ARRAY, LTIME, DATE, TIME, DATE_AND_TIME, and TIME_OF_DAY, refer to the EcoStruxure Machine Expert Programming Guide. 20 EIO0000003059.03 Memory Mapping Memory Mapping Introduction This chapter describes the memory maps and sizes of the different memory areas in the Modicon M241 Logic Controller. These memory areas are used to store user program logic, data and the programming libraries. Controller Memory Organization Introduction The controller memory is composed of two types of physical memory: • The non-volatile memory, page 23 contains files (application, configuration files, and so on). • The Random Access Memory (RAM), page 22 is used for application execution. Files Transfers in Memory Item Controller State File Transfer Events Connection Description 1 – Initiated automatically at Power ON and Reboot Internal Files transfer from non-volatile memory to RAM. The content of the RAM is overwritten. 2 All states except INVALID_OS (1) Initiated by user Ethernet or USB programming port Files can be transferred via: • Web server, page 91 • FTP server, page 101 • Controller Assistant • EcoStruxure Machine Expert 3 All states Initiated automatically by script (data transfer) or by power cycle (cloning) when an SD card is inserted SD card Up/download with SD card (1). (1) If the controller is in the INVALID_OS state, the only accessible memory is the SD card and only for firmware upgrades. EIO0000003059.03 21 Memory Mapping NOTE: The modification of files in non-volatile memory does not affect a running application. Any changes to files in non-volatile memory are taken into account at the next reboot. RAM Memory Organization Introduction This section describes the RAM (Random Access Memory) size for different areas of the Modicon M241 Logic Controller. Memory Mapping The RAM size is 64 Mbytes. The RAM is composed of 2 areas: • dedicated application memory • OS memory This table describes the dedicated application memory: Area Element Size System area 192 Kbytes System Area Mappable Addresses %MW0...%MW59999 128 Kbytes System and diagnostic variables, page 23 (%MW60000...%MW60199) This memory is accessible through Modbus requests only. These must be read-only requests. Dynamic Memory Area: Read Relocation Table, page 26 (%MW60200...%MW61999) This memory is accessible through Modbus requests only. These must be read-only requests. System and diagnostic variables, page 23 (%MW62000...%MW62199) This memory is accessible through Modbus requests only. These can be read or write requests. Dynamic Memory Area: Write Relocation Table, page 26 (%MW62200...%MW63999) This memory is accessible through Modbus requests only. These can be read or write requests. %MW64000…%MW65535 Reserved Retain and Persistent data, page 23 64 Kbytes User area 8 Mbytes Symbols Dynamic allocation Variables Application Libraries 22 EIO0000003059.03 Memory Mapping System and Diagnostic Variables Variables Description PLC_R Structure of controller read-only system variables. PLC_W Structure of controller read/write system variables. ETH_R Structure of Ethernet read-only system variables. ETH_W Structure of Ethernet read/write system variables. PROFIBUS_R Structure of PROFIBUS DP read-only system variables. SERIAL_R Structure of Serial Lines read-only system variables. SERIAL_W Structure of Serial Lines read/write system variables. TM3_MODULE_R Structure of TM3 modules read-only system variables. For more information on system and diagnostic variables, refer to Modicon M241 Logic Controller System Functions and Variables PLCSystem Library Guide. Memory Addressing This table describes the memory addressing for the address sizes Double Word (%MD), Word (%MW), Byte (%MB), and Bit (%MX): Double Words Words Bytes Bits %MD0 %MW0 %MB0 %MX0.7 ... %MX0.0 %MB1 %MX1.7 ... %MX1.0 %MW1 %MB2 %MX2.7 ... %MX2.0 %MB3 %MX3.7 ... %MX3.0 %MD1 %MW2 %MB4 %MX4.7 ... %MX4.0 %MB5 %MX5.7 ... %MX5.0 %MW3 %MB6 %MX6.7 ... %MX6.0 %MB7 %MX7.7 ... %MX7.0 %MD2 %MW4 %MB8 %MX8.7 ... %MX8.0 ... ... ... ... ... ... ... ... ... ... ... ... ... Example of overlap of memory ranges: %MD0 contains %MB0 (...) %MB3, %MW0 contains %MB0 and %MB1, %MW1 contains %MB2 and %MB3. NOTE: The Modbus communication is asynchronous with the application. Non-Volatile Memory Organization Introduction The non-volatile memory contains the file system used by the controller. File Type The Modicon M241 Logic Controller manages the following file types: EIO0000003059.03 23 Memory Mapping Type Description Boot application This file resides in non-volatile memory and contains the compiled binary code of the executable application. Each time the controller is rebooted, the executable application is extracted from the boot application and copied into the controller RAM (1). Application source Source file that can be uploaded from non-volatile memory to the PC if the source file is not available on the PC (2). Post configuration File that contains Ethernet, serial line, and firewall parameters. The parameters specified in the file override the parameters in the executable application at each reboot. Data logging Files in which the controller logs events as specified by the application. HTML page HTML pages displayed by the web server for the website embedded in the controller. Operating System (OS) Controller firmware that can be written to non-volatile memory. The firmware file is applied at next reboot of the controller. Retain variable Remanent variables Retain-persistent variable (1): The creation of a boot application is optional in EcoStruxure Machine Expert, according to application properties. Default option is to create the boot application on download. When you download an application from EcoStruxure Machine Expert to the controller, you are transferring only the binary executable application directly to RAM (2): EcoStruxure Machine Expert does not support uploading of either the executable application or the boot application to a PC for modification. Program modifications must be made to the application source. When you download your application, you have the option to store the source file to non-volatile memory. File Organization This table shows the file organizationof the non-volatile memory: Disk Directory File Content Up/Downloaded Data Type /sys OS M241M251FW1v_XX.YY (1) Firmware of core 1 Firmware M241M251FW2v_XX.YY (1) Firmware of core 2 Version.ini Control file for firmware version Web Index.htm HTML pages served by the web server for the website embedded in the controller. Website Conf.htm – /usr App Application.app Boot application Application Application.crc – Application.map – Archive.prj (2) Application source – settings.conf (3) OPC UA configuration Configuration OpcUASymbolConf.map (3) OPC UA symbols configuration Configuration Cfg Machine.cfg (2) Post configuration file, page 161 Configuration CodesysLateConf.cfg (2) • Name of application to launch • Routing table (main/sub net) Configuration /usr Log UserDefinedLogName_1.log All *.log files created using the data logging functions (see EcoStruxure Machine Expert - Data Logging Functions - DataLogging Library Guide). You must specify the total number of files created and the names and contents of each log file. log file UserDefinedLogName_n.log – Rcp Main directory for recipe – Syslog crashC1.txt(2) crashC2.txt(2) crashBoot.txt(2) This file contains a record of detected system errors. For use by Schneider Electric Technical Support. Log file PlcLog.txt (2) This file contains system event data that is also visible online in EcoStruxure Machine Expert – 24 EIO0000003059.03 Memory Mapping Disk Directory File Content Up/Downloaded Data Type by viewing the Log tab of the Controller Device Editor, page 54. FwLog.txt This file contains a record of firmware system events. For use by Schneider Electric Technical Support. – /usr Fdr/FDRS (4) only for TM241CE• Device1.prm Parameter files stored by the FDR client device1 FDR, page 134 /data – – Retained and persistent data – /sd0 – – SD card. Removable – – User files – – (1): v_XX.YY represents the version (2): if any (3): if OPC UA, page 155 is configured (4): the Fdr/FDRS directory is hidden NOTE: For more information on libraries and available function blocks, refer to Libraries, page 19. Files Redirection When system, program or certain user activity creates specific file types, the M241 Logic Controller examines the file extension and automatically moves the file to a corresponding folder in non-volatile memory. The following table lists the file types that are moved in this way and the destination folder in non-volatile memory: File extensions Non-volatile memory folder *.app, *.ap_, *.err, *.crc, *.frc, *.prj /usr/App *.cfg, *.cf_ /usr/Cfg *.log /usr/Log *.rcp, *.rsi /usr/Rcp Backup Data Logging File Data logging files can become large to the point of exceeding the space available in the file system. Therefore, you should develop a method to archive the log data periodically on an SD card. You could split the log data into several files, for example LogMonth1, LogMonth2, and use the ExecuteScript (see Modicon M241 Logic Controller, System Functions and Variables, PLCSystem Library Guide) command to copy the first file to an SD card. Afterwards, you may remove it from the internal file system while the second file is accumulating data. If you allow the data logging file to grow and exceed the limits of the file size, you could lose data. NOTICE LOSS OFAPPLICATION DATA • Backup SD card data regularly. • Do not remove power or reset the controller, and do not insert or remove the SD card while it is being accessed. Failure to follow these instructions can result in equipment damage. EIO0000003059.03 25 Memory Mapping Relocation Table Introduction The Relocation Table allows you to organize data to optimize communication between the controller and other equipment by regrouping non-contiguous data into a contiguous table of located registers, accessible through Modbus. NOTE: A relocation table is considered an object. Only one relocation table object can be added to a controller. Relocation Table Description This table describes the Relocation Table organization: Register Description 60200...61999 Dynamic Memory Area: Read Relocation Table 62200...63999 Dynamic Memory Area: Write Relocation Table For further information, refer to Modicon M241 Logic Controller PLCSystem – Library Guide. Adding a Relocation Table This table describes how to add a Relocation Table to your project: Step Action 1 In the Applications tree tab, select the Application node. 2 Click the right mouse button. 3 Click Objects > Relocation Table.... Result: The Add Relocation Table window is displayed. 4 Click Add. Result: The new relocation table is created and initialized. NOTE: As a relocation table is unique for a controller, its name is Relocation Table and cannot be changed. Relocation Table Editor The relocation table editor allows you to organize your variables in the relocation table. To access the relocation table editor, double-click the Relocation Table node in the Tools tree tab: 26 EIO0000003059.03 Memory Mapping This picture describes the relocation table editor: Icon Element Description New Item Adds an element to the list of system variables. Move Down Moves down the selected element of the list. Move Up Moves up the selected element of the list. Delete Item Removes the selected elements of the list. Copy Copies the selected elements of the list. Paste Pastes the elements copied. Erase Empty Item Removes all the elements of the list for which the "Variable" column is empty. - ID Automatic incremental integer (not editable). - Variable The name or the full path of a variable (editable). - Address The address of the system area where the variable is stored (not editable). - Length Variable length in word. - Validity Indicates if the entered variable is valid (not editable). NOTE: If a variable is undefined after program modifications, the content of the cell is displayed in red, the related Validity cell is False, and Address is set to -1. EIO0000003059.03 27 Tasks Tasks Introduction The Task Configuration node in the Applications tree allows you to define one or more tasks to control the execution of your application program. The task types available are: • Cyclic • Freewheeling • Event • External event This chapter begins with an explanation of these task types and provides information regarding the maximum number of tasks, the default task configuration, and task prioritization. In addition, this chapter introduces the system and task watchdog functions and explains its relationship to task execution. Maximum Number of Tasks Maximum Number of Tasks The maximum number of tasks you can define for the Modicon M241 Logic Controller are: • Total number of tasks = 19 • Cyclic tasks = 5 • Freewheeling tasks = 1 • Event tasks = 8 • External Event tasks = 16 Special Considerations for Freewheeling A Freewheeling task, page 31 does not have a fixed duration. In Freewheeling mode, each task scan starts when the previous scan has been completed and after a period of system processing (30% of the total duration of the Freewheeling task). If the system processing period is reduced to less than 15% for more than 3 seconds due to interruptions by other tasks, a system error is detected. For more information, refer to the System Watchdog, page 32. NOTE: You may wish to avoid using a Freewheeling task in a multi-task application when some high priority and time-consuming tasks are running. Doing so may provoke a task Watchdog Timeout. You should not assign CANopen to a freewheeling task. CANopen should be assigned to a cyclic task. Task Configuration Screen Screen Description This screen allows you to configure the tasks. Double-click the task that you want to configure in the Applications tree to access this screen. Each configuration task has its own parameters that are independent of the other tasks. 28 EIO0000003059.03 Tasks The Configuration window is composed of 4 parts: The table describes the fields of the Configuration screen: Field Name DefinitionPriority Configure the priority of each task with a number from 0 to 31 (0 is the highest priority, 31 is the lowest). Only one task at a time can be running. The priority determines when the task runs: a higher priority task pre-empts a lower priority task. NOTE: Do not assign tasks with the same priority. If there are yet other tasks that attempt to pre-empt tasks with the same priority, the result could be indeterminate and unpredicable. For important information, refer to Task Priorities, page 33. Type These task types are available: • Cyclic, page 30 • Event, page 31 • External , page 32 • Freewheeling, page 31 Watchdog To configure the watchdog, page 33, define these 2 parameters: • Time: enter the timeout before watchdog execution. • Sensitivity: defines the number of expirations of the watchdog timer before the controller stops program execution and enters a HALT state. POUs The list of POUs (see EcoStruxure Machine Expert, Programming Guide) (Programming Organization Units) controlled by the task is defined in the task configuration window: • To add a POU linked to the task, use the command Add Call and select the POU in the Input Assistant editor. • To remove a POU from the list, use the command Remove Call. • To replace the selected POU of the list by another one, use the command Change Call. • POUs are executed in the order shown in the list. To move the POUs in the list, select a POU and use the command Move Up or Move Down. NOTE: You can create as many POUs as you want. An application with several small POUs, as opposed to one large POU, can improve the refresh time of the variables in online mode. EIO0000003059.03 29 Tasks Task Types Introduction The following section describes the various task types available for your program, along with a description of the task type characteristics. Cyclic Task A Cyclic task is assigned a fixed cycle time using the interval setting in the type section of the configuration subtab for that task. Each Cyclic task type executes as follows: 1. Read Inputs: The physical input states are written to the %I input memory variables and other system operations are executed. 2. Task Processing: The user code (POU, and so on) defined in the task is processed. The %Q output memory variables are updated according to your application program instructions but not yet written to the physical outputs during this operation. 3. Write Outputs: The %Q output memory variables are modified with the output forcing that has been defined; however, the writing of the physical outputs depends upon the type of output and instructions used. For more information on defining the bus cycle task, refer to the EcoStruxure Machine Expert Programming Guide and PLC Settings, page 56. For more information on I/O behavior, refer to Controller States Detailed Description, page 39. 4. Remaining Interval time: The controller firmware carries out system processing and other lower priority tasks. NOTE: If you define too short a period for a cyclic task, it will repeat immediately after the write of the outputs and without executing other lower priority tasks or any system processing. This will affect the execution of all tasks and cause the controller to exceed the system watchdog limits, generating a system watchdog exception. NOTE: When the task cycle time is set to a value less than 3 ms, the actual task duration should first be monitored through the Task Monitoring screen during commissioning to ensure that it is consistently lower than the configured task cycle time. If greater, the task cycle may not be respected without causing a task cycle watchdog time-out and the controller transitioning to a HALT state. To avoid this condition to a certain degree, when the task cycle time is set to a value of less than 3 ms, real limits of +1 ms are imposed if, on any given cycle, the calculated cycle time slightly exceeds the configured cycle time. NOTE: Get and set the interval of a Cyclic Task by application using the GetCurrentTaskCycle and SetCurrentTaskCycle function. (Refer to EcoStruxure Machine Expert - Manage a Cyclic Task Interval - Toolbox_ Advance Library Guide for further details.) 30 EIO0000003059.03 Tasks Freewheeling Task A Freewheeling task does not have a fixed duration. In Freewheeling mode, each task scan begins when the previous scan has been completed and after a short period of system processing. Each Freewheeling task type executes as follows: 1. Read Inputs: The physical input states are written to the %I input memory variables and other system operations are executed. 2. Task Processing: The user code (POU, and so on) defined in the task is processed. The %Q output memory variables are updated according to your application program instructions but not yet written to the physical outputs during this operation. 3. Write Outputs: The %Q output memory variables are modified with the output forcing that has been defined; however, the writing of the physical outputs depends upon the type of output and instructions used. For more information on defining the bus cycle task, refer to the EcoStruxure Machine Expert Programming Guide and PLC Settings, page 56. For more information on I/O behavior, refer to Controller States Detailed Description, page 39. 4. System Processing: The controller firmware carries out system processing and other lower priority tasks (for example: HTTP management, Ethernet management, parameters management). NOTE: If you want to define the task interval, refer to Cyclic Task, page 30. Event Task This type of task is event-driven and is initiated by a program variable. It starts at the rising edge of the boolean variable associated to the trigger event unless pre- empted by a higher priority task. In that case, the Event task will start as dictated by the task priority assignments. For example, if you have defined a variable called my_Var and would like to assign it to an Event, proceed as follows: Step Action 1 Double-click the TASK in the Applications tree. 2 Select Event from the Type list in the Configuration tab. 3 Click the Input Assistant button to the right of the Event field. Result: The Input Assistant window appears. 4 Navigate in the tree of the Input Assistant dialog box to find and assign the my_Var variable. NOTE: When the event task is triggered at an excessive frequency, the controller will go to the HALT state (Exception).The maximum rate of events is 6 events per millisecond. If the event task is triggered at a higher frequency than this, the message 'ISR Count Exceeded' is logged in the application log page. EIO0000003059.03 31 Tasks External Event Task This type of task is event-driven and is initiated by the detection of a hardware or hardware-related function event. It starts when the event occurs unless pre- empted by a higher priority task. In that case, the External Event task will start as dictated by the task priority assignments. For example, an External event task could be associated with an HSC Stop event. To associate the HSC0_STOP event to an External event task, select it from the External event drop-down list on the Configuration tab. Depending on the controller, there are up to 4 types of events that can be associated with an External event task: • Rising edge on an advanced input (DI0...DI15) • HSC thresholds • HSC Stop • CAN Sync NOTE: CAN Sync is a specific event object, depending on the CANopen manager configuration. NOTE: The maximum frequency of events is 6 per millisecond. If the external event task is triggered at a higher frequency than this, the controller goes to the HALT state (Exception) and an “ISR Count Exceeded” message is logged on the application log page. System and Task Watchdogs Introduction Two types of watchdog functionality are implemented for the Modicon M241 Logic Controller: • System Watchdogs: These watchdogs are defined in and managed by the controller firmware. These are not configurable by the user. • Task Watchdogs: These watchdogsare optional watchdogs that you can define for each task. These are managed by your application program and are configurable in EcoStruxure Machine Expert. System Watchdogs Three system watchdogs are defined for the Modicon M241 Logic Controller. They are managed by the controller firmware and are therefore sometimes referred to as hardware watchdogs in the EcoStruxure Machine Expert online help. When one of the system watchdogs exceeds its threshold conditions, an error is detected. The threshold conditions for the 3 system watchdogs are defined as follows: • If all of the tasks require more than 85% of the processor resources for more than 3 seconds, a system error is detected. The controller enters the HALT state. • If the total execution time of the tasks with priorities between 0 and 24 reaches 100% of processor resources for more than 1 second, an application error is detected. The controller responds with an automatic reboot into the EMPTY state. • If the lowest priority task of the system is not executed during an interval of 10 seconds, a system error is detected. The controller responds with an automatic reboot into the EMPTY state. NOTE: System watchdogs are not configurable by the user. 32 EIO0000003059.03 Tasks Task Watchdogs EcoStruxure Machine Expert allows you to configure an optional task watchdog for every task defined in your application program. (Task watchdogs are sometimes also referred to as software watchdogs or control timers in the EcoStruxure Machine Expert online help). When one of your defined task watchdogs reaches its threshold condition, an application error is detected and the controller enters the HALT state. When defining a task watchdog, the following options are available: • Time: This defines the maximum execution time for a task. When a task takes longer than this, the controller will report a task watchdog exception. • Sensitivity: The sensitivity field defines the number of task watchdog exceptions that must occur before the controller detects an application error. To access the configuration of a task watchdog, double-click the Task in the Applications tree. NOTE: For more information on watchdogs, refer to EcoStruxure Machine Expert Programming Guide. Task Priorities Task Priority Configuration You can configure the priority of each task between 0 and 31 (0 is the highest priority, 31 is the lowest). Each task must have a unique priority. Assigning the same priority to more than one task leads to a build error. Task Priority Suggestions • Priority 0 to 24: Controller tasks. Assign these priorities to tasks with a high availability requirement. • Priority 25 to 31: Background tasks. Assign these priorities to tasks with a low availability requirement. EIO0000003059.03 33 Tasks Task Priorities of Embedded I/Os When a task cycle starts, it can interrupt any task with lower priority (task preemption). The interrupted task resumes when the higher priority task cycle is finished. NOTE: If the same input is used in different tasks the input image may change during the task cycle of the lower priority task. To improve the likelihood of proper output behavior during multitasking, a build error message is displayed if outputs in the same byte are used in different tasks. WARNING UNINTENDED EQUIPMENT OPERATION Map your inputs so that tasks do not alter the input images in an unexpected manner. Failure to follow these instructions can result in death, serious injury, or equipment damage. Task Priorities of TM2/TM3 Modules and CANopen I/Os You can select the task that drives TM3 and CANopen physical exchanges. In the PLC settings, select Bus cycle task to define the task for the exchange. By default, the task is set to MAST. This definition at the controller level can be overridden by the I/O bus configuration, page 81. During the read and write phases, all physical I/Os are refreshed at the same time. TM3/TM2 and CANopen data is copied into a virtual I/O image during a physical exchanges phase, as shown in this figure: Inputs are read from the I/O image table at the beginning of the task cycle. Outputs are written to the I/O image table at the end of the task. 34 EIO0000003059.03 Tasks NOTE: Event tasks cannot drive the TM3/TM2 bus cycle. Default Task Configuration Default Task Configuration The MAST task can be configured in Freewheeling or Cyclic mode. The MAST task is automatically created by default in Cyclic mode. Its preset priority is medium (15), its preset interval is 20 ms, and its task watchdog service is activated with a time of 100 ms and a sensitivity of 1. Refer to Task Priorities, page 33 for more information on priority settings. Refer to Task Watchdogs, page 32 for more information on watchdogs. Designing an efficient application program is important in systems approaching the maximum number of tasks. In such an application, it can be difficult to keep the resource utilization below the system watchdog threshold. If priority reassignments alone are not sufficient to remain below the threshold, some lower priority tasks can be made to use fewer system resources if the SysTaskWaitSleep function, contained in the SysTask library, is added to those tasks. NOTE: Do not delete or change the name of the MAST task. Otherwise, EcoStruxure Machine Expert detects an error when you attempt to build the application, and you are not able to download it to the controller. EIO0000003059.03 35 Controller States and Behaviors Controller States and Behaviors Introduction This chapter provides information on controller states, state transitions, and behaviors in response to system events. It begins with a detailed controller state diagram and a description of each state. It then defines the relationship of output states to controller states before explaining the commands and events that result in state transitions. It concludes with information about Remanent variables and the effect of EcoStruxure Machine Expert task programming options on the behavior of your system. Controller State Diagram Controller State Diagram Controller State Diagram This diagram describes the controller operating mode: Legend: • Controller states are indicated in ALL-CAPS BOLD • User and application commands are indicated in Bold • System events are indicated in Italics 36 EIO0000003059.03 Controller States and Behaviors • Decisions, decision results, and general information are indicated in normal text (1) For details on STOPPED to RUNNING state transition, refer to Run Command, page 45. (2) For details on RUNNING to STOPPED state transition, refer to Stop Command, page 45. Note 1 The Power Cycle (Power Interruption followed by a Power ON) deletes all output forcing settings. Refer to Controller State and Output Behavior, page 42 for further details. Note 2 The outputs will assume their hardware initialization values. Note 3 In some cases, when a system error is detected, it will cause the controller to reboot automatically into the EMPTY state as if no Boot application were present in the non-volatile memory. However, the Boot application is not deleted from the non-volatile memory. In this case, the ERR LED (red) flashes regularly. Note 4 After verification of a valid Boot application the following events occur: • The application is loaded into RAM. • The Post Configuration, page 161 file settings (if any) are applied. During the load of the boot application, a Check context test occurs to verify that the Remanent variables are valid. If the Check context test is invalid, the boot application will load but the controller will transitions to the STOPPED state, page 48. Note 5a The Starting Mode is set in the PLC settings tab of the Controller Device Editor, page 56. Note 5b When a power interruption occurs, the controller continues in the RUNNING state for at least 4 ms before shutting down. If you have configured and provide power to the Run/Stop input from the same source as the controller, the loss of power tothis input will be detected immediately, and the controller will behave as if a STOP command was received. Therefore, if you provide power to the controller and the Run/Stop input from the same source, your controller will normally reboot into the STOPPED state after a power interruption when Starting Mode is set to Start as previous state. Note 6 During a successful application download the following events occur: • The application is loaded directly into RAM. • By default, the Boot application is created and saved into the non-volatile memory. EIO0000003059.03 37 Controller States and Behaviors Note 7 The default behavior after downloading an application program is for the controller to enter the STOPPED state irrespective of the Run/Stop input setting, the Run/ Stop switch position or the last controller state before the download. However, there are 2 considerations in this regard: Online Change: An online change (partial download) initiated while the controller is in the RUNNING state returns the controller to the RUNNING state if successful and provided the Run/Stop input is configured and set to Run or Run/Stop switch is set to Run. Before using the Login with online change option, test the changes to your application program in a virtual or non-production environment and confirm that the controller and attached equipment assume their expected conditions in the RUNNING state. WARNING UNINTENDED EQUIPMENT OPERATION Always verify that online changes to a RUNNING application program operate as expected before downloading them to controllers. Failure to follow these instructions can result in death, serious injury, or equipment damage. NOTE: Online changes to your program are not automatically written to the Boot application, and will be overwritten by the existing Boot application at the next reboot. If you wish your changes to persist through a reboot, manually update the Boot application by selecting Create boot application in the online menu (the controller must be in the STOPPED state to achieve this operation). Multiple Download: EcoStruxure Machine Expert has a feature that allows you to perform a full application download to multiple targets on your network or fieldbus. One of the default options when you select the Multiple Download... command is the Start all applications after download or online change option, which restarts all download targets in the RUNNING state, provided their respective Run/Stop inputs are commanding the RUNNING state, but irrespective of their last controller state before the multiple download was initiated. Deselect this option if you do not want all targeted controllers to restart in the RUNNING state. In addition, before using the Multiple Download option, test the changes to your application program in a virtual or non-production environment and confirm that the targeted controllers and attached equipment assume their expected conditions in the RUNNING state. WARNING UNINTENDED EQUIPMENT OPERATION Always verify that your application program will operate as expected for all targeted controllers and equipment before issuing the "Multiple Download..." command with the "Start all applications after download or online change" option selected. Failure to follow these instructions can result in death, serious injury, or equipment damage. NOTE: During a multiple download, unlike a normal download, EcoStruxure Machine Expert does not offer the option to create a Boot application. You can manually create a Boot application at any time by selecting Create boot application in the Online menu on all targeted controllers. Note 8 The EcoStruxure Machine Expert software platform allows many powerful options for managing task execution and output conditions while the controller is in the STOPPED or HALT states. Refer to Controller States Description, page 39 for further details. 38 EIO0000003059.03 Controller States and Behaviors Note 9 To exit the HALT state it is necessary to issue one of the Reset commands (Reset Warm, Reset Cold, Reset Origin), download an application or cycle power. In case of non-recoverable event (hardware watchdog or internal error), a power cycle is mandatory. Note 10 The RUNNING state has 2 exception conditions: • RUNNING with External Error: this exception condition is indicated by the I/O LED, which displays solid red. You may exit this state by clearing the external error (probably changing the application configuration). No controller commands are required, but may however include the need of a power cycle of the controller. For more information, refer to I/O Configuration General Description, page 78. • RUNNING with Breakpoint: this exception condition is indicated by the RUN LED, which displays a single green flash. Refer to Controller States Description, page 39 for further details. Note 11 The boot application can be different from the application loaded. It can happen when the boot application was downloaded through SD card, FTP, or file transfer or when an online change was performed without creating the boot application. Controller States Description Controller States Description Introduction This section provides a detailed description of the controller states. WARNING UNINTENDED EQUIPMENT OPERATION • Never assume that your controller is in a certain controller state before commanding a change of state, configuring your controller options, uploading a program, or modifying the physical configuration of the controller and its connected equipment. • Before performing any of these operations, consider the effect on all connected equipment. • Before acting on a controller, always positively confirm the controller state by viewing its LEDs, confirming the condition of the Run/Stop input, verifying the presence of output forcing, and reviewing the controller status information via EcoStruxure Machine Expert.(1) Failure to follow these instructions can result in death, serious injury, or equipment damage. (1) The controller states can be read in the PLC_R.i_wStatus system variable of the M241 PLCSystem library (see Modicon M241 Logic Controller, System Functions and Variables, PLCSystem Library Guide) Controller States Table The following table describes the controller states: EIO0000003059.03 39 Controller States and Behaviors Controller State Description LED RUN (Green) ERR (Red) I/O (Red) BOOTING The controller executes the boot firmware and its own internal self-tests. It then checks the checksum of the firmware and user applications. OFF OFF ON OFF ON ON OFF ON OFF INVALID_OS There is not a valid firmware file present in the non-volatile memory. The controller does not execute the application. Refer to Firmware Management, page 175 to restore a correct state. OFF Regular flash OFF EMPTY The controller has no application. OFF Single flash OFF EMPTY after a system error detected This state is the same as the other EMPTY state. However the application is present, and is intentionally not loaded. A reboot (power cycle), or a new application download, restores a correct state. OFF Fast flash OFF RUNNING The controller is executing a valid application. ON OFF OFF RUNNING with breakpoint This state is same as the RUNNING state with the following exceptions: • The task-processing portion of the program does not resume until the breakpoint is cleared. • The LED indications are different. For more information on breakpoint management, refer to EcoStruxure Machine Expert Programming Guide. Single flash OFF OFF RUNNING with external error detected The controller is executing a valid application and a configuration, TM3, SD card, or other I/O error is detected. When I/O LED is ON, the details about the detected error can be found in PLC_R. i_lwSystemFault_1 and PLC_R.i_lwSystemFault_2. Any of the detected error conditions reported by these variables cause the I/O LED to be ON. ON OFF ON STOPPED The controller has a valid application that is stopped. See details of the
Compartilhar