Sie sind auf Seite 1von 218

Modicon M218 Logic Controller EIO0000000827 12/2012

Modicon M218 Logic Controller


Programming Guide
12/2012

EIO0000000827.04

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 that is 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. 2012 Schneider Electric. All rights reserved.

EIO0000000827 12/2012

Table of Contents

Safety Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . About the Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Chapter 1 About the Modicon M218 Logic Controller . . . . . . . . . .
Modicon M218 Logic Controller Devices Overview. . . . . . . . . . . . . . . . . .

7 9 13
13

Chapter 2 How to Configure the Controller . . . . . . . . . . . . . . . . . . .


How to Configure the Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

17
17

Chapter 3 Libraries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Libraries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

21
21

Chapter 4 Supported Standard Data Types . . . . . . . . . . . . . . . . . . .


Supported Standard Data Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

23
23

Chapter 5 Memory Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


Memory Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Relocation Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

25
26 30

Chapter 6 Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Maximum Number of Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Task Configuration Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Task Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . System and Task Watchdogs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Task Priorities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Default Task Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

33
34 35 38 41 42 44

Chapter 7 Controller States and Behaviors . . . . . . . . . . . . . . . . . . .


7.1 Controller State Diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Controller State Diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.2 Controller States Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Controller States Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.3 State Transitions and System Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . Controller States and Output Behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . Commanding State Transitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Error Detection, Types, and Management . . . . . . . . . . . . . . . . . . . . . . . . Remanent Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

45
46 46 50 50 54 55 58 64 66

EIO0000000827 12/2012

Chapter 8 Controller Configuration . . . . . . . . . . . . . . . . . . . . . . . . . .


Controller Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . M218 Controller Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . M218 Controller Services. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

67
68 69 70 71

Chapter 9 Embedded Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . .


I/O Embedded Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . HSC Embedded Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PTO_PWM Embedded Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Analog I/O Embedded Function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

73
74 78 80 83

Chapter 10 Expansion Modules Configuration. . . . . . . . . . . . . . . . . .


General Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Adding an Expansion Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

87
88 90

Chapter 11 Serial Line Configuration . . . . . . . . . . . . . . . . . . . . . . . . .


Serial Line Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Serial Line Protocol Manager. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ASCII Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . SoMachine Network Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Modbus IOScanner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Modbus Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

91
92 94 97 100 101 110

Chapter 12 Ethernet Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . .


Ethernet Services. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . IP Address Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Modbus TCP Server/Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

115
116 117 122

Chapter 13 Connecting the Modicon M218 Logic Controller to a PC


Connecting the Controller to a PC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Active Path of the Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

129
130 132

Chapter 14 Loader Device Accessory . . . . . . . . . . . . . . . . . . . . . . . . .


14.1 About the Loader Device Accessory . . . . . . . . . . . . . . . . . . . . . . . . . . . . Loader Device AccessoryDescription . . . . . . . . . . . . . . . . . . . . . . . . . . . Physical Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . LED Status and Diagnostic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Firmware and SoMachine Software Compatibility . . . . . . . . . . . . . . . . . . 14.2 Transfer From SoMachine to the USB Memory Key . . . . . . . . . . . . . . . . Transfer From SoMachine to the USB Memory Key . . . . . . . . . . . . . . . . 14.3 File Transfer with a USB Memory Key. . . . . . . . . . . . . . . . . . . . . . . . . . . Upload From the Controller to the USB Memory Key . . . . . . . . . . . . . . . Download From the USB Memory Key to the Controller . . . . . . . . . . . . 14.4 Other Functionalities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Set the Controller to RUNNING State . . . . . . . . . . . . . . . . . . . . . . . . . . . Update the Firmware of the Loader Device Accessory . . . . . . . . . . . . . .

133
134 135 137 138 140 142 142 143 144 146 149 150 151

EIO0000000827 12/2012

Chapter 15 Updating the Controller Firmware . . . . . . . . . . . . . . . . .


Updating Through USB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Launching the Exec Loader Wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Step 1 - Welcome . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Step 2 - Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Step 3 - File and Device Exec Properties . . . . . . . . . . . . . . . . . . . . . . . . . Step 4 - Transfer Progress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

153
154 156 157 158 159 161

Chapter 16 Modicon M218 Logic Controller - Troubleshooting and FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


Troubleshooting. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Frequently Asked Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

163
164 171

Appendices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Appendix A Function and Function Block Representation . . . . . . .
Differences Between a Function and a Function Block. . . . . . . . . . . . . . . How to Use a Function or a Function Block in IL Language . . . . . . . . . . . How to Use a Function or a Function Block in ST Language . . . . . . . . . .

173
175
176 177 181

Appendix B Functions to get/set serial line configuration in user program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


GetSerialConf: Get the Serial Line Configuration . . . . . . . . . . . . . . . . . . . SetSerialConf: Change the Serial Line Configuration . . . . . . . . . . . . . . . . SERIAL_CONF: Structure of the Serial Line Configuration Data Type. . .

185
186 187 189

Appendix C Controller Performance . . . . . . . . . . . . . . . . . . . . . . . . . .


Processing Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

191
191

Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

193 217

EIO0000000827 12/2012

EIO0000000827 12/2012

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, 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.

EIO0000000827 12/2012

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.

EIO0000000827 12/2012

About the Book

At a Glance
Document Scope The purpose of this document is to help you to configure your Modicon M218 Logic Controller. NOTE: Read and understand this document and all related documents (see page 9) before installing, operating, or maintaining your Modicon M218 Logic Controller. The Modicon M218 Logic Controller users should read through the entire document to understand all features. Validity Note This document has been updated with the release of SoMachine M218 Add-On V2.0.31.30 Related Documents
Title of Documentation SoMachine Programming Guide Modicon M218 Logic Controller Hardware Guide TM2...N Expansion Module Hardware Guide Modicon TM2 Expansion Modules Configuration Programming Guide Modicon M218 Logic Controller System Functions and Variables M218 PLCSystem Library Guide Reference Number EIO0000000067 (eng), EIO0000000072 (chs) EIO0000000843 (eng), EIO0000000844 (chs) EIO0000001030 (eng), EIO0000001029 (chs) EIO0000000396 (eng), EIO0000000401 (chs) EIO0000000835 (eng), EIO0000000836 (chs)

Modicon M218 Logic Controller High Speed Counting M218 HSC Library EIO0000000837 (eng), Guide EIO0000000838 (chs)

EIO0000000827 12/2012

Modicon M218 Logic Controller Pulse Train Output, Pulse Width Modulation M218 PTOPWM Library Guide PLCCommunication Library Guide

EIO0000000839 (eng), EIO0000000840 (chs) EIO0000000361 (eng), EIO0000000746 (chs)

You can download these technical publications and other technical information from our website at www.schneider-electric.com. Product Related Information

WARNING
LOSS OF CONTROL
z

z z z z

The designer of any control scheme must consider the potential failure modes of control paths and, for certain critical control functions, provide a means to achieve a safe state during and after a path failure. Examples of critical control functions are emergency stop and overtravel stop, power outage and restart. Separate or redundant control paths must be provided for critical control functions. System control paths may include communication links. Consideration must be given to the implications of unanticipated transmission delays or failures of the link. Observe all accident prevention regulations and local safety guidelines.1 Each implementation of this equipment must be individually and thoroughly tested for proper operation before being placed into service.

Failure to follow these instructions can result in death, serious injury, or equipment damage.
1 For additional information, refer to NEMA ICS 1.1 (latest edition), "Safety Guidelines for the Application, Installation, and Maintenance of Solid State Control" and to NEMA ICS 7.1 (latest edition), "Safety Standards for Construction and Guide for Selection, Installation and Operation of Adjustable-Speed Drive Systems" or their equivalent governing your particular location.

WARNING
UNINTENDED EQUIPMENT OPERATION
z z

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.

10

EIO0000000827 12/2012

User Comments We welcome your comments about this document. You can reach us by e-mail at techcomm@schneider-electric.com.

EIO0000000827 12/2012

11

12

EIO0000000827 12/2012

Modicon M218 Logic Controller About the Modicon M218 Logic Controller EIO0000000827 12/2012

About the Modicon M218 Logic Controller

Modicon M218 Logic Controller Devices Overview


Overview The Schneider Electric Modicon M218 Logic Controller has a variety of powerful features. This Controller can service a wide range of applications. The software configuration and programming is accomplished with the SoMachine software, and is described in the SoMachine Programming Guide (see page 9). Key Features Programming languages The Modicon M218 Logic Controller is supported and programmed with the SoMachine software, which supports the following IEC61131-3 programming languages: z IL: Instruction List z ST: Structured Text z FBD: Function Block Diagram z SFC: Sequential Function Chart z LD: Ladder Diagram SoMachine software can also be used to program these controllers using CFC (Continuous Function Chart ) language. Power Supply The power supply of the Modicon M218 Logic Controller is either: 24 Vdc or 100...240 Vac, depending on the controller model. Real Time Clock The Modicon M218 Logic Controller includes a Real Time Clock (RTC) system. Run/Stop Switch 1 Run/Stop switch is integrated on each controller to toggle its state.

EIO0000000827 12/2012

13

About the Modicon M218 Logic Controller

Memory The table below describes the different types of memory:


Memory type RAM Flash Size 1 Mbytes 1 Mbytes Used To execute the application. To save program and data in case of a power interruption.

Embedded Input/Output The following embedded I/O types are available, depending on the controller model: z Regular input z Fast input (HSC) z Regular output z Fast output (PTO/PWM/FG) z Analog input z Analog output Embedded Communication features 3 types of communication ports are available on the front panel, depending on the controller model (see page 14): z Ethernet Port (for TM218LDAE24DRHN and TM218LDAE40DRPHN) z USB Programming Port z 2 Serial Link Port For more details, refer to the chapter Integrated Communication Ports. Modicon M218 Logic Controller Range
Reference TM218LDA16DRN (see Modicon M218 Logic Controller, Hardware Guide) TM218LDA24DRN (see Modicon M218 Logic Controller, Hardware Guide) TM218LDA24DRHN (see Modicon M218 Logic Controller, Hardware Guide) Digital Input 7 regular inputs and 2 fast inputs (HSC)(1) 12 regular inputs and 2 fast inputs (HSC)(1) 10 regular inputs and 4 fast inputs (HSC) (2) 10 relay outputs No No 10 relay outputs No No Digital Output 7 relay outputs Analog Input No Analog Output No

(1) The reduced fast inputs have a maximum frequency of 10 kHz. They can be used either as regular inputs or as reduced fast inputs for counting. (2) The fast inputs can be used either as regular inputs or as fast inputs for counting or event functions. (3) The fast outputs can be used either as regular outputs or as fast outputs for PTO, PWM, Frequency Generator functions, or reflex output for HSC.

14

EIO0000000827 12/2012

About the Modicon M218 Logic Controller

Reference TM218LDD24DUPHN (see Modicon M218 Logic Controller, Hardware Guide) TM218LDAE24DRHN (see Modicon M218 Logic Controller, Hardware Guide) TM218LDA40DRN (see Modicon M218 Logic Controller, Hardware Guide) TM218LDA40DRPHN (see Modicon M218 Logic Controller, Hardware Guide) TM218LDD40DUPHNB (see Modicon M218 Logic Controller, Hardware Guide) TM218LDAE40DRPHN (see Modicon M218 Logic Controller, Hardware Guide) TM218LDA40DR2HN (see Modicon M218 Logic Controller, Hardware Guide) TM218LDA40DR4PHN (see Modicon M218 Logic Controller, Hardware Guide) TM218LDA60DRN (see Modicon M218 Logic Controller, Hardware Guide)

Digital Input 10 regular inputs and 4 fast inputs (HSC)(2) 10 regular inputs and 4 fast inputs (HSC)(2) 22 regular inputs and 2 fast inputs (HSC)(1) 20 regular inputs and

Digital Output 6 regular outputs and 4 fast outputs (PTO/PWM/FG)(3) 10 relay outputs

Analog Input No

Analog Output No

No

No

16 relay outputs

No

No

12 relay outputs and 4 No 4 fast inputs (HSC)(2) fast outputs (PTO/PWM/FG)(3) 20 regular inputs and 12 regular outputs, 4 fast inputs (HSC)(2) and 4 fast outputs (PTO/PWM/FG)(3) 20 regular inputs and No

No

No

12 relay outputs and 4 No 4 fast inputs (HSC)(2) fast outputs (PTO/PWM/FG)(3) 20 regular inputs and 4 fast inputs (HSC)(2) 20 regular inputs and 12 relay outputs and 4 2 analog inputs 4 fast inputs (HSC)(2) fast outputs (PTO/PWM/FG)(3) 34 regular inputs and 2 fast inputs (HSC)(1) 24 relay outputs No 16 relay outputs No

No

2 analog outputs

2 analog outputs

No

(1) The reduced fast inputs have a maximum frequency of 10 kHz. They can be used either as regular inputs or as reduced fast inputs for counting. (2) The fast inputs can be used either as regular inputs or as fast inputs for counting or event functions. (3) The fast outputs can be used either as regular outputs or as fast outputs for PTO, PWM, Frequency Generator functions, or reflex output for HSC.

EIO0000000827 12/2012

15

About the Modicon M218 Logic Controller

16

EIO0000000827 12/2012

Modicon M218 Logic Controller How to Configure the Controller EIO0000000827 12/2012

How to Configure the Controller

2
How to Configure the Controller
Introduction Before configuring the controller, you must first create a new project or open an existing project in the SoMachine software (see SoMachine, Programming Guide). Graphical Configuration Editor In the Graphical Configuration Editor (see SoMachine, Programming Guide), the controller is displayed as below:

EIO0000000827 12/2012

17

How to Configure the Controller

Click on the following element to add (if empty) or replace objects:


Element 1 2 3 4 5 Description Serial Line 1 port manager (SoMachine_Network_Manager by default) Ethernet port manager NOTE: Only available on TM218LDAE24DRHN and TM218LDAE40DRPHN. Expansion modules Serial Line 2 port manager (Modbus_Manager by default) Access to the controller configuration screen (double click the controller)

Controller Configuration Screen To access to the controller configuration screen, proceed as follow:
Step 1 2 Action Select the Configuration tab. Double-click the controller.

In the task selection pane, entries and sub-entries let you access the different configuration windows:

18

EIO0000000827 12/2012

How to Configure the Controller

Entry Parameters Embedded Functions

Sub-entry IO HSC PTO_PWM

Refer to... Controller Device Editor (see page 68) I/O Embedded Function configuration (see page 73) NOTE: PTO_PWM is available only on TM218LDA40DRPHN, TM218LDAE40DRPHN, TM218LDA40DR4PHN, TM218LDD24DUPHN and TM218LDD40DUPHNB Analog I/O Embedded Function configuration (see page 83) NOTE: Only available on TM218LDA40DR2HN and TM218LDA40DR4PHN Serial Line configuration (see page 91) Ethernet configuration (see page 115) NOTE: Only available on TM218LDAE24DRHN and TM218LDAE40DRPHN

Analog IO

Communication

Serial Line 1 Serial Line 2 Ethernet

Device Tree The controller functions of the Configuration tab are also accessible from the Program tab. There, the Devices tree describes the hardware configuration (for example, the following Devices tree is the default tree when the controller is added):

EIO0000000827 12/2012

19

How to Configure the Controller

Item PLC Logic

Description This part shows items related to the application: z Tasks configuration z Programming z Library manager z POUs z Relocation Table

Embedded Functions This representation shows the Embedded Functions of the M218. NOTE: PTO-PWM available only on TM218LDA40DRPHN, TM218LDAE40DRPHN, TM218LDA40DR4PHN, TM218LDD24DUPHN and TM218LDD40DUPHNB Analog IO available only on TM218LDA40DR2HN and TM218LDA40DR4PHN Serial Line 1 Serial Line 2 Ethernet These are the embedded communications. NOTE: Ethernet available only on TM218LDAE24DRHN and TM218LDAE40DRPHN

Content of Device Tree The device tree represents the objects managed by a specific target (controller or HMI). These objects are: z application objects (Tasks, etc.), z programming objects (POU, GVL, etc.), z hardware-related objects (Embedded functions, Expansion modules, etc.) By default, the device tree includes the following hardware-related objects:
Reference TM218LDA16DRN TM218LDA24DRN TM218LDA24DRHN TM218LDA40DRN TM218LDA40DR2HN TM218LDA60DRN TM218LDA40DRPHN TM218LDA40DR4PHN TM218LDD24DUPHN TM218LDD40DUPHNB TM218LDAE24DRHN TM218LDAE40DRPHN Embedded IO IO HSC Embedded communications Serial Line 1 (SoMachine_Network_Manager) Serial Line 2 (Modbus_Manager)

IO HSC PTO_PWM IO HSC IO HSC PTO_PWM Serial Line 1 (SoMachine_Network_Manager) Serial Line 2 (Modbus_Manager) Ethernet (Modbus TCP)

20

EIO0000000827 12/2012

Modicon M218 Logic Controller Libraries EIO0000000827 12/2012

Libraries

3
Libraries
Introduction Libraries provide functions, function blocks, data types and global variables that can be used to develop your project. The Library Manager of SoMachine provides information about the libraries included in your project and allows you to install new ones. For more information on the Library Manager, refer to the CoDeSys online help in SoMachine. Modicon M218 Logic Controller When you select a Modicon M218 Logic Controller for your application, SoMachine automatically loads the following libraries:
Library name IoStandard Description CmpIoMgr configuration types, ConfigAccess, Parameters and help functions: manages the I/Os in the application. Contains functions and function blocks which are required matching IEC61131-3 as standard POUs for an IEC programming system. The standard POUs must be tied to the project (standard.library). Analog Monitors, BCD Conversions, Bit/Byte Functions, Controller Datatypes, Function Manipulators, Mathematical Functions, Signals. Contains functions and variables to get information and send commands to the controller system.

Standard

Util

M218 PLCSystem (see Modicon M218 Logic Controller, System Functions and Variables, M218 PLCSystem Library Guide)

EIO0000000827 12/2012

21

Libraries

Library name

Description

Contains function blocks and variables to get M218 HSC (see Modicon M218 information and send commands to the Fast Logic Controller, High Speed Counting, M218 HSC Library Guide) Inputs/Outputs of the Modicon M218 Logic Controller. These function blocks permit you to implement HSC (High Speed Counting) functions on the Fast Inputs/Outputs of the Modicon M218 Logic Controller. M218 PTOPWM (see Modicon M218 Logic Controller, Pulse Train Output, Pulse Width Modulation, M218 PTOPWM Library Guide) Contains function blocks and variables to get information and send commands to the Fast Inputs/Outputs of the Modicon M218 Logic Controller. These function blocks permit you to implement PTO (Pulse Train Output) and PWM (Pulse With Modulation) functions on the Fast Outputs of the Modicon M218 Logic Controller. The relocation table allows the user to organize data to optimize exchanges between the Modbus client and the controller, by regrouping non-contiguous data into a contiguous table of registers. Contains a function block to send a command with stop signal management to the fast inputs/outputs of the Modicon M218 Logic Controller when a PTO is configured.

M218 Relocation Table (see page 30)

M218 Packaging (see Modicon M218 Logic Controller, Packaging Library, M218 Packaging Library Guide)

22

EIO0000000827 12/2012

Modicon M218 Logic Controller Supported Standard Data Types EIO0000000827 12/2012

Supported Standard Data Types

4
Supported Standard Data Types
Supported Standard Data Types The Controller supports the following IEC Data types:
Data type BOOL BYTE WORD DWORD LWORD SINT USINT INT UINT DINT UDINT LINT ULINT REAL STRING WSTRING TIME Lower limit False 0 0 0 0 -128 0 -32,768 0 -2,147,483,648 0 -2 0 1.175494351e-38 1 character 1 character 63

Upper limit True 255 65,535 4,294,967,295 2


64-1

Information content 1 Bit 8 Bit 16 Bit 32 Bit 64 Bit 8 Bit 8 Bit 16 Bit 16 Bit 32 Bit 32 Bit 64 Bit 64 Bit 32 Bit 1 character = 1 byte 1 character = 1 word 16 bit

127 255 32,767 65,535 2,147,483,647 4,294,967,295 2 -1 264-1 3.402823466e+38 255 characters 255 characters 63

For more information on ARRAY, LTIME, DATE, TIME, DATE_AND_TIME, and TIME_OF_DAY, refer to the CoDeSys online help in SoMachine.

EIO0000000827 12/2012

23

Supported Standard Data Types

Unsupported Standard Data Types The Controller does not support the following IEC Data types:
Data type LREAL Lower limit Upper limit Information content

2.2250738585072014e-308 1.7976931348623158e+308 64 Bit

24

EIO0000000827 12/2012

Modicon M218 Logic Controller Memory Mapping EIO0000000827 12/2012

Memory Mapping

5
Introduction This chapter describes the memory maps and sizes of the different memory areas in the Modicon M218 Logic Controller. These memory areas are used to store user program logic, data and the programming libraries. What Is in This Chapter? This chapter contains the following topics:
Topic Memory Organization Relocation Table Page 26 30

EIO0000000827 12/2012

25

Memory Mapping

Memory Organization
Introduction This section describes the RAM (Random Access Memory) size for different areas of the Modicon M218 Logic Controller. Memory Mapping The RAM size is 2 Mbytes composed of 2 areas: 1024 kbytes System Area for Operating System memory z 1024 kbytes Customer Area for dedicated application and configuration data.
z

Memory containing Persistent and Retain variables is preserved and protected. The Persistent and Retain variables will be retained during power outages or when the controller is powered off.

26

EIO0000000827 12/2012

Memory Mapping

This table shows the different types of memory areas with their sizes in the Modicon M218 Logic Controller memory:
Area System Area 1024 kbytes Element System Area Mappable Addresses %MW0...%MW59999 System and Diagnostic variables (%MW60000...%MW60199) This memory is accessible through ModBus requests only. These must be read-only requests. Dynamic Memory Area: Read Relocation Table (see page 30) (%MW60200...%MW61999) This memory is accessible through ModBus requests only. These must be read-only requests. Reserved Memory Area (%MW62000...%MW62199) This memory is accessible through ModBus requests only. These must be read-only requests. Dynamic Memory Area: Write Relocation Table (see page 30) (%MW62200...%MW63999) This memory is accessible through ModBus requests only. These can be read or write requests. Reserved Customer Area 1024 kbytes 920576 Size (bytes) 120000 400

7600

Variables (including Retain and Persistent variables, 838860(1) see table below) Application Libraries (see page 28) Symbols 209716(1)

The memory size for variables, applications, libraries, and symbols are customized depending on the usage. It is recommended that variables, applications, and libraries take up to 80% of customer area, and symbols take 20% of the customer area.

(1)

EIO0000000827 12/2012

27

Memory Mapping

1888 bytes Retention RAM 744 bytes 144 bytes 1000 bytes
(2)

Retain Variables (2) Persistent Variables %MW0...%MW499

Not all the 744 bytes are available for the customer application because some libraries may use Retain Variables.

The following table describes the retain data memory mapping for TM218LDD40DUPHNB:
8000 bytes Retention RAM 3000 bytes 1000 bytes 4000 bytes
(2)

Retain Variables (2) Persistent Variables %MW0...%MW1999

Not all the 3000 bytes are available for the customer application because some libraries may use Retain Variables.

System Variables For more information on System Variables, refer to the M218 PLCSystem Library Guide. Library Sizes
Library Name M218 HSC (see Modicon M218 Logic Controller, High Speed Counting, M218 HSC Library Guide) Average Size 10 kbytes Comment Depends on the functions used.

25 kbytes M218 PLCSystem (see Modicon M218 Logic Controller, System Functions and Variables, M218 PLCSystem Library Guide)

Always embedded in the application. The use of the functions does not consume additional memory.

28

EIO0000000827 12/2012

Memory Mapping

Library Name M218 PTOPWM (see Modicon M218 Logic Controller, Pulse Train Output, Pulse Width Modulation, M218 PTOPWM Library Guide) PLC Communication M218 Packaging

Average Size 10 kbytes

Comment Depends on the functions used.

20 kbytes 10 kbytes

Depends on the functions used. Depends on the functions used.

EIO0000000827 12/2012

29

Memory Mapping

Relocation Table
Introduction The Relocation Table allows you to organize data to optimize communication between the controller and other equipment by regrouping non-contiguous data into a contiguous table of registers. NOTE: A Relocation Table is considered as an object. Only one Relocation Table object can be added to a controller. Relocation Table Description This table describes the Relocation Table organization:
Register 60200...61999 62200...63999 Description Dynamic Memory Area: Read Relocation Table Dynamic Memory Area: Write Relocation Table

For further information refer to M218 PLCSystem Library Guide. Adding a Relocation Table The following table describes how to add a Relocation Table to your project:
Step 1 Action Select the Program tab:

2 3

In the Device tree of the Devices window, right click the Application node to display the contextual menu and select Add Object... sub-menu. Select Relocation Table... in the list and click the Open button of the Add Relocation Table editor Result: The new Relocation Table is created and initialized. NOTE: As a Relocation Table must be unique for a controller, its name is Relocation Table and cannot be changed.

30

EIO0000000827 12/2012

Memory Mapping

Relocation Table Editor The Relocation Table Editor allows you to organize your variables under the Relocation Table. To access the Relocation Table Editor, double-click the Relocation Table node in the Device tree of the Devices window:

The following picture describes the Relocation Table Editor:

EIO0000000827 12/2012

31

Memory Mapping

Icon

Element New Item Move Down Move Up Delete Item Copy Paste Erase Empty Item

Description Adds an element to the list of system variables. Moves down the selected element of the list. Moves up the selected element of the list. Removes the selected elements of the list. Copies the selected elements of the list. Pastes the elements copied. Removes all the elements of the list for which the "Variable" column is empty. Automatic incremental integer (not editable) The name or the full path of a variable (editable) The address of the system area where the variable is stored (not editable). Variable length in word Indicates if the entered variable is valid (not editable).

ID Variable Address Length Validity

NOTE: If a variable is undefined after program modifications, the content of the cell is displayed in red, the related Validity cell is False, and Address is set to -1.

32

EIO0000000827 12/2012

Modicon M218 Logic Controller Tasks EIO0000000827 12/2012

Tasks

6
Introduction The Task Configuration node in the SoMachine device tree allows you to define one or several tasks to control the execution of your application program. The task types available are: z Cyclic z Freewheeling z Event z External Event This chapter begins with an explanation of these task types and provides information regarding the maximum number of tasks, the default task configuration, and task prioritization. In addition, this chapter introduces the system and task watchdog functions and explains their relationship to task execution. What Is in This Chapter? This chapter contains the following topics:
Topic Maximum Number of Tasks Task Configuration Screen Task Types System and Task Watchdogs Task Priorities Default Task Configuration Page 34 35 38 41 42 44

EIO0000000827 12/2012

33

Tasks

Maximum Number of Tasks


Maximum Number of Tasks The maximum number of tasks you can define for the Modicon M218 Logic Controller are: z Total number of tasks = 7 z Cyclic tasks = 3 z Freewheeling tasks = 1 z Event tasks = 2 z External Event tasks = 4 NOTE: The total number of Freewheeling task, Cyclic tasks and Event tasks must not be greater than 3. Special Considerations for Freewheeling A Freewheeling task (see page 39) does not have a fixed duration. In Freewheeling mode, each task scan starts when the previous scan has been completed and after a period of system processing (30% of the total duration of the Freewheeling task). If the system processing period is reduced to less than 15% for more than 3 seconds due to other tasks interruptions, a system error is detected. For more information refer to the System Watchdog (see page 41). NOTE: It is recommended not to use a Freewheeling task in a multi-tasks application when some high priority and time-consuming tasks are running.

34

EIO0000000827 12/2012

Tasks

Task Configuration Screen


Access to Task Configuration Follow these steps to access the Task Configuration:
Step 1 Action Click the Program menu:

Double-click the task that you want to configure in the device tree of the Devices window:

NOTE: For more information on adding a task, refer to the SoMachine online help tutorials.

EIO0000000827 12/2012

35

Tasks

Task Configuration Screen Each task configuration has its own parameters which are independent of the other tasks. The task Configuration window is composed of 4 parts:

36

EIO0000000827 12/2012

Tasks

The following table describes the fields of the task Configuration screen:
Field Name Priority Definition You can configure the priority of each task with a number between 0 and 31 (0 is the highest priority, 31 is the lowest). Only 1 task at a time can be running. The priority determines when the task will run: z a higher priority task will preempt a lower priority task z tasks with same priority will run in turn (2 ms time-slice) NOTE: Do not assign tasks with the same priority. For important safety information, refer to Task Priorities (see page 42). Type 4 types of task are available: z Cyclic (see page 38) z Freewheeling (see page 39) z Event (see page 39) z External event (see page 40) To configure the watchdog, you must define two parameters:
z Time: enter the timeout before watchdog execution. z Sensitivity: defines the number of expirations of the watchdog timer before the

Watchdog (see page 41)

Controller stops program execution and enters into a HALT state (see page 50). POUs (see SoMachine, Programming Guide) The list of POUs (Programming Organization Unit) controlled by the task is defined in the task Configuration window:

z z z z

To add a POU linked to the task, use the command Add POU. To remove a POU from the list, use the command Remove POU. The command Open POU opens the currently selected POU in the appropriate editor. To replace the currently selected POU of the list by another one, use the command Change POU... z POUs are executed in the order they appear in the task Configuration window. To rearrange POUs in the list, select a POU and click Move Up or Move Down Clicking any of the POU commands will open the Input Assistant window. NOTE: You can create as many POUs as you want. An application with several small POUs, as opposed to one large POU improves the refresh time of the variables in online mode.

EIO0000000827 12/2012

37

Tasks

Task Types
Introduction The following section describes the various task types available for your program, along with a description of the task type characteristics. Cyclic Task A Cyclic task is assigned a fixed cycle time using the Interval setting in the Type section of Configuration sub-tab for that task. Each Cyclic task type executes as follows:

1. Read Inputs: The physical input states are written to the %I input memory variables and other system operations are executed. 2. Task Processing: The user code (POU, etc.) defined in the task is processed. The %Q output memory variables are updated according to your application program instructions but not yet written to the physical outputs during this operation. 3. Write Outputs: The %Q output memory variables are modified with any output forcing that has been defined; however, the writing of the physical outputs depends upon the type of output and instructions used. For more information on defining the Bus cycle task, refer to the CoDeSys online help in SoMachine and Modicon M218 Logic Controller Settings (see page 70). For more information on I/O behavior, refer to Controller States Detailed Description (see page 50). NOTE: Expansion I/Os are always physically updated by the MAST task. 4. Remaining Interval time: The controller firmware carries out system processing and any other lower priority tasks. NOTE: If you define too short a period for a cyclic task, it will repeat immediately after the write of the outputs and without executing other lower priority tasks or any system processing. This will affect the execution of all tasks and cause the controller to exceed the system watchdog limits, generating a system watchdog exception. NOTE: You can get and set the interval of a Cyclic Task by application using the GetCurrentTaskCycle and SetCurrentTaskCycle function. (Refer to Toolbox Advance Library Guide for further details.)
38

EIO0000000827 12/2012

Tasks

Freewheeling Task A Freewheeling task does not have a fixed duration. In Freewheeling mode, each task scan begins when the previous scan has been completed and after a short period of system processing. Each Freewheeling task type executes as follows:

1. Read Inputs: The physical input states are written to the %I input memory variables and other system operations are executed. 2. Task Processing: The user code (POU, etc.) defined in the task is processed. The %Q output memory variables are updated according to your application program instructions but not yet written to the physical outputs during this operation. 3. Write Outputs: The %Q output memory variables are modified with any output forcing that has been defined; however, the writing of the physical outputs depends upon the type of output and instructions used. For more information on defining the Bus cycle task, refer to the CoDeSys online help in SoMachine and Modicon M218 Logic Controller Settings (see page 70). For more information on I/O behavior, refer to Controller States Detailed Description (see page 50). 4. System Processing: The controller firmware carries out system processing and any other lower priority tasks (for example: http management, ethernet management, parameters management). Event Task This type of task is event-driven and is initiated by a program variable. It starts at the rising edge of the boolean variable associated to the trigger event unless preempted by a higher priority task. In that case, the Event task will start as dictated by the task priority assignments. For example, if you have defined a variable called my_Var and would like to assign it to an Event, select the Event type on the Configuration sub-tab and click on the Input Assistant button to the right of the Event name field. This will cause the Input Assistant dialog box to appear. In the Input Assistant dialog box, you navigate the tree to find and assign the my_Var variable.

EIO0000000827 12/2012

39

Tasks

External Event Task This type of task is event-driven and is initiated by the detection of a hardware or hardware-related function event. It starts when the event occurs unless preempted by a higher priority task. In that case, the External Event task will start as dictated by the task priority assignments. For example, an External Event task could be associated with an HSC Threshold cross event. To associate the HSC2_TH1 event to an External Event task, select it from the External event dropdown list on the Configuration sub-tab. Depending on the related product, there are up to 2 types of events that can be associated with an External Event task: z Rising edge on Fast input (%IX0.0 ... %IX0.3 inputs) z HSC thresholds

40

EIO0000000827 12/2012

Tasks

System and Task Watchdogs


Introduction Two types of watchdog functionality are implemented for the Modicon M218 Logic Controller:
z z

System Watchdogs: These watchdogs are defined in and managed by the controller firmware. These are not configurable by the user. Task Watchdogs: Optional watchdogs that can be defined for each task. These are managed by your application program and are configurable in SoMachine.

System Watchdogs Two system watchdogs are defined for the Modicon M218 Logic Controller. They are managed by the controller firmware and are therefore sometimes referred to as hardware watchdogs in the SoMachine online help. When one of the system watchdogs exceeds its threshold conditions, an error is detected. The threshold conditions for the 2 system watchdogs are defined as follows: If all of the tasks require more than 80% of the processor resources for more than 3 seconds, a system error is detected. The controller enters the HALT state. z If the lowest priority task of the system is not executed during an interval of 20 seconds, a system error is detected. The controller responds with an automatic reboot into the EMPTY state.
z

NOTE: System watchdogs are not configurable by the user. Task Watchdogs SoMachine allows you to configure an optional task watchdog for every task defined in your application program. (Task watchdogs are sometimes also referred to as software watchdogs or control timers in the SoMachine online help). When one of your defined task watchdogs reaches its threshold condition, an application error is detected and the controller enters the HALT state. When defining a task watchdog, the following options are available: z Time: This defines the allowable maximum execution time for a task. When a task takes longer than this the controller will report a task watchdog exception. z Sensitivity: The sensitivity field defines the number of task watchdog exceptions that must occur before the controller detects an application error. A task watchdog is configured on the Configuration sub-tab of the Task Configuration tab for the individual task. To access this tab, double-click the task in the device tree. NOTE: For more information on watchdogs, refer to the CoDeSys online help in SoMachine.

EIO0000000827 12/2012

41

Tasks

Task Priorities
Introduction You can configure the priority of each task between 0 and 31 (0 is the highest priority, 31 is the lowest). Each task must have a unique priority. If you assign the same priority to more than one task, execution for those tasks is indeterminate and unpredictable, which may lead to unintended consequences.

WARNING
UNINTENDED EQUIPMENT OPERATION Do not assign the same priority to different tasks. Failure to follow these instructions can result in death, serious injury, or equipment damage.

42

EIO0000000827 12/2012

Tasks

Task Preemption Due to Task Priorities When a task cycle starts, it can interrupt any task with lower priority (task preemption). The interrupted task will resume when the higher priority task cycle is finished.

NOTE: If the same input is used in different tasks the input image may change during the task cycle of the lower priority task. To improve the likelihood of proper output behavior during multitasking, an error is detected if outputs in the same byte are used in different tasks.

WARNING
UNINTENDED EQUIPMENT OPERATION Map your inputs so that tasks do not alter the input images in an unexpected manner. Failure to follow these instructions can result in death, serious injury, or equipment damage.

EIO0000000827 12/2012

43

Tasks

Default Task Configuration


Default Task Configuration
z

For the Modicon M218 Logic Controller: The MAST task can be configured in Freewheeling or Cyclic mode. The MAST task is automatically created by default in Cyclic mode. Its preset priority is medium (15), its preset interval is 20 ms, and its task watchdog service is activated with a time of 100 ms and a sensitivity of 1. Refer to Task Priorities (see page 42) for more information on priority settings. Refer to System and Task Watchdogs (see page 41) for more information on watchdogs.

Designing an efficient application program is important in systems approaching the maximum number of tasks. In such an application, it can be difficult to keep the resource utilization below the system watchdog threshold. If priority reassignments alone are not sufficient to remain below the threshold, some lower priority tasks can be made to use fewer system resources if the SysTaskWaitSleep function is added to those tasks. For more information about this function, see the optional SysTask library of the system / SysLibs category of libraries. NOTE: Do not delete or change the Name of the MAST task. If you do so, SoMachine detects an error when you attempt to build the application, and you will not be able to download it to the controller.

44

EIO0000000827 12/2012

Modicon M218 Logic Controller Controller States and Behaviors EIO0000000827 12/2012

Controller States and Behaviors

7
Introduction This chapter 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 Remanent variables and the effect of SoMachine task programming options on the behavior of your system. What Is in This Chapter? This chapter contains the following sections:
Section 7.1 7.2 7.3 Controller State Diagram Controller States Description State Transitions and System Events Topic Page 46 50 54

EIO0000000827 12/2012

45

Controller States and Behaviors

7.1

Controller State Diagram

Controller State Diagram


Controller State Diagram The following diagram describes the controller operating mode:

Legend: Controller states are indicated in ALL-CAPS BOLD z User and application commands are indicated in Bold
z

46

EIO0000000827 12/2012

Controller States and Behaviors


z z

System events are indicated in Italics Decisions, decision results and general information are indicated in normal text

(1)

For details on STOPPED to RUNNING state transition, refer to Run Command (see page 58).

For details on RUNNING to STOPPED state transition, refer to Stop Command (see page 59). Note 1 The Power Cycle (Power Interruption followed by a Power ON) deletes all output forcing settings. Refer to Controller State and Output Behavior (see page 55) for further details. Note 2 The boot process can take up to 10 seconds under normal conditions. The outputs will assume their initialization states. Note 3 In some cases, when a system error is detected, it will cause the controller to automatically reboot into the EMPTY state as if no Boot application were present in the Flash memory. However, the Boot application is not actually deleted from the Flash memory. Note 4 The application is loaded into RAM after verification of a valid Boot application. During the load of the boot application, a Check context test occurs to assure that the Remanent variables are valid. If the Check context test is invalid, the boot application will load but the controller will assume STOPPED state (see page 62). Note 5 During a successful application download the following events occur: The application is loaded directly into RAM. z By default, the Boot application is created and saved into the Flash memory.
z

(2)

Note 6 The default behavior after downloading an application program is for the controller to enter the STOPPED state irrespective of the Run/Stop input setting or the last controller state before the download.

EIO0000000827 12/2012

47

Controller States and Behaviors

However, there are two important considerations in this regard: Online Change: An online change (partial download) initiated while the controller is in the RUNNING state returns the controller to the RUNNING state if successful and provided the Run/Stop input is configured and set to Run. Before using the Login with online change option, test the changes to your application program in a virtual or non-production environment and confirm that the controller and attached equipment assume their expected conditions in the RUNNING state.

WARNING
UNINTENDED EQUIPMENT OPERATION Always verify that online changes to a RUNNING application program operate as expected before downloading them to controllers. Failure to follow these instructions can result in death, serious injury, or equipment damage. NOTE: Online changes to your program are not automatically written to the Boot application, and will be overwritten by the existing Boot application at the next reboot. If you wish your changes to persist through a reboot, manually update the Boot application by selecting Create boot application in the Online menu (the controller must be in the STOPPED state to achieve this operation). Multiple Download: SoMachine has a feature that allows you to perform a full application download to multiple targets on your network or fieldbus. One of the default options when you select the Multiple Download... command is the Start all applications after download or online change option, which restarts all download targets in the RUNNING state, provided their respective Run/Stop inputs are commanding the RUNNING state, but irrespective of their last controller state before the multiple download was initiated. Deselect this option if you do not want all targeted controllers to restart in the RUNNING state. In addition, before using the Multiple Download option, test the changes to your application program in a virtual or non-production environment and confirm that the targeted controllers and attached equipment assume their expected conditions in the RUNNING state.

WARNING
UNINTENDED EQUIPMENT OPERATION Always verify that your application program will operate as expected for all targeted controllers and equipment before issuing the "Multiple Download" command with the "Start all applications after download or online change" option selected. Failure to follow these instructions can result in death, serious injury, or equipment damage.
48
EIO0000000827 12/2012

Controller States and Behaviors

NOTE: During a multiple download, unlike a normal download, SoMachine does not offer the option to create a Boot application. You can manually create a Boot application at any time by selecting Create boot application in the Online menu on all targeted controllers (the controller must be in the STOPPED state for this operation). Note 7 The SoMachine software platform allows many powerful options for managing task execution and output conditions while the controller is in the STOPPED or HALT states. Refer to Controller States Description (see page 50) for further details. Note 8 To exit the HALT state it is necessary to issue one of the Reset commands (Reset Warm, Reset Cold, Reset Origin), download an application or cycle power. In case of non recoverable event (hardware watchdog or internal error), a cycle power is mandatory. Note 9 The RUNNING state has two exception conditions. They are: z RUNNING with External Error: this exception condition is indicated by the MS Status LED , which displays solid green with 1 red flash . You may exit this state by clearing the external error. No controller commands are required. z RUNNING with Breakpoint: this exception condition is indicated by the MS Status LED , which displays 3 green flashes. Refer to Controller States Description (see page 50) for further details. Note 10 The controller has a Run/Stop Switch to toggle the PLC state from RUN to STOP or from STOP to RUN. If the switch is set to Stop, the controller will be stopped irrespective of the Run/Stop input setting.

EIO0000000827 12/2012

49

Controller States and Behaviors

7.2

Controller States Description

Controller States Description


Introduction This section provides a detailed description of the controller states.

WARNING
UNINTENDED EQUIPMENT OPERATION
z

z z

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.(1)

Failure to follow these instructions can result in death, serious injury, or equipment damage.
(1)

The controller states can be read in the PLC_R.i_wStatus system variable of the M218 PLCSystem library (see Modicon M218 Logic Controller, System Functions and Variables, M218 PLCSystem Library Guide)

Controller States Table The following table describes the controller states:
Controller State BOOTING Description The controller executes the boot firmware and its own internal self-tests. It then checks the checksum of the firmware and user applications. It does not execute the application nor does it communicate. This state is the same as the normal BOOTING state except that a flag is set to make it appear as if no Boot application is present and the LED indications are different. RUN/MS LED Flashing green/red

BOOTING after detection of a System Error 50

Rapid flashing red

EIO0000000827 12/2012

Controller States and Behaviors

Controller State INVALID_OS

Description

RUN/MS LED

Flashing red There is not a valid firmware file present In the Flash memory. The controller does not execute the application. Communication is only possible through the USB host port, and then only for uploading a valid OS. Refer to Updating an M218 Controller Firmware (see page 153). There is no or an invalid application. This state is the same as the normal EMPTY state except that a flag is set to make it appear as if no Boot Application is present (no Application is loaded) and the LED indications are different. The controller is executing a valid application. Single flash green Rapid flashing red

EMPTY EMPTY after detection of a System Error RUNNING

Green

RUNNING with This state is the same as the RUNNING state with 3 flash green Breakpoint the following exceptions: z The task-processing portion of the program does not resume until the breakpoint is cleared. z The LED indications are different. For more information on breakpoint management, refer to the CoDeSys online help in SoMachine. RUNNING with This state is the same as the normal RUNNING detection of an state except the LED indications are different. External Error STOPPED Green / single flash red

Flashing green The controller has a valid application that is stopped. See Details of the STOPPED State (see page 52) for an explanation of the behavior of outputs and field buses in this state. This state is the same as the normal STOPPED state except the LED indications are different. Flashing green / single flash red

STOPPED with detection of an External Error HALT

The controller stops executing the application because it has detected an Application Error. This description is the same as for the STOPPED state with the following exceptions: z The task responsible for the Application Error always behaves as if the Update IO while in stop option was not selected. All other tasks follow the actual setting. z The LED indications are different

Rapid flashing red

EIO0000000827 12/2012

51

Controller States and Behaviors

Details of the STOPPED State The following statements are true for the STOPPED state: The input configured as the Run/Stop input remains operational. z All outputs initially assume their configured state (Keep current values or Set all outputs to default) or the state dictated by output forcing if used. The subsequent state of the outputs depends on the value of the Update IO while in stop setting and on commands received from remote devices.
z

Task and I/O Behavior When Update IO While In Stop Is Selected When the Update IO while in stop setting is selected: z The Read Inputs operation continues normally. The physical inputs are read and then written to the %I input memory variables. z The Task Processing operation is not executed. z The Write Outputs operation continues. The %Q output memory variables are updated to reflect either the Keep current values configuration or the Set all outputs to default configuration, adjusted for any output forcing, and then written to the physical outputs. NOTE: if Q0, Q1, Q2 or Q3 outputs are configured for PTO, PWM, FG, or HSC operation, they fallback to a value of 0 irrespective of the configured fallback setting. For PTO operation, outputs Q0, Q1, Q2, and Q3 execute a fast stop deceleration. Outputs configured for PWM, FG, and HSC go immediately to 0.

WARNING
UNINTENDED EQUIPMENT OPERATION Design and program your system so that controlled equipment assumes a safe state when the controller enters fallback mode if you use outputs Q0, Q1, Q2, or Q3 for PTO, PWM, FG, or HSC operation. Failure to follow these instructions can result in death, serious injury, or equipment damage. NOTE: Commands received by Serial, USB, and Ethernet communications can continue to write to the memory variables. Changes to the %Q output memory variables are written to the physical outputs.

52

EIO0000000827 12/2012

Controller States and Behaviors

Task and I/O Behavior When Update IO While In Stop Is Not Selected When the Update IO while in stop setting is not selected, the controller sets the I/O to either the Keep current values or Set all outputs to default condition (as adjusted for output forcing if used). After this, the following becomes true: z The Read Inputs operation ceases. The %I input memory variablea are frozen at their last values. z The Task Processing operation is not executed. z The Write Outputs operation ceases. The %Q output memory variables can be updated via the Ethernet, Serial, and USB connections. However, the physical outputs are unaffected and retain the state specified by the configuration options. NOTE: if Q0, Q1, Q2 or Q3 outputs are configured for PTO, PWM, FG, or HSC operation, they fallback to a value of 0 irrespective of the configured fallback setting. For PTO operation, outputs Q0, Q1, Q2, and Q3 execute a fast stop deceleration. Outputs configured for PWM, FG, and HSC go immediately to 0.

WARNING
UNINTENDED EQUIPMENT OPERATION Design and program your system so that controlled equipment assumes a safe state when the controller enters fallback mode if you use outputs Q0, Q1, Q2, or Q3 for PTO, PWM, FG, or HSC operation. Failure to follow these instructions can result in death, serious injury, or equipment damage.

EIO0000000827 12/2012

53

Controller States and Behaviors

7.3

State Transitions and System Events

Overview This section begins with an explanation of the output states possible for the controller. It then presents the system commands used to transition between controller states and the system events that can also affect these states. It concludes with an explanation of the Remanent variables, and the circumstances under which different variables and data types are retained through state transitions. What Is in This Section? This section contains the following topics:
Topic Controller States and Output Behavior Commanding State Transitions Error Detection, Types, and Management Remanent Variables Page 55 58 64 66

54

EIO0000000827 12/2012

Controller States and Behaviors

Controller States and Output Behavior


Introduction The Modicon M218 Logic 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. For example, typical controllers define only two options for output behavior in stop: fallback to default value or keep current value. The possible output behaviors and the controller states to which they apply are: z Managed by Application Program z Keep Current Values z Set All Outputs to Default z Initialization Values z Output Forcing Managed by Application Program Your application program manages outputs normally. This applies in the RUNNING and RUNNING with External Error states. Keep Current Values You can select this option by choosing Keep current values in the Behaviour for outputs in Stop dropdown menu of the PLC settings sub-tab of the Controller Editor. To access the Controller Editor, right-click on the controller in the device tree and select Edit Object. You can also double click on MyController (or the name given by the user to the controller) in the device tree to access the Controller Editor. This output behavior applies in the STOPPED and HALT controller states. Outputs are set to and maintained in their current state, although the details of the output behavior varies greatly depending on the setting of the Update IO while in stop option and the actions commanded via configured fieldbuses. Refer to Controller States Description (see page 50) for more details on these variations.

EIO0000000827 12/2012

55

Controller States and Behaviors

Set All Outputs to Default You can select this option by choosing Set all outputs to default in the Behaviour for outputs in Stop dropdown menu of the PLC settings sub-tab of the Controller Editor. To access the Controller Editor, right-click on the controller in the device tree and select Edit Object. This output behavior applies in the STOPPED and HALT controller states. Outputs are set to and maintained in their current state, although the details of the output behavior varies greatly depending on the setting of the Update IO while in stop option and the actions commanded via configured fieldbuses. Refer to Controller States Description (see page 50) for more details on these variations. Initialization Values This output state applies in the BOOTING, EMPTY (following power cycle with no boot application or after the detection of a system error), and INVALID_OS states. In the initialization state, analog, transistor and relay outputs assume the following values: z For an analog output : Z (High Impedance) z For a fast transistor output: Z (High Impedance) z For a regular transistor output: 0 Vdc z For a relay output: Open 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 are only able to force the value of an output while your controller is connected to SoMachine. To do so you use the Force Values command in the Debug/Watch menu. Output forcing overrides all other commands to an output irrespective of the task programming that is being executed. When you logout of SoMachine when output forcing has been defined, you are presented with the option to retain output forcing settings. If you select this option, the output forcing continues to control the state of the selected outputs until you download an application or use one of the Reset commands. When the option Update IO while in stop, if supported by your controller, is checked (default state), the forced outputs keep the forcing value even when the logic controller is in STOP.

56

EIO0000000827 12/2012

Controller States and Behaviors

Output Forcing Considerations The output you wish to force must be contained in a task that is currently being executed by the controller. Forcing outputs in unexecuted tasks, or in tasks whose execution is delayed either by priorities or events will have no effect on the output. However, once the task that had been delayed is executed, the forcing will take effect at that time. Depending on task execution, the forcing could impact your application in ways that may not be obvious to you. For example, an event task could turn on an output. Later, you may attempt to turn off that output but the event is not being triggered at the time. This would have the effect of the forcing apparently being ignored. Further, at a later time, the event could trigger the task at which point the forcing would take effect.

WARNING
UNINTENDED EQUIPMENT OPERATION
z z

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 containted 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 without removing the forcing.

Failure to follow these instructions can result in death, serious injury, or equipment damage.

EIO0000000827 12/2012

57

Controller States and Behaviors

Commanding State Transitions


Run Command Effect: Commands a transition to the RUNNING controller state. Starting Conditions: BOOTING or STOPPED state. Methods for Issuing a Run Command: Run/Stop Input: If configured, command a rising edge to the Run/Stop input (assuming the Run/Stop switch is in the RUN position). The Run/Stop input must be 1 for all of the subsequent options to be effective. Refer to Run/Stop Input (see page 77) for more information. z Run/Stop Switch: manually set the switch to RUN (given the Run/Stop input is set to 1 if it is configured). z With SoMachine software (with the Run/Stop Input set to 1 and the Run/Stop switch set to the RUN position): z Click on the menu Online Start z Click on the start icon which is symbolized by an arrow in the icon bar
z z

By an external call via Modbus request using the PLC_W.q_wPLCControl and PLC_W.q_uiOpenPLCControl system variables of the M218 PLCSystem Library (see Modicon M218 Logic Controller, System Functions and Variables, M218 PLCSystem Library Guide). Login with online change option: An online change (partial download) initiated while the controller is in the RUNNING state returns the controller to the RUNNING state if successful. The controller is restarted into the RUNNING state automatically under certain conditions.

Refer to Controller State Diagram (see page 46) for further details.

58

EIO0000000827 12/2012

Controller States and Behaviors

Stop Command Effect: Commands a transition to the STOPPED controller state. Starting Conditions: BOOTING, EMPTY or RUNNING state. Methods for Issuing a Stop Command: Run/Stop Input: If configured, command a value of 0 to the Run/Stop input. Refer to Run/Stop Input (see page 77) for more information. z Run/Stop Switch: manually set the switch to STOP. z With SoMachine software: z Click on the menu Online Stop z Click on the stop icon which is symbolized by an square in the icon bar
z z

z z

By an internal call by the application or an external call via Modbus request using the PLC_W. q_wPLCControl and PLC_W. q_uiOpenPLCControl system variables of the M218 PLCSystem Library (see Modicon M218 Logic Controller, System Functions and Variables, M218 PLCSystem Library Guide). Login with online change option: An online change (partial download) initiated while the controller is in the STOPPED state returns the controller to the STOPPED state if successful. Download Command: implicitly sets the controller into the STOPPED state. The controller is restarted into the STOPPED state automatically under certain conditions.

Refer to Controller State Diagram (see page 46) for further details. Reset Warm Effect: Resets all variables, except for the remanent variables, to their default values. Places the controller into the STOPPED state. Starting Conditions: RUNNING, STOPPED, or HALT states. Methods for Issuing a Reset Warm Command: SoMachine Online Menu: Select the Reset warm command. z By an internal call by the application or an external call via Modbus request using the PLC_W. q_wPLCControl and PLC_W. q_uiOpenPLCControl system variables of the M218 PLCSystem Library (see Modicon M218 Logic Controller, System Functions and Variables, M218 PLCSystem Library Guide).
z

EIO0000000827 12/2012

59

Controller States and Behaviors

Effects of the Reset Warm Command: 1. The application stops. 2. Forcing is erased. 3. Diagnostic indications for detected errors are reset. 4. The values of the retain variables are maintained. 5. The values of the retain-persistent variables are maintained. 6. All non-located and non-remanent variables are reset to their initialization values. 7. The values of the first 500 %MW registers are maintained. 8. The values of %MW500 to %MW59999 registers are reset to 0. 9. All fieldbus communications are stopped and then restarted after the reset is complete. 10.All I/O are briefly reset to their initialization values and then to their userconfigured default values. For details on variables, refer to Remanent Variables (see page 66). Reset Cold Effect: Resets all variables, except for the retain-persistent type of remanent variables, to their initialization values. Places the controller into the STOPPED state. Starting Conditions: RUNNING, STOPPED, or HALT states. Methods for Issuing a Reset Cold Command: SoMachine Online Menu: Select the Reset cold command. z By an internal call by the application or an external call via Modbus request using the PLC_W. q_wPLCControl and PLC_W. q_uiOpenPLCControl system variables of the M218 PLCSystem Library (see Modicon M218 Logic Controller, System Functions and Variables, M218 PLCSystem Library Guide).
z

Effects of the Reset Cold Command: 1. The application stops. 2. Forcing is erased. 3. Diagnostic indications for detected errors are reset. 4. The values of the retain variables are reset to their initialization value. 5. The values of the retain-persistent variables are maintained. 6. All non-located and non-remanent variables are reset to their initialization values. 7. The values of the first 500 %MW registers are maintained. 8. The values of %MW500 to %MW59999 registers are reset to 0. 9. All fieldbus communications are stopped and then restarted after the reset is complete. 10.All I/O are briefly reset to their initialization values and then to their userconfigured default values. For details on variables, refer to Remanent Variables (see page 66).

60

EIO0000000827 12/2012

Controller States and Behaviors

Reset Origin Effect: Resets all variables, including the remanent variables, to their initialization values. Erases all user files on the controller. Places the controller into the EMPTY state. Starting Conditions: RUNNING, STOPPED, or HALT states.
z

Methods for Issuing a Reset Origin Command: SoMachine Online Menu: Select the Reset origin command.

Effects of the Reset Origin Command: 1. The application stops. 2. Forcing is erased. 3. The Boot application file is erased. 4. Diagnostic indications for detected errors are reset. 5. The values of the retain variables are reset. 6. The values of the retain-persistent variables are reset. 7. All non-located and non-remanent variables are reset. 8. The values of the first 500 %MW registers are maintained. 9. The values of %MW500 to %MW59999 registers are reset to 0. 10.All fieldbus communications are stopped. 11.All I/O are reset to their initialization values. For details on variables, refer to Remanent Variables (see page 66).

EIO0000000827 12/2012

61

Controller States and Behaviors

Reboot Effect: Commands a reboot of the controller. Starting Conditions: Any state.
z

Methods for Issuing the Reboot Command: Power cycle

Effects of the Reboot: 1. The state of the controller depends on a number of conditions: a. The controller state will be RUNNING if: - the Run/Stop switch is in the RUN position - and, if configured, the Run/Stop Input is set to 1. b. The controller state will be STOPPED if: - the Run/Stop switch is in the STOP position - or, if configured, the Run/Stop input is set to 0. - the boot application is different than the application loaded prior to the reboot. - the previously saved context is invalid. - controller state was HALT prior to a power cycle. c. The controller state will be EMPTY if: - There is no boot application or the boot application is invalid, or - The reboot was provoked by specific detected System Errors. d. The controller state will be INVALID_OS if there is no valid firmware. 2. 3. 4. 5. 6. 7. 8. 9. Forcing is erased. Diagnostic indications for detected errors are reset. The values of the retain variables are restored if saved context is valid. The values of the retain-persistent variables are restored if saved context is valid. All non-located and non-remanent variables are reset to their initialization values. The values of the first 500 %MW registers are restored if saved context is valid. The values of %MW500 to %MW59999 registers are reset to 0. All fieldbus communications are stopped and restarted after the boot application is loaded successfully. 10.All I/O are reset to their initialization values and then to their user-configured default values if the controller assumes a STOPPED state after the reboot.

For details on variables, refer to Remanent Variables (see page 66). NOTE: If you make an online change to your application program while your controller is in the RUNNING or STOPPED state but do not manually update your Boot application, the controller will detect a difference in context at the next reboot, the remanent variables will be reset as per a Reset cold command, and the controller will enter the STOPPED state.

62

EIO0000000827 12/2012

Controller States and Behaviors

Download Application Effect: Loads your application executable into the RAM memory. Optionally, creates a Boot application in the Flash memory. Starting Conditions: RUNNING, STOPPED, HALT, and EMPTY states.
z

Methods for Issuing the Download Application Command: SoMachine Online Menu: select Download command.

Effects of the SoMachine Download Command: 1. The existing application stops and then is erased. 2. If valid, the new application is loaded and the controller assumes a STOPPED state. 3. Forcing is erased. 4. Diagnostic indications for detected errors are reset. 5. The values of the retain variables are reset to their initialization values. 6. The values of any existing retain-persistent variables are maintained. 7. All non-located and non-remanent variables are reset to their initialization values. 8. The values of the first 500 %MW registers are maintained. 9. The values of %MW500 to %MW59999 registers are reset to 0. 10.All fieldbus communications are stopped and then any configured fieldbus of the new application is started after the download is complete. 11.All I/O are reset to their initialization values and then set to the new userconfigured default values after the download is complete. For details on variables, refer to Remanent Variables (see page 66).

EIO0000000827 12/2012

63

Controller States and Behaviors

Error Detection, Types, and Management


Detected Error Management The controller manages 3 types of detected errors: external detected errors z application detected errors z system detected errors
z

The following table describes the types of errors that may be detected:
Type of Error Detected External Error Detected Description Resulting Controller State RUNNING with External Error Detected Or STOPPED with External Error Detected

External errors are detected by the system while RUNNING or STOPPED but do not affect the ongoing controller state. An external error is detected in the following cases: z A connected device reports an error to the controller z The controller detects an error with an external device whether or not it reports an error, for example when the external device is communicating but not properly configured for use with the controller z The controller detects an error with the state of an output z The controller detects a loss of communication with a device z The controller is configured for an expansion module that is not present or not detected z The boot application in Flash memory is not the same as the one in RAM. Examples: z output short circuit z missing expansion module z communication lost z etc.

Application An application error is detected when improper programming is encountered or when a task watchdog threshold is exceeded. Error Examples: Detected z task (software) watchdog exception z execution of an unknown function z ProcessorLoad Watchdog (if all of the tasks require more than 80 % of the processor resources for more than 3 seconds) z etc.

HALT

64

EIO0000000827 12/2012

Controller States and Behaviors

Type of Error Detected System Error Detected

Description

Resulting Controller State

A system error is detected when the controller enters a condition BOOTING that cannot be managed during runtime. Most such conditions EMPTY result from firmware or hardware exceptions, but there are some cases when incorrect programming can result in the detection of a system error, for example, when attempting to write to memory that was reserved during runtime. Examples: z System (hardware) watchdog overflow z exceeding the defined size of an array z etc. NOTE: There are some system errors that can be managed by runtime and are therefore treated like application errors.

NOTE: refer to the M218 PLCSystem Library Guide (see Modicon M218 Logic Controller, System Functions and Variables, M218 PLCSystem Library Guide) for more detailed information on diagnostics.

EIO0000000827 12/2012

65

Controller States and Behaviors

Remanent Variables
Remanent Variables Remanent variables can retain their values in the event of power outages, reboots, resets, and application program downloads. There are multiple types of remanent variables, declared individually as "retain" or "persistent", or in combination as "retain-persistent". Remanent variables are retained only if the battery (see Modicon M218 Logic Controller, Hardware Guide) is sufficient. NOTE: For this controller, variables declared as persistent have the same behavior as variables declared as retain-persistent. The following table describes the behavior of remanent variables in each case:
Action VAR VAR RETAIN VAR PERSISTENT and RETAINPERSISTENT X X X X X X

Online change to application program Stop Power cycle Reset warm Reset cold Reset origin Download of application program X The value is maintained The value is re initialized

X X -

X X X X -

NOTE: The first 500 %MW are automatically retained and persistent if no variable is associated to them (their values are kept after a reboot / Reset warm / Reset cold). The other %MW are managed as VAR.
z

For example if you have in your program: VAR myVariable AT %MW0 : WORD; END_VAR

%MW0 will behave like myVariable (not retained and not persistent).

66

EIO0000000827 12/2012

Modicon M218 Logic Controller Controller Configuration EIO0000000827 12/2012

Controller Configuration

8
Introduction This chapter describes how to configure the Modicon M218 Logic Controller. What Is in This Chapter? This chapter contains the following topics:
Topic Controller Configuration Applications M218 Controller Settings M218 Controller Services Page 68 69 70 71

EIO0000000827 12/2012

67

Controller Configuration

Controller Configuration
Controller Configuration Window Double-click the controller name (MyController by default) to access the Controller Configuration window:

The table below describes the tabs of the Controller Configuration Editor screen:
Tab Name Communication Settings Description Allows you to configure the connection between SoMachine and the controller. For more information, refer to the CoDeSys online help in SoMachine.

Applications (see page 69) Shows the applications currently running in the controller and allows you to remove applications from the controller. Files PLC Settings (see page 70) File management between the PC and the controller. For more information, refer to the CoDeSys online help in SoMachine. Configuration of: z Application for I/O handing z I/O behavior in stop z Bus cycle options Allows configuring on-line services of the controller (RTC, device identification). Displays device-specific status and diagnostic messages. Displays general information on the device (name, description, provider, version, image).

Services (see page 71) Status Information

68

EIO0000000827 12/2012

Controller Configuration

Applications
Overview The figure below shows the Applications tab:

This dialog box allows to scan and remove applications on the Controller.
Element Applications on the Controller Buttons Refresh List Remove Remove all Description List of the names of applications which have been found on the Controller during the last scan. The Controller will be scanned for applications, the list will be updated. The application currently selected in the list will be removed from the Controller. All applications will be removed from the Controller.

For more information, refer to the CoDeSys online help in SoMachine.

EIO0000000827 12/2012

69

Controller Configuration

M218 Controller Settings


Overview The figure below show the PLC Settings tab:

The following table describes the elements of the PLC Settings Tab:
Element Application for I/O handling PLC settings Update IO while in stop Behavior for outputs in Stop Description By default, set to Application because there is only one application in the controller. If this option is activated (default), the values of the input channels will be updated when the Controller is stopped. From the selection list choose one of the following options to configure how the values at the output channels should be handled in case of Controller stop: z Keep current values: The current values will not be modified. z Set all outputs to default: The default (fallback) values resulting from the mapping will be assigned. NOTE: This option is not taken into account for the outputs used by the HSC, PTO, PWM or Frequency Generator. Update all variables in all devices Bus cycle options Bus cycle task If this option is activated, then for all devices of the current Controller configuration all I/O variables will get updated in each cycle of the bus cycle task. This corresponds to the option Always update variables, which can be set separately for each device in the I/O Mapping dialog. This configuration setting is the parent for all Bus cycle task parameters used in the application device tree. The selection list offers all tasks currently defined in the Task Configuration of the active application. The default setting is the MAST task. NOTE: The selection <unspecified> signifies that the slowest cyclic task possible is used.

70

EIO0000000827 12/2012

Controller Configuration

M218 Controller Services


Services Tab The Services tab is divided in two parts: z RTC Configuration z Device Identification The figure below shows the Services tab:

NOTE: To display controller information in this tab, the controller needs to be connected to your PC. The following table describes the elements of the Services tab:
Element RTC Configuration PLC time Description Displays the date/time read from the controller. This readonly field is initially empty. To read and display the date/time in the controller, click the Read button. Allows defining a date and a time which are sent to the controller by a click the Write button. A message box informs the user on the success of the command. Local time fields are initialized with the current settings of the PC. Allows sending directly the current time and date settings of the PC. A message box informs the user of the success of the command. Displays the Firmware version, the Boot Version and the Coprocessor Version of the selected device if connected to the PC. 71

Local time

Synchronize with local date/time Device Identification

EIO0000000827 12/2012

Controller Configuration

72

EIO0000000827 12/2012

Modicon M218 Logic Controller Embedded Functions EIO0000000827 12/2012

Embedded Functions

9
Overview This chapter describes how to configure the embedded functions of the Modicon M218 Logic Controller. The number of inputs and outputs dedicated to the embedded function depends on the controller reference (see page 13). What Is in This Chapter? This chapter contains the following topics:
Topic I/O Embedded Function HSC Embedded Function PTO_PWM Embedded Function Analog I/O Embedded Function Page 74 78 80 83

EIO0000000827 12/2012

73

Embedded Functions

I/O Embedded Function


Overview The embedded I/O function allows configuring the controller inputs. The following table describes the digital inputs of the M218 controllers:
Reference TM218LDA16DRN TM218LDA24DRN TM218LDA24DRHN TM218LDD24DUPHN TM218LDAE24DRHN TM218LDA40DRN TM218LDA40DRPHN TM218LDD40DUPHNB TM218LDAE40DRPHN TM218LDA40DR2HN TM218LDA40DR4PHN TM218LDA60DRN Total number of digital inputs 9 14 14 14 14 24 24 24 24 24 24 36 Number of fast Inputs 2 reduced fast inputs (I0, I1) 2 reduced fast inputs (I0, I1) 4 (I0 to I3) 4 (I0 to I3) 4 (I0 to I3) 2 reduced fast inputs (I0, I1) 4 (I0 to I3) 4 (I0 to I3) 4 (I0 to I3) 4 (I0 to I3) 4 (I0 to I3) 2 reduced fast inputs (I0, I1)

Accessing the I/O Configuration Window Follow these steps to access the embedded I/O configuration window:
Step 1 Description Select the Configuration tab:

2 3

Double-click the controller. NOTE: You can also right-click the controller and select Edit device parameters. In the Task Pane click Embedded Functions IO:

74

EIO0000000827 12/2012

Embedded Functions

I/O Configuration Window The following window allows you to configure the embedded digital inputs:

NOTE: For more information on the I/O Mapping tab, refer to the CoDeSys online help in SoMachine.

EIO0000000827 12/2012

75

Embedded Functions

When you click the IO Summarize button, the IO Summary window appears. It allows you to check your configured I/O mapping:

76

EIO0000000827 12/2012

Embedded Functions

Configuration Parameters For each digital input, you can configure the following parameters:
Parameter Filter Value No 3 ms* 12 ms Description Reduce the effect of noise on a controller input. Constraint Available if Latch and Event are disabled. In the other cases, this parameter is disabled and its value is No. This parameter is only available for the fast inputs I0 to I3. NOTE: not available for the reduced Fast Inputs I0 and I1. Available if: Event disabled AND Run/Stop disabled. This parameter is only available for the fast inputs I0 to I3. NOTE: not available for the reduced Fast Inputs I0 and I1. Available if: Latch disabled AND Run/Stop disabled. Bounce Filtering 0.004 ms* 0.4 ms 1.2 ms 4 ms No* Yes Reduces the effect of bounce on a controller input. Available if Latch is enabled or Event is enabled. In the other cases, this parameter is disabled and its value is 0.004. Any of the inputs can be configured as Run/Stop, but only one.

Latch

No* Yes

Allows incoming pulses with amplitude widths shorter than the controller scan time to be captured and recorded.

Event

No* Rising edge Falling edge Both edges

Event detection

Run/Stop

The Run/Stop input can be used to run or stop a program in the controller

parameter default value

NOTE: The selection is grey and inactive if the parameter is unavailable.

EIO0000000827 12/2012

77

Embedded Functions

HSC Embedded Function


Overview The HSC function can execute fast counts of pulses from sensors, encoders, switches, etc... that are connected to the dedicated fast inputs. There are 2 types of HSC: Simple type: a single input counter (see Modicon M218 Logic Controller, High Speed Counting, M218 HSC Library Guide). z Main type: a counter that uses up to 4 inputs (2 fast inputs and 2 standard inputs) and 2 reflex outputs. (see Modicon M218 Logic Controller, High Speed Counting, M218 HSC Library Guide)
z

Accessing the HSC Configuration Window Follow these steps to access the embedded HSC configuration window:
Step 1 Description Select the Configuration tab:

2 3

Double-click the controller. NOTE: You can also right-click the controller and select Edit device parameters. In the Task Pane click Embedded Functions HSC:

78

EIO0000000827 12/2012

Embedded Functions

HSC Configuration Window The following figure shows a sample HSC configuration window used to configure the HSC:

The following table describes the areas of the HSC configuration window:
Number Action 1 2 3 4 5 6 Select the HSC tab to access each one of the HSC configuration windows. Select a specific HSC tab to access the HSC channel you need to configure. After choosing the type of HSC (Simple or Main) you want, use the field Variable to change the instance. You can expand each parameter by clicking the plus sign next to it to access its settings. Configuration window where the HSC parameters are set depending on the mode used. When you click on the IO Summarize button, the IO Summary window appears. It allows you to check your configured I/O mapping.

For detail information on configuration parameters, refer to M218 HSC choice matrix (see Modicon M218 Logic Controller, High Speed Counting, M218 HSC Library Guide).
EIO0000000827 12/2012

79

Embedded Functions

PTO_PWM Embedded Function


Overview The PTO embedded function can provide 3 different functions: PTO The PTO (Pulse Train Output) implements digital technology (see Modicon M218 Logic Controller, Pulse Train Output, Pulse Width Modulation, M218 PTOPWM Library Guide) that provides precise positioning for open loop control of motor drives. PWM The PWM (Pulse Width Modulation) function generates a programmable square wave signal on a dedicated output (see Modicon M218 Logic Controller, Pulse Train Output, Pulse Width Modulation, M218 PTOPWM Library Guide) with adjustable duty cycle and frequency. FG The FG (Frequency Generator) function generates a square wave signal on dedicated output (see Modicon M218 Logic Controller, Pulse Train Output, Pulse Width Modulation, M218 PTOPWM Library Guide) channels with a fixed duty cycle (50%). Accessing the PTO_PWM Configuration Window Follow these steps to access the PTO_PWM embedded function configuration window:
Step 1 Description Select the Configuration tab:

2 3

Double-click the controller. NOTE: You can also right-click the controller and select Edit device parameters. In the Task Pane click Embedded Functions PTO_PWM:

80

EIO0000000827 12/2012

Embedded Functions

PTO_PWM Configuration Window The following figure shows a sample PTO_PWM configuration window used to configure a PTO, PWM or FG:

EIO0000000827 12/2012

81

Embedded Functions

The following table describes the areas of the PTO_PWM configuration window:
Number 1 2 3 4 5 Action Select the PTO_PWM tab to access each one of the PTO_PWM configuration windows. Select a specific PTO tab to access the PTO_PWM channel you need to configure. After choosing the type of PTO_PWM (PTO, PWM or Frequency Generator) you want, use the field Variable to change the instance name. You can expand each parameter by clicking the plus sign next to it to access its settings. Configuration window where the embedded function is used for:
z a PTO (see Modicon M218 Logic Controller, Pulse Train Output, Pulse Width

Modulation, M218 PTOPWM Library Guide)


z a PWM (see Modicon M218 Logic Controller, Pulse Train Output, Pulse

Width Modulation, M218 PTOPWM Library Guide)


z a Frequency Generator (see Modicon M218 Logic Controller, Pulse Train

Output, Pulse Width Modulation, M218 PTOPWM Library Guide) 6 When you click on the IO Summarize button, the IO Summary window appears. It allows to check your configured I/O mapping.

For detail information on configuration parameters, refer to: z PTO configuration. (see Modicon M218 Logic Controller, Pulse Train Output, Pulse Width Modulation, M218 PTOPWM Library Guide) z PWM and FG configuration. (see Modicon M218 Logic Controller, Pulse Train Output, Pulse Width Modulation, M218 PTOPWM Library Guide)

82

EIO0000000827 12/2012

Embedded Functions

Analog I/O Embedded Function


Overview The following M218 controllers have embedded analog I/O. z TM218LDA40DR2HN z 2 analog outputs
z

TM218LDA40DR4PHN z 2 analog inputs


z

2 analog outputs

Accessing the Analog I/O Configuration Window Follow these steps to access the analog I/O embedded function configuration window:
Step 1 Description Select the Configuration tab:

2 3

Double-click the controller. NOTE: You can also right-click the controller and select Edit device parameters. In the Task Pane click Embedded Functions Analog IO:

EIO0000000827 12/2012

83

Embedded Functions

Analog I/O Configuration Window The following window allows you to configure the analog I/O:

NOTE: Embedded analog I/Os are always physically updated by the MAST task, same as expansion I/Os. For more information on the Analog I/O Mapping tab, refer to the CoDeSys online help in SoMachine.

84

EIO0000000827 12/2012

Embedded Functions

Configuration Parameters You can configure the following input parameters:


Parameter Type Value Not used * 10...10 V 0...10 V 0...20 mA 4...20 mA Normal * Customized 0 * to 6 Description Range mode Constraint

Scope Filter Level

Unit Filter value reduces the effect of noise on a controller analog input Minimum value Maximum value

Available if Type value is defined. Available if Type value is defined. Available if Scope is customized. Available if Scope is customized.

Minimum Maximum

32768 to 32767(1) 32768 to 32767(2)

* parameter default value (1) If Scope is Normal and Type is 10...10 V, the default value is -4096. If Scope is Customized, the default value is 32768 . (2) If Scope is Normal, the default value is 4095 . If Scope is Customized, the default value is 32767.

You can configure the following output parameters:


Parameter Type Value Not used * 10...10 V 0...10 V 0...20 mA 4...20 mA Normal * Customized 32768 to 32767(1) 32768 to 32767(2) Description Range mode Constraint

Scope Minimum Maximum

Unit Minimum value Maximum value

Available if Type value is defined. Available if Scope is customized. Available if Scope is customized.

* parameter default value (1) If Scope is Normal and Type is 10...10 V, the default value is -4096. If Scope is Customized, the default value is 32768 . (2) If Scope is Normal, the default value is 4095 . If Scope is Customized, the default value is 32767.

NOTE: The selection is grey and inactive if the parameter is unavailable.

EIO0000000827 12/2012

85

Embedded Functions

86

EIO0000000827 12/2012

Modicon M218 Logic Controller Expansion Modules Configuration EIO0000000827 12/2012

Expansion Modules Configuration

10
Overview This chapter describes the TM2...N and TM2 expansion module configuration of the Modicon M218 Logic Controller. What Is in This Chapter? This chapter contains the following topics:
Topic General Description Adding an Expansion Module Page 88 90

EIO0000000827 12/2012

87

Expansion Modules Configuration

General Description
Introduction In your project, you can add the following types of expansion modules to your controller: z digital z analog z expert (e.g. HSC, PTO) Use the GetRightBusStatus (see Modicon M218 Logic Controller, System Functions and Variables, M218 PLCSystem Library Guide) function regularly to monitor the expansion bus status. TM218...N Expansion Module Configuration For more information about module configuration, refer to the following programming and hardware guides:
Expansion Module TM218...N Expansion Modules Programming Guide Hardware Guide

TM2...N Expansion Modules TM2...N Expansion Modules Configuration Programming Guide Hardware Guide (see Modicon TM2...N Expansion Modules, Programming Guide)

TM2 Expansion Module Configuration For more information about module configuration, refer to the programming and hardware guides of each expansion module type:
Expansion Module TM2 Digital I/O Modules Programming Guide Hardware Guide

TM2 Digital I/O Modules Hardware TM2 I/O Modules Configuration Programming Guide (see Modicon Guide (see Modicon TM2, Digital I/O Modules, Hardware Guide) TM2, Modules Configuration, Programming Guide) TM2 Analog I/O Modules Hardware TM2 I/O Modules Configuration Programming Guide (see Modicon Guide (see Modicon TM2, Analog I/O Modules, Hardware Guide) TM2, Modules Configuration, Programming Guide) TM2 I/O Modules Configuration Programming Guide (see Modicon TM2, Modules Configuration, Programming Guide) TM2 High Speed Counter Modules Hardware Guide (see Modicon TM2, High Speed Counter Modules, Hardware Guide)

TM2 Analog I/O Modules

TM2 High-Speed Counting Modules

88

EIO0000000827 12/2012

Expansion Modules Configuration

TWDPTO220DT PTO Expansion Module Configuration For more information about module configuration, refer to the following library and hardware guides:
Expansion Module TWDPTO220DT PTO Expansion Module Library Guide Modicon M218 Pulse Train Output TWDPTO220DT Expansion Module Library Guide (see Modicon M218, Pulse Train Output, TWDPTO220DT Expansion Module Library Guide) Hardware Guide Modicon M218 Pulse Train Output TWDPTO220DT Expansion Module Hardware Guide (see Modicon M218, Pulse Train Output, TWDPTO220DT Expansion Module Hardware Guide)

Maximum Hardware Configuration The following table shows the maximum number of expansion modules for each Modicon M218 Logic Controller:
Controller TM218LDA16DRN TM218LDA24DRN TM218LDA24DRHN TM218LDD24DUPHN TM218LDAE24DRHN TM218LDA40DRN TM218LDA40DRPHN TM218LDD40DUPHNB TM218LDAE40DRPHN TM218LDA40DR2HN TM218LDA40DR4PHN TM218LDA60DRN Maximum Number of Expansion Modules 4 4 Maximum Number of I/O Points 144 152 Maximum Number of Relay Outputs 42 42

248

90

268

120

EIO0000000827 12/2012

89

Expansion Modules Configuration

Adding an Expansion Module


Procedure To add one or more expansion modules to a controller, proceed as follows:
Step 1 2 3 4 Action Select the Configuration tab. In the Graphical Configuration Editor, click Add Expansion on the controller. In the Add device window, select an expansion module to add. If you wish to add another expansion module, click Add and proceed to step 3, else click Add and close. NOTE: Click Close to leave the Add device window without adding your selection.

NOTE: To physically install TM2 expansion modules, you must first installed a TM2DOCKN adaptor module (see Modicon M218 Logic Controller, Hardware Guide). However, the TM2DOCKN does not appear in the Graphical Configuration Editor. Information on configuring expansion modules is provided in the topic General Description (see page 88).

90

EIO0000000827 12/2012

Modicon M218 Logic Controller Serial Line Configuration EIO0000000827 12/2012

Serial Line Configuration

11
Introduction This chapter describes how to configue the serial line communication of the Modicon M218 Logic Controller. What Is in This Chapter? This chapter contains the following topics:
Topic Serial Line Configuration Serial Line Protocol Manager ASCII Manager SoMachine Network Manager Modbus IOScanner Modbus Manager Page 92 94 97 100 101 110

EIO0000000827 12/2012

91

Serial Line Configuration

Serial Line Configuration


Introduction The serial line Configuration window allows configuring the physical parameters of the serial line (baud rate, parity, etc.). Serial Line Configuration To configure the serial line, proceed as follows:
Step 1 Action Select the Configuration tab and double-click the controller.

Click the Communication Serial Line 1 or Serial Line 2 entry on the task selection pane.

92

EIO0000000827 12/2012

Serial Line Configuration

Step 3

Action Click the Physical Settings entry. The Configuration window is displayed:

NOTE: You can also select the Program tab and double-click the Serial Line 1 or Serial Line 2 in the device tree to access the Configuration window. The following parameters must be identical for each serial device connected to the port:
Element Baud rate Parity Data bits Stop bits Physical Medium Description Transmission speed Used for error detection Number of bits for transmitting data Number of stop bits Specify to use RS485 with polarization resistor or without. NOTE: 2 line polarization resistors are integrated in the controller, they are switched on or off by this parameter.

EIO0000000827 12/2012

93

Serial Line Configuration

Serial Line Protocol Manager


Overview The Modicon M218 Logic Controller is equipped with 2 serial lines:
Serial Line Serial Line 1 Supported protocol ASCII Manager Modbus Manager SoMachine Network Manager * ASCII Manager Modbus Manager *

Serial Line 2

Legend. *: Default setting for serial line

The following table indicates the Manager baud rate characteristic:


Manager Maximum Baud Rate (bits/s) 115200 38400 Supported Baud Rate (bits/s)

SoMachine Network Manager Modbus Manager ASCII Manager

115200, 57600, 38400, 19200, 9600, 4800, 2400, 1200 38400, 19200, 9600, 4800, 2400, 1200

94

EIO0000000827 12/2012

Serial Line Configuration

Adding the Serial Line Protocol Manager Follow these steps to add a protocol manager on the serial line:
Step 1 Action Select Configuration tab and double-click the controller.

Click Communication Serial Line 1 or Serial Line 2.

Click the Protocol Settings entry.

EIO0000000827 12/2012

95

Serial Line Configuration

Step 4

Action Click the Remove/Change Protocol, and the Add device window is displayed.

NOTE: You also can access this window by selecting the Configuration tab and clicking the serial line port of the controller from the graphical configuration editor. 5 Select the manager and click Add and close.

96

EIO0000000827 12/2012

Serial Line Configuration

ASCII Manager
Introduction The ASCII Manager is used to transmit and/or receive data with a simple device. Configuring the Manager To configure the ASCII Manager of your controller, proceed as follows:
Step 1 Action Select the Configuration tab and double-click the controller.

Click the Communication Serial Line 1 or Serial Line 2 entry in the task selection pane.

EIO0000000827 12/2012

97

Serial Line Configuration

Step 3

Action Click the Protocol Settings entry. Result: The ASCII_Manager configuration window is displayed if ASCII_Manager is already configured on this serial line port.

NOTE: if the ASCII_Manager configuration window is not displayed, click Remove/Change Protocol at the bottom of the screen, remove the current protocol and select ASCII_Manager in the Add device screen.

98

EIO0000000827 12/2012

Serial Line Configuration

Set the parameters as described in the following table:


Parameter Start Character Description If 0, no start character is used in the frame. Otherwise, in Receiving Mode the corresponding character in ASCII is used to detect the beginning of a frame. In Sending Mode, this character is added at the beginning of the frame. If 0, no first end character is used in the frame. Otherwise, in Receiving Mode the corresponding character in ASCII is used to detect the end of a frame. In Sending Mode, this character is added at the end of the frame. If 0, no second end character is used in the frame. Otherwise, in Receiving Mode the corresponding character in ASCII is used to detect the end of a frame. In Sending Mode, this character is added at the end of the frame. If 0, this parameter is not used. This parameter allows the system to conclude an end of frame at reception, when the controller received the specified number of characters. NOTE: This parameter cannot be used simultaneously with Frame Received Timeout (ms). If 0, this parameter is not used. This parameter allows the system to conclude the end of frame at reception after a silence of the specified number of ms. Parameters specified in [Physical Settings] of the Serial Line configuration menu (see page 92).

First End Character Second End Character

Frame Length Received

Frame Received Timeout (ms) Serial Line Settings

NOTE: In the case of using several frame termination conditions, the first condition to be TRUE will terminate the exchange.

EIO0000000827 12/2012

99

Serial Line Configuration

SoMachine Network Manager


Introduction The SoMachine Network Manager must be used if you want to exchange variables with a SoMachine compatible HMI such as the Magelis GXO using SoMachine software protocol. NOTE: The parameters of Physical Setting can only be kept as default values under the SoMachine Network Manager. They cannot be modified. Adding the Manager To add a Manager on Serial Line, proceed as follows:
Step 1 2 3 4 Action Select the Configuration tab and double-click on the controller. Click the Communication Serial Line 1 entry on the left hand side. Click the Protocol Settings entry. Click the Remove/Change Protocol button. Select the SoMachine-Network_Manager object and click Add and close:

Configuring the Manager There is no configuration for the SoMachine Network Manager.
100
EIO0000000827 12/2012

Serial Line Configuration

Modbus IOScanner
Introduction The Modbus IOScanner is used to simplify exchanges with Modbus slave devices. Adding the Manager To add a Manager on Serial Line, proceed as follows:
Step 1 2 3 4 Action Select the Configuration tab and double-click the controller. Click the Communication Serial Line 1 or Serial Line 2 entry on the left hand side. Click the Protocol Settings entry. Click the Remove/Change Protocol button. Select the Modbus IOScanner object and click Add and close:

EIO0000000827 12/2012

101

Serial Line Configuration

Configuring the Manager To configure a Modbus IOScanner on Serial Line, proceed as follows:
Step 1 2 3 Action Select the Configuration tab and double-click the controller. Click the Communication Serial Line 1 or Serial Line 2 entry on the left hand side. Click the Protocol Settings entry. Result: The configuration window is displayed:

Set the parameters as described in the following table:


Element Transmission Mode Description Specify the transmission mode to use:
z RTU: uses binary coding and CRC error-checking (8 data bits) z ASCII: messages are in a ASCII format, LRC error-checking (7 data bits)

This parameter must be identical for each Modbus device on the link. Response Timeout (ms) Time between frames (ms) Timeout used in the exchanges. Time to avoid bus-collision. This parameter must be identical for each Modbus device on the link.

102

EIO0000000827 12/2012

Serial Line Configuration

Adding a Device on the Modbus IOScanner To add a device on the Modbus IOScanner, proceed as follows:
Step 1 2 3 Action Select the Configuration tab and double-click on the controller. Click the available port of the Modbus IOScanner Fieldbus in the graphical configuration editor. The Add device window appears:

Click the device to be added and click the Add and close button.

EIO0000000827 12/2012

103

Serial Line Configuration

Configuring a Device Added on the Modbus IOScanner To configure the device added on the Modbus IOScanner, proceed as follows:
Step 1 2 Action Select the Configuration tab. In the graphical configuration editor, double-click the device. Result: The configuration window is displayed.

3 4

Enter a Slave Address value for your device (choose a value from 1 to 247). Choose a value for the Response Timeout (in ms).

To configure the Modbus Channels, proceed as follows:


Step 1 Action Click the Modbus Slave Channel tab.

104

EIO0000000827 12/2012

Serial Line Configuration

Step 2

Action To configure an exchange, click the Add Channel button:

In the field Channel, you can add the following values:


z Channel: Enter a name for your channel z Access Type: Read or Write or Read/Write multiple registers. z Trigger: Choose the trigger of the exchange. It can be either CYCLIC with

the period defined in Cycle Time (ms) field or started by a RISING EDGE on a boolean variable (this boolean variable is then created in the Modbus Master I/O Mapping tab) z Comment: Add a comment about this channel

EIO0000000827 12/2012

105

Serial Line Configuration

Step 2 bis

Action In the field READ Register (if your channel is a Read or a Read/Write one), you can configure the %MW to be read on the Modbus slave. Those addresses will be mapped on %IW (see Modbus Master I/O Mapping tab): z Offset: Offset of the %MW to read. 0 means that the first object that will be read will be %MW0. z Length: Number of %MW to be read. For example if Offset = 2 and Length = 3, the channel will read %MW2, %MW3 and %MW4. z Error Handling: choose the behavior of the related %IW in case of loss of communication. In the field WRITE Register (if your channel is a Write or a Read/Write one), you can configure the %MW to be written to the Modbus slave. Those addresses will be mapped on %QW (see Modbus Master I/O Mapping tab): z Offset of the %MW to write. 0 means that the first object that will be written will be %MW0. z Length: Number of %MW to be written. For example if Offset = 2 and Length = 3, the channel will write %MW2, %MW3 and %MW4.

3 4

Click the Delete button to remove a channel. Click the Edit button to change the parameters of a channel. Click OK to validate the configuration of this channel.

To configure your Modbus Initialization Value, proceed as follows:


Step 1 Action Click the Modbus Slave Init tab:

106

EIO0000000827 12/2012

Serial Line Configuration

Step 2

Action Click the button New to create a new initialization value:

The Initialization Value window contains the following parameters:


z Access Type: Only Write Multiple Register is allowed z Register Offset: Offset of the %MW that will be initialized z Length: Number of %MW that will be initialized. For example if Offset = 2

and Length = 3, %MW2, %MW3 and %MW4 wil be initialized


z Initialization Value: Value the registers are initialized with z Comment: Add a comment about this initialization

Click the Move up or Move down button to change the position of an initialization in the list. Click the Delete button to remove an initialization in the list. Click the Edit button to change the parameters of an initialization. Click OK to create a new Initialization Value.

EIO0000000827 12/2012

107

Serial Line Configuration

These next set of interface windows show the mapping of the objects generated by the defined channels. If channel 1 and channel 2 are configured as pictured in the following two graphics, then the Modbus Master I/O Mapping is as pictured in the third graphic below:

108

EIO0000000827 12/2012

Serial Line Configuration

EIO0000000827 12/2012

109

Serial Line Configuration

Modbus Manager
Introduction The Modbus Manager is used for Modbus RTU or ASCII protocol in master or slave mode. It is recommended to use the Relocation Table (see page 30) to optimize the communication between the controller and other equipment. Configuring the Manager To configure the Modbus_Manager of your controller, proceed as follows:
Step 1 Action Select the Configuration tab and double-click the controller.

Click the Communication Serial Line 1 or Serial Line 2 entry on the task selection pane.

110

EIO0000000827 12/2012

Serial Line Configuration

Step 3

Action Click the Protocol Settings entry. Result: The Modbus_Manager configuration window is displayed if Modbus_Manager is already configured on this serial line port.

NOTE: if the Modbus_Manager configuration window is not displayed, click Remove/Change Protocol at the bottom of the screen, remove the current protocol and select Modbus_Manager in the Add device screen.

Set the parameters as described in the following table:


Element Transmission Mode Description Specify the transmission mode to use: z RTU: uses binary coding and CRC error-checking (8 data bits). z ASCII: messages are in a ASCII format, LRC error-checking (7 data bits). This parameter must be identical for each Modbus device on the link. Addressing Address Specify if the M218 device is master or slave. Modbus address of the device.

Time between Time to avoid bus-collision. frames (ms) This parameter must be identical for each Modbus device on the link. Serial Line Settings Parameters specified in [Physical Settings] of the Serial Line configuration menu (see page 92).

EIO0000000827 12/2012

111

Serial Line Configuration

Modbus Master When the controller is configured as a Modbus Master, the following Function Blocks are supported from the PLCCommunication Library: z ADDM z READ_VAR z SEND_RECV_MSG z SINGLE_WRITE z WRITE_READ_VAR z WRITE_VAR For further information, see Function Block Descriptions (see SoMachine, Modbus and ASCII Read/Write Functions, PLCCommunication Library Guide) of the PLCCommunication Library (see SoMachine, Modbus and ASCII Read/Write Functions, PLCCommunication Library Guide). Modbus Slave When the controller is configured as Modbus Slave, the following Modbus requests are supported:
Types Data Access Physical Discrete (1 Bit) Inputs and Outputs Function Read Coils Read Discrete Inputs Write Multiple Coils Data Access Physical Input (16 Bits) Registers Read Holding Registers Write Single Register Write Multiple Registers Read/Write Multiple Registers Diagnostics Diagnostics Read Device Identification Function Codes Code/Sub Code 01 02 15 03 06 16 23 08 43/14

NOTE: Only located variables of the controller application can be accessed via Modbus.

112

EIO0000000827 12/2012

Serial Line Configuration

The following table contains the Sub-function codes supported by the diagnostic Modbus request 08:
Sub-Function Code Dec 10 11 12 13 14 15 16 17 18 Hex 0A 0B 0C 0D 0E 0F 10 11 12 Clear Counters and Diagnostic Register Return Bus Message Count Return Bus Communication Error Count Return Bus Exception Error Count Return Slave Message Count Return Slave No Response Count Return Slave NAK Count Return Slave Busy Count Return Bus Character Overrun Count Function

The table below list the objects that can be read with a read device identification request (basic identification level):
Object ID 00 hex 01 hex 02 hex Object Name Vendor code Product code Major / Minor revision Type ASCII String ASCII String ASCII String Value Schneider Electric Controller reference e.g. TM218LDA24DRN aa.bb.cc.dd (same as device descriptor)

The following section describes the differences between the Modbus memory mapping of the controller and HMI Modbus mapping. If you do not program your application to recognize these differences in mapping, your controller and HMI will not communicate correctly and it will be possible for incorrect values to be written to memory areas responsible for output operations.

WARNING
UNINTENDED EQUIPMENT OPERATION Program your application to translate between the Modbus memory mapping used by the controller and that used by attached HMI devices. Failure to follow these instructions can result in death, serious injury, or equipment damage. When the controller and the HMI are connected via Modbus (HMI is master of Modbus requests), the data exchange uses simple word requests.
EIO0000000827 12/2012

113

Serial Line Configuration

There is an overlap on simple words of the HMI memory while using double words but not for the controller memory (see following diagram). In order to have a match between the HMI memory area and the controller memory area, the ratio between double words of HMI memory and the double words of controller memory has to be 2.

The following gives examples of memory match for the double words: z %MD2 memory area of the HMI corresponds to %MD1 memory area of the controller because the same simple words are used by the modbus request. z %MD20 memory area of the HMI corresponds to %MD10 memory area of the controller because the same simple words are used by the modbus request.
z

The following gives examples of memory match for the bits: %MW0:X9 memory area of the HMI corresponds to %MX1.1 memory area of the controller because the simple words are split in 2 distinct bytes in the controller memory.

NOTE: If %MD is used for data exchange between PLC and HMI, the word order should be consistent between PLC and HMI. For Modicon M218 Logic Controller, the order of double word variable is low word first.

114

EIO0000000827 12/2012

Modicon M218 Logic Controller Ethernet Configuration EIO0000000827 12/2012

Ethernet Configuration

12
Indroduction This chapter describes how to configure the Ethernet network interface of the Modicon M218 Logic Controller What Is in This Chapter? This chapter contains the following topics:
Topic Ethernet Services IP Address Configuration Modbus TCP Server/Client Page 116 117 122

EIO0000000827 12/2012

115

Ethernet Configuration

Ethernet Services
Ethernet Services The controller supports the following services: Modbus TCP Server (see page 122) z Modbus TCP Client (see page 122)
z

Ethernet Protocol The controller supports the following protocols: IP (Internet Protocol) z TCP (Transmission Control Protocol) z ARP (Address Resolution Protocol) z ICMP (Internet Control Messaging Protocol), only support Ping function.
z

TCP Server Connection The maximum number of TCP connection: 4 Modbus servers z 3 Modbus servers and 1 client
z

Each server based on TCP manages its own pool of connections. When a client tries to open a connection that exceeds the poll size, the controller closes the oldest connection. If all connections are busy (exchange in progress) when a client tries to open a new one, the new connection is denied. All server connections stay open as long as the controller stays in operational states (RUN, STOP, HALT). All server connections are closed when leaving or entering operational states (RUN, STOP, HALT), except in case of power outage (because the controller did not have time to close the connections).

116

EIO0000000827 12/2012

Ethernet Configuration

IP Address Configuration
Introduction There are 4 different ways to assign the IP address of the controller: z address assignment by DHCP server z address assignment by BOOTP server z fixed IP address z address assignment using the SetIPAddress (see Modicon M218 Logic Controller, System Functions and Variables, M218 PLCSystem Library Guide) function block NOTE: If the attempted addressing method is unsuccessful, the controller will start using a default IP address (see page 120) derived from the MAC address. You must carefully manage the IP addresses because each device on the network requires a unique address. Having multiple devices with the same IP address can cause unpredictable operation of your network and associated equipment.

WARNING
UNINTENTED EQUIPMENT OPERATION
z z z z z

Be sure that there is only one master controller configured on the network or remote link. Be sure that all devices have unique addresses. Obtain your IP address from your system administrator. Confirm that the devices IP address is unique before placing the system into service. Do not assign the same IP address to any other equipment on the network.

Failure to follow these instructions can result in death, serious injury, or equipment damage. NOTE: It is good practice to ensure that your system administrator maintains a record of all assigned IP addresses on the network and subnetwork, and to inform the system administrator of all configuration changes performed.

EIO0000000827 12/2012

117

Ethernet Configuration

Address Management The different types of address systems for the controller are shown in the following diagram:

NOTE: If a device programmed to use the DHCP or BOOTP addressing methods is unable to contact its respective server, the controller will use the default IP address. It will, however, constantly reiterate its request. The IP process automatically restarts in the following cases: Controller reboot z Ethernet cable reconnection z Application download (if IP parameters change) z DHCP or BOOTP server detection following an unsuccessful addressing attempt.
z

118

EIO0000000827 12/2012

Ethernet Configuration

Ethernet Configuration In the Devices tree of the Program tab, double-click the Ethernet item:

Set the parameters as described in the following table:


Element Interface Name Network Name IP Address by DHCP IP Address by BOOTP Fixed IP Address Transfer Rate Ethernet Protocol Description Name of the network interface, maximum 16 characters Used as device name to retrieve IP address through DHCP, maximum 16 characters IP address is obtained via DHCP. IP address is obtained via BOOTP. IP address, Subnet Mask and Gateway Address are defined by the user. Transfer rate and direction on the bus are automatically configured. Protocol type used (only supports Ethernet 2)

EIO0000000827 12/2012

119

Ethernet Configuration

Default IP Address The default IP address is based on the devices MAC address. The first two bytes are 10 and 10. The last two bytes are the last two bytes of the devices MAC address. The default subnet mask is 255.0.0.0. NOTE: A MAC address is always written in hexadecimal format, and an IP address in decimal format. You must convert the MAC address to decimal format. Example: If the MAC address is 00.80.F4.01.80.F2, the default IP address is 10.10.128.242. Address Classes The IP address is linked: to a device (known as the host) z to the network to which the device is connected
z

An IP address is always coded using 4 bytes. The distribution of these bytes between the network address and the device address may vary. This distribution is defined by the address classes. The different IP address classes are defined in the following table:
Address Class Byte 1 Class A Class B Class C Class D Class E 0 1 1 1 1 Network ID 0 1 1 1 Network ID 0 1 1 Network ID 0 1 Multicast address 0 Address reserved for subsequent use Byte 2 Host ID Host ID Host ID Byte 3 Byte 4

Subnet Mask The subnet mask is used to address several physical networks with a single network address. The mask is used to separate the sub-network and the device address in the host ID. The subnet address is obtained by retaining the bits of the IP address which correspond to the positions of the mask containing 1, and replacing the others with 0. Conversely, the subnet address of the host device is obtained by retaining the bits of the IP address which correspond to the positions of the mask containing 0, and replacing the others with 1.

120

EIO0000000827 12/2012

Ethernet Configuration

Example of a subnet address:


IP address Subnet mask 192 (11000000) 255 (11111111) 1 (00000001) 255 (11111111) 1 (00000001) 17 (00010001) 240 (11110000) 16 (00010000) 11 (00001011) 0 (00000000) 0 (00000000)

Subnet address 192 (11000000)

NOTE: The device does not communicate on its sub-network when there is no gateway. Gateway The gateway allows a message to be routed to a device which is not on the current network. If there is no gateway, the gateway address is 0.0.0.0.

EIO0000000827 12/2012

121

Ethernet Configuration

Modbus TCP Server/Client


Introduction The Modbus protocol is widely used in industry. Unlike Modbus serial link, Modbus TCP/IP is not based on a hierarchical structure, but on a client / server model. The transfer of information between a Modbus client and server is initiated when the client sends a request to the server to transfer information, to execute a command, or to perform one of many other possible functions. After the server receives the request, it executes the command or retrieves the required data from its memory. The server then responds to the client by either acknowledging that the command is complete or by providing the requested data. The Modicon M218 Logic Controller implements both client and server services so that it can initiate communications with other controllers and I/O devices, and respond to requests from other controllers, SCADA, HMIs and other devices. Without any configuration, the embedded Ethernet port of the controller supports Modbus Server. The Modbus Server is included in the firmware, and does not require any programming action from the user. Due to this feature, it is accessible in RUNNING, STOPPED and EMPTY states. Modbus TCP Client The Modbus TCP Client supports the following function blocks from the PLCCommunication library without any configuration: z ADDM z READ_VAR z SEND_RECV_MSG z SINGLE_WRITE z WRITE_READ_VAR z WRITE_VAR For further information, see Function Block Descriptions (see SoMachine, Modbus and ASCII Read/Write Functions, PLCCommunication Library Guide) of the PLCCommunication Library.

122

EIO0000000827 12/2012

Ethernet Configuration

Modbus TCP Server The Modbus Server supports the following Modbus requests:
Function Code Dec (Hex) 1 (1h) 2 (2h) 3 (3h) 6 (6h) 8 (8h) 15 (Fh) 16 (10h) 23 (17h) 43 (2Bh) 14 (Eh) Sub-function Dec (Hex) Function Read digital outputs (%Q) Read digital inputs (%I) Read holding register (%MW) Write single register (%MW) Diagnostic (see page 123) Write multiple digital outputs (%Q) Write multiple registers (%MW) Read/write multiple registers (%MW) Read device identification (see page 127)

Diagnostic Request The following table contains the Data Selection Code list:
Data Selection Code 0x00 0x01 0x02 0x03 0x04 0x05 - 0x7E 0x7F Description Reserved Basic Network Diagnostics (see page 124) Ethernet Port Diagnostic (see page 125) Modbus TCP/Port 502 Diagnostics (see page 126) Modbus TCP/Port 502 Connection Table (see page 126) Reserved for other public codes Data Structure Offsets

EIO0000000827 12/2012

123

Ethernet Configuration

Basic Network Diagnostics Basic Network Diagnostics


Field Name Basic NW Diag Validity Communication Global Status Supported Communication Services Status of Communication Services IP Address Subnet Mask Default Gateway MAC Address Ether Frame Format Capability / Configuration / Operational Ether Rcv Frames OK Ether Xmit Frames OK Reserved Num MB Open Server Connections Num MB Error Msgs Sent Num MB Msgs Sent Num MB Msgs Rcvd Device Name IP Assignment Mode Capability / Operational Total: Bytes 4 2 2 2 4 4 4 6 6 4 4 2 2 4 4 4 16 4 78 TR Designation IP Address Subnet Mask Default Gateway MAC Address Ethernet Frame Format Total number of Ethernet Frames received OK Total number of Ethernet Frames Transmitted OK Num_Open_ServerCnx Num_MB_Error_Msgs_Sent Num_MB_Msgs_Sent Num_MB_Msgs_Rcvd Device Name IPAssignment ModeCapability; IPAssignmentModeOperational

124

EIO0000000827 12/2012

Ethernet Configuration

Ethernet Port Diagnostic Ethernet Port Diagnostic: Port Diagnostics Data Validity
Field Name Port Diagnostics Data Validity Logical/Physical Port Number Ether Control Capability Link Speed Capability Ether Control Configuration Link Speed Configuration Ether Control Operational Link Speed Operational Port MAC Address Media Counters Reserved Total: Bytes 2 2 2 2 2 2 2 2 6 72 46 140 TR Designation Cable Type - Duplex Status Speed Speed Speed MAC Address -

Ethernet Port Diagnostic: Media Counters Diagnostic Data Validity


Field Name Media Counters Data Validity Num Frames Xmit OK Num Frames Received OK Reserved Total: Bytes 4 4 4 60 72 TR Designation Frames transmitted OK Frames received OK -

EIO0000000827 12/2012

125

Ethernet Configuration

Modbus TCP/Port 502 Diagnostics Modbus TCP/Port 502 Diagnostics:


Field Name Modbus TCP/Port 502 Diag Validity Port 502 Status Num Open Connections Num MB Msgs Sent Num MB Msgs Received Num Open Client Connections Reserved Max Num Connections Max Num Client Connections Reserved Num MB Error Msgs Sent Reserved Total: Bytes 4 2 2 4 4 2 2 2 2 2 4 102 34 + 6*N + 2 TR Designation Num_Open_Cnx Num_MB_Msgs_Xmit Num_MB_Msgs_Rcvd Num_Open_ClientCnx Max_Num_Cnx Max_Num_ClientCnx Num_MB_Error_Msgs_Sent -

Modbus TCP/Port 502 Connection Table Modbus TCP/Port 502 Connection Table:
Field Name Connection Table Validity Number of Entries (NE) Starting Entry Index (SE) Connection Table Entry 1 Connection Table Entry 2 Reserved Connection Table Entry N Total: Bytes 2 2 2 16 16 ... 16 6 + 16 * N TR Designation -

126

EIO0000000827 12/2012

Ethernet Configuration

Read Device Identification Request The table below list the objects that can be read with a read device identification request (basic identification level):
Object ID 00h 01h 02h Object Name Vendor name Product code Major / minor revision Type ASCII string ASCII string ASCII string Value Schneider Electric Controller reference eg: TM218LDA40DR2HN aa.bb.cc.dd (same as device descriptor)

EIO0000000827 12/2012

127

Ethernet Configuration

128

EIO0000000827 12/2012

Modicon M218 Logic Controller Connecting the Modicon M218 Logic Controller to a PC EIO0000000827 12/2012

Connecting the Modicon M218 Logic Controller to a PC

13
Page 130 132

What Is in This Chapter? This chapter contains the following topics:


Topic Connecting the Controller to a PC Active Path of the Controller

EIO0000000827 12/2012

129

Connecting the Modicon M218 Logic Controller to a PC

Connecting the Controller to a PC


Overview To transfer, run and monitor your applications, connect your controller to a computer that has SoMachine installed using a USB cable.

NOTICE
INOPERABLE EQUIPMENT Always connect the communication cable to the PC before connecting it to the controller. Failure to follow these instructions can result in equipment damage. USB Mini-B Port Connection TSX CNA MUM3P : This USB cable is suitable for short duration connection like quick updates or retrieving data values. BMX XCA USBH045 : Grounded and shielded, this USB cable is suitable for long duration connection. NOTE: You can only connect 1 controller to the PC at the same time. The USB Mini-B Port is the programming port you can use to connect a PC with a USB host port using SoMachine software. Using a typical USB cable, this connection is suitable for quick updates of the program or short duration connections to perform maintenance and inspect data values. It is not suitable for long term connections such as commissioning or monitoring without the use of specially adapted cables to help minimize electromagnetic interference.

WARNING
INOPERABLE EQUIPMENT OR UNINTENDED EQUIPMENT OPERATION
z z

You must use a shielded USB cable such as a BMX XCAUSBH0 secured to the functional ground (FE) of the system for any long term connection. Do not connect more than one controller at a time using USB connections.

Failure to follow these instructions can result in death, serious injury, or equipment damage. The communication cable should be connected to the PC first to minimize the possibility of electrostatic discharge affecting the controller.

130

EIO0000000827 12/2012

Connecting the Modicon M218 Logic Controller to a PC

The following figure shows the USB connection to a PC:

To connect the USB cable to your controller, do the following:


Step 1 Action 1a If making a long term connection using the cable BMX XCA USBH045, or other cable with a ground shield connection, be sure to securely connect the shield connector to the functional ground (FE) or protective ground (PE) of your system before connecting the cable to your controller and your PC. 1b If making a short term connection using the cable TSX CNA MUM3P or other non-grounded USB cable, proceed to step 2. Connect your USB cable to the computer. Open the hinged access cover. Connect the Mini connector of your USB cable to the controller USB connector.

2 3 4

EIO0000000827 12/2012

131

Connecting the Modicon M218 Logic Controller to a PC

Active Path of the Controller


Introduction After connecting the controller to the PC (see page 130), you must configure the Active Path of the controller in SoMachine. NOTE: SoMachine cannot control multiple controllers simultaneously. Active Path To set the Active Path of the controller, proceed as follows:
Step 1 2 3 4 5 6 Action In the Configuration tab, double-click the controller. Select the Communication Settings tab. Click on the Add gateway button. Click on the Scan network button. Select the controller from the list of found devices by checking its Serial Number (the 6 last numbers on the controller) and clicking on the Set active path button. Press ALT+F or click Cancel when the dialog box appears.

132

EIO0000000827 12/2012

Modicon M218 Logic Controller Loader Device Accessory EIO0000000827 12/2012

Loader Device Accessory

14
Overview This manual describes how to use the Loader Device Accessory What Is in This Chapter? This chapter contains the following sections:
Section 14.1 14.2 14.3 14.4 Topic About the Loader Device Accessory Transfer From SoMachine to the USB Memory Key File Transfer with a USB Memory Key Other Functionalities Page 134 142 143 149

EIO0000000827 12/2012

133

Loader Device Accessory

14.1

About the Loader Device Accessory

What Is in This Section? This section contains the following topics:


Topic Loader Device AccessoryDescription Physical Description LED Status and Diagnostic Firmware and SoMachine Software Compatibility Page 135 137 138 140

134

EIO0000000827 12/2012

Loader Device Accessory

Loader Device AccessoryDescription


Overview The Loader Device Accessory is an accessory that allows you to download or upload a project through the controller programming port using a USB memory key. The device can only be used with applications from SoMachine V2.0 or greater. NOTE: The USB memory key is a standard USB memory key with the following characteristics: z 1 GB minimum z USB 2.0 or less z formatted in FAT16 or FAT32 Which Files are Transferred? The Loader Device Accessory allows to transfer the following file types: a *.app file and z a *.crc file
z

These file types are transferred as pairs. The number of file pairs that are transferred depends on the SoMachine project:
If... the SoMachine project does not contain a Symbol configuration or if the project is built with a SoMachine version superior to V3.0 Then ... one pair of files is transferred. SoMachine Default File Names
z application.app z application.crc

the SoMachine project contains a 2 pairs of files are transferred. Symbol configuration built with a SoMachine version inferior to V3.1

z application.app z application.crc

and
z application_symbol.app z application_symbol.crc

EIO0000000827 12/2012

135

Loader Device Accessory

Functionalities The Loader Device Accessory can be used in the following cases: Transfer from SoMachine to the USB memory key (see page 142) z Upload from the controller to the USB memory key (see page 144) z Download from the USB memory key to the controller (see page 146) z Set the controller to RUNNING state (see page 150) z Update the firmware of the Loader Device Accessory (see page 151)
z

WARNING
UNINTENDED EQUIPMENT OPERATION
z z

z z

You must have operational knowledge of your machine or process before connecting this device to your controller. Be sure that your machine or process is in a know safe state (STOP, SHUTDOWN, INERT, etc.) before transitioning the Loader Device Accessory to the On switch position while connected to your controller. Be sure that guards are in place so that any potential unintended equipment operation will not cause injury to personnel or damage to equipment. You must have read and understood the user documentation of this and other devices involved in the functions performed by the Loader Device Accessory.

Failure to follow these instructions can result in death, serious injury, or equipment damage.

136

EIO0000000827 12/2012

Loader Device Accessory

Physical Description
Overview

1 2 3 4 5 6 7 8 Battery

Batteries USB port for the Controller USB-mini B programming port USB port for the USB memory key ON / OFF switch Status LED ERR LED COM LED Power LED

The Loader Device Accessory use 2 AA / LR6 alkaline batteries.

WARNING
INOPERABLE EQUIPMENT
z z z z z z z

Store the batteries in a cool, well ventilated area. Prolonged short circuit causes the battery to lose energy. Do not try to recharge the batteries provided with the device. Do not install the batteries backwards. Immediately discard batteries that show any sign of leakage or damage. Discard used batteries in accordance with local regulations. Do not mix with other battery types.

Failure to follow these instructions can result in death, serious injury, or equipment damage.
EIO0000000827 12/2012

137

Loader Device Accessory

LED Status and Diagnostic


LED Status The following table describes the status of the Loader Device Accessory depending on the LED states:
PWR COM ERR STS Status Stand by Possible Causes

Normal communication Operation completed

Operation error This error is indicated when: z the USB memory key is full or damaged (file detected corrupted), z the communication between the controller and the Loader Device Accessory has been interrupted. z the controller could not run or stop. Dialog error detected This error is indicated when there is a communication error. For example, when: z the USB memory key and the controller USB ports are swapped (wrong port used), z USB memory key cannot be read or written (write protection active). This error is indicated when the files are not found. For example, when: z the USB memory key may be defective or is otherwise incompatible with the Loader Device Accessory, z the USB memory key or the controller is not connected or not formatted, z the USB memory key already has more than the expected number of files, z the controller has not been rebooted since the last connection with SoMachine. LED 0.5s flashing LED 0.1s flashing

File error detected

LED on
1

LED off

LED 2s flashing

LED 1s flashing

Battery low

138

EIO0000000827 12/2012

Loader Device Accessory

PWR

COM

ERR

STS

Status Compatibility error detected

Possible Causes This error is indicated when the controller reference and the reference stored in the *.app file of the USB memory key are not compatible (see page 140). This error is indicated when a wrong USB memory key version is used (see page 135).

Battery low Replace battery USB error detected

LED on
1

LED off

LED 2s flashing

LED 1s flashing

LED 0.5s flashing

LED 0.1s flashing

Battery low

EIO0000000827 12/2012

139

Loader Device Accessory

Firmware and SoMachine Software Compatibility


Firmware Compatibility Rule Logic controller firmware versions are made of 4 digits: X.Y.Z.T. NOTE: The controller version of your application can be found with SoMachine. See the programming guide of your particular controller. To successfully transfer an application to a controller, the firmware must be compatible. A compatible firmware must follow these rules: The controller reference must be the same z X.Y digits must be identical z The Z digit from the controller must be greater or equal to the Z digit from the application. z T digit is irrelevant.
z

SoMachine Software Compatibility The device can only be used with applications from SoMachine V2.0 or greater. In order to have compatibility with versions of SoMachine prior to version 3.1, it is necessary to perform additional steps while creating the necessary files for download to a controller with a USB memory key. When using SoMachine version 3.0 or earlier, or a project created with, or a context of, a version 3.0 or earlier, follow the steps below:
Step 1 2 3 4 5 Action Open or create the project you want to transfer with the USB memory key using SoMachine. Connect your USB memory key to your computer. NOTE: The USB memory key must be empty. Select in the menu Build Clean All. Select in the menu Build Build All. Select in the menu Online Create Boot Application. NOTE: SoMachine must be running in offline mode to be able to execute this command. Define your project name and save it in the root of the USB memory key. NOTE: Save the files in the root of the USB memory key. Otherwise they will not be detected by the Loader Device Accessory.

140

EIO0000000827 12/2012

Loader Device Accessory

You must execute the Clean All, Build All sequence (steps 3 and 4 in the table above) in order that your Retain Data are properly initialized in your project.

WARNING
UNINTENDED MACHINE OPERATION Be sure to execute the Clean All, Build All sequence described above if using a version of SoMachine inferior to version 3.1, or a project originally created with, or in a context of, a version inferior to version 3.1. Failure to follow these instructions can result in death, serious injury, or equipment damage.

EIO0000000827 12/2012

141

Loader Device Accessory

14.2

Transfer From SoMachine to the USB Memory Key

Transfer From SoMachine to the USB Memory Key


Procedure The following procedure describes how you can create the necessary files for download to a controller with a USB memory key.
Step 1 2 3 Action Open or create the project you want to transfer with the USB memory key using SoMachine. Connect your USB memory key to your computer. NOTE: The USB memory key must be empty. Select in the menu Online Create Boot Application. NOTE: SoMachine must be running in offline mode to be able to execute this command. Define your project name and save it in the root of the USB memory key. NOTE: Save the files in the root of the USB memory key. Otherwise they will not be detected by the Loader Device Accessory.

NOTE: Only save one project on the USB memory key. NOTE: If your project was created with a version of SoMachine inferior to version 3.1, or created in a context of a version less than 3.1, refer to the SoMachine software compatibility (see page 140) for important information.

142

EIO0000000827 12/2012

Loader Device Accessory

14.3

File Transfer with a USB Memory Key

What Is in This Section? This section contains the following topics:


Topic Upload From the Controller to the USB Memory Key Download From the USB Memory Key to the Controller Page 144 146

EIO0000000827 12/2012

143

Loader Device Accessory

Upload From the Controller to the USB Memory Key


Procedure

WARNING
UNINTENDED EQUIPMENT OPERATION
z z

z z

You must have operational knowledge of your machine or process before connecting this device to your controller. Be sure that your machine or process is in a know safe state (STOP, SHUTDOWN, INERT, etc.) before transitioning the Loader Device Accessory to the On switch position while connected to your controller. Be sure that guards are in place so that any potential unintended equipment operation will not cause injury to personnel or damage to equipment. You must have read and understood the user documentation of this and other devices involved in the functions performed by the Loader Device Accessory.

Failure to follow these instructions can result in death, serious injury, or equipment damage. The following procedure describes how to upload on your USB memory key the current project stored in the controller:
Step 1 Action Remove any file from the root of your USB memory key. If there is a controller pair of files in the USB memory key, the download (see page 146) function starts automatically. Power on your controller. Connect the USB memory key to the Loader Device Accessory. Connect the Loader Device Accessory to the controller with USB cable. Move the Loader Device Accessory On/Off switch to the On position. NOTE: The controller is set to STOPPED state. Wait for the files to be uploaded on the USB memory key. (LED (see page 138) at Normal operation state). At the end of the upload (LED (see page 138) at Operation complete state), move the Loader Device Accessory On/Off switch to the Off position.

2 3 4 5 6 7

144

EIO0000000827 12/2012

Loader Device Accessory

Step 8 9 10

Action Disconnect the Loader Device Accessory from the controller. Disconnect the USB memory key and the USB cable from the Loader Device Accessory. Execute a Run command (see page 58) or use the Set the controller to RUNNING state (see page 150) feature to set the controller to RUNNING state.

The Loader Device Accessory is automatically switched off z after 10 s, if the upload has been successfully completed. z after 60 s, if the upload has been unsuccessful.

EIO0000000827 12/2012

145

Loader Device Accessory

Download From the USB Memory Key to the Controller


Procedure

WARNING
UNINTENDED EQUIPMENT OPERATION
z z

z z

You must have operational knowledge of your machine or process before connecting this device to your controller. Be sure that your machine or process is in a know safe state (STOP, SHUTDOWN, INERT, etc.) before transitioning the Loader Device Accessory to the On switch position while connected to your controller. Be sure that guards are in place so that any potential unintended equipment operation will not cause injury to personnel or damage to equipment. You must have read and understood the user documentation of this and other devices involved in the functions performed by the Loader Device Accessory.

Failure to follow these instructions can result in death, serious injury, or equipment damage. The following procedure describes how to download to your controller the current project stored in the USB memory key:
Step 1 Action To download a project in the USB key: z without Symbol configuration: 1 pair of files (*.app and *.crc) must be stored in the root of the USB memory key. z with Symbol configuration: 2 pairs of files (*.app and *.crc, *_Symbols.app and *_Symbols.crc) must be stored in the root of the USB memory key. If there is no pair of files stored in the root of the USB memory key, the upload function (see page 144) starts automatically.

NOTICE
LOSS OF DATA
z z

Be sure if the physical controller reference and the controller reference in the application are compatible (see page 140). Be sure that all the necessary files are present before downloading any files to the controller.

Failure to follow these instructions can result in equipment damage.

146

EIO0000000827 12/2012

Loader Device Accessory

2 3 4 5 6

Power on the controller. Connect the USB memory key to the Loader Device Accessory. Connect the Loader Device Accessory to the controller with USB cable. Move the Loader Device Accessory On/Off switch to the On position. NOTE: The controller is set to STOPPED state. Wait until the files are downloaded to the controller. (LED (see page 138) at Normal operation state.) NOTE: The controller is in EMPTY State.

Interrupting a download can erase the controller memory.

NOTICE
INOPERABLE EQUIPMENT
z z z z

Do not disconnect the USB memory key during the download. Do not disconnect the USB cable to the controller during the download. Do not switch off the Loader Device Accessory during the download. Do not remove power from the controller.

Failure to follow these instructions can result in equipment damage. NOTE: In the event that the download was interrupted, move the Loader Device Accessory switch to the off position and back to the on position to restart the download.
Step 7 8 Action At the end of the download (LED (see page 138) at Operation complete state), move the Loader Device Accessory On/Off switch to the Off position. Reboot the controller by doing a power cycle for the application to be recognized.

Depending on your controller and/or configuration, the controller may be either in a RUNNING or a STOPPED state.

WARNING
UNINTENDED EQUIPMENT OPERATION Consult the controller state and behavior diagram in your controller programming guidestate and behavior diagram (see page 46) to understand the state that will be assumed by the controller after you cycle power. Failure to follow these instructions can result in death, serious injury, or equipment damage.
EIO0000000827 12/2012

147

Loader Device Accessory

9 10 11

Disconnect the Loader Device Accessory from the controller. Disconnect the USB memory key and the USB cable from the Loader Device Accessory. If your controller is in a STOPPED state, execute a Run command (see page 58) or use the Set the controller to RUNNING state (see page 150) feature to set the controller to RUNNING state.

The Loader Device Accessory is automatically switched off z after 10 s, if the download has been successfully completed. z after 60 s, if the download has been unsuccessful.

148

EIO0000000827 12/2012

Loader Device Accessory

14.4

Other Functionalities

What Is in This Section? This section contains the following topics:


Topic Set the Controller to RUNNING State Update the Firmware of the Loader Device Accessory Page 150 151

EIO0000000827 12/2012

149

Loader Device Accessory

Set the Controller to RUNNING State


Procedure

WARNING
UNINTENDED EQUIPMENT OPERATION
z z

z z

You must have operational knowledge of your machine or process before connecting this device to your controller. Be sure that your machine or process is in a know safe state (STOP, SHUTDOWN, INERT, etc.) before transitioning the Loader Device Accessory to the On switch position while connected to your controller. Be sure that guards are in place so that any potential unintended equipment operation will not cause injury to personnel or damage to equipment. You must have read and understood the user documentation of this and other devices involved in the functions performed by the Loader Device Accessory.

Failure to follow these instructions can result in death, serious injury, or equipment damage. The following procedure describes how to set a controller to RUNNING state using the Loader Device Accessory.
Step 1 2 3 4 5 Action Disconnect the USB key from the Loader Device Accessory. Connect the Loader Device Accessory to the controller. Move the Loader Device Accessory On/Off switch to the On position. NOTE: The controller is set in RUNNING state. Move the Loader Device Accessory On/Off switch to the Off position. Disconnect the Loader Device Accessory from the controller.

The Loader Device Accessory is automatically switched off after 10 s, if the update has been successfully completed. z after 60 s, if the update has been unsuccessful.
z

150

EIO0000000827 12/2012

Loader Device Accessory

Update the Firmware of the Loader Device Accessory


Procedure The following procedure describes how to update the Loader Device Accessory firmware:
Step 1 Action The USB memory key must only contain the following files:
z key.x.production.hex z plc.x.production.hex

Where x is the product firmware version. NOTE: Connect to www.schneider-electric.com to download the latest firmware update. 2 3 4 5 Connect the USB memory key to the Loader Device Accessory. Move the Loader Device Accessory On/Off switch to the On position. At the end of the update (LED (see page 138) at Operation complete state), move the Loader Device Accessory On/Off switch to the Off position. Disconnect the USB key from the Loader Device Accessory.

The Loader Device Accessory is automatically switched off z after 10 s, if the update has been successfully completed. z after 60 s, if the update has been unsuccessful.

EIO0000000827 12/2012

151

Loader Device Accessory

152

EIO0000000827 12/2012

Modicon M218 Logic Controller Updating the Controller Firmware EIO0000000827 12/2012

Updating the Controller Firmware

15
Overview This chapter provides detailed instructions on using the Windows Exec Loader to update the firmware of your M218 controller. What Is in This Chapter? This chapter contains the following topics:
Topic Updating Through USB Launching the Exec Loader Wizard Step 1 - Welcome Step 2 - Settings Step 3 - File and Device Exec Properties Step 4 - Transfer Progress Page 154 156 157 158 159 161

EIO0000000827 12/2012

153

Updating the Controller Firmware

Updating Through USB


Introduction Performing a firmware update will delete the current application program in the device, including the Boot Application in Flash memory.

NOTICE
LOSS OF APPLICATION DATA
z z

Perform a backup of the application program to the hard disk of the PC before attempting a firmware update. Restore the application program to the device after a successful firmware update.

Failure to follow these instructions can result in equipment damage. If there is a power outage or communication interruption during the transfer of the application program or a firmware update, your device may become inoperative. If a communication interruption or a power outage occurs, reattempt the transfer.

NOTICE
INOPERABLE EQUIPMENT
z z

Do not interrupt the transfer of the application program or a firmware update 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. The Serial Line 1 is configured for the SoMachine protocol by default when you add a new controller or when you update the controller firmware. The SoMachine protocol is incompatible with that of other protocols such as Modbus Serial Line. Connecting a new controller to, or updating the firmware of a controller connected to, an active Modbus configured serial line can cause the other devices on the serial line to stop communicating. Make sure that the controllers Serial Line 1port is not connected to an active Modbus serial line network and that the port is properly configured for the intended protocol before downloading a valid application.

154

EIO0000000827 12/2012

Updating the Controller Firmware

NOTICE
UNINTENDED EQUIPMENT OPERATION Be sure your application has the Serial Line port(s) properly configured for Modbus before physically connecting the controller to an operational Modbus Serial Line network. Failure to follow these instructions can result in equipment damage. Before starting the firmware update procedure, ensure you have:
z z

USB cable TSX CNA MUM3P Modicon M218 Logic Controller

This updating procedure is a maintenance operation. It requires that the controller be disconnected from the systems and applications it effects. The PC and the controller must stay connected during this operation. NOTE: If the PC and the controller are unintentionally disconnected during a firmware update, the controller will not function correctly until a new, successful firmware update operation is performed. Installing Cables Follow these steps to install the cables properly:
Step 1 2 3 Action Plug the TSX CNA MUM3P cable to an USB Port of your PC. (see page 130) Plug the second end of the cable to the USB port of the controller. Launch the Exec Loader Wizard USB (see page 156)

EIO0000000827 12/2012

155

Updating the Controller Firmware

Launching the Exec Loader Wizard


Introduction The Exec Loader wizard is a Windows-based wizard that guides you through the steps necessary to update the firmware of your M218 controller. The firmware is updated exclusively through the USB Programming Port of the M218. Opening the Exec Loader Wizard To launch the Exec Loader wizard, complete the following steps:
Step 1 2 Action Close all your windows applications, including virtual machines. If the gateway is running, right-click the CoDeSys Gateway Sys Try (running) icon in the task bar and select Stop Gateway.

When the gateway is stopped, the CoDeSys Gateway Sys Tray (stopped icon appears in the task bar:

ClickStart Programs Schneider Electric SoMachine Tools Exec Loader Wizard USB

Overview of Update Steps The wizard provides a screen for each step. The following table summarizes the 4 steps required to update your firmware:
Step 1 2 3 Screen Welcome (see page 157) Settings (see page 158) File and Device Exec Properties (see page 159) Transfer Progress (see page 161) Function Introduction to the Exec Loader wizard. Select the correct firmware file to transfer to your controller. Compare the hardware IDs and the firmware version information of the firmware file and the controller. Monitor the transfer of the firmware file to the controller.

156

EIO0000000827 12/2012

Updating the Controller Firmware

Step 1 - Welcome
Step 1 - Welcome The wizard provides a screen for each step. The Welcome screen is an introduction to the Exec Loader wizard. To continue:
z z

Select Next to continue the procedure and display the next screen, Step 2 Settings (see page 158). Select Close to close the screen without changing the firmware of your controller.

EIO0000000827 12/2012

157

Updating the Controller Firmware

Step 2 - Settings
Selecting Settings Use these steps to select the appropriate firmware:
Step 2 1 Action In Settings, click Browse and select the correct file for your controller model. Example: C:\Program Files\Schneider Electric\SoMachine\Firmware\M218\TM28LDAE40DRPHN.mfw Remove power from the Controller, as indicated on the screen. Select Next. During the progress bar, you will be prompted to re-apply power to the controller.

2 3

When the Exec Loader Wizard has successfully opened a connection with the controller, it goes automatically to step 3 (see page 159). If it doesnt, the progress bar will disappear and the Exec Loader Wizard go back to screen of Step1. Then you can select Next to try again. NOTE: Check the USB connection or reboot the controller by doing a power cycle.

158

EIO0000000827 12/2012

Updating the Controller Firmware

Step 3 - File and Device Exec Properties


Overview At this step, the following information is checked by the Exec Loader Wizard for both the firmware file and your controller before the procedure can continue:
z z

Hardware ID - the selected firmware file is correct for the target controller. Exec Version Number - the selected firmware file is newer than the currently installed firmware.

Hardware ID The Hardware ID is a unique identifier for each controller reference:


z z

Green check mark: OK Red cross: incorrect firmware file. Select a firmware file corresponding to your controller reference (go back to step 2 (see page 158))

EIO0000000827 12/2012

159

Updating the Controller Firmware

Exec Version Number The Exec Version Number identifies the version of the firmware:
z z

Green check mark: you will update your controller to a newer version of the firmware Yellow check mark: you will downgrade your controller to an older version of the firmware or update your controller with the same version of the current firmware

Starting the Transfer Click on the Next button to start the transfer.

160

EIO0000000827 12/2012

Updating the Controller Firmware

Step 4 - Transfer Progress


Overview In this screen you can monitor the transfer progress. The remaining time information is available after a while. If Transfer is Successful If the transfer is successful, a message box is displayed to allow for another transfer. Two options are available:
z z

Yes - the wizard returns to Step 2 - Settings (see page 158) and you can set up another transfer. No - click on the Close button to exit the wizard. This completes the update procedure.

If Transfer is not Successful If the transfer is interrupted (for example, due to a loss of communication), a message box is displayed allowing a retry of the transfer. Two options are available:
z z

Yes - the wizard returns to Step 3 - Files and Device Exec Properties (see page 159) and you can try another transfer. No - click on the Close button to exit the wizard.

Your controller remains inoperative until a successful transfer has been accomplished.

NOTICE
INOPERABLE EQUIPMENT
z z

Do not interrupt the transfer of the application program or a firmware update 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.

EIO0000000827 12/2012

161

Updating the Controller Firmware

162

EIO0000000827 12/2012

Modicon M218 Logic Controller Modicon M218 Logic Controller - Troubleshooting and FAQ EIO0000000827 12/2012

Modicon M218 Logic Controller Troubleshooting and FAQ

16
Page 164 171

What Is in This Chapter? This chapter contains the following topics:


Topic Troubleshooting Frequently Asked Questions

EIO0000000827 12/2012

163

Modicon M218 Logic Controller - Troubleshooting and FAQ

Troubleshooting
Introduction This section describes the procedures to troubleshoot your Modicon M218 Logic Controller. Transferring the Application is not Possible Possible causes: The PC cannot communicate with the controller. z Is your application valid? z Is the CoDeSys gateway running?
z

Resolution: z Refer to the part below (Communication Between SoMachine and the Modicon M218 Logic Controller (see page 165)). z Your application program must be valid. For more information, refer to the CoDeSys online help in SoMachine: Concepts and Base Concepts Debugging z The CoDeSys gateway must be running: a. click the CoDeSys Gateway SysTray(stopped) icon in the task bar, b. select Start Gateway.

164

EIO0000000827 12/2012

Modicon M218 Logic Controller - Troubleshooting and FAQ

Communication Between SoMachine on a Computer and the Modicon M218 Logic Controller is not Possible Possible causes: z Incorrect cable usage. z The controller is not detected by the PC. z Communication settings are not correct. z The controller is not correctly operating. Resolution:

EIO0000000827 12/2012

165

Modicon M218 Logic Controller - Troubleshooting and FAQ

Check 1

Action Check that:


z the cable is correctly linked to the controller and to the PC and not damaged, z you use the specific cable depending on the connection type: z TSX CNA MUM3P cable for an USB connection.

Check that the Modicon M218 Logic Controller has been detected by your PC: 1. click Start Control Panel System, select the Hardware tab and click Device Manager,

2. check that the Modicon M218 Logic Controller node appears in the list: .

3. If the Modicon M218 Logic Controller node does not appear or if there is an node, unplug/plug the cable on the controller side. 3

icon in front of the

Check that the active path is correct: 1. double click the Controller node in the Devices window, 2. check that the Modicon M218 Logic Controller node appears in bold and not in italic. If not: a. stop the CoDeSys Gateway: right click the CoDeSys Gateway SysTray(running) icon

in the task bar and select Stop Gateway, b. unplug/plug the cable on the controller side, c. start the CoDeSys gateway: right click the CoDeSys Gateway SysTray(stopped) icon

in the task bar and select Start Gateway , d. select the gateway in the Controller configuration window of SoMachine and click Scan network. Select the Modicon M218 Logic Controller node and click Set active path. NOTE: If your PC is connected to an Ethernet network, its address might change. In this case, the currently active path set is not correct anymore and the Modicon M218 Logic Controller node appears in italic. Select the Modicon M218 Logic Controller node and click Resolve Name. The node must not appear in italic anymore, click Set Active Path. 4 Refer to the System & I/O Diagnostic LEDs (see Modicon M218 Logic Controller, Hardware Guide) section.

Application Program is not Executed Possible causes: No POU is declared in the task. Resolution: As POUs are managed by tasks, you must at least add a POU to a task: 1. double click a task in the Devices window, 2. click Add POU in the task window, 3. select the POU you want to execute in the Input Assistant window and click OK.

166

EIO0000000827 12/2012

Modicon M218 Logic Controller - Troubleshooting and FAQ

Possible causes: z Application does not go to RUN state. z One input is configured in RUN/STOP mode. z Run/Stop Switch is switched to Stop position. Resolution: z Use the input configured in RUN/STOP mode to run the application. z Turn Run/Stop Switch to the Run position.

EIO0000000827 12/2012

167

Modicon M218 Logic Controller - Troubleshooting and FAQ

CoDeSys Gateway does not Start (CoDeSys Gateway SysTray icon is black) Possible cause: Connection during a long time. Resolution: If the CoDeSys Gateway SysTray icon is black (stopped): 1. Open the task Manager, 2. stop the Gatewayservice.exe, and start it again: z Reset your computer or, z in Control Panel, open Administrative Tools and Computer Management, z in Service, double click CoDeSys Gateway, z Click Start Service button. 3. Control if the CoDeSys Gateway SysTray icon is red (running). Serial Line Communication is not Possible Possible causes: z Communication settings are not identical between serial line devices. z The controller is not correctly operating. Resolution: Check that: z Protocol communication settings (baud rate, parity...) are identical for all serial line devices. z The correct communication manager is added on the Serial Line object: z Modbus manager if the line is used for Modbus protocol, z SoMachine-Network Manager if the line is used for communication to access IEC variable.
z

The controller operates correctly. Refer to the System & I/O Diagnostic LEDs (see Modicon M218 Logic Controller, Hardware Guide) section.

Creating the Boot Application is not Possible Possible cause: The operation is not possible while the controller is in RUN state. Resolution:
z z

Select Stop Application, Select Create Boot Project.

168

EIO0000000827 12/2012

Modicon M218 Logic Controller - Troubleshooting and FAQ

PTO Function does not Start Possible cause: The AUX input is configured as Drive ready but not used. Resolution:
z z

If the AUX variable is set to Drive_Ready, check that the Drive is correctly operating, or set the Dis_Drive_Ready variable of the PTOsimple function block to 0.

Changing Device Name do not Work Possible cause: Application is running. Resolution:
z z

Select Stop Application, Change device name.

Monitoring of the POU is Slow Possible cause: Task interval is too small or POUs is too great. Resolution:
z z

Increase the configured task interval. Split the application in smaller POUs.

ERR LED is Flashing Fast on the PLC Possible cause: A system error was detected. Resolution: Check your application program (pointer management, arrays management, etc...).

EIO0000000827 12/2012

169

Modicon M218 Logic Controller - Troubleshooting and FAQ

Controller is in HALT State Possible cause: The PLC has stopped due to a watchdog event.
z

Resolution: If a task watchdog is configured: a. Run the application without task watchdog b. Get the maximum task cycle time from the task monitor c. Set the task watchdog greater than the maximum task cycle time If a task watchdog is not configured: z If a Cyclic task is configured, increase the cycle time to a value > 1.25 times the average task time z If several tasks are configured, one of these is a Freewheeling task, try reconfiguring the Freewheeling task as a Cyclic task

Possible cause: A division by 0 is detected in the application program. Resolution: Check your application program. Use POUs for implicit checks in your application to manage this kind of situation. Source Download Leads to Communication Error The following table describes the possible causes of a communication error during Source Download:
Possible Cause You attempted to download the source while the controller was in a RUN state. The source file exceeded the available memory space in the controller. Resolution Stop the controller before attempting the download.

If sending additional files with the source, considering deselecting them to reduce the overall size of the download. See Project Project Settings Source Download Additional Files... in the SoMachine main menu.

170

EIO0000000827 12/2012

Modicon M218 Logic Controller - Troubleshooting and FAQ

Frequently Asked Questions


How Can I Determine the Firmware, Boot and Coprocessor Version of the Controller? The Device Identification area of the controller Services tab (see page 71) provides information about versions. To acces the Services tab, proceed as follows:
Step 1 2 Action In online mode, from the graphical configuration editor, double-click the controller. Select the Services tab.

What Programming Languages Are Supported by a Modicon M218 Logic Controller? Refer to key features of Modicon M218 Logic Controller (see page 13). What Variable Types Are Supported by a Modicon M218 Logic Controller? Refer to supported data types. (see page 23) When Should I Use Freewheeling or Cyclic Task Type? Freewheeling or cyclic task type usage are described in Task Types (see page 38): z Freewheeling: use this setting if you accept to have a variable cycle time. The next cycle will start after a waiting duration equals 30% of the last cycle execution duration. z Cyclic: use this mode if you want to control the cycle time. What Are the Effects of Cold/Warm Restart? Refer to Reset Cold/Reset Warm (see page 59). Can I Connect Several M218 Controllers Through Several USB Ports to My PC? No, because driver conflicts may occur.

EIO0000000827 12/2012

171

Modicon M218 Logic Controller - Troubleshooting and FAQ

Why Is the Communication Between the HMI and the Controller Interrupted when Making Online Changes? When online changes are made to a M218 application, the Symbol Configuration is downloaded. This results in a temporary interruption of the communication. It occurs when the protocol used between the controller and the HMI is the SoMachine network protocol. Can I Simulate the Physical Controller Behavior with the Simulation Mode? No. The simulation mode is only used to simulate the logic of the user application, not the Controller hardware behavior.

172

EIO0000000827 12/2012

Modicon M218 Logic Controller EIO0000000827 12/2012

Appendices

Overview This appendix lists the documents necessary for technical understanding of the M218 Programming Guide. What Is in This Appendix? The appendix contains the following chapters:
Chapter A B C Chapter Name Function and Function Block Representation Functions to get/set serial line configuration in user program Controller Performance Page 175 185 191

EIO0000000827 12/2012

173

174

EIO0000000827 12/2012

Modicon M218 Logic Controller Function and Function Block Representation EIO0000000827 12/2012

Function and Function Block Representation

Overview Each function can be represented in the following languages: z IL: Instruction List z ST: Structured Text z LD: Ladder Diagram z FBD: Function Block Diagram z CFC: Continuous Function Chart This chapter provides functions and function blocks representation examples and explains how to use them for IL and ST languages. What Is in This Chapter? This chapter contains the following topics:
Topic Differences Between a Function and a Function Block How to Use a Function or a Function Block in IL Language How to Use a Function or a Function Block in ST Language Page 176 177 181

EIO0000000827 12/2012

175

Function and Function Block Representation

Differences Between a Function and a Function Block


Function A function: is a POU (Program Organization Unit) that returns one immediate result z is directly called with its name (not through an Instance) z has no persistent state from one call to the other z can be used as an operand in other expressions
z

Examples: boolean operators (AND), calculations, conversion (BYTE_TO_INT) Function Block A function block: is a POU (Program Organization Unit) that returns one or more outputs z is always called through an Instance (function block copy with dedicated name and variables) z each Instance has a persistent state (outputs and internal variables) from one call to the other
z

Examples: timers, counters In the example below, Timer_ON is an instance of the Function Block TON:

176

EIO0000000827 12/2012

Function and Function Block Representation

How to Use a Function or a Function Block in IL Language


General Information This part explains how to implement a Function and a Function Block in IL language. Functions IsFirstMastCycle and SetRTCDrift and Function Block TON are used as examples to show implementations. Using a Function in IL Language The following procedure describes how to insert a function in IL language:
Step 1 Action Open or create a new POU in Instruction List language. NOTE: The procedure to create a POU is not detailed here. For more information, refer to the SoMachine global help. Create the variables that the function requires. If the function has 1 or more inputs, start loading the first input using LD instruction. Insert a new line below and: z type the name of the function in the operator column (left field), or z use the Input Assistant to select the function (select Insert Box in context menu). If the function has more than 1 input and when Input Assistant is used, the necessary number of lines is automatically created with ??? in the fields on the right. Replace the ??? with the appropriate value or variable that corresponds to the order of inputs. Insert a new line to store the result of the function into the appropriate variable: type ST instruction in the operator column (left field) and the variable name in the field on the right.

2 3 4

To illustrate the procedure, consider the Functions IsFirstMastCycle (without input parameter) and SetRTCDrift (with input parameters) graphically presented below:
Function without input parameter: IsFirstMastCycle Graphical Representation

with input parameters: SetRTCDrift

In IL language, the function name is used directly in the Operator Column:


EIO0000000827 12/2012

177

Function and Function Block Representation

Function IL example of a function without input parameter: IsFirstMastCycle

Representation in SoMachine POU IL Editor

IL example of a function with input parameters: SetRTCDrift

178

EIO0000000827 12/2012

Function and Function Block Representation

Using a Function Block in IL language The following procedure describes how to insert a function block in IL language:
Step 1 Action Open or create a new POU in Instruction List language. NOTE: The procedure to create a POU is not detailed here. For more information, refer to the SoMachine global help. Create the variables that the function block requires, including the instance name. Function Blocks are called using a CAL instruction:
z Use the Input Assistant to select the FB (right-click and select Insert Box in context menu). z Automatically, the CAL instruction and the necessary I/O are created.

2 3

Each parameter (I/O) is an instruction:


z Value to inputs are set by ":=". z Values to outputs are set by "=>".

4 5

In the CAL right-side field, replace ??? with the instance name. Replace other ??? with an appropriate variable or immediate value.

To illustrate the procedure, consider this example with the TON Function Block graphically presented below:
Function Block TON Graphical Representation

EIO0000000827 12/2012

179

Function and Function Block Representation

In IL language, the function block name is used directly in the Operator Column:
Function Block TON Representation in SoMachine POU IL Editor

180

EIO0000000827 12/2012

Function and Function Block Representation

How to Use a Function or a Function Block in ST Language


General Information This part explains how to implement a Function and a Function Block in ST language. Function SetRTCDrift and Function Block TON are used as examples to show implementations. Using a Function in ST Language The following procedure describes how to insert a function in ST language:
Step 1 Action Open or create a new POU in Structured Text language. NOTE: The procedure to create a POU is not detailed here. For more information, refer to the SoMachine global help. Create the variables that the function requires. Use the general syntax in the POU ST Editor for the ST language of a function. The general syntax is: FunctionResult:= FunctionName(VarInput1, VarInput2,.. VarInputx);

2 3

To illustrate the procedure, consider the function SetRTCDrift graphically presented below:
Function SetRTCDrift Graphical Representation

The ST language of this function is the following:


Function SetRTCDrift Representation in SoMachine POU ST Editor PROGRAM MyProgram_ST VAR myDrift: SINT(-29..29) := 5; myDay: DAY_OF_WEEK := SUNDAY; myHour: HOUR := 12; myMinute: MINUTE; myRTCAdjust: RTCDRIFT_ERROR; END_VAR myRTCAdjust:= SetRTCDrift(myDrift, myDay, myHour, myMinute);

EIO0000000827 12/2012

181

Function and Function Block Representation

Using a Function Block in ST Language The following procedure describes how to insert a function block in ST language:
Step 1 Action Open or create a new POU in Structured Text language. NOTE: The procedure to create a POU is not detailed here. For more information, refer to the SoMachine global help. Create the input and output variables and the instance required for the function block:
z Input variables are the input parameters required by the function block z Output variables receive the value returned by the function block

Use the general syntax in the POU ST Editor for the ST language of a Function Block. The general syntax is: FunctionBlock_InstanceName(Input1:=VarInput1, Input2:=VarInput2,... Ouput1=>VarOutput1, Ouput2=>VarOutput2,...);

To illustrate the procedure, consider this example with the TON function block graphically presented below:
Function Block TON Graphical Representation

182

EIO0000000827 12/2012

Function and Function Block Representation

The following table shows examples of a function block call in ST language:


Function Block TON Representation in SoMachine POU ST Editor

EIO0000000827 12/2012

183

Function and Function Block Representation

184

EIO0000000827 12/2012

Modicon M218 Logic Controller Functions to get/set serial line configuration in user program EIO0000000827 12/2012

Functions to get/set serial line configuration in user program

Overview This section describes the functions to get/set the serial line configuration in your program. To use these functions, you must add the M218 Communication library. For further information on adding a library, refer to the SoMachine Programming Guide (see SoMachine, Programming Guide). What Is in This Chapter? This chapter contains the following topics:
Topic GetSerialConf: Get the Serial Line Configuration SetSerialConf: Change the Serial Line Configuration SERIAL_CONF: Structure of the Serial Line Configuration Data Type Page 186 187 189

EIO0000000827 12/2012

185

Functions to get/set serial line configuration in user program

GetSerialConf: Get the Serial Line Configuration


Function Description GetSerialConf returns the configuration parameters for a specific serial line communication port. Graphical Representation

Parameter Description
Input Link Type LinkNumber (see SoMachine, Modbus and ASCII Read/Write Functions, PLCCommunication Library Guide) POINTER TO SERIAL_CONF (see page 189) Comment Link is the communication port number.

PointerToSerialConf

PointerToSerialConf is the address of the configuration structure (variable of SERIAL_CONF type) in which the configuration parameters are stored. The ADR standard function must be used to define the associated pointer. (See the example below.)

Output GetSerialConf

Type WORD

Comment This function returns: z 0: The configuration parameters are returned z 255: The configuration parameters are not returned because: z the function was not successful z the function is in progress

Example Refer to the SetSerialConf (see page 188) example.

186

EIO0000000827 12/2012

Functions to get/set serial line configuration in user program

SetSerialConf: Change the Serial Line Configuration


Function Description SetSerialConf is used to change the serial line configuration. Graphical Representation

NOTE: Changing the configuration of the Serial Line(s) port(s) during programming execution can interrupt ongoing communications with other connected devices.

WARNING
LOSS OF CONTROL DUE TO UNEXPECTED CONFIGURATION CHANGE Be sure to validate and test all the parameters of the SetSerialConf function before putting your program into service. Failure to follow these instructions can result in death, serious injury, or equipment damage. Parameter Description
Input Link Type LinkNumber (see SoMachine, Modbus and ASCII Read/Write Functions, PLCCommunication Library Guide) POINTER TO SERIAL_CONF (see page 189) Comment LinkNumber is the communication port number.

PointerToSerialConf

PointerToSerialConf is the address of the configuration structure (variable of SERIAL_CONF type) in which the new configuration parameters are stored. The ADR standard function must be used to define the associated pointer. (See the example below.) If 0, set the application default configuration to the serial line.

EIO0000000827 12/2012

187

Functions to get/set serial line configuration in user program

Output SetSerialConf

Type WORD

Comment This function returns:


z 0: The new configuration is set z 255: The new configuration is refused because: z the function is in progress z the input parameters are not valid

Example VAR MySerialConf: SERIAL_CONF result: WORD; END_VAR (*Get current configuration of serial line 1*) GetSerialConf(1, ADR(MySerialConf)); (*Change to modbus RTU slave address 9*) MySerialConf.Protocol := 0; (*Modbus RTU/Somachine protocol (in this case CodesysCompliant selects the protocol)*) MySerialConf.CodesysCompliant := 0; (*Modbus RTU*) MySerialConf.address := 9; (*Reconfigure the serial line 1*) result := SetSerialConf(1, ADR(MySerialConf)); (*Set modbus address to 9*)

188

EIO0000000827 12/2012

Functions to get/set serial line configuration in user program

SERIAL_CONF: Structure of the Serial Line Configuration Data Type


Structure Description The SERIAL_CONF structure contains configuration information about the serial line port. It contains these variables:
Variable Bauds InterframeDelay FrameReceivedTimeout Type DWORD WORD WORD Description baud rate minimum time (in ms) between 2 frames in Modbus (RTU, ASCII) In the ASCII protocol, FrameReceivedTimeout allows the system to conclude the end of a frame at reception after a silence of the specified number of ms. If 0 this parameter is not used. In the ASCII protocol, FrameLengthReceived allows the system to conclude the end of a frame at reception, when the controller received the specified number of characters. If 0, this parameter is not used. 0: Modbus RTU or SoMachine (see CodesysCompliant) 1: Modbus ASCII 2: ASCII Address Parity BYTE BYTE Modbus address 0 to 255 (0 for Master) 0: none 1: odd 2: even Rs485 ModPol (polarizartion resistor) DataFormat StopBit CharFrameStart BYTE BYTE BYTE BYTE BYTE 0: RS232 1: RS485 0: no 1: yes 7 bits or 8 bits 1: 1 stop bit 2: 2 stop bits In the ASCII protocol, 0 means there is no start character in the frame. Otherwise, the corresponding ASCII character is used to detect the beginning of a frame in receiving mode. In sending mode, this character is added at the beginning of the user frame. In the ASCII protocol, 0 means there is no second end character in the frame. Otherwise, the corresponding ASCII character is used to detect the end of a frame in receiving mode. In sending mode, this character is added at the end of the user frame.

FrameLengthReceived

WORD

Protocol

BYTE

CharFrameEnd1

BYTE

EIO0000000827 12/2012

189

Functions to get/set serial line configuration in user program

Variable CharFrameEnd2

Type BYTE

Description In the ASCII protocol, 0 means there is no second end character in the frame. Otherwise, the corresponding ASCII character is used (along with CharFrameEnd1) to detect the end of a frame in receiving mode. In sending mode, this character is added at the end of the user frame. 0: Modbus RTU 1: SoMachine (when Protocol = 0)

CodesysCompliant CodesysNetType

BYTE BYTE

not used

190

EIO0000000827 12/2012

Modicon M218 Logic Controller M218 - Controller Performance) EIO0000000827 12/2012

Controller Performance

C
Processing Performance
Introduction This chapter provides information about the M218 controller processing performance. Logic Processing The following table shows logic processing performance for various logical instructions:
IL Instruction Type Addition/subtraction/multiplication of INT Addition/subtraction/multiplication of DINT Addition/subtraction/multiplication of REAL Division of REAL Operation on BOOLEAN, e.g. Status:= Status and value LD INT + ST INT LD DINT + ST DINT LD REAL + ST REAL Duration for 1000 instructions 380 s 401 s 7608 s 15978 s 572 s 386 s 430 s 750 s

Basic System Time The following table shows the basic overhead performance for each MAST cycle:
I/O type Embedded Inputs & Internal Processing Embedded Outputs Overhead for each MAST cycle 1500 s 450 s

EIO0000000827 12/2012

191

M218 - Controller Performance)

HSC, PWM, PTO and Frequency Generator Processing The following table shows the processing performance for complex functions for each MAST cycle:
Complex function type HSC Simple HSC Main PWM PTO Simple Frequency Generator Overhead for each MAST cycle 150 s 350 s 150 s 200 s 150 s

Communication and System Processing Time The communication processing time varies, depending on the number of sent/received requests. Response Time on Event The response time shown in the following table represents the time between a signal rising edge on an input triggering an external task and the edge of an output set by this task. The event task also process 100 IL instructions before setting the output:
Minimum 950 s Typical 1200 s Maximum 2000 s

192

EIO0000000827 12/2012

Modicon M218 Logic Controller Glossary EIO0000000827 12/2012

Glossary

0-9
%I According to the IEC standard, %I represents an input bit (for example a language object of type digital IN).

%IW According to the IEC standard, %IW represents an input word register (for example a language object of type analog IN).

%MW According to the IEC standard, %MW represents a memory word register (for example a language object of type memory word).

%Q According to the IEC standard, %Q represents an output bit (for example a language object of type digital OUT).

%QW According to the IEC standard, %QW represents an output word register (for example a language object of type analog OUT).

EIO0000000827 12/2012

193

Glossary

A
analog input An analog input module contains circuits that convert an analog DC input signal to a digital value that can be manipulated by the processor. By implication, the analog input is usually direct. That means a data table value directly reflects the analog signal value.

analog output An analog output module contains circuits that transmit an analog DC signal proportional to a digital value input to the module from the processor. By implication, these analog outputs are usually direct. That means a data table value directly controls the analog signal value.

application source The application source file can be uploaded to the PC to reopen a SoMachine project. This source file can support a full SoMachine project (for example, one that includes HMI application).

ARP The address resolution protocol is the IP network layer protocol for Ethernet that maps an IP address to a MAC (hardware) address.

ARRAY An ARRAY is a table containing elements of a single type. The syntax is as follows: ARRAY [<limits>] OF <Type> Example 1: ARRAY [1..2] OF BOOL is a 1-dimensional table with 2 elements of type BOOL. Example 2: ARRAY [1..10, 1..20] OF INT is a 2-dimensional table with 10x20 elements of type INT. ASCII The american standard code for information interchange is a communication protocol for representing alphanumeric characters (letters, numbers, and certain graphic and control characters).

194

EIO0000000827 12/2012

Glossary

assigned variable A variable is "assigned" if its location in controller memory can be known. For example, the Water_pressure variable is said to be assigned through its association with memory location %MW102.Water_pressure. AWG The american wire gauge standard specifies wire gauges in North America.

B
BCD The binary coded decimal format represents decimal numbers between 0 and 9 with a set of 4 bits (a nybble/nibble, also titled as Halfbyte). In this format, the 4 bits used to encode decimal numbers have an unused range of combinations. For example, the number 2,450 is encoded as 0010 0100 0101 0000 BOOL A Boolean type is the basic data type in computing. A BOOL variable can have one of these values: 0 (FALSE), 1 (TRUE). A bit that is extracted from a word is of type BOOL, for example: %MW10.4 is a fifth bit a memory word number 10. Boot application Files that contain machine dependent parameters: z machine name z device name or IP address z Modbus Serial Line address z Routing table

BOOTP The bootstrap protocol is 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 clients MAC address. The server which maintains a pre-configured table of client device MAC addresses and associated IP addressessends 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.

EIO0000000827 12/2012

195

Glossary

bps bit per second as a definition of transmission rate, also given in conjunction with multiplicator kilo (kbps) and mega (mbps).

BYTE When 8 bits are grouped together, they are called a BYTE. You can enter a BYTE either in binary mode or in base 8. The BYTE type is encoded in an 8-bit format that ranges from 16#00 to 16#FF (in hexadecimal format).

C
CFC The continuous function chart (an extension of the IEC61131-3 standard) is a graphical programming language that works like a flowchart. By adding simple logicals blocks (AND, OR, etc.), each function or function block in the program is represented in this graphical format. For each block, the inputs are on the left and the outputs on the right. Block outputs can be linked to inputs of other blocks in order to create complex expressions.

controller A controller (or programmable logic controller, or programmable controller) is used to automate industrial processes.

controller status output The controller status output is a special function used in circuits that are external to the controller that control the power supply to the output devices or the controllers power supply.

CRC A network messages cyclic redundancy check field contains a small number of bits that produce a checksum. The message is calculated by the transmitter according to the messages content. Receiving nodes then recalculate the field. Any discrepancy in the two CRC fields indicates that the transmitted message and the received message are different.

CTS Clear to send is a data transmission signal and acknowledges the RDS signal from the transmitting station.

196

EIO0000000827 12/2012

Glossary

cyclic task The cyclic scan time has a fixed duration (interval) specified by the user. If the current scan time is shorter than the cyclic scan time, the controller waits until the cyclic scan time has elapsed before starting a new scan.

D
data log The controller logs events relative to the user application in a data log.

DHCP The dynamic host configuration protocol is an advanced extension of BOOTP. DHCP is a more advanced, but both DHCP and BOOTP are common. (DHCP can handle BOOTP client requests.)

digital I/O A digital input or output has an individual circuit connection at the electronic module that corresponds directly to a data table bit that holds the value of the signal at that I/O circuit. It gives the control logic digital access to I/O values.

DIN Deutsches Institut fr Normung is a German institution that sets engineering and dimensional standards.

DINT A double integer type is encoded in a 32-bit format.

DNS The domain name system is the naming system for computers and devices connected to a LAN or the Internet.

drop cable A drop cable is the unterminated derivation cord used to connect a TAP to a device.

DSR Data set ready is a data transmission signal.

EIO0000000827 12/2012

197

Glossary

DTM With device type managers representing the field device in SoMachine, direct communications are possible to every single field device via SoMachine, the controller and the field bus, thus avoiding the need for individual cable connections.

DWORD A double word type is encoded in a 32-bit format.

E
EDS Electronic data sheet contains for example the properties of a device e.g. parameters and settings of a drive.

EEPROM Electrically erasable programmable read-only memory is a type of non-volatile memory used to store data that must be saved when power is removed.

EIA The electronic industries alliance is the trade organization for establishing electrical/electronic and data communication standards (including RS-232 and RS485) in the United States.

EIA rack An electronic industries alliance rack is a standardized (EIA 310-D, IEC 60297 and DIN 41494 SC48D) system for mounting various electronic modules in a stack or rack that is 19 inches (482.6 mm) wide.

electronic module In a programmable controller system, most electronic modules directly interface to the sensors, actuators, and external devices of the machine/process. This electronic module is the component that mounts in a bus base and provides electrical connections between the controller and the field devices. Electronic modules are offered in a variety of signal levels and capacities. (Some electronic modules are not I/O interfaces, including power distribution modules and transmitter/receiver modules.)

198

EIO0000000827 12/2012

Glossary

EN EN identifies one of many European standards maintained by CEN (European Committee for Standardization), CENELEC (European Committee for Electrotechnical Standardization), or ETSI (European Telecommunications Standards Institute).

encoder An encoder is a device for length or angular measurement (linear or rotary encoders).

Ethernet Ethernet is a physical and data link layer technology for LANs, also known as IEE 802.3.

EtherNet/IP The ethernet industrial protocol is an open communications protocol for manufacturing automation solutions in industrial systems. EtherNet/IP is in a family of networks that implements Common Industrial Protocol at its upper layers. The supporting organization (ODVA) specifies EtherNet/IP to accomplish global adaptability and media independence.

expansion I/O module An expansion input or output module is either a digital or analog module that adds additional I/O to the base controller.

F
FAST I/O FAST I/Os are specific I/Os with some electrical features (response time, for example) but the treatment of these channels is done by the Controller CPU.

FAST task The FAST task is a periodic, high-priority task of a short duration that is run on a processor through its programming software. The tasks fast speed keeps it from interfering with the execution of lower priority master (MAST) tasks. A FAST task is useful when fast periodic changes in discrete inputs need to be monitored.

EIO0000000827 12/2012

199

Glossary

FB A function block performs a specific automation function, such as speed control, interval control, or counting. A function block comprises configuration data and a set of operating parameters.

FBD A function block diagram is a graphically oriented programming language, compliant with IEC 61131-3. It works with a list of networks whereby each network contains a graphical structure of boxes and connection lines which represents either a logical or arithmetic expression, the call of a function block, a jump, or a return instruction.

FDT Field device tool for standardized communications between field devices and SoMachine.

FE Functional ground is the point of a system or device that must be grounded to help prevent equipment damage.

FG frequency generator

firmware The firmware represents the operating system on a controller.

Flash memory Flash memory is nonvolatile memory that can be overwritten. It is stored on a special EEPROM that can be erased and reprogrammed.

FTP File transfer protocol is a standard network protocol (built on a client-server architecture), to exchange and manipulate files over TCP/IP based networks.

200

EIO0000000827 12/2012

Glossary

function A function: z is a POU that returns 1 immediate result z is directly called with its name (as opposed to through an instance) z has no persistent state from one call to the next z can be used as an operand in expressions Examples: boolean (AND) operators, calculations, conversions (BYTE_TO_INT)

function block (FB) See FB.

function block diagram (FBD) See FBD.

G
GVL The global variable list manages global variables that are available in every application POU.

H
HE10 Rectangular connector for electrical signals with frequencies below 3MHz, complying with IEC60807-2.

HMI A human-machine interface is an operator interface (usually graphical) for industrial equipment.

HSC high-speed counter

HVAC Heating ventilation and air conditioning applications monitor and control indoor environments.

EIO0000000827 12/2012

201

Glossary

I
I/O input/output

I/O scan An input/output scan continuously polls I/O modules to collect data bits and status, error, and diagnostics information. This process monitors inputs and controls outputs.

I/O terminal An input/output terminal on the front of an expansion I/O module connects input and output signals.

ICMP The internet control message protocol reports errors and provides information related to datagram processing.

IEC The international electrotechnical commission is a non-profit and non-governmental international standards organization that prepares and publishes international standards for all electrical, electronic, and related technologies.

IEC 61131-3 The IEC 61131-3 is an international electrotechnical commission standard for industrial automation equipment (like controllers). IEC 61131-3 deals with controller programming languages and defines 2 graphical and 2 textual programming language standards: z graphical: ladder diagram, function block diagram z textual: structured text, instruction list

IEEE The institute of electrical and electronics engineers is a non-profit international standards and conformity assessment body for advances in all fields of electrotechnology.

202

EIO0000000827 12/2012

Glossary

IEEE 802.3 IEEE 802.3 is a collection of IEEE standards defining the physical layer, and the media access control (MAC) sublayer of the data link layer, of wired Ethernet.

IL A program written in the instruction list language is composed of a series of instructions executed sequentially by the controller. Each instruction includes a line number, an instruction code, and an operand. (IL is IEC 61131-3 compliant.)

immediate addressing The direct method of addressing memory objects, including physical inputs and outputs, used in programming instructions as operands and parameters by using their direct address (for example, %Iwx or %QWx). The use of immediate addressing in your program may avoid the need to create symbols for these objects, but there are also disadvantages. For example, if you change the programs configuration by adding or deleting devices or I/O modules or slices, the immediate addresses used as programming instruction operands and/or parameters are not updated and must be corrected manually, which may cause extensive program modifications and lead to incorrect programming instructions. (See symbolic addressing.)

input filter An input filter is a special function that rejects input noises. It is useful for eliminating input noises and chatter in limit switches. All inputs provide a level of input filtering using the hardware. Additional filtering with software is also configurable through the programing or the configuration software.

input terminal An input terminal on the front of an expansion I/O module connects input signals from input devices (such as sensors, push buttons, and limit switches). For some modules, input terminals accept both sink and source DC input signals.

instruction list language (IL) Refer to IL.

INT A single integer is encoded in 16 bits.

EIO0000000827 12/2012

203

Glossary

IP The internet protocol is part of the TCP/IP protocol family that tracks the Internet addresses of devices, routes outgoing messages, and recognizes incoming messages.

IP 20 Ingress protection rating according to IEC 60529. IP20 modules are protected against ingress and contact of objects larger than 12.5 mm. The module is not protected against harmful ingress of water.

IP 67 Ingress protection rating according to IEC 60529. IP67 modules are completely protected against ingress of dust and contact. Ingress of water in harmful quantity is not possible when the enclosure is immersed in water up to 1 m.

K
Kd derivative gain

Ki integral gain

Kp proportional gain

L
Ladder Diagram language See LD.

LAN A local area network local area network is a short-distance communications network that is implemented in a home, office, or institutional environment.

204

EIO0000000827 12/2012

Glossary

latching input A latching input module interfaces with devices that transmit messages in short pulses. Incoming pulses are captured and recorded for later examination by the application.

LD A program in the ladder diagram language includes a graphical representation of instructions of a controller program with symbols for contacts, coils, and blocks in a series of rungs executed sequentially by a controller. IEC 61131-3 compliant.

LED A light emitting diode is an indicator that lights up when electricity passes through it.

LINT Long integer is a 64-bit variable (4 times INT or two times DINT).

located variable A located variable has an address. (See unlocated variable.)

LRC longitudinal redundancy checking

LREAL Long real is a 64-bit variable.

LSB The least significant bit (or least significant byte) is the part of a number, address, or field that is written as the right-most single value in conventional hexadecimal or binary notation.

LWORD A long word type is encoded in a 64-bit format.

EIO0000000827 12/2012

205

Glossary

M
MAC address The media access control address is a unique 48-bit number associated with a specific piece of hardware. The MAC address is programmed into each network card or device when it is manufactured.

Magelis Magelis is the commercial name for Schneider Electrics range of HMI terminals.

MAST A master (MAST) task is a processor task that is run through its programming software. The MAST task has two sections: z IN: Inputs are copied to the IN section before execution of the MAST task. z OUT: Outputs are copied to the OUT section after execution of the MAST task.

master/slave The single direction of control in a network that implements the master/slave model is always from a master device or process to one or more slave devices.

MIB The management information base is an object database that is monitored by a network management system like SNMP. SNMP monitors devices that are defined by their MIBs. Schneider has obtained a private MIB, groupeschneider (3833).

minimum I/O update time The minimum I/O update time is the minimum time it takes for the bus cycle to shut down to force an I/O update at each cycle.

Modbus The Modbus communication protocol allows communications between many devices connected to the same network.

Modbus SL Modbus serial line

206

EIO0000000827 12/2012

Glossary

MSB The most significant bit (or most significant byte) is the part of a number, address, or field that is written as the left-most single value in conventional hexadecimal or binary notation.

N
NAK negative acknowledge

NC A normally closed contact is a contact pair that is closed when the actuor is deenergized (no power is applied) and open when the actuor is energized (power is applied).

NEC The national electric code standard dictates the safe installation of electrical wiring and equipment.

NEMA The national electrical manufacturers association publishes standards for the performance of various classes of electrical enclosures. The NEMA standards cover corrosion resistance, ability to protect from rain and submersion, etc. For IEC member countries, the IEC 60529 standard classifies the ingress protection rating for enclosures.

network A network includes interconnected devices that share a common data path and protocol for communications.

NMT Network management protocols provide services for network initialization, error control, and device status control.

EIO0000000827 12/2012

207

Glossary

NMT state machine A network management state machine defines the communication behavior of any CANopen device. The CANopen NMT state machine consists of an initialization state, a pre-operational state, an Operational state, and a stopped state. After power-on or reset, the device enters the initialization state. After the device initialization is finished, the device automatically enters the pre-operational state and announces the state transition by sending the boot-up message. In this manner, the device indicates that it is ready to work. A device that stays in pre-operational state may start to transmit SYNC-, Time Stamp-, or Heartbeat message. In this state, the device cannot communicate through a PDO; it must do so with an SDO. In the operational state, the device can use all supported communication objects.

NO A normally open contact is a contact pair that is open when the actuor is deenergized (no power is applied) and closed when the actuor is energized (power is applied).

node A node is an addressable device on a communication network.

O
ODVA The open deviceNet vendors association supports the family of network technologies that are built on CIP (EtherNet/IP, DeviceNet, and CompoNet).

OS Operating system. Can be used for Firmware that can be uploaded/downloaded by the user.

OSI The open system interconnection reference model is a 7-layer model that describes network protocol communications. Each abstract layer receives services from the layer below it and provides services to the layer above.

output terminal An output terminal connects output signals to output devices (such as electromechanical relays and solenoid valves).

208

EIO0000000827 12/2012

Glossary

P
PCI A peripheral component interconnect is an industry-standard bus for attaching peripherals.

PDU protocol data unit

PE Protective ground is a return line across the bus for fault currents generated at a sensor or actuator device in the control system.

periodic execution The master task is executed either cyclically or periodically. In periodic mode, you determine a specific time (period) in which the master task must be 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.

persistent data Value of persistent data that will be used at next application change or cold start. Only get re-initialized at a reboot of the controller or reset origin. Especially they maintain their values after a download.

PI proportional integral

PID proportional, integral and derivative control

PLC The programmable logic controller is the brain of an industrial manufacturing process. It automates a process, used instead of relay control systems. PLCs are computers suited to survive the harsh conditions of the industrial environment.

EIO0000000827 12/2012

209

Glossary

PLCopen The PLCopen standard brings efficiency, flexibility, and manufacturer independence to the automation and control industry through the standardization of tools, libraries, and modular approaches to software programming.

PLI pulse latch input

POU A program organization unit includes a variable declaration in source code and the corresponding instruction set. POUs facilitate the modular reuse of software programs, functions, and function blocks. Once declared, POUs are available to one another. SoMachine programming requires the utilization of POUs.

POU FB Program organization unit function block types are user programs that can be defined by the user in the ST, IL, LD, or FBD languages. You can use POU FB types in an application to:
z z z z

simplify the design and entry of the program make the program easier to read simplify debugging reduce the amount of generated code

power supply terminals The power supply is connected to these terminals to provide power to the controller.

protocol A protocol is a convention or standard that controls or enables the connection, communication, and data transfer between two computing endpoints.

PTO Pulse train outputs are used to control for instance stepper motors in open loop.

PWM Pulse width modulation is used for regulation processes (e.g. actuators for temperature control) where a pulse signal is modulated in its length. For these kind of signals, transistor outputs are used.

210

EIO0000000827 12/2012

Glossary

R
RAM random access memory

REAL Real is a numeric data type. The REAL type is encoded in a 32-bit format.

real-time clock (RTC) See RTC

reflex output In a counting mode, the high speed counters current value is measured against its configured thresholds to determine the state of these dedicated outputs.

retained data A retained data value is used in the next power-on or warm start. The value is retained even after an uncontrolled shutdown of the controller or a normal switch-off of the controller.

RJ-45 This registered jack is a modular connector that is commonly implemented in communication networks.

RPM revolutions per minute

RPS revolutions per second

RS-232 RS-232 (also known as EIA RS-232C or V.24) is a standard type of serial communication bus, based on three wires.

RS-485 RS-485 (also known as EIA RS-485) is a standard type of serial communication bus, based on two wires.
EIO0000000827 12/2012

211

Glossary

RTC The real-time clock option keeps the time for a limited amount of time even when the controller is not powered.

RTS Request to send is a data transmission signal and will be acknowledged by the CTS signal from the destination node.

RTU A remote terminal unit is a device that interfaces with objects in the physical world to a distributed control system or SCADA system by transmitting telemetry data to the system and/or altering the state of connected objects based on control messages received from the system.

RxD receiving data (data transmission signal)

S
SCADA A supervisory control and data acquisition system monitors, manages, and controls industrial applications or processes.

scan A controllers scanning program performs 3 basic functions: [1] It reads inputs and places these values in memory; [2] it executes the application program 1 instruction at a time and stores results in memory; [3] It uses the results to update outputs.

SEL-V A system that follows IEC 61140 guidelines for safety extra low voltage is protected in such a way that voltage between any 2 accessible parts (or between 1 accessible part and the PE terminal for Class 1 equipment) does not exceed a specified value under normal conditions or under single-fault conditions.

Sequential Function Chart See SFC.

212

EIO0000000827 12/2012

Glossary

SFC A program written in the sequential function chart language can be used for processes that can be split into steps. SFC 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.)

sink input A sink input is a wiring arrangement in which the device provides current to the input electronic module. A sink input is referenced to 0 Vdc.

SINT Signed integer is a 16-bit value.

SL serial line

SNMP The simple network management protocol can control a network remotely by polling the devices for their status, performing security tests, and viewing information relating to data transmission. It can also be used to manage software and databases remotely. The protocol also permits active management tasks, such as modifying and applying a new configuration

source output A source output is a wiring arrangement in which the output electronic module provides current to the device. A source output is referenced to +24 Vdc.

SSI Serial synchronous interface is a common interface for relative and absolute measurement systems like encoders.

ST See structured text.

STRING A STRING variable is a series of ASCII characters.

EIO0000000827 12/2012

213

Glossary

Structured Text A program written in the structured text (ST) language includes complex statements and nested instructions (such as iteration loops, conditional executions, or functions). ST is compliant with IEC 61131-3.

symbol A symbol is a string of a maximum of 32 alphanumeric characters, of which the first character is alphabetic. It allows you to personalize a controller object to facilitate the maintainability of the application.

symbolic addressing The indirect method of addressing memory objects, including physical inputs and outputs, used in programming instructions as operands and parameters by first defining symbols for them using these symbols in association with the programming instructions. In contrast to immediate addressing, this is the recommended method because if the programs configuration changes, symbols are automatically updated with their new immediate address associations, whereas any immediate addresses used as operands or parameters are not. (See immediate addressing.)

system time An internal clock provides a device with the system time.

system variable A system variable structure provides controller data and diagnostic information and allows sending commands to the controller.

T
TAP A terminal access point is a junction box connected to the trunk cable that allows you to plug in drop cables.

214

EIO0000000827 12/2012

Glossary

task A group of sections and subroutines, executed cyclically or periodically for the MAST task, or periodically for the FAST task. A task possesses a level of priority and is linked to inputs and outputs of the controller. These I/O are refreshed in consequence. A controller can have several tasks.

TCP A transmission control protocol is a connection-based transport layer protocol that provides a reliable simultaneous bi-directional transmission of data. TCP is part of the TCP/IP protocol suite.

terminal block The terminal block is the component that mounts in an electronic module and provides electrical connections between the controller and the field devices.

threshold output Threshold outputs are controlled directly by the HSC according to the settings established during configuration.

trunk cable A trunk cable is the main cable that is terminated at both physical ends with line termination resistors.

TVDA tested validated documented architectures

TxD TxD represents a transmit signal.

U
UDINT An unsigned double integer is encoded in 32 bits.

EIO0000000827 12/2012

215

Glossary

UDP The user datagram protocol is a connectionless mode protocol (defined by IETF RFC 768) in which messages are delivered in a datagram (data telegram) to a destination computer on an IP network. The UDP protocol is typically bundled with the Internet Protocol. UDP/IP messages do not expect a response, and are therefore ideal for applications in which dropped packets do not require retransmission (such as streaming video and networks that demand real-time performance).

UINT An unsigned integer is encoded in 16 bits.

UL Underwriters laboratories, US organization for product testing and safety certification.

unlocated variable An unlocated variable does not have an address. (See located variable.)

UTC coordinated universal time

V
VSD variable speed drive

W
WORD The WORD type is encoded in a 16-bit format.

216

EIO0000000827 12/2012

Modicon M218 Logic Controller Index EIO0000000827 12/2012

Index

B C A
Firmware Update ExecLoader Introduction, 156 File and Device Properties, 159 Settings, 158 Transfer Progress, 161 Update Through USB, 154 Welcome, 157 Functions Differences Between a Function and a Function Block, 176 How to Use a Function or a Function Block in IL Language, 177 How to Use a Function or a Function Block in ST Language, 181

C
Controller Configuration Access Controller Configuration, 68 Applications, 69 PLC Settings, 70 Services, 71

D
Download application, 63

E
Embedded Functions Configuration Embedded HSC Configuration, 78 Embedded I/O Configuration, 74 Embedded PTO_PWM Configuration, 80 Expansion Module Adding Expansion Module, 88 Configure Expansion Module, 88, 89

G
GetSerialConf, 186

I
Initialization Values, 56

F
FAQ, 171 features key features, 13

L
libraries, 21

M
M218, 13 main features, 13 Memory Mapping, 25
EIO0000000827 12/2012

217

Index

O
Output Behavior, 56, 56 Output Forcing, 56 overview, 13

TM218LDA60DRN, 13 TM218LDAE24DRHN, 13 TM218LDAE40DRPHN, 13 TM218LDD24DUPHN, 13 TM218LDD40DUPHNB, 13 Troubleshooting, 164

P
programming languages IL, ST, FBD, SFC, LD, CFC, 13

R
Reboot, 62 Remanent variables, 66 Reset cold, 60 Reset origin, 61 Reset warm, 59 Run command, 58

S
Serial Line Serial Line Configuration, 92 SERIAL_CONF, 189 SetSerialConf, 187 State diagram, 46 Stop command, 59

T
Task Cyclic task, 38 Event task, 39 External Event Task, 40 Freewheeling task, 39 Types, 38 Watchdogs, 41 TM218LDA16DRN, 13 TM218LDA24DRHN, 13 TM218LDA24DRN, 13 TM218LDA40DR2HN, 13 TM218LDA40DR4PHN, 13 TM218LDA40DRN, 13 TM218LDA40DRPHN, 13
218

EIO0000000827 12/2012

Das könnte Ihnen auch gefallen