Modicon M221 Logic Controller Programming Guide en
Modicon M221 Logic Controller Programming Guide en
EIO0000001360 06/2016
Modicon M221
Logic Controller
Programming Guide
06/2016
EIO0000001360.07
www.schneider-electric.com
The information provided in this documentation contains general descriptions and/or technical
characteristics of the performance of the products contained herein. This documentation is not
intended as a substitute for and is not to be used for determining suitability or reliability of these
products for specific user applications. It is the duty of any such user or integrator to perform the
appropriate and complete risk analysis, evaluation and testing of the products with respect to the
relevant specific application or use thereof. Neither Schneider Electric nor any of its affiliates or
subsidiaries shall be responsible or liable for misuse of the information contained herein. If you
have any suggestions for improvements or amendments or have found errors in this publication,
please notify us.
No part of this document may be reproduced in any form or by any means, electronic or
mechanical, including photocopying, without express written permission of Schneider Electric.
All pertinent state, regional, and local safety regulations must be observed when installing and
using this product. For reasons of safety and to help ensure compliance with documented system
data, only the manufacturer should perform repairs to components.
When devices are used for applications with technical safety requirements, the relevant
instructions must be followed.
Failure to use Schneider Electric software or approved software with our hardware products may
result in injury, harm, or improper operating results.
Failure to observe this information can result in injury or equipment damage.
2016 Schneider Electric. All rights reserved.
2 EIO0000001360 06/2016
Table of Contents
Safety Information. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
About the Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Part I Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Chapter 1 About the Modicon M221 Logic Controller . . . . . . . . . . . 19
TM221C Logic Controller Description . . . . . . . . . . . . . . . . . . . . . . . . . 20
TM221M Logic Controller Description . . . . . . . . . . . . . . . . . . . . . . . . . 26
Chapter 2 Configuration Features . . . . . . . . . . . . . . . . . . . . . . . . . . 31
2.1 Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Object Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Addressing I/O Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Maximum Number of Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
2.2 Task Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Tasks and Scan Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Maximum Number of Tasks and Priorities. . . . . . . . . . . . . . . . . . . . . . 50
2.3 Controller States and Behaviors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Controller States Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Controller States Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Controller State Transitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Persistent Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Output Behavior. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
2.4 Post Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Post Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Post Configuration File Management . . . . . . . . . . . . . . . . . . . . . . . . . 69
Part II Configuring the M221 Logic Controller . . . . . . . . . . . 71
Chapter 3 How to Configure a Controller . . . . . . . . . . . . . . . . . . . . 73
Building a Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Optional I/O Expansion Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Configuring the M221 Logic Controller . . . . . . . . . . . . . . . . . . . . . . . . 83
Updating Firmware using Executive Loader Wizard . . . . . . . . . . . . . . 84
Chapter 4 Embedded Input/Output Configuration . . . . . . . . . . . . . . 85
4.1 Digital Input Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Configuring Digital Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
EIO0000001360 06/2016 3
4.2 Digital Output Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Configuring Digital Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
4.3 Analog Input Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Configuring Analog Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
4.4 High Speed Counter Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Configuring High Speed Counters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Configuring Dual Phase and Single Phase Counters . . . . . . . . . . . . . 100
Configuring Frequency Meter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
4.5 Pulse Generator Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Configuring Pulse Generators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Configuring Pulse (%PLS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Configuring Pulse Width Modulation (%PWM). . . . . . . . . . . . . . . . . . . 113
Configuring Pulse Train Output (%PTO) . . . . . . . . . . . . . . . . . . . . . . . 115
Configuring Frequency Generator (%FREQGEN) . . . . . . . . . . . . . . . . 118
Chapter 5 I/O Bus Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
I/O Configuration General Description . . . . . . . . . . . . . . . . . . . . . . . . . 120
Maximum Hardware Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Configuring Cartridges and Expansion Modules . . . . . . . . . . . . . . . . . 127
Chapter 6 Embedded Communication Configuration . . . . . . . . . . . . 129
6.1 Ethernet Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Configuring Ethernet Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Configuring Modbus TCP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Configuring EtherNet/IP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
6.2 Serial Line Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Configuring Serial Line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
6.3 Supported Modbus Function Codes. . . . . . . . . . . . . . . . . . . . . . . . . . . 152
Supported Modbus Function Codes. . . . . . . . . . . . . . . . . . . . . . . . . . . 152
Chapter 7 SD Card . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
File Management Operations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
SD Card Supported File Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
Clone Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Firmware Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
Application Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
Post Configuration Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
Error Log Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
Memory Management: Backing Up and Restoring Controller Memory 171
4 EIO0000001360 06/2016
Part III Programming the M221 Logic Controller . . . . . . . . . 173
Chapter 8 I/O Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Digital Inputs (%I) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Digital Outputs (%Q) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Analog Inputs (%IW) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
Analog Outputs (%QW) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
Chapter 9 Network Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
Input Assembly Objects (%QWE) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Output Assembly Objects (%IWE). . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
Input Registers Objects (%QWM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Output Registers Objects (%IWM) . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Chapter 10 Function Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Advanced Expert Input/Output Functions . . . . . . . . . . . . . . . . . . . . . . 189
Chapter 11 System Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
System Bits (%S). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
System Words (%SW) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
Input Channel Status (%IWS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
Output Channel Status (%QWS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
Glossary ......................................... 229
Index ......................................... 235
EIO0000001360 06/2016 5
6 EIO0000001360 06/2016
Safety Information
Important Information
NOTICE
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.
EIO0000001360 06/2016 7
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.
8 EIO0000001360 06/2016
About the Book
At a Glance
Document Scope
This document describes the configuration and programming of the Modicon M221 Logic
Controller for SoMachine Basic. For further information, refer to the separate documents provided
in the SoMachine Basic online help.
Validity Note
This document has been updated for the release of SoMachine Basic V1.4 SP1.
The technical characteristics of the devices described in this document also appear online. To
access this information online:
Step Action
1 Go to the Schneider Electric home page www.schneider-electric.com.
2 In the Search box type the reference of a product or the name of a product range.
Do not include blank spaces in the reference or product range.
To get information on grouping similar modules, use asterisks (*).
3 If you entered a reference, go to the Product Datasheets search results and click on the
reference that interests you.
If you entered the name of a product range, go to the Product Ranges search results and click
on the product range that interests you.
4 If more than one reference appears in the Products search results, click on the reference that
interests you.
5 Depending on the size of your screen, you may need to scroll down to see the data sheet.
6 To save or print a data sheet as a .pdf file, click Download XXX product datasheet.
The characteristics that are presented in this manual should be the same as 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 manual and online information,
use the online information as your reference.
EIO0000001360 06/2016 9
Related Documents
10 EIO0000001360 06/2016
Title of Documentation Reference Number
Modicon TMC2 Cartridge - Programming Guide EIO0000001782 (ENG)
EIO0000001783 (FRE)
EIO0000001784 (GER)
EIO0000001785 (SPA)
EIO0000001786 (ITA)
EIO0000001787 (CHS)
EIO0000001788 (POR)
EIO0000001789 (TUR)
Modicon TMC2 Cartridge - Hardware Guide EIO0000001768 (ENG)
EIO0000001769 (FRE)
EIO0000001770 (GER)
EIO0000001771 (SPA)
EIO0000001772 (ITA)
EIO0000001773 (CHS)
EIO0000001775 (TUR)
EIO0000001774 (POR)
Modicon TM3 Expansion Modules Configuration - Programming EIO0000001396 (ENG)
Guide EIO0000001397 (FRE)
EIO0000001398 (GER)
EIO0000001399 (SPA)
EIO0000001400 (ITA)
EIO0000001401 (CHS)
EIO0000001374 (POR)
EIO0000001375 (TUR)
Modicon TM3 Digital I/O Modules - Hardware Guide EIO0000001408 (ENG)
EIO0000001409 (FRE)
EIO0000001410 (GER)
EIO0000001411 (SPA)
EIO0000001412 (ITA)
EIO0000001413 (CHS)
EIO0000001376 (POR)
EIO0000001377 (TUR)
Modicon TM3 Analog I/O Modules - Hardware Guide EIO0000001414 (ENG)
EIO0000001415 (FRE)
EIO0000001416 (GER)
EIO0000001417 (SPA)
EIO0000001418 (ITA)
EIO0000001419 (CHS)
EIO0000001378 (POR)
EIO0000001379 (TUR)
EIO0000001360 06/2016 11
Title of Documentation Reference Number
Modicon TM3 Expert Modules - Hardware Guide EIO0000001420 (ENG)
EIO0000001421 (FRE)
EIO0000001422 (GER)
EIO0000001423 (SPA)
EIO0000001424 (ITA)
EIO0000001425 (CHS)
EIO0000001380 (POR)
EIO0000001381 (TUR)
Modicon TM3 Safety Modules - Hardware Guide EIO0000001831 (ENG)
EIO0000001832 (FRE)
EIO0000001833 (GER)
EIO0000001834 (SPA)
EIO0000001835 (ITA)
EIO0000001836 (CHS)
EIO0000001837 (POR)
EIO0000001838 (TUR)
Modicon TM3 Transmitter and Receiver Modules - Hardware Guide EIO0000001426 (ENG)
EIO0000001427 (FRE)
EIO0000001428 (GER)
EIO0000001429 (SPA)
EIO0000001430 (ITA)
EIO0000001431 (CHS)
EIO0000001382 (POR)
EIO0000001383 (TUR)
Modicon TM2 Expansion Modules Configuration - Programming EIO0000000396 (ENG)
Guide EIO0000000397 (FRE)
EIO0000000398 (GER)
EIO0000000399 (SPA)
EIO0000000400 (ITA)
EIO0000000401 (CHS)
Modicon TM2 Digital I/O Modules - Hardware Guide EIO0000000028 (ENG)
EIO0000000029 (FRE)
EIO0000000030 (GER)
EIO0000000031 (SPA)
EIO0000000032 (ITA)
EIO0000000033 (CHS)
Modicon TM2 Analog I/O Modules - Hardware Guide EIO0000000034 (ENG)
EIO0000000035 (FRE)
EIO0000000036 (GER)
EIO0000000037 (SPA)
EIO0000000038 (ITA)
EIO0000000039 (CHS)
12 EIO0000001360 06/2016
Title of Documentation Reference Number
SR2MOD02 and SR2MOD03 Wireless Modem - User Guide EIO0000001575 (ENG)
You can download these technical publications and other technical information from our website
at http://download.schneider-electric.com
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.
1For 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.
EIO0000001360 06/2016 13
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
EN 61131-2:2007 Programmable controllers, part 2: Equipment requirements and tests.
ISO 13849-1:2008 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
EN 60204-1:2006 Safety of machinery - Electrical equipment of machines - Part 1: General
requirements
EN 1088:2008 Safety of machinery - Interlocking devices associated with guards - Principles
ISO 14119:2013 for design and selection
ISO 13850:2006 Safety of machinery - Emergency stop - Principles for design
EN/IEC 62061:2005 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:2008 Digital data communication for measurement and control: Functional safety
field buses.
2006/42/EC Machinery Directive
2004/108/EC Electromagnetic Compatibility Directive
2006/95/EC Low Voltage Directive
14 EIO0000001360 06/2016
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.
EIO0000001360 06/2016 15
16 EIO0000001360 06/2016
Modicon M221
Introduction
EIO0000001360 06/2016
Part I
Introduction
Introduction
Overview
This part provides general information about the Modicon M221 Logic Controller and its
configuration and programming features.
EIO0000001360 06/2016 17
Introduction
18 EIO0000001360 06/2016
Modicon M221
About the Modicon M221 Logic Controller
EIO0000001360 06/2016
Chapter 1
About the Modicon M221 Logic Controller
EIO0000001360 06/2016 19
About the Modicon M221 Logic Controller
Overview
The TM221C Logic Controller has various powerful features and can service a wide range of
applications.
Software configuration, programming, and commissioning are accomplished with the SoMachine
Basic software described in the SoMachine Basic Operating Guide (see SoMachine Basic,
Operating Guide) and the M221 Logic Controller - Programming Guide.
Programming Languages
The M221 Logic Controller is configured and programmed with the SoMachine Basic software,
which supports the following IEC 61131-3 programming languages:
IL: Instruction List
LD: Ladder Diagram
Grafcet (List)
Grafcet (SFC)
Power Supply
The power supply of the TM221C Logic Controller is 24 Vdc (see Modicon M221 Logic Controller,
Hardware Guide) or 100...240 Vac (see Modicon M221 Logic Controller, Hardware Guide).
Run/Stop
The M221 Logic Controller can be operated externally by the following:
a hardware Run/Stop switch (see Modicon M221 Logic Controller, Hardware Guide)
a Run/Stop (see Modicon M221 Logic Controller, Hardware Guide) operation by a dedicated
digital input, defined in the software configuration (for more information, refer to Configuring
Digital Inputs (see page 86).)
SoMachine Basic software (for more information, refer to Toolbar (see SoMachine Basic,
Operating Guide)).
a TMH2GDB Remote Graphic Display (for more information, refer to Controller State Menu
(see Modicon TMH2GDB, Remote Graphic Display, User Guide)).
20 EIO0000001360 06/2016
About the Modicon M221 Logic Controller
Memory
This table describes the different types of memory:
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
Analog inputs
Removable Storage
The M221 Logic Controllers include an embedded SD card slot (see Modicon M221 Logic
Controller, Hardware Guide).
The Modicon M221 Logic Controller allows the following types of file management with an SD card:
Clone management (see page 160): back up the application, firmware, and post configuration
(if it exists) of the logic controller
Firmware management (see page 162): download firmware to the logic controller and to a
TMH2GDB Remote Graphic Display
Application management (see page 164): back up and restore the logic controller application,
or copy it to another logic controller of the same reference
Post configuration management (see page 166): add, change, or delete the post configuration
file of the logic controller
Error log management (see page 168): back up or delete the error log file of the logic controller
Memory management (see page 171): back up and restore memory bits and words from a
controller
EIO0000001360 06/2016 21
About the Modicon M221 Logic Controller
Reference Digital Inputs Digital Outputs Analog Communication Ports Power Supply
Inputs
TM221C16R 5 regular inputs(1) 7 relay outputs Yes 1 serial line port 100...240 Vac
(see Modicon 4 fast inputs 1 USB programming
M221 Logic (HSC)(2) port
Controller,
Hardware
Guide)
TM221CE16R Yes 1 serial line port
(see Modicon 1 USB programming
M221 Logic port
Controller, 1 Ethernet port
Hardware
Guide)
TM221C16T 5 regular inputs(1) Source outputs Yes 1 serial line port 24 Vdc
(see Modicon 4 fast inputs 5 regular transistor 1 USB programming
M221 Logic (HSC)(2) outputs port
Controller, 2 fast outputs
Hardware (PLS/PWM/PTO)(3)
Guide)
TM221CE16T Yes 1 serial line port
(see Modicon 1 USB programming
M221 Logic port
Controller, 1 Ethernet port
Hardware
Guide)
TM221C16U 5 regular inputs(1) Sink outputs Yes 1 serial line port 24 Vdc
4 fast inputs 5 regular transistor 1 USB programming
(HSC)(2) outputs port
2 fast outputs
TM221CE16U 1 serial line port
(see Modicon (PLS/PWM/PTO)(3) 1 USB programming
M221 Logic port
Controller, 1 Ethernet port
Hardware
Guide)
NOTE: The TM221C Logic Controller uses removable screw terminal blocks.
(1) The regular inputs have a maximum frequency of 5 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, or for PLS, PWM or PTO functions, or
reflex outputs for HSC.
22 EIO0000001360 06/2016
About the Modicon M221 Logic Controller
Reference Digital Inputs Digital Outputs Analog Communication Ports Power Supply
Inputs
TM221C24R 10 regular inputs(1) 10 relay outputs Yes 1 serial line port 100...240 Vac
(see Modicon 4 fast inputs 1 USB programming
M221 Logic (HSC)(2) port
Controller,
Hardware
Guide)
TM221CE24R Yes 1 serial line port
(see Modicon 1 USB programming
M221 Logic port
Controller, 1 Ethernet port
Hardware
Guide)
TM221C24T Source outputs Yes 1 serial line port 24 Vdc
(see Modicon 8 regular transistor 1 USB programming
M221 Logic outputs port
Controller, 2 fast outputs
Hardware (PLS/PWM/PTO)(3)
Guide)
TM221CE24T Yes 1 serial line port
(see Modicon 1 USB programming
M221 Logic port
Controller, 1 Ethernet port
Hardware
Guide)
TM221C24U 10 regular inputs(1) Sink outputs Yes 1 serial line port 24 Vdc
4 fast inputs 8 regular transistor 1 USB programming
(HSC) (2) outputs port
2 fast outputs
TM221CE24U Yes 1 serial line port
(see Modicon (PLS/PWM/PTO)(3) 1 USB programming
M221 Logic port
Controller, 1 Ethernet port
Hardware
Guide)
NOTE: The TM221C Logic Controller uses removable screw terminal blocks.
(1) The regular inputs have a maximum frequency of 5 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, or for PLS, PWM or PTO functions, or
reflex outputs for HSC.
EIO0000001360 06/2016 23
About the Modicon M221 Logic Controller
Reference Digital Inputs Digital Outputs Analog Communication Ports Power Supply
Inputs
TM221C40R 20 regular inputs(1) 16 relay outputs Yes 1 serial line port 100...240 Vac
(see Modicon 4 fast inputs 1 USB programming
M221 Logic (HSC)(2) port
Controller,
Hardware
Guide)
TM221CE40R Yes 1 serial line port
(see Modicon 1 USB programming
M221 Logic port
Controller, 1 Ethernet port
Hardware
Guide)
TM221C40T Source outputs Yes 1 serial line port 24 Vdc
(see Modicon 14 regular transistor 1 USB programming
M221 Logic outputs port
Controller, 2 fast outputs
Hardware (PLS/PWM/PTO)(3)
Guide)
TM221CE40T Yes 1 serial line port
(see Modicon 1 USB programming
M221 Logic port
Controller, 1 Ethernet port
Hardware
Guide)
TM221C40U 20 regular inputs(1) Sink outputs Yes 1 serial line port 24 Vdc
(see Modicon 4 fast inputs 12 regular transistor 1 USB programming
M221 Logic (HSC) (2) outputs port
Controller, 4 fast outputs
Hardware (PLS/PWM/PTO)(3)
Guide)
TM221CE40U Yes 1 serial line port
(see Modicon 1 USB programming
M221 Logic port
Controller, 1 Ethernet port
Hardware
Guide)
NOTE: The TM221C Logic Controller uses removable screw terminal blocks.
(1) The regular inputs have a maximum frequency of 5 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, or for PLS, PWM or PTO functions, or
reflex outputs for HSC.
24 EIO0000001360 06/2016
About the Modicon M221 Logic Controller
Delivery Content
The following figure presents the content of the delivery for a TM221C Logic Controller:
EIO0000001360 06/2016 25
About the Modicon M221 Logic Controller
Overview
The TM221M Logic Controller has various powerful features and can service a wide range of
applications.
Software configuration, programming, and commissioning are accomplished with the SoMachine
Basic software described in the SoMachine Basic Operating Guide (see SoMachine Basic,
Operating Guide) and the M221 Logic Controller - Programming Guide.
Programming Languages
The M221 Logic Controller is configured and programmed with the SoMachine Basic software,
which supports the following IEC 61131-3 programming languages:
IL: Instruction List
LD: Ladder Diagram
Grafcet (List)
Grafcet (SFC)
Power Supply
The power supply of the TM221M Logic Controller is 24 Vdc (see Modicon M221 Logic Controller,
Hardware Guide).
Run/Stop
The M221 Logic Controller can be operated externally by the following:
a hardware Run/Stop switch (see Modicon M221 Logic Controller, Hardware Guide)
a Run/Stop operation by a dedicated digital input, defined in the software configuration (for more
information, refer to Configuring Digital Inputs (see page 86))
SoMachine Basic software (for more information, refer to Toolbar (see SoMachine Basic,
Operating Guide)).
a TMH2GDB Remote Graphic Display (for more information, refer to Controller State Menu).
26 EIO0000001360 06/2016
About the Modicon M221 Logic Controller
Memory
This table describes the different types of memory:
Embedded Inputs/Outputs
The following embedded I/O types are available, depending on the controller reference:
Regular inputs
Fast inputs (HSC)
Regular transistor outputs
Fast transistor outputs (PLS/PWM/PTO)
Relay outputs
Analog inputs
Removable Storage
The M221 Logic Controllers include an embedded SD card slot (see Modicon M221 Logic
Controller, Hardware Guide).
The Modicon M221 Logic Controller allows the following types of file management with an SD card:
Clone management (see page 160): back up the application, firmware, and post configuration
(if it exists) of the logic controller
Firmware management (see page 162): download firmware updates directly to the logic
controller, and download firmware to a TMH2GDB Remote Graphic Display
Application management (see page 164): back up and restore the logic controller application,
or copy it to another logic controller of the same reference
Post configuration management (see page 166): add, change, or delete the post configuration
file of the logic controller
Error log management (see page 168): back up or delete the error log file of the logic controller
Memory management (see page 171): backup/restore of memory bits and words from a
controller
EIO0000001360 06/2016 27
About the Modicon M221 Logic Controller
28 EIO0000001360 06/2016
About the Modicon M221 Logic Controller
TM221M16TG 4 regular inputs(1) 6 regular transistor Yes 2 serial line ports Removable spring
(see Modicon 4 fast inputs outputs 1 USB programming terminal blocks
M221 Logic (HSC)(2) 2 fast transistor port
Controller, outputs
Hardware Guide) (PLS/PWM/PTO)(3
)
TM221ME16T 4 regular inputs(1) 6 regular transistor Yes 1 serial line port Removable screw
(see Modicon 4 fast inputs outputs 1 USB programming terminal blocks
M221 Logic (HSC)(2) 2 fast transistor port
Controller, outputs 1 Ethernet port
Hardware Guide) (PLS/PWM/PTO)(3
)
TM221ME16TG 4 regular inputs(1) 6 regular transistor Yes 1 serial line port Removable spring
(see Modicon 4 fast inputs outputs USB programming terminal blocks
M221 Logic (HSC)(2) 2 fast transistor port
Controller, outputs 1 Ethernet port
Hardware Guide) (PLS/PWM/PTO)(3
)
TM221M32TK 12 regular inputs(1) 14 regular Yes 2 serial line ports HE10 (MIL 20)
(see Modicon 4 fast inputs transistor outputs 1 USB programming connectors
M221 Logic (HSC)(2) 2 fast outputs port
Controller, (PLS/PWM/PTO)(3
Hardware Guide) )
TM221ME32TK 12 regular inputs(1) 14 regular outputs Yes 1 serial line port HE10 (MIL 20)
(see Modicon 4 fast inputs 2 fast outputs 1 USB programming connectors
M221 Logic (HSC)(2) (PLS/PWM/PTO)(3 port
Controller, ) 1 Ethernet port
Hardware Guide)
NOTE: The TM221M Logic Controller uses a 24 Vdc power supply (see Modicon M221 Logic Controller, Hardware
Guide).
(1) The regular inputs I2, I3, I4, and I5 have a maximum frequency of 5 kHz.
The other regular inputs have a maximum frequency of 100 Hz.
(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 as regular transistor outputs, or for PLS, PWM or PTO functions, or reflex
outputs for HSC.
EIO0000001360 06/2016 29
About the Modicon M221 Logic Controller
Delivery Content
The following figure presents the content of the delivery for a TM221M Logic Controller:
30 EIO0000001360 06/2016
Modicon M221
Configuration Features
EIO0000001360 06/2016
Chapter 2
Configuration Features
Configuration Features
Introduction
This chapter provides information related to M221 Logic Controller memory mapping, task, states,
behaviors, objects, and functions. The topics explained in this chapter allow the operator to
understand the featured specifications of M221 Logic Controller that are primarily needed to
configure and program the controller in SoMachine Basic.
EIO0000001360 06/2016 31
Configuration Features
Section 2.1
Objects
Objects
32 EIO0000001360 06/2016
Configuration Features
Objects
Overview
In SoMachine Basic, the term object is used to represent an area of logic controller memory
reserved for use by an application. Objects can be:
Simple software variables, such as memory bits and words
Addresses of digital or analog inputs and outputs
Controller-internal variables, such as system words and system bits
Predefined system functions or function blocks, such as timers and counters.
Controller memory is either pre-allocated for certain object types, or automatically allocated when
an application is downloaded to the logic controller.
Objects can only be addressed by a program once memory has been allocated. Objects are
addressed using the prefix %. For example, %MW12 is the address of a memory word, %Q0.3 is the
address of an embedded digital output, and %TM0 is the address of a Timer function block.
EIO0000001360 06/2016 33
Configuration Features
Object Types
Introduction
The language object types for the M221 Logic Controller are described in the following table:
34 EIO0000001360 06/2016
Configuration Features
EIO0000001360 06/2016 35
Configuration Features
36 EIO0000001360 06/2016
Configuration Features
EIO0000001360 06/2016 37
Configuration Features
38 EIO0000001360 06/2016
Configuration Features
Memory objects and software objects are generic objects used in SoMachine Basic, whereas
system objects and I/O objects are controller-specific. All controller-specific objects are discussed
in the Programming (see page 173) section.
For programming details of memory objects, software objects, and communication objects, refer
to the SoMachine Basic Generic Functions Library Guide.
For programming details of PID objects and PTO objects, refer to the Advanced Functions Library
Guide.
EIO0000001360 06/2016 39
Configuration Features
Addressing Examples
This table presents addressing examples for various object types:
40 EIO0000001360 06/2016
Configuration Features
EIO0000001360 06/2016 41
Configuration Features
42 EIO0000001360 06/2016
Configuration Features
EIO0000001360 06/2016 43
Configuration Features
44 EIO0000001360 06/2016
Configuration Features
EIO0000001360 06/2016 45
Configuration Features
Section 2.2
Task Structure
Task Structure
46 EIO0000001360 06/2016
Configuration Features
Overview
The Modicon TM221M Logic Controller supports the following task types:
Master task
Periodic task
Event task
The master tasks can be configured in either of the following scan modes:
Freewheeling mode
Periodic mode
For more information, refer to the Configuring Program Behavior and Tasks (see SoMachine
Basic, Operating Guide).
Tasks
Master tasks are triggered by continuous cyclic scanning or by the software timers by specifying
the scan period 2...150 ms (default 100 ms) in the periodic mode.
Periodic tasks are triggered by software timers, so are configured by specifying the scan period
2...255 ms (default 255 ms) in the periodic mode.
Event tasks are triggered by the physical inputs or the HSC function blocks. These events are
associated with embedded digital inputs (%I0.2...%I0.5) (rising, falling or both edges) or with the
high speed counters (when the count reaches the high speed counter threshold). You can
configure up to two events for each HSC function block, depending on the configuration.
You must configure one priority for each event task. The priority range is 0...7 and the priority 0 has
the highest priority.
Scan Modes
The freewheeling mode is a continuous cyclic scanning mode. In this mode, a new scan starts
immediately after the previous scan has completed.
This figure presents the relationship between master tasks and periodic tasks when the master
task is in freewheeling mode:
EIO0000001360 06/2016 47
Configuration Features
In freewheeling mode, the master task sleep time is at least 30% of the total cycle time with a
minimum of 1 millisecond. This percentage may be higher depending on the user application
(periodic task scan time, event task scan time, communication interaction, and so on).
In periodic mode, the logic controller waits until the configured scan time has elapsed before
starting a new scan. Every scan is therefore the same duration.
This figure presents the relationship between master tasks and periodic tasks when the master
task is in periodic mode:
If the processor goes to the HALTED state when the master task is configured in freewheeling
mode, verify whether the periodic task scan delay time is significant in comparison to the periodic
task period. If so, try:
reconfiguring the master freewheeling task as a cyclic task
increasing the periodic task period.
Event priorities control the relationship between the event tasks, master tasks, and periodic tasks.
The event task interrupts the master task and periodic task execution.
This figure presents the relationship between event tasks, master tasks, and periodic tasks in the
periodic mode:
The event tasks are triggered by a hardware interruption that sends a task event to the event task.
48 EIO0000001360 06/2016
Configuration Features
Watchdog Timer
You can configure a specific application watchdog timer for the master task and periodic task. If
the task execution time exceeds the configured watchdog timer period, the logic controller goes to
the HALTED state.
A system watchdog timer verifies whether the program is using more than 80% of the processing
capacity. In this case, the logic controller goes in the HALTED state.
EIO0000001360 06/2016 49
Configuration Features
Description
This table summarizes the task types, available scan modes for each task, scan mode triggering
conditions, operator configurable ranges, maximum number of each task, and their execution
priorities:
Task Type Scan Mode Triggering Condition Configurable Range Maximum Priority
Number of
Tasks
Master Freewheeling Normal Not applicable 1 Lowest
Periodic Software timer 2...150 ms
Periodic Periodic Software timer 2...255 ms 1 Higher than master
task and lower than
event tasks
Event Periodic Physical inputs %I0.2...%I0.5 4 Highest
%HSC function blocks Up to 2 events per 4
%HSC object
50 EIO0000001360 06/2016
Configuration Features
Section 2.3
Controller States and Behaviors
Introduction
This section provides you with 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 persistent
variables and the effect of SoMachine Basic task programming options on the behavior of your
system.
EIO0000001360 06/2016 51
Configuration Features
52 EIO0000001360 06/2016
Configuration Features
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, checking for the presence of output forcing, and
reviewing the controller status information via SoMachine Basic.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
NOTE: The system word %SW6 indicates the logic controller state (EMPTY, STOPPED, RUNNING,
HALTED, and POWERLESS).
When using the Start In Run feature, the controller will start executing program logic when power
is applied to the equipment. It is essential to know in advance how automatic reactivation of the
outputs will affect the process or machine being controlled. Configure the Run/Stop input to help
control the Start In Run feature. In addition, the Run/Stop input is designed to give local control
over remote RUN commands. If the possibility of a remote RUN command after the controller had
been stopped locally by SoMachine would have unintended consequences, you must configure
and wire the Run/Stop input to help control this situation.
WARNING
UNINTENDED MACHINE START-UP
Confirm that the automatic reactivation of the outputs does not produce unintended
consequences before using the Start In Run feature.
Use the Run/Stop input to help control the Start In Run feature and to help prevent the
unintentional start-up from a remote location.
Verify the state of security of your machine or process environment before applying power to
the Run/Stop input or before issuing a Run command from a remote location.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
EIO0000001360 06/2016 53
Configuration Features
When using the Unconditional Start In Run feature, the controller will attempt to start executing
program logic when power is applied to the equipment, independent of the reason the controller
had previously stopped. This occurs even if there is no charge in the battery, or if the battery is not
present. Therefore, the controller will start with all memory values re-initialized to zero or other
predetermined default values. It is conceivable that if the controller attempts to restart, for example,
after a short power outage, the values in memory at the time of the outage would be lost, and
restarting the machine may have unintended consequences as there was no battery to maintain
memory values. It is essential to know in advance how an unconditional start will affect the process
or machine being controlled. Configure the Run/Stop input to help control the Unconditional Start
In Run feature.
WARNING
UNINTENDED MACHINE OPERATION
Conduct a thorough risk analysis to determine the effects, under all conditions, of configuring
the controller with the Unconditional Start In Run feature.
Use the Run/Stop input to help avoid an unwanted unconditional restart.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
For more information about the Unconditional Start In Run feature, refer to Application Behavior
(see SoMachine Basic, Operating Guide).
54 EIO0000001360 06/2016
Configuration Features
EIO0000001360 06/2016 55
Configuration Features
NOTE: The system word %SW6 indicates the logic controller state (EMPTY, STOPPED, RUNNING,
HALTED, and POWERLESS).
56 EIO0000001360 06/2016
Configuration Features
Boot Controller
Effect: Command a reboot of the logic controller. For details about power-on sequence, refer to the
controller states diagram (see page 52).
Methods:
Power cycle
Reboot by script
The script on an SD card can issue a REBOOT as its last command.
Application Download
Effect: Download the application into the logic controller memory.
Optionally, select the Reset Memories option to reset to 0 (default choice) or retain the present
value of all memory words and bits on application download (see SoMachine Basic, Operating
Guide).
Methods:
SoMachine Basic online button:
Select the PC to controller (download) command.
Effect: Erase the application in the logic controller and set the logic controller in EMPTY state.
Download the application into the logic controller memory. If download is successful, a Cold
Start is done and the logic controller is set in STOPPED state.
Application file transfer by SD card:
Effect: At the next reboot, erase the application in the logic controller and download the
application files from the SD card to the controller memory. If download is successful, a Cold
Start is done and the controller is set in STOPPED state.
Initialize Controller
Effect: Set the controller in EMPTY state, and then, after a Cold Start, in STOPPED state.
Methods:
SoMachine Basic online button:
Select the Initialize controller command.
EIO0000001360 06/2016 57
Configuration Features
RUN Controller
Effect: Command a transition to the RUNNING controller state.
Methods:
Run/Stop (see Modicon M221 Logic Controller, Hardware Guide) switch on front face:
It commands a transition to RUNNING state on rising edge.
STOP Controller
Effect: Command a transition to the STOPPED state.
Methods:
Run/Stop (see Modicon M221 Logic Controller, Hardware Guide) switch on front face:
It forces a transition to STOPPED state on low level.
Download command:
It needs the controller to be set in STOPPED state (after the download the controller is in
STOPPED state).
Remote Graphic Display.
58 EIO0000001360 06/2016
Configuration Features
Cold Start
Cold Start is defined to be a power-up with all data initialized to its default values, and program
started from the beginning with program variables cleared. Software and hardware settings are
initialized.
Cold Start occurs for the following reasons:
Boot controller without validated application online modification.
Apply power to a logic controller without a charged backup battery.
Download application
Initialize logic controller
Warm Start
The Warm Start resumes running the program, in its previous operating state, with the counters,
function blocks, and system words and bits maintained.
EIO0000001360 06/2016 59
Configuration Features
Persistent Variables
60 EIO0000001360 06/2016
Configuration Features
EIO0000001360 06/2016 61
Configuration Features
Output Behavior
Introduction
The controller defines output behavior in response to commands and system events in a way that
allows for greater flexibility. An understanding of this behavior is necessary before discussing the
commands and events that affect controller states.
The possible output behaviors and the controller states to which they apply are:
Managed by application
Initialization values
Fallback Management (see SoMachine Basic, Operating Guide)
Maintain values
Fallback values
Output forcing
Managed by Application
Your application manages outputs normally. This applies in the RUNNING state.
62 EIO0000001360 06/2016
Configuration Features
Fallback Management
The objective of the fallback behavior is to control the outputs when the controller leaves the
RUNNING state.
Fallback values are applied on the transition from RUNNING to STOPPED or HALTED states, except
for special cases described below.
Fallback Execution
On a fallback occurrence:
If Maintain values is not selected, the outputs take the values configured in Fallback value.
If Maintain values is selected, the outputs keep their values.
Special cases:
Alarm output: The fallback is never applied in the alarm output. If alarm output is configured, its
fallback value is forced to 0.
Pulse generators (PLS, PWM, PTO, FREQGEN) and reflex outputs:
If Maintain values is not selected, the outputs take the values configured in Fallback value.
If Maintain values is selected, the outputs are set to 0.
NOTE:
After a download, the outputs are set to 0 (default values).
In EMPTY state, the outputs are set to 0.
As the data image reflects the physical values, fallback values are also applied to the data
image.
Fallback Values
This output state applies in the STOPPED and HALTED states.
During fallback, the outputs assume the following values:
For embedded outputs:
Fast transistor output: according to fallback setting
Regular transistor output: according to fallback setting
Relay output: according to fallback setting
Expert I/O functions (HSC, PLS, PWM, PTO, and FREQGEN):
- Source output: 0 Vdc
- Sink output: 24 Vdc
EIO0000001360 06/2016 63
Configuration Features
NOTE: An exception to the application of fallback values is in the case of an I/O expansion bus
error. For more information, refer to I/O Configuration General Description (see page 120).
Output Forcing
The controller allows you to force the state of selected outputs to a defined value for the purposes
of system testing, commissioning, and maintenance.
You can force the value of an output while your controller is connected to SoMachine Basic or with
a TMH2GDB Remote Graphic Display (see Modicon TMH2GDB, Remote Graphic Display, User
Guide).
To do so, either use the Force command in an animation table, or force the value using the F0 or
F1 buttons in the Ladder editor.
Output forcing overrides all other commands to an output irrespective of the task logic that is being
executed.
The forcing is not released by any online change nor logout of SoMachine Basic.
The forcing is automatically released by Cold Start (see page 59) and Download application
(see page 57) command.
The forcing does not apply for expert I/O functions (HSC, PLS, PWM and PTO).
WARNING
UNINTENDED EQUIPMENT OPERATION
You must have a thorough understanding of how forcing will affect the outputs relative to the
tasks being executed.
Do not attempt to force I/O that is contained in tasks that you are not certain will be executed
in a timely manner, unless your intent is for the forcing to take affect at the next execution of
the task whenever that may be.
If you force an output and there is no apparent affect on the physical output, do not exit
SoMachine Basic without removing the forcing.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
Output Rearming
In the case of a short-circuit or current overload, the common group of outputs automatically enters
into thermal protection mode (all outputs in the group are set to 0), and are then periodically
rearmed (each second) to test the connection state. However, you must be aware of the effect of
this rearming on the machine or process being controlled.
NOTE: The output rearming does not apply to sink outputs.
64 EIO0000001360 06/2016
Configuration Features
WARNING
UNINTENDED MACHINE START-UP
Inhibit the automatic rearming of outputs if this feature is an undesirable behavior for your
machine or process.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
NOTE: Only the short-circuit between an output set to TRUE and 0 V is detected. The short-circuit
between an output set to FALSE and 24 V is not detected.
If necessary, you can use system bits and words to both detect that a short circuit or overload has
occurred and on which cluster of outputs it has occurred. System bit %S10 can be used to detect
within your program that an output error has occurred. You can then use the system word %SW139
to determine programmatically in which cluster of outputs a short circuit or overload has occurred.
The automatic rearming feature can be disabled by setting the system bit %S49 to 0 (%S49 is set
to 0 by default).
EIO0000001360 06/2016 65
Configuration Features
Section 2.4
Post Configuration
Post Configuration
Introduction
This section describes how to manage and configure the post configuration file of the Modicon
M221 Logic Controller.
66 EIO0000001360 06/2016
Configuration Features
Post Configuration
Introduction
Post configuration is an option that allows you to modify some parameters of the application
without changing the application. Post configuration parameters are defined in a file called
Machine.cfg, which is stored in the controller.
By default, all communication parameters are set in the configuration of the application. However,
under certain conditions, some or all of these parameters can be modified automatically via the
mechanism Post Configuration. One or more communication parameters can be specified in the
post configuration file, and those parameters can override the parameters specified by the
configuration. For example, one parameter may be stored in the post configuration file to change
the Ethernet IP address of the controller while leaving the other Ethernet parameters, such as the
gateway address, unchanged.
Parameters
The post configuration file allows you to modify network parameters.
Ethernet parameters:
Address configuration mode
IP address
Subnet mask
Gateway address
Device name
Serial line parameters, for each serial line in the application (embedded port or TMC2SL1
cartridge):
Physical medium
Baud rate
Parity
Data bits
Stop bit
Modbus address
Polarization (for RS-485)
Operating Mode
The post configuration file is read and applied:
after a Warm Start (see page 59)
after a Cold Start (see page 59)
after a reboot (see page 57)
after an application download (see page 57)
after an Ethernet reconfiguration caused by an Ethernet cable reconnection (exclusively for the
Ethernet part of the post configuration file (see page 131))
EIO0000001360 06/2016 67
Configuration Features
For further details on controller states and transitions, refer to Controller States and Behaviors
(see page 51).
68 EIO0000001360 06/2016
Configuration Features
Introduction
The post configuration file can be transferred, modified, or deleted with an SD card. Refer to Post
Configuration Management (see page 166).
NOTE: A post configuration file example is available in the directory
Firmwares & PostConfiguration\PostConfiguration\add_change\usr\cfg of the
SoMachine Basic installation directory.
EIO0000001360 06/2016 69
Configuration Features
NOTE:
When using a post configuration file for Ethernet configuration, it is not mandatory to specify all the
parameters:
If the M221 Logic Controller is configured (by the user application) in DHCP or BOOTP mode,
the network parameters IP (IP address), MASK (subnet mask) and GATEWAY (gateway
address) are not configured in the file.
If a parameter is not configured in the post configuration file, the M221 Logic Controller uses the
value configured in the user application (see Ethernet configuration (see page 130)).
If the M221 Logic Controller is configured in DHCP or BOOTP mode by the user application and
if fixed IP mode (IPMODE=0) is configured in the post configuration file, configure the network
parameters (IP (IP address), MASK (subnet mask) and GATEWAY (gateway address)) as they
are not configured by the user application. Otherwise, the M221 Logic Controller starts with the
default Ethernet configuration.
70 EIO0000001360 06/2016
Modicon M221
Configuring the M221 Logic Controller
EIO0000001360 06/2016
Part II
Configuring the M221 Logic Controller
Overview
This part provides information about how to configure the M221 Logic Controller references.
EIO0000001360 06/2016 71
Configuring the M221 Logic Controller
72 EIO0000001360 06/2016
Modicon M221
How to Configure a Controller
EIO0000001360 06/2016
Chapter 3
How to Configure a Controller
Overview
This chapter describes how to build a configuration in SoMachine Basic and configure the M221
Logic Controller.
EIO0000001360 06/2016 73
How to Configure a Controller
Building a Configuration
Introduction
Configure a controller by building a configuration in SoMachine Basic. To build a configuration, first
create a new project or open an existing project.
Refer to SoMachine Basic Operating Guide for information on how to:
create or open an existing project
replace the default logic controller
add an expansion module to the logic controller
add a cartridge to the logic controller
save the project.
Some general information about the SoMachine Basic user interface is provided below.
Start Page
The start page window is always displayed when you launch SoMachine Basic. Use this window
to register the SoMachine Basic software, manage the connection to the logic controller, and
create or select a project to work with.
1 Toolbar
2 Status bar
3 Tabs
74 EIO0000001360 06/2016
How to Configure a Controller
Item Description
Toolbar Provides easy access to commonly used functions.
For more information, refer to the Toolbar (see SoMachine Basic, Operating Guide).
Status bar Displays status and information messages on the system status.
For more information, refer to the Status bar (see SoMachine Basic, Operating Guide).
Tabs To develop an application, work your way through the module tabs from left to right:
Properties
Set up the project properties.
Configuration
Replicate and configure the hardware configuration of the logic controller and
associated expansion modules.
Programming
Develop the program in one of the supported programming languages.
Display
Build an operator interface for a Remote Graphic Display device.
Refer to the TMH2GDB Remote Graphic Display User Guide for details.
Commissioning
Manage the connection between SoMachine Basic and the logic controller,
upload/download applications, test, and commission the application.
Hardware Tree
The hardware tree is displayed on left-hand side in the Configuration window. It shows a structured
view of the hardware configuration. When you add a controller, an expansion module, or a
cartridge to the project, several nodes are automatically added to the hardware tree.
NOTE: The nodes in the hardware tree are specific to the controller and the hardware
configuration. These nodes depend on the I/O functions that the controller, expansion modules,
and cartridges provide.
EIO0000001360 06/2016 75
How to Configure a Controller
Item Description
Digital inputs Use to configure the embedded digital inputs of the logic controller.
Digital outputs Use to configure the embedded digital outputs of the logic controller.
Analog inputs Use to configure the embedded analog inputs of the logic controller.
High Speed Counters Use to configure the embedded high speed counting functions (HSC).
Pulse Generators Use to configure the embedded pulse generator functions
(PLS/PWM/PTO/FREQGEN).
IO Bus Use to configure the expansion modules and cartridges connected to the
logic controller.
ETH1 Use to configure the embedded Ethernet communications.
Modbus TCP Use to configure the Modbus TCP protocol for Ethernet communications.
EtherNet/IP adapter Use to configure the EtherNet/IP adapter for Ethernet communications.
SLn (Serial line) Use to configure the embedded serial line or the serial line added using a
cartridge.
n Serial line number (1 or 2, controller-specific).
76 EIO0000001360 06/2016
How to Configure a Controller
Editor
The editor area is displayed in center of the Configuration window. It displays the graphical
representation of hardware configuration of the devices. The hardware configuration in a project
can be:
only a controller
a controller with cartridges
a controller with expansion modules
a controller with cartridges and expansion modules.
If you add an expansion module to the configuration, the expansion module appears at the right-
hand side of the controller or the previously added expansion module. Cartridges are added on the
controller in the cartridge slot.
When configuring a controller, a cartridge, or an expansion module, the configuration properties of
the node selected in the hardware tree are displayed below the graphical configuration. These
properties allow you to configure the device.
This figure presents the configuration of a controller with an expansion module (the controller is
selected):
EIO0000001360 06/2016 77
How to Configure a Controller
Catalog
The catalog area is displayed on right-hand side in the Configuration window. It displays the
complete range of the logic controllers, expansion modules, and cartridges that can be configured
using SoMachine Basic. It also provides a short description of the selected device.
You can drag-and-drop the objects from the catalog area to the editor area. You can also replace
the existing controller by a different controller with simple drag-and-drop from the catalog.
This figure presents the catalog of the logic controllers and the expansion modules:
78 EIO0000001360 06/2016
How to Configure a Controller
Presentation
I/O expansion modules can be marked as optional in the configuration. The Optional module
feature provides a more flexible configuration by the acceptance of the definition of modules that
are not physically attached to the logic controller. Therefore, a single application can support
multiple physical configurations of I/O expansion modules, allowing a greater degree of scalability
without the necessity of maintaining multiple application files for the same application.
Without the Optional module feature, when the logic controller starts up the I/O expansion bus
(following a power cycle, application download or initialization command), it compares the
configuration defined in the application with the physical I/O modules attached to the I/O bus.
Among other diagnostics made, if the logic controller determines that there are I/O modules
defined in the configuration that are not physically present on the I/O bus, an error is detected and
the I/O bus does not start.
With the Optional module feature, the logic controller ignores the absent I/O expansion modules
that you have marked as optional, which then allows the logic controller to start the I/O expansion
bus.
The logic controller starts the I/O expansion bus at configuration time (following a power cycle,
application download, or initialization command) even if optional expansion modules are not
physically connected to the logic controller.
The following module types can be marked as optional:
TM3 I/O expansion modules
TM2 I/O expansion modules
NOTE: TM3 Transmitter/Receiver modules (TM3XTRA1 and the TM3XREC1) and TMC2
cartridges cannot be marked as optional.
The application must be configured with a functional level (see SoMachine Basic, Operating
Guide) of at least Level 3.2 for modules marked as optional to be recognized as such by the logic
controller.
You must be fully aware of the implications and impacts of marking I/O modules as optional in your
application, both when those modules are physically absent and present when running your
machine or process. Be sure to include this feature in your risk analysis.
WARNING
UNINTENDED EQUIPMENT OPERATION
Include in your risk analysis each of the variations of I/O configurations that can be realized
marking I/O expansion modules as optional, and in particular the establishment of TM3 Safety
modules (TM3S) as optional I/O modules, and make a determination whether it is acceptable
as it relates to your application.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
EIO0000001360 06/2016 79
How to Configure a Controller
Step Action
1 Drag-and-drop the I/O expansion module from the catalog to the editor.
2 In the Device information area, select the Optional module check box:
Step Action
1 Select the I/O expansion module in the editor.
2 In the Device information area, select the Optional module check box.
80 EIO0000001360 06/2016
How to Configure a Controller
The selection of the Optional module feature is used by the logic controller to start the I/O bus. The
following system words are updated to indicate the status of the physical I/O bus configuration:
EIO0000001360 06/2016 81
How to Configure a Controller
82 EIO0000001360 06/2016
How to Configure a Controller
Controller Configuration
Controller configuration depends on the number and type of embedded input/outputs, I/O objects,
and communication ports.
Use the Configuration tab to configure the properties of your controller and the expansion modules.
Select a node in the hardware tree to configure the properties of the controller.
This table shows the available configurations of the M221 Logic Controller:
EIO0000001360 06/2016 83
How to Configure a Controller
Overview
You can update the firmware of the controller using the Executive Loader wizard.
Refer to Controller States and Behavior (see page 51) for information concerning the state of the
firmware in your controller.
Step Action
1 Close all Windows applications, including virtual machines.
2 Click Start Programs Schneider Electric SoMachine Basic SoMachine Basic Firmware
Update or run the ExecLoaderWizard.exe from SoMachine Basic installation folder\Execloader
folder.
84 EIO0000001360 06/2016
Modicon M221
Embedded Input/Output Configuration
EIO0000001360 06/2016
Chapter 4
Embedded Input/Output Configuration
Overview
This chapter describes how to configure the embedded I/O objects of the M221 Logic Controller.
The number of embedded inputs and outputs depends on the controller reference. For more
information, refer to the tables for:
TM221C Logic Controller (see page 22)
TM221M Logic Controller (see page 28)
EIO0000001360 06/2016 85
Embedded Input/Output Configuration
Section 4.1
Digital Input Configuration
Introduction
By default, all digital inputs are used as regular inputs. Some of the digital inputs are fast and can
be used by configuring the high speed counters (see page 96) while other inputs can be configured
as event sources.
Step Action
1 Click the Digital inputs node in the hardware tree to display the digital input properties.
This figure shows the properties of the digital inputs in the editor area:
86 EIO0000001360 06/2016
Embedded Input/Output Configuration
EIO0000001360 06/2016 87
Embedded Input/Output Configuration
Run/Stop Yes True/False False Allows you to configure 1 digital input as an additional
Run/Stop switch.
If you configure a digital input as Run/Stop switch, you
cannot use the input in any other function block (for
example, high speed counter function block, fast counter
function block, and so on).
If you enable Run/Stop for an input, you cannot configure
that input for:
Latch
Event
Event Yes Not Used Not Used Allows you to select an event that triggers the inputs
Falling Edge %I0.2...%I0.5.
Rising Edge By default, this option is disabled due to default value of
Both edges Filtering. Set the Filtering to No Filter to enable the Event
option.
If you select an event from the drop-down list (other than
Not Used), the Priority parameter enables for editing to set
the priority of the event.
Priority Yes 0...7 7 Allows you to set the priority of the triggering event for the
inputs %I0.2...%I0.5.
You can set the priority of each event using the Priority
parameter that is editable only for the inputs configured as
event.
Assign each configured event a different priority: if 2
events have same priority, a detected error message
appears in the window.
Subroutine No any empty Displays the number of the subroutine associated with an
input configured as an event.
88 EIO0000001360 06/2016
Embedded Input/Output Configuration
Additional configuration details are displayed in the Programming tab. For more information, refer
to Digital Inputs (%I) (see page 176).
EIO0000001360 06/2016 89
Embedded Input/Output Configuration
Section 4.2
Digital Output Configuration
Introduction
By default, all digital outputs are used as regular outputs. For controllers equipped with transistor
outputs, 2 outputs are fast transistor outputs and can be used by configuring the pulse generators
(see page 108).
Step Action
1 Click the Digital outputs node in the hardware tree to display the digital output properties.
This figure shows the properties of the digital outputs in the editor area:
90 EIO0000001360 06/2016
Embedded Input/Output Configuration
EIO0000001360 06/2016 91
Embedded Input/Output Configuration
Additional configuration details are displayed in the Programming tab. For more information, refer
to Digital Outputs (%Q) (see page 177).
92 EIO0000001360 06/2016
Embedded Input/Output Configuration
Section 4.3
Analog Input Configuration
Introduction
The analog inputs do not have any configurable property in SoMachine Basic. By default, analog
inputs are used as regular inputs.
Step Action
1 Click the Analog inputs node in the hardware tree to display the analog input properties.
This figure shows the properties of the analog inputs in the editor area:
EIO0000001360 06/2016 93
Embedded Input/Output Configuration
Additional configuration details are displayed in the Programming tab. For more information, refer
to Analog Inputs (%IW) (see page 178).
94 EIO0000001360 06/2016
Embedded Input/Output Configuration
Section 4.4
High Speed Counter Configuration
EIO0000001360 06/2016 95
Embedded Input/Output Configuration
Introduction
You can configure high speed counters to perform any one of the following functions:
Single Phase
Dual Phase [Pulse / Direction]
Dual Phase [Quadrature X1]
Dual Phase [Quadrature X2]
Dual Phase [Quadrature X4]
Frequency Meter
For information on how to select a function, refer to High Speed Counter in Counter Modes
(see Modicon M221 Logic Controller, Advanced Functions Library Guide) or High Speed Counter
in Frequency Meter Mode (see Modicon M221 Logic Controller, Advanced Functions Library
Guide).
The High Speed Counter function block works at a maximum frequency of 100 kHz for all counting
modes with a range of 0 to 65535 in single word and 0 to 4294967295 in double word.
The High Speed Counter function blocks use dedicated inputs and auxiliary inputs and outputs.
These inputs and outputs are not reserved for the exclusive use of High Speed Counter function
blocks:
If the dedicated input/output is not used by an HSC instance, it is available for the application
as a regular digital input/output.
If the application does not use an HSC dedicated input/output as a regular digital input/output,
it is available for the corresponding HSC instance.
96 EIO0000001360 06/2016
Embedded Input/Output Configuration
EIO0000001360 06/2016 97
Embedded Input/Output Configuration
Step Description
1 Click the High Speed Counters node in the hardware tree.
Result: The High Speed Counters list is displayed:
2 Click ... in under Configuration to select the type of high speed counter to assign and to display the High
Speed Counter Assistant window.
For detailed information on the high speed counter, refer to the table below.
This table describes each parameter of the high speed counters configuration:
98 EIO0000001360 06/2016
Embedded Input/Output Configuration
For details on the configuration of the Dual Phase [Pulse / Direction], Dual Phase
[Quadrature X1], Dual Phase [Quadrature X2], Dual Phase [Quadrature X4], and
Single Phase, refer to Configuring Dual Phase and Single Phase Counters (see page 100).
For details on the configuration of the Frequency Meter, refer to Configuring Frequency Meter
(see page 105).
EIO0000001360 06/2016 99
Embedded Input/Output Configuration
Item Description
1 Displays the title of the assistant dialog window for the selected HSC instance %HSCi.
2 Allows you to select the HSC type, mode, and dual phase counter type.
Item Description
3 Displays the dedicated inputs, auxiliary inputs, and reflex outputs.
Properties in this area of the assistant window are different for each counter type and the HSC
instance. For more details, refer to Dedicated I/O Assignments (see page 97).
Common Parameters
This table describes parameters common to the counter types: Dual Phase [Pulse /
Direction], Dual Phase [Quadrature X2], and Single Phase:
Dual Phase [Quadrature X1], Dual Phase [Quadrature X2], and Dual Phase [Quadrature
X4] Parameters
This table describes parameters specific to Dual Phase [Quadrature X1], Dual Phase
[Quadrature X2], and Dual Phase [Quadrature X4]:
Section 4.5
Pulse Generator Configuration
Introduction
The pulse generator function blocks, Pulse (PLS), Pulse Width Modulation (PWM), Pulse
Train Output (PTO) and Frequency Generator (FREQGEN) are used to generate square
or modulated wave signals on dedicated output channels %Q0.0 or %Q0.1.
The PWM outputs feature a modulated wave signal with a variable width and duty cycle, while the
PTO outputs generate a a square wave to control a linear single-axis stepper or servo drive in open
loop mode. The PLS also creates a square wave for a programmed number of pulses.
Step Action
1 Click the Pulse Generators node in the hardware tree to display the pulse generator properties.
This figure presents the properties of the pulse generators in the editor area:
2 Edit the properties and click [...] to configure the pulse generator output.
For detailed information on the pulse generator configuration parameters, refer to the table below.
PLS Configuration
Refer to Configuring Pulse (%PLS) (see page 110).
For more details on the Pulse function block, refer to the Modicon M221 Logic Controller
Advanced Functions Library Guide, chapter Pulse (%PLS) (see Modicon M221 Logic Controller,
Advanced Functions Library Guide).
PWM Configuration
Refer to Configuring Pulse Width Modulation (%PWM) (see page 113).
For more details on the Pulse Width Modulation function block, refer to the Modicon M221
Logic Controller Advanced Functions Library Guide, chapter Pulse Width Modulation (%PWM)
(see Modicon M221 Logic Controller, Advanced Functions Library Guide).
PTO Configuration
Refer to Configuring Pulse Train Output (%PTO) (see page 115)
For more details on the Pulse Train Output function block, refer to the Modicon M221 Logic
Controller Advanced Functions Library Guide, chapter Pulse Train Output (%PTO) (see Modicon
M221 Logic Controller, Advanced Functions Library Guide).
The table describes each parameter available when the channel is configured in PLS mode:
For more details on the Pulse function block, refer to the Modicon M221 Logic Controller
Advanced Functions Library Guide, chapter Pulse (%PLS) (see Modicon M221 Logic Controller,
Advanced Functions Library Guide).
The table describes each parameter available when the channel is configured in PWM mode:
The table describes each parameter available when the channel is configured in PTO mode:
The Frequency Generator (FG) function generates a square wave signal with programmable
frequency and duty cycle of 50%. The controller uses an internal clock generator and provides an
output signal on a dedicated output channel (%Q0.0). This output signal can directly command a
constant motion of the axis. The target frequency is always positive.
For more details on the FREQGEN function block, refer to the Modicon M221 Logic Controller
Advanced Functions Library Guide, chapter Frequency Generator (%FREQGEN) (see Modicon
M221 Logic Controller, Advanced Functions Library Guide).
Chapter 5
I/O Bus Configuration
Overview
This chapter describes how to configure the I/O bus (expansion modules) of the M221 Logic
Controller.
Introduction
In your project, you can add I/O expansion modules to your M221 Logic Controller to increase the
number of digital and analog inputs and outputs over those native to the logic controller itself
(embedded I/O).
You can add either TM3 or TM2 I/O expansion modules to the logic controller, and further expand
the number of I/O via TM3 transmitter and receiver modules to create remote I/O configurations.
Special rules apply in all cases when creating local and remote I/O expansions, and when mixing
TM2 and TM3 I/O expansion modules (refer to Maximum Hardware Configuration (see page 123)).
The I/O expansion bus of the M221 Logic Controller is created when you assemble the I/O
expansion modules to the logic controller. I/O expansion modules are considered as external
devices in the logic controller architecture and are treated, as such, differently than the embedded
I/Os of the logic controller.
In either case, the logic controller continues to solve logic and the embedded I/O continues to be
managed by the application (Managed by application) while it attempts to re-establish
communication with the I/O expansion modules. If the communication is successful, the I/O
expansion modules will resume to be managed by the application. If communication with the I/O
expansion modules is unsuccessful, you must resolve the reason for the unsuccessful
communication, and then cycle power on the logic controller system, or issue an Initialize
Controller command with SoMachine Basic.
WARNING
UNINTENDED EQUIPMENT OPERATION
Include in your risk assessment the possibility of unsuccessful communication between the
logic controller and any I/O expansion modules.
If the Maintain values deployed during an I/O expansion bus error is incompatible with your
application, use alternate means to control your application for such an event.
Monitor the state of the I/O expansion bus using the dedicated system words and take
appropriate actions as determined by your risk assessment.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
For more information on the actions taken upon start up of the logic controller when an I/O
expansion bus error is detected, refer to Optional I/O Expansion Modules (see page 79).
WARNING
UNINTENDED EQUIPMENT OPERATION
Update the configuration of your program each time you add or delete any type of I/O expansions
on your I/O bus, or you add or delete any devices on your field bus.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
WARNING
UNINTENDED EQUIPMENT OPERATION
Include in your risk analysis each of the variations of I/O configurations that can be realized
marking I/O expansion modules as optional, and in particular the establishment of TM3 Safety
modules (TM3S) as optional I/O modules, and make a determination whether it is acceptable
as it relates to your application.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
NOTE: For more details about this feature, refer to Optional I/O Expansion Modules (see page 79).
Introduction
The M221 Logic Controller is a control system that offers an all-in-one solution with optimized
configurations and an expandable architecture.
Application requirements determine the architecture of your M221 Logic Controller configuration.
The following figure represents the components of a local configuration:
NOTE: You cannot mount a TM2 module before any TM3 module as indicated in the following
figure:
Application requirements determine the architecture of your M221 Logic Controller configuration.
NOTE: You cannot use TM2 modules in configurations that include the TM3 transmitter and
receiver modules.
The following figure represents the components of a remote configuration:
NOTE: The configuration with its TM3 and TM2 expansion modules is validated by SoMachine
Basic software in the Configuration window taking into account the total power consumption of the
installed modules.
NOTE: In some environments, the maximum configuration populated by high consumption
modules, coupled with the maximum distance allowable between the TM3 transmitter and receiver
modules, may present bus communication issues although the SoMachine Basic software allows
for the configuration. In such a case you will need to analyze the consumption of the modules
chosen for your configuration, as well as the minimum cable distance required by your application,
and possibly seek to optimize your choices.
NOTE: Expansion modules consume current from the 5 Vdc and 24 Vdc supplied to the I/O Bus.
Therefore, the current delivered by the logic controller to the I/O Bus defines the maximum number
of expansion modules that can be connected to the I/O Bus (validated by SoMachine Basic
software in the Configuration window).
Introduction
In your project, you can add the following devices to the controller:
TMC2 Cartridges
TM3 Digital I/O Modules
TM3 Expert I/O Modules
TM2 Digital I/O Modules
TM2 Analog I/O Modules
TMC2 Cartridges
For more information about cartridge configuration, refer to the following programming and
hardware guides:
Chapter 6
Embedded Communication Configuration
Overview
This chapter describes how to configure the communication features of the M221 Logic Controller.
Section 6.1
Ethernet Configuration
Ethernet Configuration
Introduction
You can configure the TCP/IP connection to the logic controller by configuring the Ethernet
network. The Ethernet establishes a local area network (LAN) between the logic controller and
other devices. The Ethernet configuration provides you the ability to configure the IP address of
the network device.
NOTE: The controller-PC link uses the TCP/IP protocol. It is required for this protocol to be installed
on the PC.
You can obtain the IP address by the following protocols:
Dynamic Host Configuration Protocol (DHCP)
Bootstrap Protocol (BOOTP)
You can also specify the IP address by specifying the following addresses:
IP address
Subnet mask
Gateway address
NOTE: Schneider Electric follows, and recommends to its customers, industry best practices in the
development and implementation of control systems. This recommendation includes a "Defense-
in-Depth" approach to secure an Industrial Control System. This approach places the controllers
behind one or more firewalls to restrict access to authorized personnel and protocols only.
WARNING
UNAUTHENTICATED ACCESS AND SUBSEQUENT UNAUTHORIZED MACHINE
OPERATION
Evaluate whether your environment or your machines are connected to your critical
infrastructure and, if so, take appropriate steps in terms of prevention, based on Defense-in-
Depth, before connecting the automation system to any network.
Limit the number of devices connected to a network to the minimum necessary.
Isolate your industrial network from other networks inside your company.
Protect any network against unintended access by using firewalls, VPN, or other, proven
security measures.
Monitor activities within your systems.
Prevent subject devices from direct access or direct link by unauthorized parties or unauthen-
ticated actions.
Prepare a recovery plan including backup of your system and process information.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
Ethernet Services
The logic controller supports the following services:
Modbus TCP Server
Modbus TCP Client
EtherNet/IP Adapter
Modbus TCP Slave Device
Ethernet Configuration
This table describes how to configure the Ethernet:
Step Action
1 Click the ETH1 node in the hardware tree to display the Ethernet properties.
This figure presents the Ethernet properties in the editor area:
NOTE: The Security Parameters displayed depend on the functional level (see SoMachine Basic,
Operating Guide) selected for the application.
This table describes each parameter of the Ethernet configuration:
NOTE: When a protocol listed in Security Parameters is disabled, requests from the corresponding
server type are ignored. The corresponding configuration screen remains accessible; however,
program execution is not affected.
Address Management
This diagram presents the different types of address systems for the M221 Logic Controller:
NOTE: If a device programmed to use the DHCP or BOOTP addressing methods is unable to
contact its respective server, the controller uses the default IP address. It will, however, constantly
repeat its request.
The IP process restarts in the following cases:
Controller reboot
Ethernet cable reconnection
Application download (if IP parameters change)
DHCP or BOOTP server detected after a prior addressing attempt was unsuccessful or when
the DHCP address lease expires.
Introduction
You can configure the Ethernet port to enable the embedded Modbus TCP server giving the logic
controller Modbus TCP abilities.
Step Action
1 Click the Modbus TCP node that appears below the ETH1 node in the hardware tree to display the
Modbus TCP properties
This figure presents the properties displayed in the editor area:
2 Select Enabled to edit the properties to configure the Modbus TCP protocol.
NOTE: If the Enabled button is grayed out, verify that the Functional Level of your application
(Programming Tasks Behavior tab) is at least Level 3.2.
For detailed information on Modbus TCP configuration parameters, refer to the table below.
Step Action
1 Enter the IP address in the Address field.
2 Enter the value for Unit ID and Connection timeout (100 ms).
3 Click the Add button.
Result: A list of remote servers that you have added appears on the screen.
This figure presents the table listing the remote servers:
This table describes each column of the table listing the remote servers:
Configuring EtherNet/IP
Introduction
This section describes the configuration of the EtherNet/IP connection to the controller.
For further information about EtherNet/IP, refer to www.odva.org
Step Action
1 Click the EtherNet/IP adapter node that appears below the ETH1 node in the hardware tree.
This figure presents the properties of the EtherNet/IP Adapter in the editor area:
NOTE: Output means output from the Scanner controller (%IWE for the Adapter).
Input means input from the Scanner controller (%QWE for the Adapter).
The following graphic presents the directionality of Input assembly and Output assembly in
EtherNet/IP communications:
EDS File
A template electronic data sheet (EDS) file, M221_EDS_Model.eds, is provided in SoMachine
Basic installation folder \Firmwares & PostConfiguration.
Modify the file as described in the user guide to be found in the same folder.
Profile
The controller supports the following objects:
Section 6.2
Serial Line Configuration
Introduction
The M221 Logic Controller references are equipped with at least 1 serial line. The controller
references without the Ethernet feature support 2 serial lines:
SL1 (serial line).
SL2 (serial line).
The SL1 or SL2 port supports the following features to simplify modem connections:
An initialization (Init) command to send an initial configuration to the modem. This command is
automatically sent by the controller after an application download or at power on.
System bit %S105 to be able to send the Init command to the modem again.
System word %SW167 to provide the status of the Init command operation.
You can configure both protocol and serial line settings. Serial lines are configured for the Modbus
RTU protocol by default.
Step Action
1 Click the SL1 (Serial line) or SL2 (Serial line) node in the hardware tree to display the serial line
configuration.
Device Configuration
This table describes each parameter of the selected device:
Section 6.3
Supported Modbus Function Codes
Presentation
This section lists the function codes supported by both serial Modbus and Modbus TCP and their
effect on controller memory variables
Modbus Slave
The following Modbus requests are supported:
NOTE:
The impact of Modbus function codes used by a master M221 Logic Controller depends on the
slave device type. In the major types of slave device:
Internal bit means %M
Input bit means %I
Internal register means %MW
Input register means %IW
Depending on the type of slave and the slave address, an internal bit should be a %M or %Q; an
input bit should be a %I or %S, an input register should be a %IW or a %SW and an internal register
should be a %MW or a %QW.
For more details, refer to the documentation of the slave device.
Chapter 7
SD Card
SD Card
Introduction
The Modicon M221 Logic Controller allows file transfers with an SD card.
This chapter describes how to manage Modicon M221 Logic Controller files with an SD card.
Introduction
The Modicon M221 Logic Controller allows the following types of file management with an SD card:
Clone management (see page 160): back up the application, firmware, and post configuration
(if it exists) of the logic controller
Firmware management (see page 162): download firmware directly to the logic controller, and
load firmware to the Remote Graphic Display
Application management (see page 164): back up and restore the logic controller application,
or copy it to another logic controller of the same reference
Post configuration management (see page 166): add, change, or delete the post configuration
file of the logic controller
Error log management (see page 168): back up or delete the error log file of the logic controller
Memory management (see page 171): Back up and restore memory objects of the controller
NOTE:
Logic controller logic solving and services execution continues during file transfers.
Certain commands require a power cycle of the logic controller. See the description of the
commands for more information.
The Modicon M221 Logic Controller accepts only SD cards formatted in FAT or FAT32.
With the use of the SD card, powerful operations can be automatically conducted affecting the
behavior of your logic controller and resident application. Care must be taken when inserting an
SD card into the controller; you must be aware of the affect that the contents of the SD card will
have on your logic controller.
NOTE: File management with SD card uses script files. These scripts can be automatically created
with the Memory Management task (see SoMachine Basic, Operating Guide).
WARNING
UNINTENDED EQUIPMENT OPERATION
You must have operational knowledge of your machine or process before connecting an SD
card to your logic controller.
Ensure that guards are in place so that any potential affect of the contents of the SD card will
not cause injury to personnel or damage to equipment.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
If there is a power outage or communication interruption during the transfer of the application, your
device may become inoperative. If a communication interruption or a power outage occurs,
reattempt the transfer. If there is a power outage or communication interruption during a firmware
update, or if an invalid firmware is used, your device will become inoperative. In this case, use a
valid firmware and reattempt the firmware update.
NOTICE
INOPERABLE EQUIPMENT
Do not interrupt the transfer of the application program or a firmware change once the transfer
has begun.
Do not place the device into service until the transfer has completed successfully.
Failure to follow these instructions can result in equipment damage.
Introduction
This table lists the file locations and types of file that can be managed:
Command Description
Download Download a file from the SD card to the controller.
Upload Upload files contained in controller memory to the SD
card.
Delete Delete files contained in a controller.
Script Log
A script.log file is automatically created in the SD card root directory after script operations.
The status of the script operations can be verified reading this file.
Clone Management
Cloning
Cloning allows you to automatically back up the application, firmware, and post configuration (if it
exists) of the Modicon M221 Logic Controller to the SD card.
The SD card can then be used to later restore the firmware, application, and post configuration (if
it exists) to the logic controller, or copy them to another logic controller with the same reference.
Before cloning a controller, the M221 Logic Controller verifies whether the application is copy-
protected or not. For details, refer to Password Protecting an Application (see SoMachine Basic,
Operating Guide).
NOTE:
The SD card must be empty and correctly formatted to perform this procedure.
The detected error log and data memory are not cloned.
If the application is password-protected, the clone operation is blocked (the SD LED is flashing).
Step Action
1 Format an SD card on the PC.
2 Insert the SD card into the controller.
Result: The clone operation starts automatically and the SD LED turns ON.
3 Wait until the end of the operation (until the SD LED is turned OFF or flashing).
If an error is detected, the SD and ERR LEDs flash and the detected error is logged in Script.log
file.
NOTE: The clone operation lasts 2 or 3 minutes. The clone operation has a low priority in order to
minimize impact on the user logic and communication performance of the logic controller.
Depending on the amount of free time in your program, the operation may require more time to
complete if the logic controller is in RUNNING state compared to the STOPPED state.
4 Remove the SD card from the controller.
Step Action
1 Remove power from the controller.
2 Insert the SD card into the controller.
3 Restore power to the controller.
Result: The clone operation is in progress.
NOTE: The SD LED is turned on during the operation.
4 Wait until the end of the operation (until the SD LED is turned OFF or flashing).
If an error is detected, the SD and ERR LEDs flash and the detected error is logged in
Script.log file.
5 Remove the SD card to restart the controller.
NOTE: Downloading a cloned application to the controller first removes the existing application
from controller memory, regardless of any user access-rights that may be enabled in the target
controller.
Firmware Management
Overview
You can use an SD card to download firmware updates directly to the logic controller or a Remote
Graphic Display.
Refer to Controller States and Behavior (see page 51) for information on the logic controller
operating states and status of the LEDs.
Step Action
1 Remove power from the controller.
2 Insert an empty SD card into the PC that is running SoMachine Basic.
3 Create a file called script.cmd in the SD card root directory.
4 Edit the file and insert the following command:
Download "/sys/os"
5 Create the folder path \sys\os in the SD card root directory and copy the firmware file in the os
folder:
NOTE: A firmware file example and the script are available in the folder Firmwares &
PostConfiguration\M221\ of the SoMachine Basic installation folder.
The firmware file name for the M221 Logic Controller is M221.mfw.
6 Remove the SD card from the PC and insert it into the SD card slot of the logic controller.
7 Restore power to the controller.
Result: Copying of the firmware file begins. During the operation, the SD system LED on the logic
controller is ON.
NOTE: Avoid removing power from the logic controller while the operation is in progress.
8 Wait until the end of the operation (until the SD LED is turned OFF or flashing).
If an error is detected, the SD and ERR LEDs flash and the detected error is logged in
Script.log file.
9 Remove the SD card.
10 Reconnect the USB programming cable to the logic controller and login to the logic controller with
the SoMachine Basic software.
Step Action
1 Apply power to the logic controller.
2 Connect the Remote Graphic Display to the logic controller (see Modicon TMH2GDB, Remote
Graphic Display, User Guide).
3 Insert an empty SD card into the PC that is running SoMachine Basic.
4 Create a file called script.cmd in the SD card root directory.
5 Edit the file and insert the following command:
Download "/disp/TMH2GDB.mfw"
6 Create the folder path /disp/ in the SD card root directory and copy the firmware file in the
disp folder:
NOTE: The firmware file and an example script are available in the folder Firmwares &
PostConfiguration\TMH2GDB\ of the SoMachine Basic installation folder.
The firmware file name for the Remote Graphic Display is TMH2GDB.mfw.
7 Remove the SD card from the PC and insert it into the SD card slot of the M221 Logic Controller.
Result: The logic controller begins transferring the firmware file from the SD card to the Remote
Graphic Display. During this operation:
the message File Transfer is displayed on the Remote Graphic Display
the SD system LED on the M221 Logic Controller is turned on
system word %SW182 is set to 5 (Display firmware transfer in progress)
NOTE: Do not disconnect the Remote Graphic Display or remove power from the M221 Logic
Controller while the operation is in progress. The firmware update takes 5 to 6 minutes.
8 Wait until the end of the operation (until the SD LED is turned OFF or flashing).
If an error is detected, the SD and ERR LEDs flash and the detected error is logged in
Script.log file.
NOTE: Restoring the file system on the Remote Graphic Display (red backlight) is part of the
process.
Application Management
Overview
You can use an SD card to back up and restore your controller application, or copy it to another
controller with the same reference.
Backing Up an Application
This table describes how to back up the controller application on the SD card:
Step Action
1 Create a script.cmd file with a text editor on your PC.
2 Edit the file and insert the following line:
Upload "/usr/app"
3 Copy the script file to the root folder of the SD card.
4 Insert the prepared SD card in the controller.
Result: Copying of the application file begins. During the operation, the SD system LED on the
logic controller is ON.
NOTE: Avoid removing power from the logic controller while the operation is in progress.
NOTE: The application backup process has a low priority in order to minimize impact on the
program and communication performance of the logic controller. Depending on the amount of
free time in your program, the operation may take considerably longer to complete if the logic
controller is in RUNNING state compared to the STOPPED state.
5 Wait until the end of the operation (until the SD LED is turned OFF or flashing).
If an error is detected, the SD and ERR LEDs flash and the detected error is logged in
Script.log file.
Result: The application file (*.smbk) is saved on the SD card.
Step Action
1 Take an SD card previously created and edit the script.cmd file in the root folder of the SD
card with a text editor.
2 Replace the content of the script by the following line:
Download "/usr/app"
3 Remove power from the controller.
4 Insert the prepared SD card in the controller.
Step Action
5 Restore power to the controller.
Result: Copying of the application file begins. During the operation, the SD system LED on the
logic controller is ON.
NOTE: Avoid removing power from the logic controller while the operation is in progress.
6 Wait until the end of the operation (until the SD LED is turned OFF or flashing).
If an error is detected, the SD and ERR LEDs flash and the detected error is logged in
Script.log file.
7 Remove the SD card to restart the controller.
Overview
You can use an SD card to add, change, or delete the post configuration file of your controller.
Step Action
1 Create a file called script.cmd.
2 Edit the file and insert the following line:
Download "/usr/cfg"
3 Copy the post configuration file (Machine.cfg) to the folder \usr\cfg and the script file to the
root folder of the SD card:
NOTE: A post configuration file example and the associated script are available in the directory
Firmwares & PostConfiguration\PostConfiguration\add_change\ of the
SoMachine Basic installation directory.
4 If necessary, edit the Machine.cfg file to configure your post configuration parameters.
5 Insert the prepared SD card in the controller.
Result: Downloading of the post configuration file begins. During the operation, the SD system
LED on the logic controller is ON.
NOTE: Avoid removing power from the logic controller while the operation is in progress.
NOTE: Before the download the file format is verified, as well as if all of the channels,
parameters, and values configured are valid; in case of detected error the download is aborted.
6 Wait until the end of the operation (until the SD LED is turned OFF or flashing).
If an error is detected, the SD and ERR LEDs flash and the detected error is logged in
Script.log file.
7 Do a power cycle or an initialization command to apply the new post configuration file.
Step Action
1 Create a script.cmd file with a text editor on your PC.
2 Edit the file and insert the following line:
Upload "/usr/cfg"
3 Copy the script file to the root folder of the SD card.
4 Insert the prepared SD card in the controller.
Result: Copying of the post configuration file begins. During the operation, the SD system
LED on the logic controller is ON.
NOTE: Avoid removing power from the logic controller while the operation is in progress.
NOTE: The application backup process has a low priority to minimize impact on the
program and communication performance of the logic controller. Depending on the amount
of free time in your program, the operation may take considerably longer to complete, if the
logic controller is in RUNNING state compared to the STOPPED state.
5 Wait until the end of the operation (until the SD LED is turned OFF or flashing).
If an error is detected, the SD and ERR LEDs flash and the detected error is logged in
Script.log file.
Result: The post configuration file is saved on the SD card.
Step Action
1 Insert an empty SD card into the PC that is running SoMachine Basic.
2 Create a file called script.cmd.
3 Edit the file and insert the following line:
Delete "/usr/cfg"
4 Copy the script file available in the directory Firmwares &
PostConfiguration\PostConfiguration\remove\ of the SoMachine Basic installation
directory to the root directory of the SD card.
5 Insert the prepared SD card in the controller.
Result: The post configuration file is removed. During the operation, the SD system LED on the
logic controller is ON.
NOTE: Avoid removing power from the logic controller while the operation is in progress.
6 Wait until the end of the operation (until the SD LED is turned OFF or flashing).
If an error is detected, the SD and ERR LEDs flash and the detected error is logged in
Script.log file.
7 Do a power cycle or an initialization command to apply the application parameters.
Overview
You can use the SD card to back up or delete the error log file of the logic controller.
Step Action
1 Create a script.cmd file with a text editor on your PC.
2 Edit the file and insert the following line:
Upload "/sys/log"
3 Copy the script file to the root folder of the SD card.
4 Insert the prepared SD card in the logic controller.
Result: Transfer of the error log file begins. During the operation, the SD system LED on the logic
controller is ON.
NOTE: Avoid removing power from the logic controller while the operation is in progress.
5 Wait until the end of the operation (until the SD LED is turned OFF or flashing).
If an error is detected, the SD and ERR LEDs flash and the detected error is logged in
Script.log file.
Result: The error log file (PlcLog.csv) is saved on the SD card.
Step Action
1 Create a script.cmd file with a text editor on your PC.
2 Edit the file and insert the following line:
Delete "/sys/log"
3 Copy the script file to the root folder of the SD card.
4 Insert the prepared SD card in the logic controller.
Result: Deleting of the error log file begins. During the operation, the SD system LED on the logic
controller is ON.
NOTE: Avoid removing power from the logic controller while the operation is in progress.
5 Wait until the end of the operation (until the SD LED is turned OFF or flashing).
If an error is detected, the SD and ERR LEDs flash and the detected error is logged in
Script.log file.
Result: The error log file (PlcLog.csv) is deleted from the logic controller.
After an upload through the SD card, the code is represented as in the example below:
02/06/14, 12:04:01, 0x01110001
This table describes the meaning of the hexadecimal error representation:
Overview
You can use an SD card to back up and restore controller memory objects, or copy the memory
objects to another controller.
Step Action
1 Create a script.cmd file with a text editor on your PC.
2 Edit the file and insert the following line:
Upload "/usr/mem"
3 Copy the script file to the root folder of the SD card.
4 Insert the prepared SD card in the controller.
Result: Copying of the memory begins. During the operation, the SD system LED on the logic
controller is ON.
NOTE: Avoid removing power from the logic controller while the operation is in progress.
NOTE: The memory backup process has a low priority to minimize impact on the program and
communication performance of the logic controller. Depending on the amount of free time in your
program, the operation may take considerably longer to complete if the logic controller is in
RUNNING state compared to the STOPPED state.
5 Wait until the end of the operation (until the SD LED is turned OFF or flashing).
If an error is detected, the SD and ERR LEDs flash and the detected error is logged in
Script.log file.
Result: The memory file (*.csv) is saved on the SD card.
Step Action
1 Edit the script.cmd file in the root folder of the SD card with a text editor.
2 Replace the content of the script by the following line:
Download "/usr/mem"
3 Insert the prepared SD card in the controller.
Result: Copying of the memory file begins. During the operation, the SD system LED on the logic
controller is ON.
NOTE: Avoid removing power from the logic controller while the operation is in progress.
4 Wait until the end of the operation (until the SD LED is turned OFF or flashing).
If an error is detected, the SD and ERR LEDs flash and the detected error is logged in
Script.log file.
Part III
Programming the M221 Logic Controller
Overview
This part provides information about the system and I/O objects specific to the M221 Logic
Controller. These objects are displayed in the Programming tab.
For descriptions of all other objects, refer to SoMachine Basic Generic Functions Library Guide.
Chapter 8
I/O Objects
I/O Objects
Introduction
Digital input bit objects are the image of digital inputs on the logic controller.
Step Action
1 Select the Tools tab in the left-hand area of the Programming window.
2 Click I/O objects Digital inputs.
Result: Digital input properties appear on the screen.
Introduction
Digital output bit objects are the image of digital outputs on the logic controller.
Step Action
1 Select the Tools tab in the left-hand area of the Programming window.
2 Click I/O objects Digital outputs.
Result: Digital output properties appear on the screen.
Introduction
Analog input word objects are the digital values of an analog signal connected to the logic
controller.
Two 0-10V analog inputs are embedded in the logic controller. The embedded analog inputs use
a 10 bits resolution converter so that each increment is approximately 10 mV (10V/210-1). Once
the system detects the value 1023, the channel is considered to be saturated.
Refer to M221 Hardware Guide (see Modicon M221 Logic Controller, Hardware Guide) and TMC2
Cartridges Hardware Guide used in the configuration for more details.
Step Action
1 Select the Tools tab in the left-hand area of the Programming window.
2 Click I/O objects Analog inputs.
Result: Analog input properties appear on the screen.
Introduction
Analog output word objects are the digital values of the analog signals recieved from the logic
controller using cartridges.
Two 0-10 V analog outputs and two 4-20 mA analog outputs are embedded in the cartridges
TMC2AQ2C and TMC2AQ2V respectively.
Refer to TMC2 Cartridges Hardware Guide used in the configuration for more details.
Step Action
1 Select the Tools tab in the left-hand area of the Programming window.
2 Click I/O objects Analog outputs.
Result: Analog output properties appear on the screen.
Chapter 9
Network Objects
Network Objects
Introduction
Input assembly objects are the digital values of EtherNet/IP Input assembly frames received on the
logic controller.
Step Action
1 Select the Tools tab in the left-hand area of the Programming window.
2 Click Network objects Input assembly.
Result: The properties window appears.
Introduction
Output assembly objects are the digital values of EtherNet/IP Output assembly frames received on
the logic controller.
Step Action
1 Select the Tools tab in the left-hand area of the Programming window.
2 Click Network objects Output assembly.
Result: The properties window appears.
Introduction
Input registers objects are the digital values of Modbus mapping table Input registers received on
the logic controller.
Step Action
1 Select the Tools tab in the left-hand area of the Programming window.
2 Click Network objects Input registers.
Result: The properties window appears.
Introduction
Output registers objects are the digital values of Modbus mapping table output registers received
on the logic controller.
Step Action
1 Select the Tools tab in the left-hand area of the Programming window.
2 Click Network objects Output registers.
Result: The properties window appears.
Chapter 10
Function Blocks
Function Blocks
Introduction
The M221 logic controller provides:
Four fast inputs (%I0.0, %I0.1, %I0.6 and %I0.7)
Two fast outputs on controller references that contain transistor outputs (%Q0.0 and %Q0.1)
NOTE: No fast outputs functions are supported on controller references that contain relay outputs.
The M221 logic controller supports the following expert I/O functions (depending on the reference):
Functions Description
Counters Fast Counter The FC function can execute fast counts of pulses from
(Advanced input (see Modicon M221 Logic sensors, switches, and so on.
functions) Controller, Advanced
Functions Library Guide)
High Speed Counter The HSC function can execute fast counts of pulses from
(see Modicon M221 Logic sensors, switches, and so on, that are connected to the fast
Controller, Advanced inputs.
Functions Library Guide)
Pulse Generators Pulse (see Modicon M221 The PLS function generates a square wave pulse signal on
(Advanced output Logic Controller, dedicated output channels.
functions) Advanced Functions
Library Guide)
Pulse Width Modulation The PWM function generates a modulated wave signal on
(see Modicon M221 Logic dedicated output channels with a variable duty cycle.
Controller, Advanced
Functions Library Guide)
Pulse Train Output The PTO function generates a pulse train output to control a
(see Modicon M221 Logic linear single-axis stepper or servo drive in open loop mode.
Controller, Advanced
Functions Library Guide)
These functions and their function blocks are described in the Modicon M221 Logic Controller
Advanced Functions Library Guide (see Modicon M221 Logic Controller, Advanced Functions
Library Guide).
NOTE:
When an input is used as Run/Stop, it cannot be used by an expert function.
When an output is used as Alarm, it cannot be used by an expert function.
Chapter 11
System Objects
System Objects
Introduction
This section provides information about the function of system bits.
Step Action
1 Select the Tools tab in the left-hand area of the Programming window.
2 Click System objects System Bits.
Result: System bit properties appear on the screen.
%S10 I/O communication Normally set to 1 (TRUE on control panel). This bit can be 1 S
status set to 0 (FALSE on control panel) by the system when an I/O
communication interruption is detected. When %S10=0, the
ERR LED flashes.
%S11 Watchdog overflow Normally set to 0. This bit can be set to 1 by the system when 0 S
the program execution time (scan time) exceeds the
maximum scan time (application watchdog).
Watchdog overflow causes the controller state to change to
HALTED.
%S11 is also set to 1 by the system if the processing load is
greater than 80% of the processing capacity (refer to
%SW75 (see page 202)). If the processor load is greater
than 80% on any two consecutive measurements, the
controller goes to HALTED state. Otherwise, %S11 is reset.
%S12 Logic controller in This bit indicates that the controller is RUNNING. 0 S, SIM
RUNNING state The system sets the bit to:
1 when the controller state is RUNNING,
0 for STOPPED, BOOTING, or any other state.
This bit can be set to 0 by the program and the system (on
cold restart).
%S49 Output rearming Normally set to 0, this bit can be set to 1 or 0 by the program. 0 US
(see page 62) Set to 0, the automatic re-arming of outputs following a
short circuit is disabled.
Set to 1, the automatic re-arming of outputs following a
short circuit is enabled.
NOTE: The bit is reset to 0 on a cold start; otherwise, the bit
value is retained.
The system bit %S10 can be used to detect within your
program that an output error has occurred. You can then use
the system word %SW139 to determine programmatically in
which cluster of outputs a short circuit or overload has
occurred.
NOTE: %S10 and %SW139 are reset to their initial state
when %S49 is set to 1.
S Controlled by the system
U Controlled by the user
U S Set to 1 by the user, reset to 0 by the system
S U Set to 1 by the system, reset to 0 by the user
SIM Applied in the Simulator
Introduction
This section provides information about the function of system words.
Step Action
1 Select the Tools tab in the left-hand area of the Programming window.
2 Click System objects System Words.
Result: System word properties appear on the screen.
The %SW1 value can be modified in the program at each end of a cycle, in
the program or in an animation table without having to stop the program.
Cycle times can be correctly observed while the program is running.
%SW6 Controller state Controller state: S, SIM
%MW60012 0 = EMPTY
2 = STOPPED
3 = RUNNING
4 = HALTED
5 = POWERLESS
S Controlled by the system
U Controlled by the user
SIM Applied in the simulator
%SW16=0B16 hex:
8 MSB=0B in hexadecimal, then cc=11 in decimal
8 LSB=16 in hexadecimal, then dd=22 in decimal
NOTE: The post configuration has priority over the configuration provided
by your application. The configuration of your application is not taken into
account if the M221 Logic Controller has a post configuration.
%SW101 Value of the When bit %S101 is set to 1, you can change the Modbus address of SL1 or U
%SW102 Modbus address SL2. The address of SL1 is %SW101. The address of SL2 is %SW102.
port
NOTE: The update is applied immediately after writing a new address to
%SW101 or %SW102.
S Controlled by the system
U Controlled by the user
SIM Applied in the simulator
Baud rate:
000: 1200 baud,
001: 2400 baud,
010: 4800 baud,
011: 9600 baud,
100: 19200 baud,
101: 38400 baud,
110: 57600 baud,
111: 115200 baud.
RTS/CTS:
0: disabled,
1: enabled.
Parity:
00: none,
10: odd,
11: even.
Stop bit:
0: 1 stop bit,
1: 2 stop bits.
Data bits:
0: 7 data bits,
1: 8 data bits.
%SW107 MAC address Indicates the controller MAC address (only references with Ethernet S
%SW108 channel).
%SW109 For MAC address AA:BB:CC:DD:EE:FF:
%SW107 = AA:BB
%SW108 = CC:DD
%SW109 = EE:FF
%SW114 Enable schedule Enables or disables operation of schedule blocks by the program: S and
blocks Bit [0]: Enable/disable schedule block number 0 U, SIM
Set to 0: disabled
Set to 1: enabled
...
Bit [15]: Enable/disable schedule block number 15
Set to 0: disabled
Set to 1: enabled
Bit [10]:
Set to 0: Invalid internal configuration; contact Schneider Electric
customer service.
Set to 1: No error detected.
Bit [13]:
Set to 0: Configuration error detected (mandatory modules, as
defined by the I/O expansion bus configuration, are absent or
otherwise inoperative when the logic controller attempts to start the
I/O expansion bus). In this case, the I/O bus does not start.
Set to 1: No error detected.
Bit [14]:
Set to 0: One or more modules have ceased communication with the
logic controller after the I/O expansion bus is started. This is the case
whether an I/O expansion module is defined as mandatory or optional
but present at start-up.
Set to 1: No error detected.
Bit [15]:
Set to 0: Cartridge error detected (configuration or runtime operation).
Set to 1: No error detected.
NOTE: The other bits of this word are set to 1 and are reserved.
%SW119 Optional module One bit for each expansion module in the configuration: S, SIM
feature Bit [0]: Reserved for the logic controller
configuration Bit n: Module n
Set to 1: Module is marked as optional in the configuration.
Set to 0: Module is not marked as optional in the configuration.
General status:
0x80: Cartridge is not present and it is not configured in SoMachine
Basic.
0x81: Module is present, but it is not configured.
0x82: Internal communication error with the cartridge.
0x83: Internal communication error with the cartridge.
0x84: Detected cartridge different from the configuration.
0x85: Configured cartridge is not detected.
Reference Code ID
TM221M16R 0x0780
TM221ME16R 0x0781
TM221M16T 0x0782
TM221ME16T 0x0783
TM221M32TK 0x0784
TM221ME32TK 0x0785
TM221C16R 0x0786
TM221CE16R 0x0787
TM221C16U 0x0796
TM221CE16U 0x0797
TM221C16T 0x0788
TM221CE16T 0x0789
TM221C24R 0x078A
TM221CE24R 0x078B
TM221C24T 0x078C
TM221CE24T 0x078D
TM221C24U 0x0798
TM221CE24U 0x0799
TM221C40R 0x078E
TM221CE40R 0x078F
TM221C40T 0x0790
TM221CE40T 0x0791
TM221C40U 0x079A
TM221CE40U 0x079B
Introduction
The following provides information about the properties of input channel status words. A dedicated
input channel status word exists for each analog input channel added using an I/O expansion
module or TMC2 cartridge.
Step Action
1 Select the Tools tab in the left-hand area of the Programming window.
2 Click System objects Input Status Words.
Result: Input channel status word properties is displayed.
Introduction
The following provides information about the properties of output status words. A dedicated output
channel status word exists for each analog output channel added using an I/O expansion module
or TMC2 cartridge.
Step Action
1 Select the Tools tab in the left-hand area of the Programming window.
2 Click System objects Output Status Words.
Result: Output channel status word properties are displayed in the properties window.
For cartridges:
x is the cartridge number
y is the channel number
Glossary
A
analog input
Converts received voltage or current levels into numerical values. You can store and process these
values within the logic controller.
analog output
Converts numerical values within the logic controller and sends out proportional voltage or current
levels.
application
A program including configuration data, symbols, and documentation.
B
BOOTP
(bootstrap protocol) A UDP network protocol that can be used by a network client to automatically
obtain an IP address (and possibly other data) from a server. The client identifies itself to the server
using the client MAC address. The server, which maintains a pre-configured table of client device
MAC addresses and associated IP addresses, sends the client its pre-configured IP address.
BOOTP was originally used as a method that enabled diskless hosts to be remotely booted over a
network. The BOOTP process assigns an infinite lease of an IP address. The BOOTP service
utilizes UDP ports 67 and 68.
C
configuration
The arrangement and interconnection of hardware components within a system and the hardware
and software parameters that determine the operating characteristics of the system.
controller
Automates industrial processes (also known as programmable logic controller or programmable
controller).
D
DHCP
(dynamic host configuration protocol) An advanced extension of BOOTP. DHCP is more
advanced, but both DHCP and BOOTP are common. (DHCP can handle BOOTP client requests.)
digital I/O
(digital input/output) An individual circuit connection at the electronic module that corresponds
directly to a data table bit. The data table bit holds the value of the signal at the I/O circuit. It gives
the control logic digital access to I/O values.
E
EDS
(electronic data sheet) A file for fieldbus device description that contains, for example, the
properties of a device such as parameters and settings.
EtherNet/IP
(Ethernet industrial protocol) An open communications protocol for manufacturing automation
solutions in industrial systems. EtherNet/IP is in a family of networks that implement the common
industrial protocol at its upper layers. The supporting organization (ODVA) specifies EtherNet/IP
to accomplish global adaptability and media independence.
EtherNet/IP Adapter
An EtherNet/IP Adapter, sometimes also called a server, is an end-device in an EtherNet/IP
network. I/O blocks and drives can be EtherNet/IP Adapter devices.
expansion bus
An electronic communication bus between expansion I/O modules and a controller.
G
GRAFCET
The functioning of a sequential operation in a structured and graphic form.
This is an analytical method that divides any sequential control system into a series of steps, with
which actions, transitions, and conditions are associated.
H
HMI
(human machine interface) An operator interface (usually graphical) for human control over
industrial equipment.
I
I/O
(input/output)
IEC 61131-3
Part 3 of a 3-part IEC standard for industrial automation equipment. IEC 61131-3 is concerned with
controller programming languages and defines 2 graphical and 2 textual programming language
standards. The graphical programming languages are ladder diagram and function block diagram.
The textual programming languages include structured text and instruction list.
IL
(instruction list) A program written in the language that is composed of a series of text-based
instructions executed sequentially by the controller. Each instruction includes a line number, an
instruction code, and an operand (refer to IEC 61131-3).
Input Assembly
Assemblies are blocks of data exchanged between network devices and the logic controller. An
Input Assembly generally contains status information from a network device read by the controller.
instruction list language
A program written in the instruction list language that is composed of a series of text-based
instructions executed sequentially by the controller. Each instruction includes a line number, an
instruction code, and an operand (see IEC 61131-3).
L
ladder diagram language
A graphical representation of the instructions of a controller program with symbols for contacts,
coils, and blocks in a series of rungs executed sequentially by a controller (see IEC 61131-3).
LAN
(local area network) A short-distance communications network that is implemented in a home,
office, or institutional environment.
LD
(ladder diagram) A graphical representation of the instructions of a controller program with symbols
for contacts, coils, and blocks in a series of rungs executed sequentially by a controller (refer to
IEC 61131-3).
LSB
(least significant bit/byte) The part of a number, address, or field that is written as the right-most
single value in conventional hexadecimal or binary notation.
M
master task
A processor task that is run through its programming software. The master task has 2 sections:
IN: Inputs are copied to the IN section before execution of the master task.
OUT: Outputs are copied to the OUT section after execution of the master task.
Modbus
The protocol that allows communications between many devices connected to the same network.
MSB
(most significant bit/byte The part of a number, address, or field that is written as the left-most
single value in conventional hexadecimal or binary notation.
O
Output Assembly
Assemblies are blocks of data exchanged between network devices and the logic controller. An
Output Assembly generally contains command sent by the controller to network devices.
P
periodic execution
The task is executed either cyclically or periodically. In periodic mode, you determine a specific
time (period) in which the task is executed. If it is executed under this time, a waiting time is
generated before the next cycle. If it is executed over this time, a control system indicates the
overrun. If the overrun is too high, the controller is stopped.
periodic task
The periodic task is a periodic, high-priority task of short duration that runs on a logic controller
through its programming software. The short duration of the periodic task prevents it from
interfering with the execution of slower, lower priority tasks. A periodic task is useful when fast
periodic changes in digital inputs need to be monitored.
PID
(proportional, integral, derivative) A generic control loop feedback mechanism (controller) widely
used in industrial control systems.
post configuration
(post configuration) An option that allows to modify some parameters of the application without
changing the application. Post configuration parameters are defined in a file that is stored in the
controller. They are overloading the configuration parameters of the application.
program
The component of an application that consists of compiled source code capable of being installed
in the memory of a logic controller.
protocol
A convention or standard definition that controls or enables the connection, communication, and
data transfer between 2 computing system and devices.
R
RTC
(real-time clock) A battery-backed time-of-day and calender clock that operates continuously, even
when the controller is not powered for the life of the battery.
S
security parameters
A set of configuration parameters used to enable or disable specific protocols and features relating
to the cybersecurity of an application.
SFC
(sequential function chart) A language that is composed of steps with associated actions,
transitions with associated logic condition, and directed links between steps and transitions. (The
SFC standard is defined in IEC 848. It is IEC 61131-3 compliant.)
SMS
(short message service) A standard communication service for telephones (or other devices) that
send short text messages over the mobile communications system.
Index
Symbols %TM, 40
%C, 40
%DR, 40
%FC, 40
A
advanced expert functions, 189
%FREQGEN, 40
analog inputs, 93
%HSC, 40
configuration, 93
%I, 40, 176
introduction, 93
%IW, 40, 178
properties, 178
%IWE, 40, 184
analog outputs
%IWM, 40, 187
properties, 180
%IWM/%QWM, 139
application download, 57
%IWS (input channel status), 224
%KD, 40
%KF, 40
%KW, 40
B
%M, 40 backup controller memory, 171
%MD, 40 boot controller, 57
%MF, 40
%MSG, 40
%MW, 40
C
%PLS, 40 cartridges
%PWM, 40 configuration, 127
%Q, 40, 177 TMC2, 127
%QW, 40, 180 Cold Start, 59
%QWE, 40, 182 configuration
%QWM, 40, 185 building a configuration, 74
%QWS (Output channel status), 226 configuration introduction, 74
%R, 40 Frequency Meter, 105
%S, 40 HSC, 100
%S (system bits), 192 controller
%S93, 60 configuration, 73, 83
%S94, 60, 61 configuration features, 31
%SBR, 40 controller state, 52, 53
%SC, 40 BOOTING, 54
%SW, 40 EMPTY, 54
%SW (system words), 202 HALTED, 55
%SW118, 80 POWERLESS, 56
%SW119, 80 RUNNING, 55
%SW120, 80 STOPPED, 55
%SW148, 60, 60, 61 cyber security, 133
%SW6, 53, 56
U
unit ID, 139
updating firmware, 84, 162
uploading applications, 56
W
Warm start, 59