You are on page 1of 188

EIO0000000827 11/2010

Modicon M218 Logic


Controller
Programming Guide
11/2010
EIO0000000827.00

www.schneider-electric.com
The information provided in this documentation contains general descriptions and/or
technical characteristics of the performance of the products contained herein. This
documentation is not intended as a substitute for and is not to be used for
determining suitability or reliability of these products for specific user applications. It
is the duty of any such user or integrator to perform the appropriate and complete
risk analysis, evaluation and testing of the products with respect to the relevant
specific application or use thereof. Neither Schneider Electric nor any of its affiliates
or subsidiaries shall be responsible or liable for misuse of the information contained
herein. If you have any suggestions for improvements or amendments or have found
errors in this publication, please notify us.
No part of this document may be reproduced in any form or by any means, electronic
or mechanical, including photocopying, without express written permission of
Schneider Electric.
All pertinent state, regional, and local safety regulations must be observed when
installing and using this product. For reasons of safety and to help ensure
compliance with documented system data, only the manufacturer should perform
repairs to components.
When devices are used for applications with technical safety requirements, the
relevant instructions must be followed.
Failure to use Schneider Electric software or approved software with our hardware
products may result in injury, harm, or improper operating results.
Failure to observe this information can result in injury or equipment damage.
© 2010 Schneider Electric. All rights reserved.

2 EIO0000000827 11/2010
Table of Contents

Safety Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
About the Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Chapter 1 About the Modicon M218 Logic Controller . . . . . . . . . . 13
Modicon M218 Logic Controller Devices Overview. . . . . . . . . . . . . . . . . . 13
Chapter 2 How to Configure the Controller . . . . . . . . . . . . . . . . . . . 15
How to Configure the Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Chapter 3 Libraries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Libraries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Chapter 4 Supported Standard Data Types . . . . . . . . . . . . . . . . . . . 21
Supported Standard Data Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Chapter 5 Memory Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
RAM Memory Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Relocation Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Chapter 6 Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Maximum Number of Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Task Configuration Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Task Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
System and Task Watchdogs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Task Priorities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Default Task Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Chapter 7 Controller States and Behaviors . . . . . . . . . . . . . . . . . . . 45
7.1 Controller State Diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Controller State Diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
7.2 Controller States Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Controller States Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
7.3 State Transitions and System Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Controller States and Output Behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Commanding State Transitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Error Detection, Types, and Management . . . . . . . . . . . . . . . . . . . . . . . . 63
Remanent Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

EIO0000000827 11/2010 3
Chapter 8 Controller Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Controller Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Managing the M218 Controller Applications . . . . . . . . . . . . . . . . . . . . . . 69
M218 Controller Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
M218 Controller Services. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Chapter 9 M218 Embedded Functions . . . . . . . . . . . . . . . . . . . . . . . 73
I/O Embedded Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
HSC Embedded Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
PTO_PWM Embedded Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Analog I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Chapter 10 Expansion Modules Configuration. . . . . . . . . . . . . . . . . . 89
Adding Expansion Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
TM2DMM16DRTN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Chapter 11 Modicon M218 Logic Controller Serial Line
Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Serial Lines Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
M218 Serial Line Protocol Manager. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
ASCII Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
SoMachine Network Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Modbus Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Chapter 12 M218 Ethernet Configuration . . . . . . . . . . . . . . . . . . . . . . 111
Ethernet Services. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
IP Address Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Modbus TCP Server/Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Chapter 13 Connecting the Modicon M218 Logic Controller to a PC 123
Connecting the Controller to a PC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Chapter 14 Upgrading an M218 Firmware . . . . . . . . . . . . . . . . . . . . . 125
Upgrading Through USB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Launching the Exec Loader Wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Step 1 - Welcome . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Step 2 - Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Step 3 - File and Device Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Step 4 - Transfer Progress. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Chapter 15 Modicon M218 Logic Controller - Troubleshooting and
FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Frequently Asked Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Appendices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Appendix A Function and Function Block Representation . . . . . . . . 147
Differences Between a Function and a Function Block . . . . . . . . . . . . . . 148
How to Use a Function or a Function Block in IL Language . . . . . . . . . . 149
How to Use a Function or a Function Block in ST Language . . . . . . . . . 152

4 EIO0000000827 11/2010
Appendix B Functions to get/set serial line configuration in user
program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
GetSerialConf: Get the Serial Line Configuration . . . . . . . . . . . . . . . . . . . 156
SetSerialConf: Change the Serial Line Configuration . . . . . . . . . . . . . . . . 157
SERIAL_CONF: Structure of the Serial Line Configuration Data Type. . . 159
Appendix C Controller Performance . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Processing Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187

EIO0000000827 11/2010 5
6 EIO0000000827 11/2010
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 11/2010 7
PLEASE NOTE
Electrical equipment should be installed, operated, serviced, and maintained only by
qualified personnel. No responsibility is assumed by Schneider Electric for any
consequences arising out of the use of this material.
A qualified person is one who has skills and knowledge related to the construction
and operation of electrical equipment and the installation, and has received safety
training to recognize and avoid the hazards involved.

8 EIO0000000827 11/2010
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 V2.0.

Related Documents

Title of Documentation Reference Number


Modicon M218 Logic Controller Hardware Guide EIO0000000843
(ENG);
EIO0000000844 (CHS)
Modicon TM2 Expansion Modules Configuration Programming EIO0000000396
Guide (ENG);
EIO0000000401 (CHS)
Modicon M218 Logic Controller System Functions and Variables EIO0000000835
M218 PLCSystem Library Guide (ENG);
EIO0000000836 (CHS)
Modicon M218 Logic Controller High Speed Counting M218 HSC EIO0000000837
Library Guide (ENG);
EIO0000000838 (CHS)

EIO0000000827 11/2010 9
Modicon M218 Logic Controller Pulse Train Output, Pulse Width EIO0000000839
Modulation M218 PTOPWM Library Guide (ENG);
EIO0000000840 (CHS)
PLCCommunication Library Guide 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
 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.

10 EIO0000000827 11/2010
WARNING
UNINTENDED EQUIPMENT OPERATION
 Only use software approved by Schneider Electric for use with this equipment.
 Update your application program every time you change the physical hardware
configuration.
Failure to follow these instructions can result in death, serious injury, or
equipment damage.

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

EIO0000000827 11/2010 11
12 EIO0000000827 11/2010
M218 - About the Modicon M218 Logic Controller
EIO0000000827 11/2010

About the Modicon M218 Logic


Controller
1
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.

Key Features
The Modicon M218 Logic Controller is supported and programmed with the
SoMachine Programming Software, which provides the following IEC61131-3
programming languages:
 IL: Instruction List
 ST: Structured Text
 FBD: Function Block Diagram
 SFC: Sequential Function Chart
 LD: Ladder Diagram
 CFC: Continuous Function Chart

The Modicon M218 Logic Controller can manage up to 7 tasks (1 MAST task and up
to 6 other tasks).
The power supply of Modicon M218 Logic Controller is 100...240 Vac.
The Modicon M218 Logic Controller is integrated with 2 Serial Links:
 SL1:
 RJ45 connector
 Non-isolated RS485
 Protocol: Mater/Slave Modbus ASCII/RTU, ASCII, or SoMachine Protocol

 SL2:
 Screw terminal block connector
 Non-isolated RS485
 Protocol: Mater/Slave Modbus ASCII/RTU, or ASCII

EIO0000000827 11/2010 13
M218 - About the Modicon M218 Logic Controller

Modicon M218 Logic Controller Range


The following table describes the M218 range and features:

Reference Digital Input Digital Output Analog Input Analog Output Ethernet port
TM218LDA24DRN 14 digital inputs 10 relay outputs No No No
including
2 reduced fast
inputs(1)
TM218LDA24DRHN 14 digital inputs, 10 relay outputs No No No
including 4 fast
inputs(2)
TM218LDAE24DRHN 14 digital inputs, 10 relay outputs No No 1 Ethernet
including 4 fast port
inputs(2)
TM218LDA40DRPHN 24 digital inputs, 12 relay outputs No No No
including 4 fast and 4 transistor
inputs(2) fast outputs(3)
TM218LDAE40DRPHN 24 digital inputs, 12 relay outputs No No 1 Ethernet
including 4 fast and 4 transistor port
inputs(2) fast outputs(3)
TM218LDA40DR2HN 24 digital inputs, 16 relay outputs No 2 analog No
including 4 fast outputs
inputs(2)
TM218LDA40DR4PHN 24 digital inputs, 12 relay outputs 2 analog 2 analog No
including 4 fast and 4 transistor inputs outputs
inputs(2) fast outputs(3)

(1) The reduced fast inputs have maximum frequency of 10KHz. They can be used
either as regular inputs or as reduced fast inputs for counting or event functions
(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 11/2010
How to Configure the Controller
EIO0000000827 11/2010

How to Configure the Controller

2
How to Configure the Controller

Introduction
Before configuring the controller, you must first create a new machine 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 11/2010 15
How to Configure the Controller

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

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

Controller Configuration Screen


To access to the controller configuration screen, proceed as follow:

Step Action
1 Select the Configuration tab.
2 Double click the controller.

In the left hand side, entries and sub-entries let you access the different item
configuration windows:

16 EIO0000000827 11/2010
How to Configure the Controller

Entry Sub-entry Refer to...


Parameters - Controller Device Editor (see page 68)
Embedded IO Embedded Functions configuration (see page 73)
Functions HSC NOTE: PTO_PWM is available only on
PTO_PWM TM218LDA40DRPHN, TM218LDAE40DRPHN and
TM218LDA40DR4PHN.
Communication Serial Line 1 Serial Line configuration
Serial Line 2
Ethernet Ethernet configuration (see page 111)
NOTE: Only available on TM218LDAE24DRHN and
TM218LDAE40DRPHN.

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

EIO0000000827 11/2010 17
How to Configure the Controller

Item Description
PLC Logic This part shows everything related to the application:
 Tasks configuration
 Programming
 Library manager
 POUs
 Relocation Table

Embedded Functions This representation shows the Embedded Functions of the M218.
NOTE: PTO_PWM only available on TM218LDA40DRPHN,
TM218LDAE40DRPHN and TM218LDA40DR4PHN.
Serial Line 1 These are the embedded communications.
Serial Line 2 NOTE: Ethernet is available only on TM218LDAE24DRHN and
Ethernet TM218LDAE40DRPHN.

NOTE: For TM218LDA40DR2HN andTM218LDA40DR4PHN, one more node


Analog IO gives access to configuration of analog IO (see page 84).

Content of Device Tree


The device tree represents the objects managed by a specific target (controller or
HMI). These objects are:
 application objects (Tasks, etc.),
 programming objects (POU, GVL, etc.),
 hardware-related objects (Embedded functions, Expansion modules, etc.)

By default, the device tree includes the following hardware-related objects:

Reference Embedded IO Embedded communications


TM218LDA24DRN IO Serial Line 1 (SoMachine_Network_Manager)
TM218LDA24DRHN HSC Serial Line 2 (Modbus_Manager)
TM218LDA40DR2HN
TM218LDA40DRPHN IO
TM218LDA40DR4PHN HSC
PTO_PWM
TM218LDAE24DRHN IO Serial Line 1 (SoMachine_Network_Manager)
HSC Serial Line 2 (Modbus_Manager)
Ethernet (Modbus TCP)
TM218LDAE40DRPHN IO
HSC
PTO_PWM

18 EIO0000000827 11/2010
Libraries
EIO0000000827 11/2010

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. Refer to CoDeSys online
help for more information on the Library Manager.

Modicon M218 Logic Controller


When you select a Modicon M218 Logic Controller for your application, SoMachine
automatically loads the following libraries:

Library name Description


IoStandard CmpIoMgr configuration types, ConfigAccess,
Parameters and help functions: manages the I/Os in
the application.
Standard Contains all 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).
Util Analog Monitors, BCD Conversions, Bit/Byte
Functions, Controller Datatypes, Function
Manipulators, Mathematical Functions, Signals.
M218 PLCSystem (see Modicon Contains functions and variables to get information
M218 Logic Controller, System and send commands to the controller system.
Functions and Variables, M218
PLCSystem Library Guide)

EIO0000000827 11/2010 19
Libraries

Library name Description


M218 HSC (see Modicon M218 Contains function blocks and variables to get
Logic Controller, High Speed information and send commands to the Fast
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 Contains function blocks and variables to get
M218 Logic Controller, Pulse Train information and send commands to the Fast
Output, Pulse Width Modulation, Inputs/Outputs of the Modicon M218 Logic Controller.
M218 PTOPWM Library Guide) 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.
M218 Relocation Table The relocation table allows the user to organize data
(see page 26) to optimize exchanges between the Modbus client and
the controller, by regrouping non-contiguous data into
a contiguous table of registers.

20 EIO0000000827 11/2010
Supported Standard Data Types
EIO0000000827 11/2010

Supported Standard Data Types

4
Supported Standard Data Types

Supported Standard Data Types


The Controller supports the following IEC Data types:

Data type Lower limit Upper limit Information content


BOOL False True 1 Bit
BYTE 0 255 8 Bit
WORD 0 65,535 16 Bit
DWORD 0 4,294,967,295 32 Bit
LWORD 0 2 -164 64 Bit

SINT -128 127 8 Bit


USINT 0 255 8 Bit
INT -32,768 32,767 16 Bit
UINT 0 65,535 16 Bit
DINT -2,147,483,648 2,147,483,647 32 Bit
UDINT 0 4,294,967,295 32 Bit
LINT -2 63
263-1 64 Bit

ULINT 0 264-1 64 Bit

REAL 1.175494351e-38 3.402823466e+38 32 Bit


STRING 1 character 255 characters 1 character = 1 byte
WSTRING 1 character 255 characters 1 character = 1 word
TIME - - 16 bit

EIO0000000827 11/2010 21
Supported Standard Data Types

Unsupported Standard Data Types


The Controller does not support the following IEC Data types:

Data type Lower limit Upper limit Information content


LREAL 2.225073858507201 1.797693134862315 64 Bit
4e-308 8e+308

22 EIO0000000827 11/2010
Memory Mapping
EIO0000000827 11/2010

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's in this Chapter?


This chapter contains the following topics:
Topic Page
RAM Memory Organization 24
Relocation Table 26

EIO0000000827 11/2010 23
Memory Mapping

RAM 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
 1024 kbytes Customer Area for dedicated application and configuration data.

Memory containing Persistent and Retain variables is preserved and protected. The
Persistent and Retain variables will be retained when the controller is powered off.
This table shows the different types of memory areas with their sizes in the Modicon
M218 Logic Controller memory:

Area Element Size (bytes)


System Area %MW0...%MW59999 120000
1024 kbytes
System variables (see page 25) 400
(%MW60000...%MW60199)
Dynamic Memory Area: Read Relocation Table 7600
(see page 26)
(60200...61999)
Reserved Memory Area
(62000...62199)
Dynamic Memory Area: Write Relocation Table
(see page 26)
(62200...63999)
Reserved 920576
Customer Area Variables (including Retain and Persistent variables, 838860(1)
1024 kbytes see table below)
Application
Libraries (see page 25)
Symbols 209716(1)

24 EIO0000000827 11/2010
Memory Mapping

1888 bytes Rentention RAM


744 bytes Retain Variables (2)
144 bytes Persistent Variables
1000 bytes %MW0...%MW499

NOTE:
 (1) The memory size for variables, application,libraries and symbols are
customized depending on the usage. It is recommonded that variables,
application and libraries take up to 80% of customer area, and symbols takes
20% of the customer area.
 (2) Not all the 744 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 Average Size Comment


M218 HSC (see Modicon 10 kbytes Depends on the functions used.
M218 Logic Controller, High
Speed Counting, M218 HSC
Library Guide)
M218 PLCSystem 25 kbytes Always embedded in the application.
(see Modicon M218 Logic The use of the functions does not consume
Controller, System Functions additional memory.
and Variables, M218
PLCSystem Library Guide)
D-SE-0009563.6M218 10 kbytes Depends on the functions used.
PTOPWM (see Modicon
M218 Logic Controller, Pulse
Train Output, Pulse Width
Modulation, M218 PTOPWM
Library Guide)
PLC Communication 20 kbytes Depends on the functions used.

EIO0000000827 11/2010 25
Memory Mapping

Relocation Table

Introduction
The Relocation Table allows you to organize data to optimize communication
between the controller and other equipment by regrouping non-contiguous data into
a contiguous table of 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 Description
60200...61999 Dynamic Memory Area: Read Relocation Table
62200...63999 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 Action
1 Select the Program tab:

26 EIO0000000827 11/2010
Memory Mapping

Step Action
2 In the Device tree of the Devices window, right-click the Application node and
click Add Object... in the contextual menu:

3 Select Relocation Table in the list and click the Open button:

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.

EIO0000000827 11/2010 27
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:

28 EIO0000000827 11/2010
Memory Mapping

Icon Element Description


New Item Adds an element to the list of system variables.

Move Down Moves down the selected element of the list.

Move Up Moves up the selected element of the list.

Delete Item Removes the selected elements of the list.

Copy Copies the selected elements of the list.

Paste Pastes the elements copied.

Erase Empty Removes all the elements of the list for which the "Variable"
Item column is empty.
- ID Automatic incremental integer (not editable)
- Variable The name or the full path of a variable (editable)
- Address The address of the system area where the variable is stored (not
editable).
- Length Variable length in word
- Validity Indicates if the entered variable is valid (not editable).

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

EIO0000000827 11/2010 29
Memory Mapping

30 EIO0000000827 11/2010
Tasks
EIO0000000827 11/2010

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:
 Cyclic
 Freewheeling
 Event
 External Event

This chapter begins with an explanation of these task types and provides information
regarding the maximum number of tasks, the default task configuration, and task
prioritization. In addition, this chapter introduces the system and task watchdog
functions and explains their relationship to task execution.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Maximum Number of Tasks 32
Task Configuration Screen 33
Task Types 37
System and Task Watchdogs 40
Task Priorities 41
Default Task Configuration 43

EIO0000000827 11/2010 31
Tasks

Maximum Number of Tasks

Maximum Number of Tasks


The maximum number of tasks you can define for the Modicon M218 Logic
Controller are:
 Total number of tasks = 7
 Cyclic tasks = 3
 Freewheeling tasks = 1
 Event tasks = 2
 External Event tasks = 4

NOTE: The total number of Freewheeling task, Cyclic task and Event task should
not be greater than 3.

Special Considerations for Freewheeling


A Freewheeling task (see page 38) 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 40).
It is recommended not to use a Freewheeling task in a multi-tasks application when
some high priority and time-consuming tasks are running.

32 EIO0000000827 11/2010
Tasks

Task Configuration Screen

Access to Task Configuration


Follow these steps to access the task configuration:

Step Action
1 Click on the Program menu:

2 Double click on the task that you want to configure in the device tree of the
Device window:

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

EIO0000000827 11/2010 33
Tasks

Task Configuration Screen


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

34 EIO0000000827 11/2010
Tasks

The following table describes the fields of the Task Configuration screen:

Field Name Definition


Priority 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 one task at a time can be running. The priority determines when the task will run:
 a higher priority task will preempt a lower priority task
 tasks with same priority will run in turn (2 ms time-slice)

NOTE: Do not assign tasks with the same priority. If there are yet other tasks that attempt
to preempt tasks with the same priority, the result could be indeterminate and
unpredictable. For more information, refer to Task Priorities (see page 41).
Type 4 types of task are available:
 Cyclic (see page 37)
 Freewheeling (see page 38)
 Event (see page 38)
 External event (see page 39)

Watchdog To configure the watchdog, you must define two parameters:


(see page 40)  Time: enter the timeout before watchdog execution.
 Sensitivity: defines the number of expirations of the watchdog timer before the
Controller stops program execution and enters into a HALT state (see page 51).

EIO0000000827 11/2010 35
Tasks

Field Name Definition


POUs (see SoMachine, The list of POUs (Programming Organization Unit) controlled by the task is defined in the
Programming Guide) task configuration window. 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.
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.
The command Open POU opens the currently selected POU in the appropriate editor.
To access an item already stated in the system, use the Change POU...:

POUs are executed in the order shown in the list below. To rearrange the POUs in the list,
click on Move Up or Move Down:

36 EIO0000000827 11/2010
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 duration 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 input states are written to the %I input memory variable and
other system operations are executed.
2. Task Processing: The user code (POU, etc.) defined in the task is processed.
The %Q output memory variable is updated according to your application
program instructions but not written to the physical outputs during this operation.
3. Write Outputs: The %Q output memory variable is 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 Modicon M218 Logic
Controller Settings (see page 70) and CoDeSys online help.
For more information on I/O behavior, refer to Controller States Detailed
Description (see page 51).
NOTE: Expansion I/Os are always physically updated by the MAST
(see page 175)task.
4. Remaining Interval time: The controller OS 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.

EIO0000000827 11/2010 37
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 input states are written to the %I input memory variable and
other system operations are executed.
2. Task Processing: The user code (POU, etc.) defined in the task is processed.
The %Q output memory variable is updated according to your application
program instructions but not written to the physical outputs during this operation.
3. Write Outputs: The %Q output memory variable is 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 Settings
(see page 70) and CoDeSys online help.
For more information on I/O behavior, refer to Controller States Detailed
Description (see page 51).
4. System Processing: The controller OS carries out system processing and any
other lower priority tasks. The length of the system processing period is set to
30 % of the total duration of the 3 previous operations ( 4 = 30 % x (1 + 2 + 3)).
In any case, the system processing period won't be lower than 3 ms.

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.

38 EIO0000000827 11/2010
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:
 Rising edge on Fast input (%IX0.0 ... %IX0.3 inputs)
 HSC thresholds

EIO0000000827 11/2010 39
Tasks

System and Task Watchdogs

Introduction
Two types of watchdog functionality are implemented for the Modicon M218 Logic
Controller. These are:
 System Watchdogs: These watchdogs are defined in and managed by the
controller OS (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 OS (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 EMPTY state.
 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.
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:
 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.
 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 on the task
in the device tree.
NOTE: For more details on watchdogs, refer to the CoDeSys online help.

40 EIO0000000827 11/2010
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.

EIO0000000827 11/2010 41
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.

42 EIO0000000827 11/2010
Tasks

Default Task Configuration

Default Task Configuration


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 41) for more information on priority settings. Refer to System and Task
Watchdogs (see page 40) 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.

EIO0000000827 11/2010 43
Tasks

44 EIO0000000827 11/2010
Controller States and Behaviors
EIO0000000827 11/2010

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's in this Chapter?


This chapter contains the following sections:
Section Topic Page
7.1 Controller State Diagram 46
7.2 Controller States Description 51
7.3 State Transitions and System Events 55

EIO0000000827 11/2010 45
Controller States and Behaviors

7.1 Controller State Diagram

46 EIO0000000827 11/2010
Controller States and Behaviors

Controller State Diagram

Controller State Diagram


The following diagram describes the controller operating mode:

EIO0000000827 11/2010 47
Controller States and Behaviors

Legend:
 Controller states are indicated in ALL-CAPS BOLD
 User and application commands are indicated in Bold
 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).
(2)
For details on RUNNING to STOPPED state transition, refer to Stop Command
(see page 58).

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 56) 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.

Note 5
When a power interruption occurs, the controller continues in the RUNNING state
for at least 4 ms before shutting down. If you have configured and provide power to
the Run/Stop input from the same source as the controller, the loss of power to this
input will be detected immediately, and the controller will behave as if a STOP
command was received. Therefore, if you provide power to the controller and the
Run/Stop input from the same source, your controller will normally reboot into the
STOPPED state after a power interruption.

48 EIO0000000827 11/2010
Controller States and Behaviors

Note 6
During a successful application download the following events occur:
 The application is loaded directly into RAM.
 By default, the Boot application is created and saved into the Flash memory.

Note 7
The default behavior after downloading an application program is for the controller
to enter the STOPPED state irrespective of the Run/Stop input setting or the last
controller state before the download.
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).

Note 8
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 51) for further details.

Note 9
To exit the HALT state it is necessary to issue one of the Reset commands (Reset
Warm, Reset Cold, Reset Origin), download an application or cycle power.

EIO0000000827 11/2010 49
Controller States and Behaviors

Note 10
The RUNNING state has two exceptional conditions.
They are:
 RUNNING with External Error: This exceptional 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.
 RUNNING with Breakpoint: This exceptional condition is indicated by the MS
Status LED, which displays 3 green flashes. Refer to Controller States
Description (see page 51) for further details.

Note 11
The controller has a Run/Stop Switch to toggle the PLC status 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.

50 EIO0000000827 11/2010
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
 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) Note: 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 Description RUN/MS LED


State
BOOTING The controller executes the boot firmware and its Flashing green / red
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.
BOOTING This state is the same as the normal BOOTING Rapid flashing red
after detection state except that a flag is set to make it appear as
of a System if no Boot application is present and the LED
Error indications are different.

EIO0000000827 11/2010 51
Controller States and Behaviors

Controller Description RUN/MS LED


State
INVALID_OS There is not a valid firmware file present In the Flashing red
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 Upgrading an M218 Firmware
(see page 125).
EMPTY There is no or an invalid application. Single flash green
EMPTY after This state is the same as the normal EMPTY state Rapid flashing red
detection of a except that a flag is set to make it appear as if no
System Error Boot Application is present (no Application is
loaded) and the LED indications are different.
RUNNING The controller is executing a valid application. Solid green
RUNNING with This state is the same as the RUNNING state with 3 flash green
Breakpoint the following exceptions:
 The task-processing portion of the program
does not resume until the breakpoint is cleared.
 The LED indications are different.

See CoDeSys online help in SoMachine for details


on breakpoints management.
RUNNING with This state is the same as the normal RUNNING Solid green / single
detection of an state except the LED indications are different. flash red
External Error
STOPPED The controller has a valid application that is Flashing green
stopped. See Details of the STOPPED State
(see page 53) for an explanation of the behavior of
outputs and field buses in this state.
STOPPED This state is the same as the normal STOPPED Flashing green / single
with detection state except the LED indications are different. flash red
of an External
Error
HALT The controller stops executing the application Single flash red
because it has detected an Application Error.
This description is the same as for the STOPPED
state with the following exceptions:
 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.
 The LED indications are different

52 EIO0000000827 11/2010
Controller States and Behaviors

Details of the STOPPED State


The following statements are always true for the STOPPED state:
 The input configured as the Run/Stop input remains operational.
 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.
Task and I/O Behavior When Update IO While In Stop Is Selected
When the Update IO while in stop setting is selected:
 The Read Inputs operation continues normally. The physical inputs are read
and then written to the %I input memory variable.
 The Task Processing operation is not executed.
 The Write Outputs operation continues. The %Q output memory variable is
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.

EIO0000000827 11/2010 53
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:
 The Read Inputs operation ceases. The %I input memory variable is frozen at
its last values.
 The Task Processing operation is not executed.
 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.

54 EIO0000000827 11/2010
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's in this Section?


This section contains the following topics:
Topic Page
Controller States and Output Behavior 56
Commanding State Transitions 58
Error Detection, Types, and Management 63
Remanent Variables 65

EIO0000000827 11/2010 55
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:
 Managed by Application Program
 Keep Current Values
 Set All Outputs to Default
 Initialization Values
 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 51) for more details on these variations.

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.

56 EIO0000000827 11/2010
Controller States and Behaviors

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 51) 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:
 For an analog output : Z (High Impedance)
 For a fast transistor output: Z (High Impedance)
 For a regular transistor output: 0 Vdc
 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 and commissioning. Output forcing overrides all
other commands to an output irrespective of task programming. 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. 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.

EIO0000000827 11/2010 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. 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.
 Run/Stop Switch: manually set the switch to RUN.
 With SoMachine software:
 Click on the menu Online →Start
 Click on the start icon which is symbolized by an arrow in the icon bar

NOTE: The controller muxt be logged on with SoMachine.


 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 47) for further details.

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.
 Run/Stop Switch: manually set the switch to STOP.
 With SoMachine software:
 Click on the menu Online →Stop
 Click on the stop icon which is symbolized by an square in the icon bar

NOTE: The controller muxt be logged on with SoMachine.


 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).

58 EIO0000000827 11/2010
Controller States and Behaviors

 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 47) 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.
 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).
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 user-
configured default values.
For details on variables, refer to Remanent Variables (see page 65).

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.

EIO0000000827 11/2010 59
Controller States and Behaviors

Methods for Issuing a Reset Cold Command:


 SoMachine Online Menu: Select the Reset cold command.
 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).
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 user-
configured default values.
For details on variables, refer to Remanent Variables (see page 65).

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.
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 reset to 0.
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 65).

60 EIO0000000827 11/2010
Controller States and Behaviors

Reboot
Effect: Commands a reboot of the controller.
Starting Conditions: Any state.
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 Reboot was provoked by a power cycle, and
- If configured, the Run/Stop input is set to RUN, and
- Controller state was RUNNING prior to the power cycle.
b. The controller state will be STOPPED if:
- The boot application is different than the application loaded prior to the
reboot, or
- If configured, the Run/Stop input is set to STOP, or
- Controller state was STOPPED prior to a power cycle, or
- The previously saved context is invalid.
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 a detected System Error.
d. The controller state will be INVALID_OS if there is no valid OS.
2. Forcing is erased.
3. Diagnostic indications for detected errors are reset.
4. The values of the retain variables are restored if saved context is valid.
5. The values of the retain-persistent variables are restored if saved context is valid.
6. All non-located and non-remanent variables are reset to their initialization values.
7. The values of the first 500 %MW registers are restored if saved context is valid.
8. The values of %MW500 to %MW59999 registers are reset to 0.
9. 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 65).
NOTE: The Check context test concludes that the context is valid when the
application and the remanent variables are the same as defined in the Boot
application.
NOTE: If you provide power to the Run/Stop input from the same source as the
controller, the loss of power to this input will be detected immediately, and the
controller will behave as if a STOP command was received. Therefore, if you provide
power to the controller and the Run/Stop input from the same source, your controller
will normally reboot into the STOPPED state after a power interruption.

EIO0000000827 11/2010 61
Controller States and Behaviors

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.

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.
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 user-
configured default values after the download is complete.
For details on variables, refer to Remanent Variables (see page 65).

62 EIO0000000827 11/2010
Controller States and Behaviors

Error Detection, Types, and Management

Detected Error Management


The controller manages 3 types of detected errors:
 external detected errors
 application detected errors
 system detected errors

The following table describes the types of errors that may be detected:

Type of Description Resulting


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

EIO0000000827 11/2010 63
Controller States and Behaviors

Type of Description Resulting


Error Controller
Detected State
Application An application error is detected when improper programming is HALT
Error encountered or when a task watchdog threshold is exceeded.
Detected Examples:
 task (software) watchdog exception
 execution of an unknown function
 etc.

System A system error is detected when the controller enters a condition BOOTING →
Error that cannot be managed during runtime. Most such conditions EMPTY
Detected 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:
 System (hardware) watchdog overflow
 exceeding the defined size of an array
 etc.

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.

64 EIO0000000827 11/2010
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".
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 RETAIN-
PERSISTENT
Online change to application X X X
program
Stop X X X
Power cycle - X X
Reset warm - X X
Reset cold - - X
Reset origin - - -
Download of application - - X
program
X The value is maintained
- The value is re initialized

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

EIO0000000827 11/2010 65
Controller States and Behaviors

66 EIO0000000827 11/2010
Controller Configuration
EIO0000000827 11/2010

Controller Configuration

8
Introduction
This chapter describes how to configure the Modicon M218 Logic Controller.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Controller Configuration 68
Managing the M218 Controller Applications 69
M218 Controller Settings 70
M218 Controller Services 71

EIO0000000827 11/2010 67
Controller Configuration

Controller Configuration

Controller Configuration Window


Double-click on 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 Description


Communication Settings Allows you to configure the connection between SoMachine and the controller.
For more information, refer to the CoDeSys online help.
Applications (see page 69) Shows the applications currently running in the controller and allows you to remove
applications from the controller.
Files File management between the PC and the controller.
For more information, refer to the CoDeSys online help.
PLC Settings Configuration of:
(see page 70)  Application for I/O handing
 I/O behavior in stop
 Bus cycle options

Services Allows configuring on-line services of the controller (RTC, device identification).
Status Displays device-specific status and diagnostic messages.
Information Displays general information on the device (name, description, provider, version,
image).

68 EIO0000000827 11/2010
Controller Configuration

Managing the M218 Controller Applications

Overview
The figure below show the Applications tab:

This dialog box serves to scan and to remove applications on the Controller.

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

For more information, refer to the CoDeSys online help.

EIO0000000827 11/2010 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 Description
Application for I/O handling By default, set to Application because there is only one application in the
controller.
PLC settings Update IO while in If this option is activated (default), the values of the input channels will be
stop updated when the Controller is stopped.
Behavior for From the selection list choose one of the following options to configure how the
outputs in Stop values at the output channels should be handled in case of Controller stop:
 Keep current values: The current values will not be modified.
 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 If this option is activated, then for all devices of the current Controller
variables in all configuration all I/O variables will get updated in each cycle of the bus cycle
devices task. This corresponds to the option Always update variables, which can be set
separately for each device in the I/O Mapping dialog.
Bus cycle Bus cycle task This configuration setting is the parent for all Bus cycle task parameters used in
options 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 11/2010
Controller Configuration

M218 Controller Services

Services Tab
The tab Services is divided in two parts:
 RTC Configuration
 Device Identification

The figure below show the Services tab:

NOTE: To have controller information in this tab, you need to be connected with the
controller.
The following table describes the elements of the Services Tab:

Element Description
RTC PLC time Displays the date/time read from the controller. This read-only
Configuration field is initially empty. To read and display the date/time in the
controller, click on the Read button.
Local time Allows defining a date and a time which are sent to the
controller by a click on 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.
Synchronize Allows sending directly the current time and date settings of
with local’s the PC. A message box informs the user of the success of the
date/time command.
Device Identification Displays the Firmware version, the Boot Version and the
Coprocessor Version of the selected device if connected.

EIO0000000827 11/2010 71
Controller Configuration

72 EIO0000000827 11/2010
M218 Embedded Functions
EIO0000000827 11/2010

M218 Embedded Functions

9
Overview
This chapter describes 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's in this Chapter?


This chapter contains the following topics:
Topic Page
I/O Embedded Function 74
HSC Embedded Function 79
PTO_PWM Embedded Function 81
Analog I/O 84

EIO0000000827 11/2010 73
M218 Embedded Functions

I/O Embedded Function

Overview
The embedded I/O selection allows configuring the controller inputs.
The following table shows the IO feature of Modicon M218 Logic Controller

Reference Total digital Numbers of Total digital Numbers of Numbers Analog IO


inputs fast Inputs outputs transistor of relay
output output
TM218LDA24DRN 14 2 reduced fast 10 – 10 –
input (I0,I1)
TM218LDA24DRHN 14 4 (I0 to I3) 10 – 10 –
TM218LDAE24DRHN 14 4 (I0 to I3) 10 – 10 –
TM218LDA40DRPHN 24 4 (I0 to I3) 16 4 12 –
TM218LDAE40DRPHN 24 4 (I0 to I3) 16 4 12 –
TM218LDA40DR2HN 24 4 (I0 to I3) 16 – 16 2 analog
outputs
TM218LDA40DR4PHN 24 4 (I0 to I3) 16 4 12 2 analog
inputs and
2 analog
outputs

Access the Configuration Menu


Follow these steps to access the I/O embedded function configuration window with
the Configuration menu:

Step Description
1 Click on the Configuration menu:

2 Double click on the controller you want.


NOTE: You can also right-click on the controller you want and select Edit
Parameters.

74 EIO0000000827 11/2010
M218 Embedded Functions

Step Description
3 In the Task Pane click on Embedded Functions →IO:

EIO0000000827 11/2010 75
M218 Embedded Functions

Input Configuration Window


The following window allows you to configure the embedded inputs:

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

76 EIO0000000827 11/2010
M218 Embedded Functions

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

Configuration Parameters
For each input, you can define:

Parameter Value Description Constraint


Filter No* Reduce the effect of Available if Latch and Event are
3 ms noise on a controller disabled.
12 ms input. In the other cases, this
parameter is disabled and its
value is No.
Latch No* Allows incoming pulses This parameter is only available
Yes with amplitude widths for the fast inputs I0 to I3.
shorter than the Available if:
controller scan time to be Event disabled AND Run/Stop
captured and recorded. disabled.
Event No* Event detection This parameter is only available
Rising edge for the fast inputs I0 to I3.
Falling edge Available if:
Both edges Latch disabled AND Run/Stop
disabled.
Legend *: Parameter default value

EIO0000000827 11/2010 77
M218 Embedded Functions

Parameter Value Description Constraint


Bounce No* Reduces the effect of Available if Latch is enabled or
Filtering 0.004 ms bounce on a controller Event is enabled.
0.4 ms input. In the other cases, this
1.2 ms parameter is disabled and its
4 ms value is No.
Run/Stop No* The Run/Stop input can Any of the inputs can be
Yes be used to run or stop a configured as Run/Stop, but
program in the controller only one at a time.
Legend *: Parameter default value

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

78 EIO0000000827 11/2010
M218 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).
 Main type: a counter that uses up to 4 fast inputs and 4 reflex outputs.
(see Modicon M218 Logic Controller, High Speed Counting, M218 HSC Library
Guide)

Access the Configuration Menu


Follow these steps to access the HSC embedded function configuration window with
the Configuration menu:

Step Description
1 Click on the Configuration menu:

2 Double click on the controller you want.


NOTE: You can also right-click on the controller you want and select Edit
Parameters.
3 In the Task Pane click on Embedded Functions →HSC:

EIO0000000827 11/2010 79
M218 Embedded Functions

HSC Configuration Window


This figure is a sample HSC configuration window used to configure the HSC.

The following table describes the fields of the HSC configuration window:

Mark Action
1 Select the HSC tab to access each of the HSC Configuration window.
2 Select one of these tabs according to the HSC channel you need to configure.
3 After choosing the type of HSC (Simple or Main) you want, use the field Variable to
change the instance.
4 If the parameters are collapsed, you can expand them by clicking the plus signs.
You then have access to the settings of each parameter.
5 Configuration window where the HSC parameters are determined depending on the
mode used.
6 When you click on the IO Summarize button, the IO summary window appears. It
allows to check your configuration 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).

80 EIO0000000827 11/2010
M218 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%).

Access the Configuration Menu


Follow these steps to access the PTO_PWM embedded function configuration
window with the Configuration menu:

Step Description
1 Click on the Configuration menu:

2 Double click on the controller you want.


NOTE: You can also right-click on the controller you want and select Edit
Parameters.
3 In the Task Pane click on Embedded Functions →PTO_PWM:

EIO0000000827 11/2010 81
M218 Embedded Functions

PTO_PWM Configuration Window


This figure is a sample PTO_PWM configuration window used to configure a PTO,
PWM or FG:

The following table describes the fields of the PTO_PWM configuration window:

Mark Action
1 Select the PTO tab to access each of the PTO_PWM Configuration window.
2 Select one of these tabs according to the PTO_PWM channel you need to
configure.
3 After choosing the type of PTO_PWM (PTO, PWM or Frequency Generator) you
want, use the field Variable to change the instance name.
4 If the parameters are collapsed, you can expand them by clicking the plus signs.
You then have access to the settings of each parameter.

82 EIO0000000827 11/2010
M218 Embedded Functions

Mark Action
5 Configuration window where the embedded function is used for:
 a PTO (see Modicon M218 Logic Controller, Pulse Train Output, Pulse Width
Modulation, M218 PTOPWM Library Guide)
 a PWM (see Modicon M218 Logic Controller, Pulse Train Output, Pulse Width
Modulation, M218 PTOPWM Library Guide)
 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 configuration I/O mapping.

For detail information on configuration parameters, refer to:


 PTO configuration. (see Modicon M218 Logic Controller, Pulse Train Output,
Pulse Width Modulation, M218 PTOPWM Library Guide)
 PWM and FG configuration. (see Modicon M218 Logic Controller, Pulse Train
Output, Pulse Width Modulation, M218 PTOPWM Library Guide)

EIO0000000827 11/2010 83
M218 Embedded Functions

Analog I/O

Overview
The following Modicon M218 Logic Controller have embedded analog I/O.
 TM218LDA40DR2HN: 2 analog outputs.
 TM218LDA40DR4PHN: 2 analog inputs and 2 analog outputs.

Access to the Configuration Menu


Follow these steps to access to the Analog I/O embedded function configuration
Window with the Program menu.

Step Action
1 Click on the Program menu.

2 Click on the controller you want, and expand the device tree.
3 Double click on the node Analog to open the configuration window.

84 EIO0000000827 11/2010
M218 Embedded Functions

Analog I/O configuration Window


The following table allow you to configure the analog I/O.

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

EIO0000000827 11/2010 85
M218 Embedded Functions

Parameters Configuration
You can define the parameters as the following table:

Parameter Value Description Constraint


Inputs
Type Not used * Range mode –
– 10...10 V
0...10 V
0...20 mA
4...20 mA
Scope Normal * Unit Available if Type value is
Customized defined.
Filter Level 0 * to 6 Filter value reduces the Available if Type value is
effect of noise on a defined.
controller analog input
Minimum – 32768 to 32767 Minimum value Available if Scope is
NOTE: If Scope is Normal, customized.
the default value is -4096 if
Type is – 10...10 V and is 0
for other Types, The default
value is – 32768 if Scope is
Customized
Maximum – 32768 to 32767 Maximum value Available if Scope is
NOTE: The default value is customized.
4095 if Scope is Normal.
The default value is 32767
if Scope is Customized
Outputs
Type Not used * Range mode –
– 10...10 V
0...10 V
0...20 mA
4...20 mA
Scope Normal * Unit Available if Type value is
Customized defined.

86 EIO0000000827 11/2010
M218 Embedded Functions

Parameter Value Description Constraint


Minimum – 32768 to 32767 Minimum value Available if Scope is
NOTE: If Scope is Normal, customized.
the default value is -4096 if
Type is – 10...10 V and is 0
for other Types, The default
value is – 32768 if Scope is
Customized
Maximum – 32768 to 32767 Maximum value Available if Scope is
NOTE: The default value is customized.
4095 if Scope is Normal.
The default value is 32767
if Scope is Customized
Legend *: Parameter default value.

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

EIO0000000827 11/2010 87
M218 Embedded Functions

88 EIO0000000827 11/2010
Expansion Modules Configuration
EIO0000000827 11/2010

Expansion Modules Configuration

10
Overview
This chapter describes the way to add expansion modules with SoMachine.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Adding Expansion Module 90
TM2DMM16DRTN 92

EIO0000000827 11/2010 89
Expansion Modules Configuration

Adding Expansion Module

Introduction
In your project, you can add analog, digital, and high-speed counting expansion
modules to a controller.
Use the GetRightBusStatus (see Modicon M218 Logic Controller,
System Functions and Variables, M218 PLCSystem Library Guide)
function regularly to monitor the expansion bus status.

Adding an Expansion Module


There are two methods to add an expansion module:
 Click on Add Expansion on the PLC graphic in the configuration tab, and select
the expansion module in the popup dialog box.
 Right click on My controller (or the name given by user) in the device tree in
Program tab, select Add Device, and then select the expansion module in the
popup dialog box.

Expansion Module Configuration


For more information about modules configuration, refer to the hardware and
programming guides of each Expansion Module:

Expansion Module Programming Guide Hardware Guide


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

90 EIO0000000827 11/2010
Expansion Modules Configuration

Limitation
The following table identities the maximum quantity of expansion modules for each
controller.

Controller Maximum Quantity of Maximum I/O points Maximum relay outputs


Expansion Modules
TM218LDA24DRN 4 152 42
TM218LDA24DRHN
TM218LDAE24DRHN
TM218LDA40DRPHN 7 248 90
TM218LDAE40DRPHN
TM218LDA40DR2HN
TM218LDA40DR4PHN

EIO0000000827 11/2010 91
Expansion Modules Configuration

TM2DMM16DRTN

Introduction
This expansion module is a 8-point input /8-point output module with a terminal
block.
For further hardware information, refer to TM2DMM16DRTN (see Modicon M218
Logic Controller, Hardware Guide).

Expansion Bus I/O Mapping Tab


The table below identifies the addresses of each input and output with the channel
name.

92 EIO0000000827 11/2010
Expansion Modules Configuration

Channel Type Default Description


value
Inputs IB0 BYTE - State of all inputs
I0 BOOL - State of input 0
... ...
I7 State of input 7
Outputs QB0 BYTE - Command byte of all outputs
Q0 BOOL - Command bit of output 0
... TRUE ...
FALSE
Q7 Command bit of output 7

For further generic descriptions, refer to Expansion Bus I/O Mapping Tab
Description (see Modicon TM2, Expansion Modules Configuration, Programming
Guide).

EIO0000000827 11/2010 93
Expansion Modules Configuration

94 EIO0000000827 11/2010
Modicon M218 Logic Controller Serial Line Configuration
EIO0000000827 11/2010

Modicon M218 Logic Controller


Serial Line Configuration
11
Overview
This chapter explains the Serial Lines configuration of the Modicon M218 Logic
Controller (supported managers, Serial Line type, parameters, etc.).

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Serial Lines Configuration 96
M218 Serial Line Protocol Manager 98
ASCII Manager 101
SoMachine Network Manager 104
Modbus Manager 105

EIO0000000827 11/2010 95
Modicon M218 Logic Controller Serial Line Configuration

Serial Lines Configuration

Introduction
The Serial Line configuration window allows to configure the physical parameters of
serial line (baud rate, parity, etc.).

Serial Line Configuration


To configure the Serial Line, proceed as follows:

Step Action
1 Select the Configuration tab and double click on the controller.

2 Click the Communication →Serial Line 1 or Serial Line 2 entry on the left hand
side.

96 EIO0000000827 11/2010
Modicon M218 Logic Controller Serial Line Configuration

Step Action
3 Click the Physical Settings entry.
The configuration window is displayed.

NOTE: You can also select the Program tab and double click on 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 Description
Baud rate Transmission speed
Parity Used for error detection
Data bits Number of bits for transmitting data
Stop bits Number of stop bits
Physical Medium Specify the medium to use: RS485 using polarization resistor or not.
NOTE: Two line polarization resistors are integrated in the controller,
they are switched on or off by this parameter.

EIO0000000827 11/2010 97
Modicon M218 Logic Controller Serial Line Configuration

M218 Serial Line Protocol Manager

Overview
Modicon M218 Logic Controller is integrated with 2 serial lines.

Serial Line Supported protocol


Serial Line 1 ASCII Manager
Modbus Manager
SoMachine Network Manager *
Serial Line 2 ASCII Manager
Modbus Manager *
Legend. *: Default setting for serial line

The following table indicates the Manager baud rate characteristic:

Manager Maximum Supported Baud Rate (bits/s)


Baud Rate
(bits/s)
SoMachine Network Manager 115200 115200, 57600, 38400, 19200, 9600, 4800,
2400, 1200
Modbus Manager 38400 38400, 19200, 9600, 4800, 2400, 1200
ASCII Manager

98 EIO0000000827 11/2010
Modicon M218 Logic Controller Serial Line Configuration

Adding the Serial Line Protocol Manager


Follow these steps to add a protocol manager on serial line:

Step Action
1 Select Configuration tab and double click on the controller.

2 Click the Communication →Serial Line 1 or Serial Line 2

3 Click the Protocol Settings entry.

EIO0000000827 11/2010 99
Modicon M218 Logic Controller Serial Line Configuration

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

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

The Serial Line 1 is configured for 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
commmunication. Make sure that the controller’s Serial Line 1 port is not connected
to an active Modbus serial line network before first downloading a valid application
having the port propertly configured for the intended protocol.

100 EIO0000000827 11/2010


Modicon M218 Logic Controller Serial Line Configuration

ASCII Manager

Introduction
The ASCII Manager is used to transmit and/or receive data with a simple device.

Configure the Manager


To configure the ASCII Manager of your controller, proceed as follows:

Step Action
1 Select the Configuration tab and double-click on the controller.

2 Click the Communication →Serial Line 1 or Serial Line 2 entry on the left hand side.

EIO0000000827 11/2010 101


Modicon M218 Logic Controller Serial Line Configuration

Step Action
3 Click the Protocol Settings entry.
Result: The ASCII_Manager configuration window is displayed.

NOTE: The above configuration window only occurred when ASCII_Manager is selected for this serial
link port. If not, Click on Remove/Change Protocol button in the bottom of the screen to change the
protocol to ASCII_Manager.

Set the parameters as described in the following table:

Parameter Description
Start Character 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.
First End If 0, no first end character is used in the frame. Otherwise, in Receiving
Character 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.
Second End If 0, no second end character is used in the frame. Otherwise, in
Character 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.

102 EIO0000000827 11/2010


Modicon M218 Logic Controller Serial Line Configuration

Parameter Description
Frame Length If 0, this parameter is not used. This parameter allows the system to
Received 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).
Frame Received If 0, this parameter is not used. This parameter allows the system to
Timeout (ms) conclude the end of frame at reception after a silence of the specified
number of ms.
Serial Line Parameters specified in the Serial Line configuration window
Settings (see page 96).

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

EIO0000000827 11/2010 103


Modicon M218 Logic Controller Serial Line Configuration

SoMachine Network Manager

Introduction
The SoMachine Network Manager must be used if you want to exchange variables
with a XBTGT/XBTGK device with SoMachine software protocol.
NOTE: The parameters of Physical Setting can only be kept as default values
under SoMachine Network Manager. They are not modifiable.

Configure the Manager


There is no configuration for SoMachine Network Manager.

104 EIO0000000827 11/2010


Modicon M218 Logic Controller 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 26) to optimize the
communication between the controller and other equipment.

Configure the Manager


To configure the Modbus_Manager of your controller, proceed as follows:

Step Action
1 Select the Configuration tab and double-click on the controller.

2 Click the Communication →Serial Line 1 or Serial Line 2 entry on the left hand side.

EIO0000000827 11/2010 105


Modicon M218 Logic Controller Serial Line Configuration

Step Action
3 Click the Protocol Settings entry.
Result: The Modbus_Manager configuration window will be displayed.

NOTE: The above configuration window only occurred when Modbus_Manager is selected for this
serial link port. If not, Click on Remove/Change Protocol button in the bottom of the screen to change
the protocol to Modbus_Manager.

Set the parameters as described in the following table:

Element Description
Transmission Specify the transmission mode to use:
Mode  RTU: uses binary coding and CRC error-checking (8 data bits).
 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 Specify if the M218 device is master or slave.
Address 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 Parameters specified in the Serial Line configuration window.
Settings

106 EIO0000000827 11/2010


Modicon M218 Logic Controller Serial Line Configuration

Modbus Master
When the controller is configured as a Modbus Master, the following Function Block
are supported from the PLCCommunication Library:
 ADDM
 READ_VAR
 SEND_RECV_MSG
 SINGLE_WRITE
 WRITE_READ_VAR
 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 Function Function Codes


Code/Sub Code
Data Access Physical Discrete Read Coils 01
(1 Bit) Inputs and Outputs
Read Discrete Inputs 02
Write Multiple Coils 15
Data Access Physical Input Read Holding Registers 03
(16 Bits) Registers
Write Single Register 06
Write Multiple Registers 16
Read/Write Multiple Registers 23
Diagnostics Diagnostics 08
Read Device Identification 43/14

NOTE: Only located variables of the controller application can be accessed via
Modbus.
The following table contains the Sub-function codes supported by the diagnostic
Modbus request 08:

Sub-Function Code Function


Dec Hex
10 0A Clear Counters and Diagnostic Register
11 0B Return Bus Message Count
12 0C Return Bus Communication Error Count

EIO0000000827 11/2010 107


Modicon M218 Logic Controller Serial Line Configuration

Sub-Function Code Function


13 0D Return Bus Exception Error Count
14 0E Return Slave Message Count
15 0F Return Slave No Response Count
16 10 Return Slave NAK Count
17 11 Return Slave Busy Count
18 12 Return Bus Character Overrun Count

The table below list the objects that can be read with a read device identification
request (basic identification level):

Object ID Object Name Type Value


00 hex Vendor code ASCII String Schneider Electric
01 hex Product code ASCII String Controller reference
e.g. TM218LDA24DRN
02 hex Major / Minor revision ASCII String 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.

108 EIO0000000827 11/2010


Modicon M218 Logic Controller 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:
 %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.
 %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.
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.

EIO0000000827 11/2010 109


Modicon M218 Logic Controller Serial Line Configuration

110 EIO0000000827 11/2010


Ethernet Configuration
EIO0000000827 11/2010

M218 Ethernet Configuration

12
Indroduction
This Chapter describes how to configure the Ethernet network interface of the
Modicon M218 Logic Controller

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Ethernet Services 112
IP Address Configuration 113
Modbus TCP Server/Client 118

EIO0000000827 11/2010 111


Ethernet Configuration

Ethernet Services

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

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

TCP Server Connection


The maximum number of TCP connection:
 4 Modbus servers
 3 Modbus servers and 1 client

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

112 EIO0000000827 11/2010


Ethernet Configuration

IP Address Configuration

Introduction
There are four different ways to assign the IP address of the controller:
 address assignment by DHCP server
 address assignment by BOOTP server
 fixed IP address

NOTE: If the attempted addressing method is unsuccessful, the controller will start
using a default IP address (see page 116) 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
 Be sure that there is only one master controller configured on the network or
remote link.
 Be sure that all slave devices have unique addresses. Be sure that all slave
devices have unique addresses. You cannot have duplicated addresses.
 Obtain your IP address from your system administrator.
 Confirm that the device’s 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 11/2010 113


Ethernet Configuration

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

Restart IP Process Initial IP


Close connection
acquisition state

IP Mode = IP Mode = IP Mode =


Fixed BOOTP DHCP

Initiate BOOTP InitiateBOOTP


Initiate DHCP
process process

IP IP
Valid IP ?
acquired ? acquired ?
NO
YES YES YES

NO NO

YES

Use default IP

Duplicated YES Duplicated


IP? IP?

NO NO

Final state Error Final state (IP


(default IP used) detected acquired and checked)

NOTE: If a device programmed to use the DHCP or BOOTP addressing methods is


unable to contact its respective server, the controller uses the default IP address. It
will, however, constantly reiterate its request.
The IP process automatically restarts in the following cases:
 Controller reboot
 Ethernet cable reconnection
 Application download (if IP parameters change)
 DHCP or BOOTP server detected after a prior addressing attempt was
unsuccessful.

114 EIO0000000827 11/2010


Ethernet Configuration

Ethernet Configuration
In the Devices tree, double click on the Ethernet item:

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

EIO0000000827 11/2010 115


Ethernet Configuration

Default IP Address
The default IP address is based on the device’s MAC address. The first two bytes
are 10 and 10. The last two bytes are the last two bytes of the device’s 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)
 to the network to which the device is connected

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 Byte 2 Byte 3 Byte 4


Class A 0 Network ID Host ID
Class B 1 0 Network ID Host ID
Class C 1 1 0 Network ID Host ID
Class D 1 1 1 0 Multicast address
Class E 1 1 1 1 0 Address reserved for subsequent use

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.

116 EIO0000000827 11/2010


Ethernet Configuration

Example of a subnet address:

IP address 192 (11000000) 1 (00000001) 17 (00010001) 11 (00001011)


Subnet mask 255 (11111111) 255 (11111111) 240 (11110000) 0 (00000000)
Subnet address 192 (11000000) 1 (00000001) 16 (00010000) 0 (00000000)

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 11/2010 117


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 to other controllers and I/O devices, and to
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/Client 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:
 ADDM
 READ_VAR
 SEND_RECV_MSG
 SINGLE_WRITE
 WRITE_READ_VAR
 WRITE_VAR

For further information, see Function Block Descriptions (see SoMachine, Modbus
and ASCII Read/Write Functions, PLCCommunication Library Guide) of the
PLCCommunication Library.

Modbus TCP Server


The Modbus Server supports the following Modbus requests:

Function Code Sub-function Function


Dec (Hex) Dec (Hex)
1 (1h) Read digital outputs (%Q)
2 (2h) Read digital inputs (%I)

118 EIO0000000827 11/2010


Ethernet Configuration

Function Code Sub-function Function


Dec (Hex) Dec (Hex)
3 (3h) Read holding register (%MW)
6 (6h) Write single register (%MW)
8 (8h) Diagnostic (see page 119)
15 (Fh) Write multiple digital outputs (%Q)
16 (10h) Write multiple registers (%MW)
23 (17h) Read/write multiple registers (%MW)
43 (2Bh) 14 (Eh) Read device identification (see page 122)

Diagnostic Request
The following table contains the Data Selection Code list:

Data Selection Code Description


0x00 Reserved
0x01 Basic Network Diagnostics (see page 119)
0x02 Ethernet Port Diagnostic (see page 120)
0x03 Modbus TCP/Port 502 Diagnostics (see page 121)
0x04 Modbus TCP/Port 502 Connection Table (see page 121)
0x05 - 0x7E Reserved for other public codes
0x7F Data Structure Offsets

Basic Network Diagnostics


Basic Network Diagnostics

Field Name Bytes TR Designation


Basic NW Diag Validity 4 -
Communication Global Status 2 -
Supported Communication Services 2 -
Status of Communication Services 2 -
IP Address 4 IP Address
Subnet Mask 4 Subnet Mask
Default Gateway 4 Default Gateway
MAC Address 6 MAC Address
Ether Frame Format Capability / 6 Ethernet Frame Format
Configuration / Operational

EIO0000000827 11/2010 119


Ethernet Configuration

Field Name Bytes TR Designation


Ether Rcv Frames OK 4 Total number of Ethernet Frames received
OK
Ether Xmit Frames OK 4 Total number of Ethernet Frames
Transmitted OK
Reserved 2 -
Num MB Open Server Connections 2 Num_Open_ServerCnx
Num MB Error Msgs Sent 4 Num_MB_Error_Msgs_Sent
Num MB Msgs Sent 4 Num_MB_Msgs_Sent
Num MB Msgs Rcvd 4 Num_MB_Msgs_Rcvd
Device Name 16 Device Name
IP Assignment Mode Capability / 4 IPAssignment ModeCapability;
Operational IPAssignmentModeOperational
Total: 78

Ethernet Port Diagnostic


Ethernet Port Diagnostic: Port Diagnostics Data Validity

Field Name Bytes TR Designation


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

Ethernet Port Diagnostic: Media Counters Diagnostic Data Validity

Field Name Bytes TR Designation


Media Counters Data Validity 4 -
Num Frames Xmit OK 4 Frames transmitted OK
Num Frames Received OK 4 Frames received OK

120 EIO0000000827 11/2010


Ethernet Configuration

Field Name Bytes TR Designation


Reserved 60 -
Total: 72

Modbus TCP/Port 502 Diagnostics


Modbus TCP/Port 502 Diagnostics:

Field Name Bytes TR Designation


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

Modbus TCP/Port 502 Connection Table


Modbus TCP/Port 502 Connection Table:

Field Name Bytes TR Designation


Connection Table Validity 2 -
Number of Entries (NE) 2 -
Starting Entry Index (SE) 2 -
Connection Table Entry 1 16 -
Connection Table Entry 2 16 -
Reserved ... -
Connection Table Entry N 16 -
Total: 6 + 16 * N

EIO0000000827 11/2010 121


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 Object Name Type Value


00h Vendor name ASCII string Schneider Electric
01h Product code ASCII string Controller reference
eg: TM218LDA40DR2HN
02h Major / minor revision ASCII string aa.bb.cc.dd (same as
device descriptor)

122 EIO0000000827 11/2010


Connecting the Modicon M218 Logic Controller to a PC
EIO0000000827 11/2010

Connecting the Modicon M218


Logic Controller to a PC
13
Connecting the Controller to a PC

Overview
To transfer, run and monitor the applications, connect the controller to a computer,
that has SoMachine installed. Use one of the following USB cables:
TCS XCNA 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
 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.

EIO0000000827 11/2010 123


Connecting the Modicon M218 Logic Controller to a PC

CAUTION
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


The following figure shows the USB connection to a PC:

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

Step Action
1 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 TCS XCNA MUM3P or
other non-grounded USB cable, proceed to step 2.
2 Connect your USB cable to the computer.
3 Open the hinged access cover.
4 Connect the Mini connector of your USB cable to the controller USB connector.

124 EIO0000000827 11/2010


Upgrading an M218 Firmware
EIO0000000827 11/2010

Upgrading an M218 Firmware

14
Overview
Detailed instructions are provided for using the M218 Windows ExecLoader to
update the Firmware of your controller.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Upgrading Through USB 126
Launching the Exec Loader Wizard 128
Step 1 - Welcome 129
Step 2 - Settings 130
Step 3 - File and Device Properties 131
Step 4 - Transfer Progress 133

EIO0000000827 11/2010 125


Upgrading an M218 Firmware

Upgrading Through USB

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

CAUTION
LOSS OF APPLICATION DATA
 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 injury or 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.

CAUTION
INOPERABLE EQUIPMENT
 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 is completed successfully.
Failure to follow these instructions can result in equipment damage.

The Serial Line port 1 of your controller is configured for the SoMachine protocol by
default when new 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 controller is not connected to an
active Modbus serial line network before first downloading a valid application that
has the concerned port or ports properly configured for the intended protocol.

126 EIO0000000827 11/2010


Upgrading an M218 Firmware

CAUTION
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:


 USB cable TCS XCNA 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 Action
1 Plug the TCS XCNA MUM3P cable to an USB Port of your PC.
2 Plug the second end of the cable to the USB port of the controller.
3 Launch the Exec Loader Wizard USB (see page 128)

EIO0000000827 11/2010 127


Upgrading an M218 Firmware

Launching the Exec Loader Wizard

Introduction
The M218 Exec Loader Wizard is a Windows-based wizard that guides you through
the steps necessary to update the firmware in your Schneider Electric controller.

Opening the Exec Loader Wizard


To launch the Exec Loader Wizard, complete the following steps:

Step Action
1 Close all your windows applications, including virtual machines.
2 If the gateway is running, right-click the CoDeSys Gateway SysTray (running)
icon in the task bar and select Stop Gateway.

When the gateway is stopped, the CoDeSys Gateway SysTray (stopped) icon
appears in the task bar:

3 ClickStart →Programs →Schneider Electric →SoMachine →Tools →


Exec Loader Wizard USB

Overview of Upgrade Steps


The wizard provides a screen for each step. The following table summarizes the 4
steps required to upgrade your firmware:

Step Screen Function


1 Welcome Introduction to the Exec Loader Wizard.
(see page 129)
2 Settings Select the correct firmware file to transfer to your controller.
(see page 130)
3 File and Device Compare the hardware IDs and the firmware version
Properties information of the firmware file and the controller.
(see page 131)
4 Transfer Progress Monitor the transfer of the firmware file to the controller.
(see page 133)

128 EIO0000000827 11/2010


Upgrading an M218 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:
 Select Next to continue the procedure and display the next screen, Step#2
Settings (see page 130).
 Select Close to close the screen without changing the firmware on your
controller.

EIO0000000827 11/2010 129


Upgrading an M218 Firmware

Step 2 - Settings

Selecting Settings
Use these steps to select the appropriate firmware:

Step Action
1 In Settings, click on the Browse button and select the correct file for your controller
model.
Example: C:\Program
Files\Schneider Electric\SoMachine\Firmware\M238\TM238LFDC24DT.mfw
2 Power off the Controller, as indicated on the screen.
3 Select Next.
During the progress bar, turn on the power of the controller.

When the Exec Loader Wizard has successfully opened a connection with the
controller, it goes automatically to step 3 (see page 131).

130 EIO0000000827 11/2010


Upgrading an M218 Firmware

Step 3 - File and Device 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:
 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.

EIO0000000827 11/2010 131


Upgrading an M218 Firmware

Hardware ID
The Hardware ID is a unique identifier for each controller reference:
 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 130))

Exec Version Number


The Exec Version Number identifies the version of the firmware:
 Green check mark: you will upgrade 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.

132 EIO0000000827 11/2010


Upgrading an M218 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:
 Yes - the wizard returns to Step 2 - Settings (see page 130) 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:
 Yes - the wizard returns to Step 3 - Files and Device Properties (see page 131)
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.

CAUTION
INOPERABLE EQUIPMENT
 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 is completed successfully.
Failure to follow these instructions can result in equipment damage.

EIO0000000827 11/2010 133


Upgrading an M218 Firmware

134 EIO0000000827 11/2010


Modicon M218 Logic Controller - Troubleshooting and FAQ
EIO0000000827 11/2010

Modicon M218 Logic Controller -


Troubleshooting and FAQ
15
What's in this Chapter?
This chapter contains the following topics:
Topic Page
Troubleshooting 136
Frequently Asked Questions 142

EIO0000000827 11/2010 135


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:
 PC cannot communicate with the controller.
 Is your application valid?
 Is the CoDeSys gateway running?

Resolution:
 Refer to the part below (Communication Between SoMachine and the Modicon
M218 Logic Controller (see page 136)).
 Your application program must be valid. Refer to the debugging part of the
CoDeSys help.
 The CoDeSys gateway must be running:
a. click the CoDeSys Gateway SysTray(stopped) icon in the task bar,
b. select Start Gateway.

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

136 EIO0000000827 11/2010


Modicon M218 Logic Controller - Troubleshooting and FAQ

Resolution:

EIO0000000827 11/2010 137


Modicon M218 Logic Controller - Troubleshooting and FAQ

Check Action
1 Check that:
 the cable is correctly linked to the controller and to the PC and not damaged,
 you use the specific cable depending on the connection type:
 TCS XCNA MUM3P cable for an USB connection.

2 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 icon in front of the
node, unplug/plug the cable on the controller side.
3 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 Diagnostic using LED Display section (see Modicon M218 Logic Controller, Hardware
Guide).

Application program is not executed


Possible causes:
No POU 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.

138 EIO0000000827 11/2010


Modicon M218 Logic Controller - Troubleshooting and FAQ

Possible causes:
 Application does not go to RUN state.
 One input is configured in RUN/STOP mode.
 Run/Stop Switch is switched to Stop position.

Resolution:
 Use the input configured in RUN/STOP mode to run the application.
 Turn Run/Stop Switch to the Run position.

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:
 Reset your computer or,
 in Control Panel, open Administrative Tools and Computer Management,
 in Service, double click CoDeSys Gateway,
 Click Start Service button.

3. Control if the CoDeSys Gateway SysTray icon is red (running).

Serial Line Communication is not Possible


Possible causes:
 Communication settings are not identical between serial line devices.
 The controller is not correctly operating.

Resolution:
Check that:
 protocol communication settings (baud rate, parity...) are identical for all serial
line devices.
 The correct communication manager is added on the Serial Line object:
 Modbus manager if the line is used for Modbus protocol,
 SoMachine-Network Manager if the line is used for communication to access
IEC variable.
 the controller operates correctly. Refer to the System Diagnostic using LED
Display part (see Modicon M218 Logic Controller, Hardware Guide).

EIO0000000827 11/2010 139


Modicon M218 Logic Controller - Troubleshooting and FAQ

Creating the Boot Application is not Possible


Possible cause:
Operation not possible while the controller is in RUN state.
Resolution:
 Select Stop Application,
 Select Create Boot Project.

PTO Function does not Start


Possible cause:
The AUX input is configured as Drive ready but not used.
Resolution:
 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:
 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:
 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...).

140 EIO0000000827 11/2010


Modicon M218 Logic Controller - Troubleshooting and FAQ

Controller is in HALT State


Possible cause:
The PLC has stopped due to a watchdog event.
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:
 If a Cyclic task is configured, increase the cycle time to a value > 1.25 times
the average task time
 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 Resolution


You attempted to download the Stop the controller before attempting the download.
source while the controller was in a
RUN state.
The source file exceeded the If sending additional files with the source, considering
available memory space in the deselecting them to reduce the overall size of the
controller. download. See Project →Project Settings →Source
Download →Additional Files... in the SoMachine
main menu.

EIO0000000827 11/2010 141


Modicon M218 Logic Controller - Troubleshooting and FAQ

Frequently Asked Questions

How can I Determine the Firmware, Boot and Coprocessor Version of the Controller?
In online mode, double click the Controller node in the Devices window. In the
Controller window, select the Services tab. The device identification area gives
information about versions:

Device Identification

Firmware Version:

Boot Version:

Coprocessor Version:

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 21)

When should I use Freewheeling or Cyclic Task Type?


Freewheeling or cyclic task type usage Task Configuration (see page 37):
 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.
 Cyclic: use this mode if you want to control the cycle time.

What are the Effects of Cold/Warm Restart?


Refer to the effects of reset cold/warm section (see page 58).

Can I connect the PC (SoMachine) and the Controller through 499TWD01100 Ethernet Gateway?
No, because Ethernet Gateway only supports Modbus protocol.

Can I connect several M218, through several USB ports of my PC?


No, because driver conflicts may occur.

142 EIO0000000827 11/2010


Modicon M218 Logic Controller - Troubleshooting and FAQ

Why the communication between the HMI and the controller is 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 real PLC behavior with the Simulation mode?
No. The simulation mode is only used to simulate the user application, not the PLC
behavior.

EIO0000000827 11/2010 143


Modicon M218 Logic Controller - Troubleshooting and FAQ

144 EIO0000000827 11/2010


EIO0000000827 11/2010

Appendices

Overview
This appendix lists the documents necessary for technical understanding of the
M218 Programming Guide.

What's in this Appendix?


The appendix contains the following chapters:
Chapter Chapter Name Page
A Function and Function Block Representation 147
B Functions to get/set serial line configuration in user program 155
C Controller Performance 161

EIO0000000827 11/2010 145


146 EIO0000000827 11/2010
Function and Function Block Representation
EIO0000000827 11/2010

Function and Function Block


Representation
A
Overview
Each function can be represented in the following languages:
 IL: Instruction List
 ST: Structured Text
 LD: Ladder Diagram
 FBD: Function Block Diagram
 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's in this Chapter?


This chapter contains the following topics:
Topic Page
Differences Between a Function and a Function Block 148
How to Use a Function or a Function Block in IL Language 149
How to Use a Function or a Function Block in ST Language 152

EIO0000000827 11/2010 147


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
 is directly called with its name (not through an Instance)
 has no persistent state from one call to the other
 can be used as an operand in other expressions

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
 is always called through an Instance (function block copy with dedicated name
and variables)
 each Instance has a persistent state (outputs and internal variables) from one
call to the other
Examples: timers, counters
In the example below, Timer_ON is an instance of the Function Block TON:

148 EIO0000000827 11/2010


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 Action
1 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.
2 Create the variables that the function requires.
3 If the function has 1 or more inputs, start loading the first input using LD instruction.
4 Insert a new line below and:
 type the name of the function in the operator column (left field), or
 use the Input Assistant to select the function (select Insert Box in context menu).

5 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.
6 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.

To illustrate the procedure, consider the Functions IsFirstMastCycle (without


input parameter) and SetRTCDrift (with input parameters) graphically presented
below:

Function Graphical Representation


without input parameter:
IsFirstMastCycle

with input parameters:


SetRTCDrift

EIO0000000827 11/2010 149


Function and Function Block Representation

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

Function Representation in SoMachine POU IL Editor


IL example of a function
without input parameter:
IsFirstMastCycle

IL example of a function
with input parameters:
SetRTCDrift

Using a Function Block in IL language


The following procedure describes how to insert a function block in IL language:

Step Action
1 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.
2 Create the variables that the function block requires, including the instance name.

150 EIO0000000827 11/2010


Function and Function Block Representation

Step Action
3 Function Blocks are called using a CAL instruction:
 Use the Input Assistant to select the FB (right-click and select Insert Box in context menu).
 Automatically, the CAL instruction and the necessary I/O are created.

Each parameter (I/O) is an instruction:


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

4 In the CAL right-side field, replace ??? with the instance name.
5 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 Graphical Representation


TON

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

Function Block Representation in SoMachine POU IL Editor


TON

EIO0000000827 11/2010 151


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 Action
1 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.
2 Create the variables that the function requires.
3 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);

To illustrate the procedure, consider the function SetRTCDrift graphically


presented below:

Function Graphical Representation


SetRTCDrift

The ST language of this function is the following:

Function Representation in SoMachine POU ST Editor


SetRTCDrift 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);

152 EIO0000000827 11/2010


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 Action
1 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.
2 Create the input and output variables and the instance required for the function block:
 Input variables are the input parameters required by the function block
 Output variables receive the value returned by the function block

3 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 Graphical Representation


TON

EIO0000000827 11/2010 153


Function and Function Block Representation

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

Function Block Representation in SoMachine POU ST Editor


TON

154 EIO0000000827 11/2010


Functions to get/set serial line configuration in user program
EIO0000000827 11/2010

Functions to get/set serial line


configuration in user program
B
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's in this Chapter?


This chapter contains the following topics:
Topic Page
GetSerialConf: Get the Serial Line Configuration 156
SetSerialConf: Change the Serial Line Configuration 157
SERIAL_CONF: Structure of the Serial Line Configuration Data Type 159

EIO0000000827 11/2010 155


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 Type Comment


Link LinkNumber Link is the communication port number.
PointerToSerialConf POINTER TO PointerToSerialConf is the address of the configuration
SERIAL_CONF structure (variable of SERIAL_CONF type) in which the
(see page 159) configuration parameters are stored. The ADR standard function
must be used to define the associated pointer. (See the example
below.)

Output Type Comment


GetSerialConf WORD This function returns:
 0: The configuration parameters are returned
 255: The configuration parameters are not returned because:
 the function was not successful
 the function is in progress

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

156 EIO0000000827 11/2010


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 Type Comment


Link LinkNumber LinkNumber is the communication port number.
PointerToSerialConf POINTER TO PointerToSerialConf is the address of the configuration
SERIAL_CONF structure (variable of SERIAL_CONF type) in which the new
(see page 159) 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.

Output Type Comment


SetSerialConf WORD This function returns:
 0: The new configuration is set
 255: The new configuration is refused because:
 the function is in progress
 the input parameters are not valid

EIO0000000827 11/2010 157


Functions to get/set serial line configuration in user program

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; (*Set modbus address to 9*)

(*Reconfigure the serial line 1*)


result := SetSerialConf(1, ADR(MySerialConf));

158 EIO0000000827 11/2010


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 Type Description


Bauds DWORD baud rate
InterframeDelay WORD minimum time (in ms) between 2 frames in Modbus (RTU, ASCII)
FrameReceivedTimeout WORD 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.
FrameLengthReceived WORD 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.
Protocol BYTE 0: Modbus RTU or SoMachine (see CodesysCompliant)
1: Modbus ASCII
2: ASCII
Address BYTE Modbus address 0 to 255 (0 for Master)
Parity BYTE 0: none
1: odd
2: even
Rs485 BYTE 0: RS232
1: RS485
ModPol (polarizartion BYTE 0: no
resistor)
1: yes
DataFormat BYTE 7 bits or 8 bits
StopBit BYTE 1: 1 stop bit
2: 2 stop bits
CharFrameStart BYTE 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.
CharFrameEnd1 BYTE 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.

EIO0000000827 11/2010 159


Functions to get/set serial line configuration in user program

Variable Type Description


CharFrameEnd2 BYTE 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.
CodesysCompliant BYTE 0: Modbus RTU
1: SoMachine (when Protocol = 0)
CodesysNetType BYTE not used

160 EIO0000000827 11/2010


M218 - Controller Performance)
EIO0000000827 11/2010

Controller Performance

C
Processing Performance

Introduction
This chapter provides information about the processing performance.

Logic Processing
The following table shows logic processing performance for various logical
instructions:

IL Instruction Type Duration for 1000 instructions


Addition/subtraction/multiplication of INT 380 μs
Addition/subtraction/multiplication of DINT 401 μs
Addition/subtraction/multiplication of REAL 7608 μs
Division of REAL 15978 μs
Operation on BOOLEAN, e.g. Status:= Status and 572 μs
value
LD INT + ST INT 386 μs
LD DINT + ST DINT 430 μs
LD REAL + ST REAL 750 μs

Basic System Time


The following table shows the basic overhead performance for each MAST cycle:

I/O type Overhead for each MAST cycle


Embedded Inputs & Internal Processing 1500 μs
Embedded Outputs 450 μs

EIO0000000827 11/2010 161


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 Overhead for each MAST cycle


HSC Simple 150 μs
HSC Main 350 μs
PWM 150 μs
PTO Simple 200 μs
Frequency Generator 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 Typical Maximum


950 μs 1200 μs 2000 μs

162 EIO0000000827 11/2010


Glossary
EIO0000000827 11/2010

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 11/2010 163


Glossary

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

164 EIO0000000827 11/2010


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.

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:
 machine name
 device name or IP address
 Modbus Serial Line address
 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 client’s MAC address. The server—
which maintains a pre-configured table of client device MAC addresses and
associated IP addresses—sends the client its pre-configured IP address. BOOTP
was originally used as a method that enabled diskless hosts to be remotely booted
over a network. The BOOTP process assigns an infinite lease of an IP address. The
BOOTP service utilizes UDP ports 67 and 68.

EIO0000000827 11/2010 165


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

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 controller’s
power supply.

CRC
A network message's cyclic redundancy check field contains a small number of bits
that produce a checksum. The message is calculated by the transmitter according
to the message’s 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.

166 EIO0000000827 11/2010


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.

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 für 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 11/2010 167


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.

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 RS-
485) 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.)

168 EIO0000000827 11/2010


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.

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 task’s 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 11/2010 169


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.

function
A function:
 is a POU that returns 1 immediate result
 is directly called with its name (as opposed to through an instance)
 has no persistent state from one call to the next
 can be used as an operand in expressions

170 EIO0000000827 11/2010


Glossary

Examples: boolean (AND) operators, calculations, conversions (BYTE_TO_INT)

function block (FB)


See FB.

function block diagram (FBD)


See FBD.

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

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.

I/O
input/output

EIO0000000827 11/2010 171


Glossary

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:
 graphical: ladder diagram, function block diagram
 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.

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

172 EIO0000000827 11/2010


Glossary

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 program’s 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.

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.

EIO0000000827 11/2010 173


Glossary

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.

Kd
derivative gain

Ki
integral gain

Kp
proportional gain

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.

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.

174 EIO0000000827 11/2010


Glossary

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.

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 Electric's 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:
 IN: Inputs are copied to the IN section before execution of the MAST task.
 OUT: Outputs are copied to the OUT section after execution of the MAST task.

EIO0000000827 11/2010 175


Glossary

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

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.

NAK
negative acknowledge

NC
A normally closed contact is a contact pair that is closed when the actuor is de-
energized (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.

176 EIO0000000827 11/2010


Glossary

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.

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 de-
energized (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.

EIO0000000827 11/2010 177


Glossary

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 electrome-
chanical relays and solenoid valves).

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.

178 EIO0000000827 11/2010


Glossary

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.

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.

EIO0000000827 11/2010 179


Glossary

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:
 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.

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

180 EIO0000000827 11/2010


Glossary

reflex output
In a counting mode, the high speed counter’s 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.

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.

EIO0000000827 11/2010 181


Glossary

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)

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

scan
A controller’s 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.

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

182 EIO0000000827 11/2010


Glossary

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.

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.

EIO0000000827 11/2010 183


Glossary

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
program’s 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.

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

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.

184 EIO0000000827 11/2010


Glossary

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.

UDINT
An unsigned double integer is encoded in 32 bits.

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

EIO0000000827 11/2010 185


Glossary

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

VSD
variable speed drive

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

186 EIO0000000827 11/2010


Index
EIO0000000827 11/2010

Index
B
AC
C Firmware Update
ExecLoader Introduction, 128
Controller Configuration
File and Device Properties, 131
Access Controller Configuration, 68
Settings, 130
Applications, 69
Transfer Progress, 133
PLC Settings, 70
Update Through USB, 126
Services, 71
Welcome, 129
Functions
D Differences Between a Function and a
Function Block, 148
Download application, 62 How to Use a Function or a Function
Block in IL Language, 149
How to Use a Function or a Function
E Block in ST Language, 152
Embedded Functions Configuration
Embedded HSC Configuration, 79
Embedded I/O Configuration, 74 G
Embedded PTO_PWM Configuration, 81 GetSerialConf, 156
Expansion Module
Adding Expansion Module, 90
Configure Expansion Module, 90 L
libraries, 19
F
FAQ, 142 M
features
main features, 13
key features, 13

O
overview, 13

EIO0000000827 11/2010 187


Index

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

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

S
Serial Line
Serial Line Configuration, 96
SERIAL_CONF, 159
SetSerialConf, 157
State diagram, 47
Stop command, 58

T
Task
Cyclic task, 37
Event task, 38
External Event Task, 39
Freewheeling task, 38
Types, 37
Watchdogs, 40
Troubleshooting, 136

188 EIO0000000827 11/2010

You might also like