TM2DO Programming
TM2DO Programming
TM2DO Programming
EIO0000000827.04
www.schneider-electric.com
The information provided in this documentation contains general descriptions and/or technical characteristics of the performance of the products contained herein. This documentation is not intended as a substitute for and is not to be used for determining suitability or reliability of these products for specific user applications. It is the duty of any such user or integrator to perform the appropriate and complete risk analysis, evaluation and testing of the products with respect to the relevant specific application or use thereof. Neither Schneider Electric nor any of its affiliates or subsidiaries shall be responsible or liable for misuse of the information that is contained herein. If you have any suggestions for improvements or amendments or have found errors in this publication, please notify us. No part of this document may be reproduced in any form or by any means, electronic or mechanical, including photocopying, without express written permission of Schneider Electric. All pertinent state, regional, and local safety regulations must be observed when installing and using this product. For reasons of safety and to help ensure compliance with documented system data, only the manufacturer should perform repairs to components. When devices are used for applications with technical safety requirements, the relevant instructions must be followed. Failure to use Schneider Electric software or approved software with our hardware products may result in injury, harm, or improper operating results. Failure to observe this information can result in injury or equipment damage. 2012 Schneider Electric. All rights reserved.
EIO0000000827 12/2012
Table of Contents
Safety Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . About the Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Chapter 1 About the Modicon M218 Logic Controller . . . . . . . . . .
Modicon M218 Logic Controller Devices Overview. . . . . . . . . . . . . . . . . .
7 9 13
13
17
17
Chapter 3 Libraries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Libraries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21
21
23
23
25
26 30
Chapter 6 Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Maximum Number of Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Task Configuration Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Task Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . System and Task Watchdogs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Task Priorities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Default Task Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33
34 35 38 41 42 44
45
46 46 50 50 54 55 58 64 66
EIO0000000827 12/2012
67
68 69 70 71
73
74 78 80 83
87
88 90
91
92 94 97 100 101 110
115
116 117 122
129
130 132
133
134 135 137 138 140 142 142 143 144 146 149 150 151
EIO0000000827 12/2012
153
154 156 157 158 159 161
163
164 171
Appendices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Appendix A Function and Function Block Representation . . . . . . .
Differences Between a Function and a Function Block. . . . . . . . . . . . . . . How to Use a Function or a Function Block in IL Language . . . . . . . . . . . How to Use a Function or a Function Block in ST Language . . . . . . . . . .
173
175
176 177 181
185
186 187 189
191
191
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
193 217
EIO0000000827 12/2012
EIO0000000827 12/2012
Safety Information
Important Information
NOTICE Read these instructions carefully, and look at the equipment to become familiar with the device before trying to install, operate, or maintain it. The following special messages may appear throughout this documentation or on the equipment to warn of potential hazards or to call attention to information that clarifies or simplifies a procedure.
EIO0000000827 12/2012
PLEASE NOTE Electrical equipment should be installed, operated, serviced, and maintained only by qualified personnel. No responsibility is assumed by Schneider Electric for any consequences arising out of the use of this material. A qualified person is one who has skills and knowledge related to the construction and operation of electrical equipment and its installation, and has received safety training to recognize and avoid the hazards involved.
EIO0000000827 12/2012
At a Glance
Document Scope The purpose of this document is to help you to configure your Modicon M218 Logic Controller. NOTE: Read and understand this document and all related documents (see page 9) before installing, operating, or maintaining your Modicon M218 Logic Controller. The Modicon M218 Logic Controller users should read through the entire document to understand all features. Validity Note This document has been updated with the release of SoMachine M218 Add-On V2.0.31.30 Related Documents
Title of Documentation SoMachine Programming Guide Modicon M218 Logic Controller Hardware Guide TM2...N Expansion Module Hardware Guide Modicon TM2 Expansion Modules Configuration Programming Guide Modicon M218 Logic Controller System Functions and Variables M218 PLCSystem Library Guide Reference Number EIO0000000067 (eng), EIO0000000072 (chs) EIO0000000843 (eng), EIO0000000844 (chs) EIO0000001030 (eng), EIO0000001029 (chs) EIO0000000396 (eng), EIO0000000401 (chs) EIO0000000835 (eng), EIO0000000836 (chs)
Modicon M218 Logic Controller High Speed Counting M218 HSC Library EIO0000000837 (eng), Guide EIO0000000838 (chs)
EIO0000000827 12/2012
Modicon M218 Logic Controller Pulse Train Output, Pulse Width Modulation M218 PTOPWM Library Guide PLCCommunication Library Guide
You can download these technical publications and other technical information from our website at www.schneider-electric.com. Product Related Information
WARNING
LOSS OF CONTROL
z
z z z z
The designer of any control scheme must consider the potential failure modes of control paths and, for certain critical control functions, provide a means to achieve a safe state during and after a path failure. Examples of critical control functions are emergency stop and overtravel stop, power outage and restart. Separate or redundant control paths must be provided for critical control functions. System control paths may include communication links. Consideration must be given to the implications of unanticipated transmission delays or failures of the link. Observe all accident prevention regulations and local safety guidelines.1 Each implementation of this equipment must be individually and thoroughly tested for proper operation before being placed into service.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
1 For additional information, refer to NEMA ICS 1.1 (latest edition), "Safety Guidelines for the Application, Installation, and Maintenance of Solid State Control" and to NEMA ICS 7.1 (latest edition), "Safety Standards for Construction and Guide for Selection, Installation and Operation of Adjustable-Speed Drive Systems" or their equivalent governing your particular location.
WARNING
UNINTENDED EQUIPMENT OPERATION
z z
Only use software approved by Schneider Electric for use with this equipment. Update your application program every time you change the physical hardware configuration.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
10
EIO0000000827 12/2012
User Comments We welcome your comments about this document. You can reach us by e-mail at techcomm@schneider-electric.com.
EIO0000000827 12/2012
11
12
EIO0000000827 12/2012
Modicon M218 Logic Controller About the Modicon M218 Logic Controller EIO0000000827 12/2012
EIO0000000827 12/2012
13
Embedded Input/Output The following embedded I/O types are available, depending on the controller model: z Regular input z Fast input (HSC) z Regular output z Fast output (PTO/PWM/FG) z Analog input z Analog output Embedded Communication features 3 types of communication ports are available on the front panel, depending on the controller model (see page 14): z Ethernet Port (for TM218LDAE24DRHN and TM218LDAE40DRPHN) z USB Programming Port z 2 Serial Link Port For more details, refer to the chapter Integrated Communication Ports. Modicon M218 Logic Controller Range
Reference TM218LDA16DRN (see Modicon M218 Logic Controller, Hardware Guide) TM218LDA24DRN (see Modicon M218 Logic Controller, Hardware Guide) TM218LDA24DRHN (see Modicon M218 Logic Controller, Hardware Guide) Digital Input 7 regular inputs and 2 fast inputs (HSC)(1) 12 regular inputs and 2 fast inputs (HSC)(1) 10 regular inputs and 4 fast inputs (HSC) (2) 10 relay outputs No No 10 relay outputs No No Digital Output 7 relay outputs Analog Input No Analog Output No
(1) The reduced fast inputs have a maximum frequency of 10 kHz. They can be used either as regular inputs or as reduced fast inputs for counting. (2) The fast inputs can be used either as regular inputs or as fast inputs for counting or event functions. (3) The fast outputs can be used either as regular outputs or as fast outputs for PTO, PWM, Frequency Generator functions, or reflex output for HSC.
14
EIO0000000827 12/2012
Reference TM218LDD24DUPHN (see Modicon M218 Logic Controller, Hardware Guide) TM218LDAE24DRHN (see Modicon M218 Logic Controller, Hardware Guide) TM218LDA40DRN (see Modicon M218 Logic Controller, Hardware Guide) TM218LDA40DRPHN (see Modicon M218 Logic Controller, Hardware Guide) TM218LDD40DUPHNB (see Modicon M218 Logic Controller, Hardware Guide) TM218LDAE40DRPHN (see Modicon M218 Logic Controller, Hardware Guide) TM218LDA40DR2HN (see Modicon M218 Logic Controller, Hardware Guide) TM218LDA40DR4PHN (see Modicon M218 Logic Controller, Hardware Guide) TM218LDA60DRN (see Modicon M218 Logic Controller, Hardware Guide)
Digital Input 10 regular inputs and 4 fast inputs (HSC)(2) 10 regular inputs and 4 fast inputs (HSC)(2) 22 regular inputs and 2 fast inputs (HSC)(1) 20 regular inputs and
Digital Output 6 regular outputs and 4 fast outputs (PTO/PWM/FG)(3) 10 relay outputs
Analog Input No
Analog Output No
No
No
16 relay outputs
No
No
12 relay outputs and 4 No 4 fast inputs (HSC)(2) fast outputs (PTO/PWM/FG)(3) 20 regular inputs and 12 regular outputs, 4 fast inputs (HSC)(2) and 4 fast outputs (PTO/PWM/FG)(3) 20 regular inputs and No
No
No
12 relay outputs and 4 No 4 fast inputs (HSC)(2) fast outputs (PTO/PWM/FG)(3) 20 regular inputs and 4 fast inputs (HSC)(2) 20 regular inputs and 12 relay outputs and 4 2 analog inputs 4 fast inputs (HSC)(2) fast outputs (PTO/PWM/FG)(3) 34 regular inputs and 2 fast inputs (HSC)(1) 24 relay outputs No 16 relay outputs No
No
2 analog outputs
2 analog outputs
No
(1) The reduced fast inputs have a maximum frequency of 10 kHz. They can be used either as regular inputs or as reduced fast inputs for counting. (2) The fast inputs can be used either as regular inputs or as fast inputs for counting or event functions. (3) The fast outputs can be used either as regular outputs or as fast outputs for PTO, PWM, Frequency Generator functions, or reflex output for HSC.
EIO0000000827 12/2012
15
16
EIO0000000827 12/2012
Modicon M218 Logic Controller How to Configure the Controller EIO0000000827 12/2012
2
How to Configure the Controller
Introduction Before configuring the controller, you must first create a new project or open an existing project in the SoMachine software (see SoMachine, Programming Guide). Graphical Configuration Editor In the Graphical Configuration Editor (see SoMachine, Programming Guide), the controller is displayed as below:
EIO0000000827 12/2012
17
Controller Configuration Screen To access to the controller configuration screen, proceed as follow:
Step 1 2 Action Select the Configuration tab. Double-click the controller.
In the task selection pane, entries and sub-entries let you access the different configuration windows:
18
EIO0000000827 12/2012
Refer to... Controller Device Editor (see page 68) I/O Embedded Function configuration (see page 73) NOTE: PTO_PWM is available only on TM218LDA40DRPHN, TM218LDAE40DRPHN, TM218LDA40DR4PHN, TM218LDD24DUPHN and TM218LDD40DUPHNB Analog I/O Embedded Function configuration (see page 83) NOTE: Only available on TM218LDA40DR2HN and TM218LDA40DR4PHN Serial Line configuration (see page 91) Ethernet configuration (see page 115) NOTE: Only available on TM218LDAE24DRHN and TM218LDAE40DRPHN
Analog IO
Communication
Device Tree The controller functions of the Configuration tab are also accessible from the Program tab. There, the Devices tree describes the hardware configuration (for example, the following Devices tree is the default tree when the controller is added):
EIO0000000827 12/2012
19
Description This part shows items related to the application: z Tasks configuration z Programming z Library manager z POUs z Relocation Table
Embedded Functions This representation shows the Embedded Functions of the M218. NOTE: PTO-PWM available only on TM218LDA40DRPHN, TM218LDAE40DRPHN, TM218LDA40DR4PHN, TM218LDD24DUPHN and TM218LDD40DUPHNB Analog IO available only on TM218LDA40DR2HN and TM218LDA40DR4PHN Serial Line 1 Serial Line 2 Ethernet These are the embedded communications. NOTE: Ethernet available only on TM218LDAE24DRHN and TM218LDAE40DRPHN
Content of Device Tree The device tree represents the objects managed by a specific target (controller or HMI). These objects are: z application objects (Tasks, etc.), z programming objects (POU, GVL, etc.), z hardware-related objects (Embedded functions, Expansion modules, etc.) By default, the device tree includes the following hardware-related objects:
Reference TM218LDA16DRN TM218LDA24DRN TM218LDA24DRHN TM218LDA40DRN TM218LDA40DR2HN TM218LDA60DRN TM218LDA40DRPHN TM218LDA40DR4PHN TM218LDD24DUPHN TM218LDD40DUPHNB TM218LDAE24DRHN TM218LDAE40DRPHN Embedded IO IO HSC Embedded communications Serial Line 1 (SoMachine_Network_Manager) Serial Line 2 (Modbus_Manager)
IO HSC PTO_PWM IO HSC IO HSC PTO_PWM Serial Line 1 (SoMachine_Network_Manager) Serial Line 2 (Modbus_Manager) Ethernet (Modbus TCP)
20
EIO0000000827 12/2012
Libraries
3
Libraries
Introduction Libraries provide functions, function blocks, data types and global variables that can be used to develop your project. The Library Manager of SoMachine provides information about the libraries included in your project and allows you to install new ones. For more information on the Library Manager, refer to the CoDeSys online help in SoMachine. Modicon M218 Logic Controller When you select a Modicon M218 Logic Controller for your application, SoMachine automatically loads the following libraries:
Library name IoStandard Description CmpIoMgr configuration types, ConfigAccess, Parameters and help functions: manages the I/Os in the application. Contains functions and function blocks which are required matching IEC61131-3 as standard POUs for an IEC programming system. The standard POUs must be tied to the project (standard.library). Analog Monitors, BCD Conversions, Bit/Byte Functions, Controller Datatypes, Function Manipulators, Mathematical Functions, Signals. Contains functions and variables to get information and send commands to the controller system.
Standard
Util
M218 PLCSystem (see Modicon M218 Logic Controller, System Functions and Variables, M218 PLCSystem Library Guide)
EIO0000000827 12/2012
21
Libraries
Library name
Description
Contains function blocks and variables to get M218 HSC (see Modicon M218 information and send commands to the Fast Logic Controller, High Speed Counting, M218 HSC Library Guide) Inputs/Outputs of the Modicon M218 Logic Controller. These function blocks permit you to implement HSC (High Speed Counting) functions on the Fast Inputs/Outputs of the Modicon M218 Logic Controller. M218 PTOPWM (see Modicon M218 Logic Controller, Pulse Train Output, Pulse Width Modulation, M218 PTOPWM Library Guide) Contains function blocks and variables to get information and send commands to the Fast Inputs/Outputs of the Modicon M218 Logic Controller. These function blocks permit you to implement PTO (Pulse Train Output) and PWM (Pulse With Modulation) functions on the Fast Outputs of the Modicon M218 Logic Controller. The relocation table allows the user to organize data to optimize exchanges between the Modbus client and the controller, by regrouping non-contiguous data into a contiguous table of registers. Contains a function block to send a command with stop signal management to the fast inputs/outputs of the Modicon M218 Logic Controller when a PTO is configured.
M218 Packaging (see Modicon M218 Logic Controller, Packaging Library, M218 Packaging Library Guide)
22
EIO0000000827 12/2012
Modicon M218 Logic Controller Supported Standard Data Types EIO0000000827 12/2012
4
Supported Standard Data Types
Supported Standard Data Types The Controller supports the following IEC Data types:
Data type BOOL BYTE WORD DWORD LWORD SINT USINT INT UINT DINT UDINT LINT ULINT REAL STRING WSTRING TIME Lower limit False 0 0 0 0 -128 0 -32,768 0 -2,147,483,648 0 -2 0 1.175494351e-38 1 character 1 character 63
Information content 1 Bit 8 Bit 16 Bit 32 Bit 64 Bit 8 Bit 8 Bit 16 Bit 16 Bit 32 Bit 32 Bit 64 Bit 64 Bit 32 Bit 1 character = 1 byte 1 character = 1 word 16 bit
127 255 32,767 65,535 2,147,483,647 4,294,967,295 2 -1 264-1 3.402823466e+38 255 characters 255 characters 63
For more information on ARRAY, LTIME, DATE, TIME, DATE_AND_TIME, and TIME_OF_DAY, refer to the CoDeSys online help in SoMachine.
EIO0000000827 12/2012
23
Unsupported Standard Data Types The Controller does not support the following IEC Data types:
Data type LREAL Lower limit Upper limit Information content
24
EIO0000000827 12/2012
Memory Mapping
5
Introduction This chapter describes the memory maps and sizes of the different memory areas in the Modicon M218 Logic Controller. These memory areas are used to store user program logic, data and the programming libraries. What Is in This Chapter? This chapter contains the following topics:
Topic Memory Organization Relocation Table Page 26 30
EIO0000000827 12/2012
25
Memory Mapping
Memory Organization
Introduction This section describes the RAM (Random Access Memory) size for different areas of the Modicon M218 Logic Controller. Memory Mapping The RAM size is 2 Mbytes composed of 2 areas: 1024 kbytes System Area for Operating System memory z 1024 kbytes Customer Area for dedicated application and configuration data.
z
Memory containing Persistent and Retain variables is preserved and protected. The Persistent and Retain variables will be retained during power outages or when the controller is powered off.
26
EIO0000000827 12/2012
Memory Mapping
This table shows the different types of memory areas with their sizes in the Modicon M218 Logic Controller memory:
Area System Area 1024 kbytes Element System Area Mappable Addresses %MW0...%MW59999 System and Diagnostic variables (%MW60000...%MW60199) This memory is accessible through ModBus requests only. These must be read-only requests. Dynamic Memory Area: Read Relocation Table (see page 30) (%MW60200...%MW61999) This memory is accessible through ModBus requests only. These must be read-only requests. Reserved Memory Area (%MW62000...%MW62199) This memory is accessible through ModBus requests only. These must be read-only requests. Dynamic Memory Area: Write Relocation Table (see page 30) (%MW62200...%MW63999) This memory is accessible through ModBus requests only. These can be read or write requests. Reserved Customer Area 1024 kbytes 920576 Size (bytes) 120000 400
7600
Variables (including Retain and Persistent variables, 838860(1) see table below) Application Libraries (see page 28) Symbols 209716(1)
The memory size for variables, applications, libraries, and symbols are customized depending on the usage. It is recommended that variables, applications, and libraries take up to 80% of customer area, and symbols take 20% of the customer area.
(1)
EIO0000000827 12/2012
27
Memory Mapping
1888 bytes Retention RAM 744 bytes 144 bytes 1000 bytes
(2)
Not all the 744 bytes are available for the customer application because some libraries may use Retain Variables.
The following table describes the retain data memory mapping for TM218LDD40DUPHNB:
8000 bytes Retention RAM 3000 bytes 1000 bytes 4000 bytes
(2)
Not all the 3000 bytes are available for the customer application because some libraries may use Retain Variables.
System Variables For more information on System Variables, refer to the M218 PLCSystem Library Guide. Library Sizes
Library Name M218 HSC (see Modicon M218 Logic Controller, High Speed Counting, M218 HSC Library Guide) Average Size 10 kbytes Comment Depends on the functions used.
25 kbytes M218 PLCSystem (see Modicon M218 Logic Controller, System Functions and Variables, M218 PLCSystem Library Guide)
Always embedded in the application. The use of the functions does not consume additional memory.
28
EIO0000000827 12/2012
Memory Mapping
Library Name M218 PTOPWM (see Modicon M218 Logic Controller, Pulse Train Output, Pulse Width Modulation, M218 PTOPWM Library Guide) PLC Communication M218 Packaging
20 kbytes 10 kbytes
EIO0000000827 12/2012
29
Memory Mapping
Relocation Table
Introduction The Relocation Table allows you to organize data to optimize communication between the controller and other equipment by regrouping non-contiguous data into a contiguous table of registers. NOTE: A Relocation Table is considered as an object. Only one Relocation Table object can be added to a controller. Relocation Table Description This table describes the Relocation Table organization:
Register 60200...61999 62200...63999 Description Dynamic Memory Area: Read Relocation Table Dynamic Memory Area: Write Relocation Table
For further information refer to M218 PLCSystem Library Guide. Adding a Relocation Table The following table describes how to add a Relocation Table to your project:
Step 1 Action Select the Program tab:
2 3
In the Device tree of the Devices window, right click the Application node to display the contextual menu and select Add Object... sub-menu. Select Relocation Table... in the list and click the Open button of the Add Relocation Table editor Result: The new Relocation Table is created and initialized. NOTE: As a Relocation Table must be unique for a controller, its name is Relocation Table and cannot be changed.
30
EIO0000000827 12/2012
Memory Mapping
Relocation Table Editor The Relocation Table Editor allows you to organize your variables under the Relocation Table. To access the Relocation Table Editor, double-click the Relocation Table node in the Device tree of the Devices window:
EIO0000000827 12/2012
31
Memory Mapping
Icon
Element New Item Move Down Move Up Delete Item Copy Paste Erase Empty Item
Description Adds an element to the list of system variables. Moves down the selected element of the list. Moves up the selected element of the list. Removes the selected elements of the list. Copies the selected elements of the list. Pastes the elements copied. Removes all the elements of the list for which the "Variable" column is empty. Automatic incremental integer (not editable) The name or the full path of a variable (editable) The address of the system area where the variable is stored (not editable). Variable length in word Indicates if the entered variable is valid (not editable).
NOTE: If a variable is undefined after program modifications, the content of the cell is displayed in red, the related Validity cell is False, and Address is set to -1.
32
EIO0000000827 12/2012
Tasks
6
Introduction The Task Configuration node in the SoMachine device tree allows you to define one or several tasks to control the execution of your application program. The task types available are: z Cyclic z Freewheeling z Event z External Event This chapter begins with an explanation of these task types and provides information regarding the maximum number of tasks, the default task configuration, and task prioritization. In addition, this chapter introduces the system and task watchdog functions and explains their relationship to task execution. What Is in This Chapter? This chapter contains the following topics:
Topic Maximum Number of Tasks Task Configuration Screen Task Types System and Task Watchdogs Task Priorities Default Task Configuration Page 34 35 38 41 42 44
EIO0000000827 12/2012
33
Tasks
34
EIO0000000827 12/2012
Tasks
Double-click the task that you want to configure in the device tree of the Devices window:
NOTE: For more information on adding a task, refer to the SoMachine online help tutorials.
EIO0000000827 12/2012
35
Tasks
Task Configuration Screen Each task configuration has its own parameters which are independent of the other tasks. The task Configuration window is composed of 4 parts:
36
EIO0000000827 12/2012
Tasks
The following table describes the fields of the task Configuration screen:
Field Name Priority Definition You can configure the priority of each task with a number between 0 and 31 (0 is the highest priority, 31 is the lowest). Only 1 task at a time can be running. The priority determines when the task will run: z a higher priority task will preempt a lower priority task z tasks with same priority will run in turn (2 ms time-slice) NOTE: Do not assign tasks with the same priority. For important safety information, refer to Task Priorities (see page 42). Type 4 types of task are available: z Cyclic (see page 38) z Freewheeling (see page 39) z Event (see page 39) z External event (see page 40) To configure the watchdog, you must define two parameters:
z Time: enter the timeout before watchdog execution. z Sensitivity: defines the number of expirations of the watchdog timer before the
Controller stops program execution and enters into a HALT state (see page 50). POUs (see SoMachine, Programming Guide) The list of POUs (Programming Organization Unit) controlled by the task is defined in the task Configuration window:
z z z z
To add a POU linked to the task, use the command Add POU. To remove a POU from the list, use the command Remove POU. The command Open POU opens the currently selected POU in the appropriate editor. To replace the currently selected POU of the list by another one, use the command Change POU... z POUs are executed in the order they appear in the task Configuration window. To rearrange POUs in the list, select a POU and click Move Up or Move Down Clicking any of the POU commands will open the Input Assistant window. NOTE: You can create as many POUs as you want. An application with several small POUs, as opposed to one large POU improves the refresh time of the variables in online mode.
EIO0000000827 12/2012
37
Tasks
Task Types
Introduction The following section describes the various task types available for your program, along with a description of the task type characteristics. Cyclic Task A Cyclic task is assigned a fixed cycle time using the Interval setting in the Type section of Configuration sub-tab for that task. Each Cyclic task type executes as follows:
1. Read Inputs: The physical input states are written to the %I input memory variables and other system operations are executed. 2. Task Processing: The user code (POU, etc.) defined in the task is processed. The %Q output memory variables are updated according to your application program instructions but not yet written to the physical outputs during this operation. 3. Write Outputs: The %Q output memory variables are modified with any output forcing that has been defined; however, the writing of the physical outputs depends upon the type of output and instructions used. For more information on defining the Bus cycle task, refer to the CoDeSys online help in SoMachine and Modicon M218 Logic Controller Settings (see page 70). For more information on I/O behavior, refer to Controller States Detailed Description (see page 50). NOTE: Expansion I/Os are always physically updated by the MAST task. 4. Remaining Interval time: The controller firmware carries out system processing and any other lower priority tasks. NOTE: If you define too short a period for a cyclic task, it will repeat immediately after the write of the outputs and without executing other lower priority tasks or any system processing. This will affect the execution of all tasks and cause the controller to exceed the system watchdog limits, generating a system watchdog exception. NOTE: You can get and set the interval of a Cyclic Task by application using the GetCurrentTaskCycle and SetCurrentTaskCycle function. (Refer to Toolbox Advance Library Guide for further details.)
38
EIO0000000827 12/2012
Tasks
Freewheeling Task A Freewheeling task does not have a fixed duration. In Freewheeling mode, each task scan begins when the previous scan has been completed and after a short period of system processing. Each Freewheeling task type executes as follows:
1. Read Inputs: The physical input states are written to the %I input memory variables and other system operations are executed. 2. Task Processing: The user code (POU, etc.) defined in the task is processed. The %Q output memory variables are updated according to your application program instructions but not yet written to the physical outputs during this operation. 3. Write Outputs: The %Q output memory variables are modified with any output forcing that has been defined; however, the writing of the physical outputs depends upon the type of output and instructions used. For more information on defining the Bus cycle task, refer to the CoDeSys online help in SoMachine and Modicon M218 Logic Controller Settings (see page 70). For more information on I/O behavior, refer to Controller States Detailed Description (see page 50). 4. System Processing: The controller firmware carries out system processing and any other lower priority tasks (for example: http management, ethernet management, parameters management). Event Task This type of task is event-driven and is initiated by a program variable. It starts at the rising edge of the boolean variable associated to the trigger event unless preempted by a higher priority task. In that case, the Event task will start as dictated by the task priority assignments. For example, if you have defined a variable called my_Var and would like to assign it to an Event, select the Event type on the Configuration sub-tab and click on the Input Assistant button to the right of the Event name field. This will cause the Input Assistant dialog box to appear. In the Input Assistant dialog box, you navigate the tree to find and assign the my_Var variable.
EIO0000000827 12/2012
39
Tasks
External Event Task This type of task is event-driven and is initiated by the detection of a hardware or hardware-related function event. It starts when the event occurs unless preempted by a higher priority task. In that case, the External Event task will start as dictated by the task priority assignments. For example, an External Event task could be associated with an HSC Threshold cross event. To associate the HSC2_TH1 event to an External Event task, select it from the External event dropdown list on the Configuration sub-tab. Depending on the related product, there are up to 2 types of events that can be associated with an External Event task: z Rising edge on Fast input (%IX0.0 ... %IX0.3 inputs) z HSC thresholds
40
EIO0000000827 12/2012
Tasks
System Watchdogs: These watchdogs are defined in and managed by the controller firmware. These are not configurable by the user. Task Watchdogs: Optional watchdogs that can be defined for each task. These are managed by your application program and are configurable in SoMachine.
System Watchdogs Two system watchdogs are defined for the Modicon M218 Logic Controller. They are managed by the controller firmware and are therefore sometimes referred to as hardware watchdogs in the SoMachine online help. When one of the system watchdogs exceeds its threshold conditions, an error is detected. The threshold conditions for the 2 system watchdogs are defined as follows: If all of the tasks require more than 80% of the processor resources for more than 3 seconds, a system error is detected. The controller enters the HALT state. z If the lowest priority task of the system is not executed during an interval of 20 seconds, a system error is detected. The controller responds with an automatic reboot into the EMPTY state.
z
NOTE: System watchdogs are not configurable by the user. Task Watchdogs SoMachine allows you to configure an optional task watchdog for every task defined in your application program. (Task watchdogs are sometimes also referred to as software watchdogs or control timers in the SoMachine online help). When one of your defined task watchdogs reaches its threshold condition, an application error is detected and the controller enters the HALT state. When defining a task watchdog, the following options are available: z Time: This defines the allowable maximum execution time for a task. When a task takes longer than this the controller will report a task watchdog exception. z Sensitivity: The sensitivity field defines the number of task watchdog exceptions that must occur before the controller detects an application error. A task watchdog is configured on the Configuration sub-tab of the Task Configuration tab for the individual task. To access this tab, double-click the task in the device tree. NOTE: For more information on watchdogs, refer to the CoDeSys online help in SoMachine.
EIO0000000827 12/2012
41
Tasks
Task Priorities
Introduction You can configure the priority of each task between 0 and 31 (0 is the highest priority, 31 is the lowest). Each task must have a unique priority. If you assign the same priority to more than one task, execution for those tasks is indeterminate and unpredictable, which may lead to unintended consequences.
WARNING
UNINTENDED EQUIPMENT OPERATION Do not assign the same priority to different tasks. Failure to follow these instructions can result in death, serious injury, or equipment damage.
42
EIO0000000827 12/2012
Tasks
Task Preemption Due to Task Priorities When a task cycle starts, it can interrupt any task with lower priority (task preemption). The interrupted task will resume when the higher priority task cycle is finished.
NOTE: If the same input is used in different tasks the input image may change during the task cycle of the lower priority task. To improve the likelihood of proper output behavior during multitasking, an error is detected if outputs in the same byte are used in different tasks.
WARNING
UNINTENDED EQUIPMENT OPERATION Map your inputs so that tasks do not alter the input images in an unexpected manner. Failure to follow these instructions can result in death, serious injury, or equipment damage.
EIO0000000827 12/2012
43
Tasks
For the Modicon M218 Logic Controller: The MAST task can be configured in Freewheeling or Cyclic mode. The MAST task is automatically created by default in Cyclic mode. Its preset priority is medium (15), its preset interval is 20 ms, and its task watchdog service is activated with a time of 100 ms and a sensitivity of 1. Refer to Task Priorities (see page 42) for more information on priority settings. Refer to System and Task Watchdogs (see page 41) for more information on watchdogs.
Designing an efficient application program is important in systems approaching the maximum number of tasks. In such an application, it can be difficult to keep the resource utilization below the system watchdog threshold. If priority reassignments alone are not sufficient to remain below the threshold, some lower priority tasks can be made to use fewer system resources if the SysTaskWaitSleep function is added to those tasks. For more information about this function, see the optional SysTask library of the system / SysLibs category of libraries. NOTE: Do not delete or change the Name of the MAST task. If you do so, SoMachine detects an error when you attempt to build the application, and you will not be able to download it to the controller.
44
EIO0000000827 12/2012
Modicon M218 Logic Controller Controller States and Behaviors EIO0000000827 12/2012
7
Introduction This chapter provides you with information on controller states, state transitions, and behaviors in response to system events. It begins with a detailed controller state diagram and a description of each state. It then defines the relationship of output states to controller states before explaining the commands and events that result in state transitions. It concludes with information about Remanent variables and the effect of SoMachine task programming options on the behavior of your system. What Is in This Chapter? This chapter contains the following sections:
Section 7.1 7.2 7.3 Controller State Diagram Controller States Description State Transitions and System Events Topic Page 46 50 54
EIO0000000827 12/2012
45
7.1
Legend: Controller states are indicated in ALL-CAPS BOLD z User and application commands are indicated in Bold
z
46
EIO0000000827 12/2012
System events are indicated in Italics Decisions, decision results and general information are indicated in normal text
(1)
For details on STOPPED to RUNNING state transition, refer to Run Command (see page 58).
For details on RUNNING to STOPPED state transition, refer to Stop Command (see page 59). Note 1 The Power Cycle (Power Interruption followed by a Power ON) deletes all output forcing settings. Refer to Controller State and Output Behavior (see page 55) for further details. Note 2 The boot process can take up to 10 seconds under normal conditions. The outputs will assume their initialization states. Note 3 In some cases, when a system error is detected, it will cause the controller to automatically reboot into the EMPTY state as if no Boot application were present in the Flash memory. However, the Boot application is not actually deleted from the Flash memory. Note 4 The application is loaded into RAM after verification of a valid Boot application. During the load of the boot application, a Check context test occurs to assure that the Remanent variables are valid. If the Check context test is invalid, the boot application will load but the controller will assume STOPPED state (see page 62). Note 5 During a successful application download the following events occur: The application is loaded directly into RAM. z By default, the Boot application is created and saved into the Flash memory.
z
(2)
Note 6 The default behavior after downloading an application program is for the controller to enter the STOPPED state irrespective of the Run/Stop input setting or the last controller state before the download.
EIO0000000827 12/2012
47
However, there are two important considerations in this regard: Online Change: An online change (partial download) initiated while the controller is in the RUNNING state returns the controller to the RUNNING state if successful and provided the Run/Stop input is configured and set to Run. Before using the Login with online change option, test the changes to your application program in a virtual or non-production environment and confirm that the controller and attached equipment assume their expected conditions in the RUNNING state.
WARNING
UNINTENDED EQUIPMENT OPERATION Always verify that online changes to a RUNNING application program operate as expected before downloading them to controllers. Failure to follow these instructions can result in death, serious injury, or equipment damage. NOTE: Online changes to your program are not automatically written to the Boot application, and will be overwritten by the existing Boot application at the next reboot. If you wish your changes to persist through a reboot, manually update the Boot application by selecting Create boot application in the Online menu (the controller must be in the STOPPED state to achieve this operation). Multiple Download: SoMachine has a feature that allows you to perform a full application download to multiple targets on your network or fieldbus. One of the default options when you select the Multiple Download... command is the Start all applications after download or online change option, which restarts all download targets in the RUNNING state, provided their respective Run/Stop inputs are commanding the RUNNING state, but irrespective of their last controller state before the multiple download was initiated. Deselect this option if you do not want all targeted controllers to restart in the RUNNING state. In addition, before using the Multiple Download option, test the changes to your application program in a virtual or non-production environment and confirm that the targeted controllers and attached equipment assume their expected conditions in the RUNNING state.
WARNING
UNINTENDED EQUIPMENT OPERATION Always verify that your application program will operate as expected for all targeted controllers and equipment before issuing the "Multiple Download" command with the "Start all applications after download or online change" option selected. Failure to follow these instructions can result in death, serious injury, or equipment damage.
48
EIO0000000827 12/2012
NOTE: During a multiple download, unlike a normal download, SoMachine does not offer the option to create a Boot application. You can manually create a Boot application at any time by selecting Create boot application in the Online menu on all targeted controllers (the controller must be in the STOPPED state for this operation). Note 7 The SoMachine software platform allows many powerful options for managing task execution and output conditions while the controller is in the STOPPED or HALT states. Refer to Controller States Description (see page 50) for further details. Note 8 To exit the HALT state it is necessary to issue one of the Reset commands (Reset Warm, Reset Cold, Reset Origin), download an application or cycle power. In case of non recoverable event (hardware watchdog or internal error), a cycle power is mandatory. Note 9 The RUNNING state has two exception conditions. They are: z RUNNING with External Error: this exception condition is indicated by the MS Status LED , which displays solid green with 1 red flash . You may exit this state by clearing the external error. No controller commands are required. z RUNNING with Breakpoint: this exception condition is indicated by the MS Status LED , which displays 3 green flashes. Refer to Controller States Description (see page 50) for further details. Note 10 The controller has a Run/Stop Switch to toggle the PLC state from RUN to STOP or from STOP to RUN. If the switch is set to Stop, the controller will be stopped irrespective of the Run/Stop input setting.
EIO0000000827 12/2012
49
7.2
WARNING
UNINTENDED EQUIPMENT OPERATION
z
z z
Never assume that your controller is in a certain controller state before commanding a change of state, configuring your controller options, uploading a program, or modifying the physical configuration of the controller and its connected equipment. Before performing any of these operations, consider the effect on all connected equipment. Before acting on a controller, always positively confirm the controller state by viewing its LEDs, confirming the condition of the Run/Stop input, checking for the presence of output forcing, and reviewing the controller status information via SoMachine.(1)
Failure to follow these instructions can result in death, serious injury, or equipment damage.
(1)
The controller states can be read in the PLC_R.i_wStatus system variable of the M218 PLCSystem library (see Modicon M218 Logic Controller, System Functions and Variables, M218 PLCSystem Library Guide)
Controller States Table The following table describes the controller states:
Controller State BOOTING Description The controller executes the boot firmware and its own internal self-tests. It then checks the checksum of the firmware and user applications. It does not execute the application nor does it communicate. This state is the same as the normal BOOTING state except that a flag is set to make it appear as if no Boot application is present and the LED indications are different. RUN/MS LED Flashing green/red
EIO0000000827 12/2012
Description
RUN/MS LED
Flashing red There is not a valid firmware file present In the Flash memory. The controller does not execute the application. Communication is only possible through the USB host port, and then only for uploading a valid OS. Refer to Updating an M218 Controller Firmware (see page 153). There is no or an invalid application. This state is the same as the normal EMPTY state except that a flag is set to make it appear as if no Boot Application is present (no Application is loaded) and the LED indications are different. The controller is executing a valid application. Single flash green Rapid flashing red
Green
RUNNING with This state is the same as the RUNNING state with 3 flash green Breakpoint the following exceptions: z The task-processing portion of the program does not resume until the breakpoint is cleared. z The LED indications are different. For more information on breakpoint management, refer to the CoDeSys online help in SoMachine. RUNNING with This state is the same as the normal RUNNING detection of an state except the LED indications are different. External Error STOPPED Green / single flash red
Flashing green The controller has a valid application that is stopped. See Details of the STOPPED State (see page 52) for an explanation of the behavior of outputs and field buses in this state. This state is the same as the normal STOPPED state except the LED indications are different. Flashing green / single flash red
The controller stops executing the application because it has detected an Application Error. This description is the same as for the STOPPED state with the following exceptions: z The task responsible for the Application Error always behaves as if the Update IO while in stop option was not selected. All other tasks follow the actual setting. z The LED indications are different
EIO0000000827 12/2012
51
Details of the STOPPED State The following statements are true for the STOPPED state: The input configured as the Run/Stop input remains operational. z All outputs initially assume their configured state (Keep current values or Set all outputs to default) or the state dictated by output forcing if used. The subsequent state of the outputs depends on the value of the Update IO while in stop setting and on commands received from remote devices.
z
Task and I/O Behavior When Update IO While In Stop Is Selected When the Update IO while in stop setting is selected: z The Read Inputs operation continues normally. The physical inputs are read and then written to the %I input memory variables. z The Task Processing operation is not executed. z The Write Outputs operation continues. The %Q output memory variables are updated to reflect either the Keep current values configuration or the Set all outputs to default configuration, adjusted for any output forcing, and then written to the physical outputs. NOTE: if Q0, Q1, Q2 or Q3 outputs are configured for PTO, PWM, FG, or HSC operation, they fallback to a value of 0 irrespective of the configured fallback setting. For PTO operation, outputs Q0, Q1, Q2, and Q3 execute a fast stop deceleration. Outputs configured for PWM, FG, and HSC go immediately to 0.
WARNING
UNINTENDED EQUIPMENT OPERATION Design and program your system so that controlled equipment assumes a safe state when the controller enters fallback mode if you use outputs Q0, Q1, Q2, or Q3 for PTO, PWM, FG, or HSC operation. Failure to follow these instructions can result in death, serious injury, or equipment damage. NOTE: Commands received by Serial, USB, and Ethernet communications can continue to write to the memory variables. Changes to the %Q output memory variables are written to the physical outputs.
52
EIO0000000827 12/2012
Task and I/O Behavior When Update IO While In Stop Is Not Selected When the Update IO while in stop setting is not selected, the controller sets the I/O to either the Keep current values or Set all outputs to default condition (as adjusted for output forcing if used). After this, the following becomes true: z The Read Inputs operation ceases. The %I input memory variablea are frozen at their last values. z The Task Processing operation is not executed. z The Write Outputs operation ceases. The %Q output memory variables can be updated via the Ethernet, Serial, and USB connections. However, the physical outputs are unaffected and retain the state specified by the configuration options. NOTE: if Q0, Q1, Q2 or Q3 outputs are configured for PTO, PWM, FG, or HSC operation, they fallback to a value of 0 irrespective of the configured fallback setting. For PTO operation, outputs Q0, Q1, Q2, and Q3 execute a fast stop deceleration. Outputs configured for PWM, FG, and HSC go immediately to 0.
WARNING
UNINTENDED EQUIPMENT OPERATION Design and program your system so that controlled equipment assumes a safe state when the controller enters fallback mode if you use outputs Q0, Q1, Q2, or Q3 for PTO, PWM, FG, or HSC operation. Failure to follow these instructions can result in death, serious injury, or equipment damage.
EIO0000000827 12/2012
53
7.3
Overview This section begins with an explanation of the output states possible for the controller. It then presents the system commands used to transition between controller states and the system events that can also affect these states. It concludes with an explanation of the Remanent variables, and the circumstances under which different variables and data types are retained through state transitions. What Is in This Section? This section contains the following topics:
Topic Controller States and Output Behavior Commanding State Transitions Error Detection, Types, and Management Remanent Variables Page 55 58 64 66
54
EIO0000000827 12/2012
EIO0000000827 12/2012
55
Set All Outputs to Default You can select this option by choosing Set all outputs to default in the Behaviour for outputs in Stop dropdown menu of the PLC settings sub-tab of the Controller Editor. To access the Controller Editor, right-click on the controller in the device tree and select Edit Object. This output behavior applies in the STOPPED and HALT controller states. Outputs are set to and maintained in their current state, although the details of the output behavior varies greatly depending on the setting of the Update IO while in stop option and the actions commanded via configured fieldbuses. Refer to Controller States Description (see page 50) for more details on these variations. Initialization Values This output state applies in the BOOTING, EMPTY (following power cycle with no boot application or after the detection of a system error), and INVALID_OS states. In the initialization state, analog, transistor and relay outputs assume the following values: z For an analog output : Z (High Impedance) z For a fast transistor output: Z (High Impedance) z For a regular transistor output: 0 Vdc z For a relay output: Open Output Forcing The controller allows you to force the state of selected outputs to a defined value for the purposes of system testing, commissioning and maintenance. You are only able to force the value of an output while your controller is connected to SoMachine. To do so you use the Force Values command in the Debug/Watch menu. Output forcing overrides all other commands to an output irrespective of the task programming that is being executed. When you logout of SoMachine when output forcing has been defined, you are presented with the option to retain output forcing settings. If you select this option, the output forcing continues to control the state of the selected outputs until you download an application or use one of the Reset commands. When the option Update IO while in stop, if supported by your controller, is checked (default state), the forced outputs keep the forcing value even when the logic controller is in STOP.
56
EIO0000000827 12/2012
Output Forcing Considerations The output you wish to force must be contained in a task that is currently being executed by the controller. Forcing outputs in unexecuted tasks, or in tasks whose execution is delayed either by priorities or events will have no effect on the output. However, once the task that had been delayed is executed, the forcing will take effect at that time. Depending on task execution, the forcing could impact your application in ways that may not be obvious to you. For example, an event task could turn on an output. Later, you may attempt to turn off that output but the event is not being triggered at the time. This would have the effect of the forcing apparently being ignored. Further, at a later time, the event could trigger the task at which point the forcing would take effect.
WARNING
UNINTENDED EQUIPMENT OPERATION
z z
You must have a thorough understanding of how forcing will affect the outputs relative to the tasks being executed. Do not attempt to force I/O that is containted in tasks that you are not certain will be executed in a timely manner, unless your intent is for the forcing to take affect at the next execution of the task whenever that may be. If you force an output and there is no apparent affect on the physical output, do not exit SoMachine without removing the forcing.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
EIO0000000827 12/2012
57
By an external call via Modbus request using the PLC_W.q_wPLCControl and PLC_W.q_uiOpenPLCControl system variables of the M218 PLCSystem Library (see Modicon M218 Logic Controller, System Functions and Variables, M218 PLCSystem Library Guide). Login with online change option: An online change (partial download) initiated while the controller is in the RUNNING state returns the controller to the RUNNING state if successful. The controller is restarted into the RUNNING state automatically under certain conditions.
Refer to Controller State Diagram (see page 46) for further details.
58
EIO0000000827 12/2012
Stop Command Effect: Commands a transition to the STOPPED controller state. Starting Conditions: BOOTING, EMPTY or RUNNING state. Methods for Issuing a Stop Command: Run/Stop Input: If configured, command a value of 0 to the Run/Stop input. Refer to Run/Stop Input (see page 77) for more information. z Run/Stop Switch: manually set the switch to STOP. z With SoMachine software: z Click on the menu Online Stop z Click on the stop icon which is symbolized by an square in the icon bar
z z
z z
By an internal call by the application or an external call via Modbus request using the PLC_W. q_wPLCControl and PLC_W. q_uiOpenPLCControl system variables of the M218 PLCSystem Library (see Modicon M218 Logic Controller, System Functions and Variables, M218 PLCSystem Library Guide). Login with online change option: An online change (partial download) initiated while the controller is in the STOPPED state returns the controller to the STOPPED state if successful. Download Command: implicitly sets the controller into the STOPPED state. The controller is restarted into the STOPPED state automatically under certain conditions.
Refer to Controller State Diagram (see page 46) for further details. Reset Warm Effect: Resets all variables, except for the remanent variables, to their default values. Places the controller into the STOPPED state. Starting Conditions: RUNNING, STOPPED, or HALT states. Methods for Issuing a Reset Warm Command: SoMachine Online Menu: Select the Reset warm command. z By an internal call by the application or an external call via Modbus request using the PLC_W. q_wPLCControl and PLC_W. q_uiOpenPLCControl system variables of the M218 PLCSystem Library (see Modicon M218 Logic Controller, System Functions and Variables, M218 PLCSystem Library Guide).
z
EIO0000000827 12/2012
59
Effects of the Reset Warm Command: 1. The application stops. 2. Forcing is erased. 3. Diagnostic indications for detected errors are reset. 4. The values of the retain variables are maintained. 5. The values of the retain-persistent variables are maintained. 6. All non-located and non-remanent variables are reset to their initialization values. 7. The values of the first 500 %MW registers are maintained. 8. The values of %MW500 to %MW59999 registers are reset to 0. 9. All fieldbus communications are stopped and then restarted after the reset is complete. 10.All I/O are briefly reset to their initialization values and then to their userconfigured default values. For details on variables, refer to Remanent Variables (see page 66). Reset Cold Effect: Resets all variables, except for the retain-persistent type of remanent variables, to their initialization values. Places the controller into the STOPPED state. Starting Conditions: RUNNING, STOPPED, or HALT states. Methods for Issuing a Reset Cold Command: SoMachine Online Menu: Select the Reset cold command. z By an internal call by the application or an external call via Modbus request using the PLC_W. q_wPLCControl and PLC_W. q_uiOpenPLCControl system variables of the M218 PLCSystem Library (see Modicon M218 Logic Controller, System Functions and Variables, M218 PLCSystem Library Guide).
z
Effects of the Reset Cold Command: 1. The application stops. 2. Forcing is erased. 3. Diagnostic indications for detected errors are reset. 4. The values of the retain variables are reset to their initialization value. 5. The values of the retain-persistent variables are maintained. 6. All non-located and non-remanent variables are reset to their initialization values. 7. The values of the first 500 %MW registers are maintained. 8. The values of %MW500 to %MW59999 registers are reset to 0. 9. All fieldbus communications are stopped and then restarted after the reset is complete. 10.All I/O are briefly reset to their initialization values and then to their userconfigured default values. For details on variables, refer to Remanent Variables (see page 66).
60
EIO0000000827 12/2012
Reset Origin Effect: Resets all variables, including the remanent variables, to their initialization values. Erases all user files on the controller. Places the controller into the EMPTY state. Starting Conditions: RUNNING, STOPPED, or HALT states.
z
Methods for Issuing a Reset Origin Command: SoMachine Online Menu: Select the Reset origin command.
Effects of the Reset Origin Command: 1. The application stops. 2. Forcing is erased. 3. The Boot application file is erased. 4. Diagnostic indications for detected errors are reset. 5. The values of the retain variables are reset. 6. The values of the retain-persistent variables are reset. 7. All non-located and non-remanent variables are reset. 8. The values of the first 500 %MW registers are maintained. 9. The values of %MW500 to %MW59999 registers are reset to 0. 10.All fieldbus communications are stopped. 11.All I/O are reset to their initialization values. For details on variables, refer to Remanent Variables (see page 66).
EIO0000000827 12/2012
61
Reboot Effect: Commands a reboot of the controller. Starting Conditions: Any state.
z
Effects of the Reboot: 1. The state of the controller depends on a number of conditions: a. The controller state will be RUNNING if: - the Run/Stop switch is in the RUN position - and, if configured, the Run/Stop Input is set to 1. b. The controller state will be STOPPED if: - the Run/Stop switch is in the STOP position - or, if configured, the Run/Stop input is set to 0. - the boot application is different than the application loaded prior to the reboot. - the previously saved context is invalid. - controller state was HALT prior to a power cycle. c. The controller state will be EMPTY if: - There is no boot application or the boot application is invalid, or - The reboot was provoked by specific detected System Errors. d. The controller state will be INVALID_OS if there is no valid firmware. 2. 3. 4. 5. 6. 7. 8. 9. Forcing is erased. Diagnostic indications for detected errors are reset. The values of the retain variables are restored if saved context is valid. The values of the retain-persistent variables are restored if saved context is valid. All non-located and non-remanent variables are reset to their initialization values. The values of the first 500 %MW registers are restored if saved context is valid. The values of %MW500 to %MW59999 registers are reset to 0. All fieldbus communications are stopped and restarted after the boot application is loaded successfully. 10.All I/O are reset to their initialization values and then to their user-configured default values if the controller assumes a STOPPED state after the reboot.
For details on variables, refer to Remanent Variables (see page 66). NOTE: If you make an online change to your application program while your controller is in the RUNNING or STOPPED state but do not manually update your Boot application, the controller will detect a difference in context at the next reboot, the remanent variables will be reset as per a Reset cold command, and the controller will enter the STOPPED state.
62
EIO0000000827 12/2012
Download Application Effect: Loads your application executable into the RAM memory. Optionally, creates a Boot application in the Flash memory. Starting Conditions: RUNNING, STOPPED, HALT, and EMPTY states.
z
Methods for Issuing the Download Application Command: SoMachine Online Menu: select Download command.
Effects of the SoMachine Download Command: 1. The existing application stops and then is erased. 2. If valid, the new application is loaded and the controller assumes a STOPPED state. 3. Forcing is erased. 4. Diagnostic indications for detected errors are reset. 5. The values of the retain variables are reset to their initialization values. 6. The values of any existing retain-persistent variables are maintained. 7. All non-located and non-remanent variables are reset to their initialization values. 8. The values of the first 500 %MW registers are maintained. 9. The values of %MW500 to %MW59999 registers are reset to 0. 10.All fieldbus communications are stopped and then any configured fieldbus of the new application is started after the download is complete. 11.All I/O are reset to their initialization values and then set to the new userconfigured default values after the download is complete. For details on variables, refer to Remanent Variables (see page 66).
EIO0000000827 12/2012
63
The following table describes the types of errors that may be detected:
Type of Error Detected External Error Detected Description Resulting Controller State RUNNING with External Error Detected Or STOPPED with External Error Detected
External errors are detected by the system while RUNNING or STOPPED but do not affect the ongoing controller state. An external error is detected in the following cases: z A connected device reports an error to the controller z The controller detects an error with an external device whether or not it reports an error, for example when the external device is communicating but not properly configured for use with the controller z The controller detects an error with the state of an output z The controller detects a loss of communication with a device z The controller is configured for an expansion module that is not present or not detected z The boot application in Flash memory is not the same as the one in RAM. Examples: z output short circuit z missing expansion module z communication lost z etc.
Application An application error is detected when improper programming is encountered or when a task watchdog threshold is exceeded. Error Examples: Detected z task (software) watchdog exception z execution of an unknown function z ProcessorLoad Watchdog (if all of the tasks require more than 80 % of the processor resources for more than 3 seconds) z etc.
HALT
64
EIO0000000827 12/2012
Description
A system error is detected when the controller enters a condition BOOTING that cannot be managed during runtime. Most such conditions EMPTY result from firmware or hardware exceptions, but there are some cases when incorrect programming can result in the detection of a system error, for example, when attempting to write to memory that was reserved during runtime. Examples: z System (hardware) watchdog overflow z exceeding the defined size of an array z etc. NOTE: There are some system errors that can be managed by runtime and are therefore treated like application errors.
NOTE: refer to the M218 PLCSystem Library Guide (see Modicon M218 Logic Controller, System Functions and Variables, M218 PLCSystem Library Guide) for more detailed information on diagnostics.
EIO0000000827 12/2012
65
Remanent Variables
Remanent Variables Remanent variables can retain their values in the event of power outages, reboots, resets, and application program downloads. There are multiple types of remanent variables, declared individually as "retain" or "persistent", or in combination as "retain-persistent". Remanent variables are retained only if the battery (see Modicon M218 Logic Controller, Hardware Guide) is sufficient. NOTE: For this controller, variables declared as persistent have the same behavior as variables declared as retain-persistent. The following table describes the behavior of remanent variables in each case:
Action VAR VAR RETAIN VAR PERSISTENT and RETAINPERSISTENT X X X X X X
Online change to application program Stop Power cycle Reset warm Reset cold Reset origin Download of application program X The value is maintained The value is re initialized
X X -
X X X X -
NOTE: The first 500 %MW are automatically retained and persistent if no variable is associated to them (their values are kept after a reboot / Reset warm / Reset cold). The other %MW are managed as VAR.
z
For example if you have in your program: VAR myVariable AT %MW0 : WORD; END_VAR
%MW0 will behave like myVariable (not retained and not persistent).
66
EIO0000000827 12/2012
Controller Configuration
8
Introduction This chapter describes how to configure the Modicon M218 Logic Controller. What Is in This Chapter? This chapter contains the following topics:
Topic Controller Configuration Applications M218 Controller Settings M218 Controller Services Page 68 69 70 71
EIO0000000827 12/2012
67
Controller Configuration
Controller Configuration
Controller Configuration Window Double-click the controller name (MyController by default) to access the Controller Configuration window:
The table below describes the tabs of the Controller Configuration Editor screen:
Tab Name Communication Settings Description Allows you to configure the connection between SoMachine and the controller. For more information, refer to the CoDeSys online help in SoMachine.
Applications (see page 69) Shows the applications currently running in the controller and allows you to remove applications from the controller. Files PLC Settings (see page 70) File management between the PC and the controller. For more information, refer to the CoDeSys online help in SoMachine. Configuration of: z Application for I/O handing z I/O behavior in stop z Bus cycle options Allows configuring on-line services of the controller (RTC, device identification). Displays device-specific status and diagnostic messages. Displays general information on the device (name, description, provider, version, image).
68
EIO0000000827 12/2012
Controller Configuration
Applications
Overview The figure below shows the Applications tab:
This dialog box allows to scan and remove applications on the Controller.
Element Applications on the Controller Buttons Refresh List Remove Remove all Description List of the names of applications which have been found on the Controller during the last scan. The Controller will be scanned for applications, the list will be updated. The application currently selected in the list will be removed from the Controller. All applications will be removed from the Controller.
EIO0000000827 12/2012
69
Controller Configuration
The following table describes the elements of the PLC Settings Tab:
Element Application for I/O handling PLC settings Update IO while in stop Behavior for outputs in Stop Description By default, set to Application because there is only one application in the controller. If this option is activated (default), the values of the input channels will be updated when the Controller is stopped. From the selection list choose one of the following options to configure how the values at the output channels should be handled in case of Controller stop: z Keep current values: The current values will not be modified. z Set all outputs to default: The default (fallback) values resulting from the mapping will be assigned. NOTE: This option is not taken into account for the outputs used by the HSC, PTO, PWM or Frequency Generator. Update all variables in all devices Bus cycle options Bus cycle task If this option is activated, then for all devices of the current Controller configuration all I/O variables will get updated in each cycle of the bus cycle task. This corresponds to the option Always update variables, which can be set separately for each device in the I/O Mapping dialog. This configuration setting is the parent for all Bus cycle task parameters used in the application device tree. The selection list offers all tasks currently defined in the Task Configuration of the active application. The default setting is the MAST task. NOTE: The selection <unspecified> signifies that the slowest cyclic task possible is used.
70
EIO0000000827 12/2012
Controller Configuration
NOTE: To display controller information in this tab, the controller needs to be connected to your PC. The following table describes the elements of the Services tab:
Element RTC Configuration PLC time Description Displays the date/time read from the controller. This readonly field is initially empty. To read and display the date/time in the controller, click the Read button. Allows defining a date and a time which are sent to the controller by a click the Write button. A message box informs the user on the success of the command. Local time fields are initialized with the current settings of the PC. Allows sending directly the current time and date settings of the PC. A message box informs the user of the success of the command. Displays the Firmware version, the Boot Version and the Coprocessor Version of the selected device if connected to the PC. 71
Local time
EIO0000000827 12/2012
Controller Configuration
72
EIO0000000827 12/2012
Embedded Functions
9
Overview This chapter describes how to configure the embedded functions of the Modicon M218 Logic Controller. The number of inputs and outputs dedicated to the embedded function depends on the controller reference (see page 13). What Is in This Chapter? This chapter contains the following topics:
Topic I/O Embedded Function HSC Embedded Function PTO_PWM Embedded Function Analog I/O Embedded Function Page 74 78 80 83
EIO0000000827 12/2012
73
Embedded Functions
Accessing the I/O Configuration Window Follow these steps to access the embedded I/O configuration window:
Step 1 Description Select the Configuration tab:
2 3
Double-click the controller. NOTE: You can also right-click the controller and select Edit device parameters. In the Task Pane click Embedded Functions IO:
74
EIO0000000827 12/2012
Embedded Functions
I/O Configuration Window The following window allows you to configure the embedded digital inputs:
NOTE: For more information on the I/O Mapping tab, refer to the CoDeSys online help in SoMachine.
EIO0000000827 12/2012
75
Embedded Functions
When you click the IO Summarize button, the IO Summary window appears. It allows you to check your configured I/O mapping:
76
EIO0000000827 12/2012
Embedded Functions
Configuration Parameters For each digital input, you can configure the following parameters:
Parameter Filter Value No 3 ms* 12 ms Description Reduce the effect of noise on a controller input. Constraint Available if Latch and Event are disabled. In the other cases, this parameter is disabled and its value is No. This parameter is only available for the fast inputs I0 to I3. NOTE: not available for the reduced Fast Inputs I0 and I1. Available if: Event disabled AND Run/Stop disabled. This parameter is only available for the fast inputs I0 to I3. NOTE: not available for the reduced Fast Inputs I0 and I1. Available if: Latch disabled AND Run/Stop disabled. Bounce Filtering 0.004 ms* 0.4 ms 1.2 ms 4 ms No* Yes Reduces the effect of bounce on a controller input. Available if Latch is enabled or Event is enabled. In the other cases, this parameter is disabled and its value is 0.004. Any of the inputs can be configured as Run/Stop, but only one.
Latch
No* Yes
Allows incoming pulses with amplitude widths shorter than the controller scan time to be captured and recorded.
Event
Event detection
Run/Stop
The Run/Stop input can be used to run or stop a program in the controller
EIO0000000827 12/2012
77
Embedded Functions
Accessing the HSC Configuration Window Follow these steps to access the embedded HSC configuration window:
Step 1 Description Select the Configuration tab:
2 3
Double-click the controller. NOTE: You can also right-click the controller and select Edit device parameters. In the Task Pane click Embedded Functions HSC:
78
EIO0000000827 12/2012
Embedded Functions
HSC Configuration Window The following figure shows a sample HSC configuration window used to configure the HSC:
The following table describes the areas of the HSC configuration window:
Number Action 1 2 3 4 5 6 Select the HSC tab to access each one of the HSC configuration windows. Select a specific HSC tab to access the HSC channel you need to configure. After choosing the type of HSC (Simple or Main) you want, use the field Variable to change the instance. You can expand each parameter by clicking the plus sign next to it to access its settings. Configuration window where the HSC parameters are set depending on the mode used. When you click on the IO Summarize button, the IO Summary window appears. It allows you to check your configured I/O mapping.
For detail information on configuration parameters, refer to M218 HSC choice matrix (see Modicon M218 Logic Controller, High Speed Counting, M218 HSC Library Guide).
EIO0000000827 12/2012
79
Embedded Functions
2 3
Double-click the controller. NOTE: You can also right-click the controller and select Edit device parameters. In the Task Pane click Embedded Functions PTO_PWM:
80
EIO0000000827 12/2012
Embedded Functions
PTO_PWM Configuration Window The following figure shows a sample PTO_PWM configuration window used to configure a PTO, PWM or FG:
EIO0000000827 12/2012
81
Embedded Functions
The following table describes the areas of the PTO_PWM configuration window:
Number 1 2 3 4 5 Action Select the PTO_PWM tab to access each one of the PTO_PWM configuration windows. Select a specific PTO tab to access the PTO_PWM channel you need to configure. After choosing the type of PTO_PWM (PTO, PWM or Frequency Generator) you want, use the field Variable to change the instance name. You can expand each parameter by clicking the plus sign next to it to access its settings. Configuration window where the embedded function is used for:
z a PTO (see Modicon M218 Logic Controller, Pulse Train Output, Pulse Width
Output, Pulse Width Modulation, M218 PTOPWM Library Guide) 6 When you click on the IO Summarize button, the IO Summary window appears. It allows to check your configured I/O mapping.
For detail information on configuration parameters, refer to: z PTO configuration. (see Modicon M218 Logic Controller, Pulse Train Output, Pulse Width Modulation, M218 PTOPWM Library Guide) z PWM and FG configuration. (see Modicon M218 Logic Controller, Pulse Train Output, Pulse Width Modulation, M218 PTOPWM Library Guide)
82
EIO0000000827 12/2012
Embedded Functions
2 analog outputs
Accessing the Analog I/O Configuration Window Follow these steps to access the analog I/O embedded function configuration window:
Step 1 Description Select the Configuration tab:
2 3
Double-click the controller. NOTE: You can also right-click the controller and select Edit device parameters. In the Task Pane click Embedded Functions Analog IO:
EIO0000000827 12/2012
83
Embedded Functions
Analog I/O Configuration Window The following window allows you to configure the analog I/O:
NOTE: Embedded analog I/Os are always physically updated by the MAST task, same as expansion I/Os. For more information on the Analog I/O Mapping tab, refer to the CoDeSys online help in SoMachine.
84
EIO0000000827 12/2012
Embedded Functions
Unit Filter value reduces the effect of noise on a controller analog input Minimum value Maximum value
Available if Type value is defined. Available if Type value is defined. Available if Scope is customized. Available if Scope is customized.
Minimum Maximum
* parameter default value (1) If Scope is Normal and Type is 10...10 V, the default value is -4096. If Scope is Customized, the default value is 32768 . (2) If Scope is Normal, the default value is 4095 . If Scope is Customized, the default value is 32767.
Available if Type value is defined. Available if Scope is customized. Available if Scope is customized.
* parameter default value (1) If Scope is Normal and Type is 10...10 V, the default value is -4096. If Scope is Customized, the default value is 32768 . (2) If Scope is Normal, the default value is 4095 . If Scope is Customized, the default value is 32767.
EIO0000000827 12/2012
85
Embedded Functions
86
EIO0000000827 12/2012
10
Overview This chapter describes the TM2...N and TM2 expansion module configuration of the Modicon M218 Logic Controller. What Is in This Chapter? This chapter contains the following topics:
Topic General Description Adding an Expansion Module Page 88 90
EIO0000000827 12/2012
87
General Description
Introduction In your project, you can add the following types of expansion modules to your controller: z digital z analog z expert (e.g. HSC, PTO) Use the GetRightBusStatus (see Modicon M218 Logic Controller, System Functions and Variables, M218 PLCSystem Library Guide) function regularly to monitor the expansion bus status. TM218...N Expansion Module Configuration For more information about module configuration, refer to the following programming and hardware guides:
Expansion Module TM218...N Expansion Modules Programming Guide Hardware Guide
TM2...N Expansion Modules TM2...N Expansion Modules Configuration Programming Guide Hardware Guide (see Modicon TM2...N Expansion Modules, Programming Guide)
TM2 Expansion Module Configuration For more information about module configuration, refer to the programming and hardware guides of each expansion module type:
Expansion Module TM2 Digital I/O Modules Programming Guide Hardware Guide
TM2 Digital I/O Modules Hardware TM2 I/O Modules Configuration Programming Guide (see Modicon Guide (see Modicon TM2, Digital I/O Modules, Hardware Guide) TM2, Modules Configuration, Programming Guide) TM2 Analog I/O Modules Hardware TM2 I/O Modules Configuration Programming Guide (see Modicon Guide (see Modicon TM2, Analog I/O Modules, Hardware Guide) TM2, Modules Configuration, Programming Guide) TM2 I/O Modules Configuration Programming Guide (see Modicon TM2, Modules Configuration, Programming Guide) TM2 High Speed Counter Modules Hardware Guide (see Modicon TM2, High Speed Counter Modules, Hardware Guide)
88
EIO0000000827 12/2012
TWDPTO220DT PTO Expansion Module Configuration For more information about module configuration, refer to the following library and hardware guides:
Expansion Module TWDPTO220DT PTO Expansion Module Library Guide Modicon M218 Pulse Train Output TWDPTO220DT Expansion Module Library Guide (see Modicon M218, Pulse Train Output, TWDPTO220DT Expansion Module Library Guide) Hardware Guide Modicon M218 Pulse Train Output TWDPTO220DT Expansion Module Hardware Guide (see Modicon M218, Pulse Train Output, TWDPTO220DT Expansion Module Hardware Guide)
Maximum Hardware Configuration The following table shows the maximum number of expansion modules for each Modicon M218 Logic Controller:
Controller TM218LDA16DRN TM218LDA24DRN TM218LDA24DRHN TM218LDD24DUPHN TM218LDAE24DRHN TM218LDA40DRN TM218LDA40DRPHN TM218LDD40DUPHNB TM218LDAE40DRPHN TM218LDA40DR2HN TM218LDA40DR4PHN TM218LDA60DRN Maximum Number of Expansion Modules 4 4 Maximum Number of I/O Points 144 152 Maximum Number of Relay Outputs 42 42
248
90
268
120
EIO0000000827 12/2012
89
NOTE: To physically install TM2 expansion modules, you must first installed a TM2DOCKN adaptor module (see Modicon M218 Logic Controller, Hardware Guide). However, the TM2DOCKN does not appear in the Graphical Configuration Editor. Information on configuring expansion modules is provided in the topic General Description (see page 88).
90
EIO0000000827 12/2012
11
Introduction This chapter describes how to configue the serial line communication of the Modicon M218 Logic Controller. What Is in This Chapter? This chapter contains the following topics:
Topic Serial Line Configuration Serial Line Protocol Manager ASCII Manager SoMachine Network Manager Modbus IOScanner Modbus Manager Page 92 94 97 100 101 110
EIO0000000827 12/2012
91
Click the Communication Serial Line 1 or Serial Line 2 entry on the task selection pane.
92
EIO0000000827 12/2012
Step 3
Action Click the Physical Settings entry. The Configuration window is displayed:
NOTE: You can also select the Program tab and double-click the Serial Line 1 or Serial Line 2 in the device tree to access the Configuration window. The following parameters must be identical for each serial device connected to the port:
Element Baud rate Parity Data bits Stop bits Physical Medium Description Transmission speed Used for error detection Number of bits for transmitting data Number of stop bits Specify to use RS485 with polarization resistor or without. NOTE: 2 line polarization resistors are integrated in the controller, they are switched on or off by this parameter.
EIO0000000827 12/2012
93
Serial Line 2
115200, 57600, 38400, 19200, 9600, 4800, 2400, 1200 38400, 19200, 9600, 4800, 2400, 1200
94
EIO0000000827 12/2012
Adding the Serial Line Protocol Manager Follow these steps to add a protocol manager on the serial line:
Step 1 Action Select Configuration tab and double-click the controller.
EIO0000000827 12/2012
95
Step 4
Action Click the Remove/Change Protocol, and the Add device window is displayed.
NOTE: You also can access this window by selecting the Configuration tab and clicking the serial line port of the controller from the graphical configuration editor. 5 Select the manager and click Add and close.
96
EIO0000000827 12/2012
ASCII Manager
Introduction The ASCII Manager is used to transmit and/or receive data with a simple device. Configuring the Manager To configure the ASCII Manager of your controller, proceed as follows:
Step 1 Action Select the Configuration tab and double-click the controller.
Click the Communication Serial Line 1 or Serial Line 2 entry in the task selection pane.
EIO0000000827 12/2012
97
Step 3
Action Click the Protocol Settings entry. Result: The ASCII_Manager configuration window is displayed if ASCII_Manager is already configured on this serial line port.
NOTE: if the ASCII_Manager configuration window is not displayed, click Remove/Change Protocol at the bottom of the screen, remove the current protocol and select ASCII_Manager in the Add device screen.
98
EIO0000000827 12/2012
NOTE: In the case of using several frame termination conditions, the first condition to be TRUE will terminate the exchange.
EIO0000000827 12/2012
99
Configuring the Manager There is no configuration for the SoMachine Network Manager.
100
EIO0000000827 12/2012
Modbus IOScanner
Introduction The Modbus IOScanner is used to simplify exchanges with Modbus slave devices. Adding the Manager To add a Manager on Serial Line, proceed as follows:
Step 1 2 3 4 Action Select the Configuration tab and double-click the controller. Click the Communication Serial Line 1 or Serial Line 2 entry on the left hand side. Click the Protocol Settings entry. Click the Remove/Change Protocol button. Select the Modbus IOScanner object and click Add and close:
EIO0000000827 12/2012
101
Configuring the Manager To configure a Modbus IOScanner on Serial Line, proceed as follows:
Step 1 2 3 Action Select the Configuration tab and double-click the controller. Click the Communication Serial Line 1 or Serial Line 2 entry on the left hand side. Click the Protocol Settings entry. Result: The configuration window is displayed:
This parameter must be identical for each Modbus device on the link. Response Timeout (ms) Time between frames (ms) Timeout used in the exchanges. Time to avoid bus-collision. This parameter must be identical for each Modbus device on the link.
102
EIO0000000827 12/2012
Adding a Device on the Modbus IOScanner To add a device on the Modbus IOScanner, proceed as follows:
Step 1 2 3 Action Select the Configuration tab and double-click on the controller. Click the available port of the Modbus IOScanner Fieldbus in the graphical configuration editor. The Add device window appears:
Click the device to be added and click the Add and close button.
EIO0000000827 12/2012
103
Configuring a Device Added on the Modbus IOScanner To configure the device added on the Modbus IOScanner, proceed as follows:
Step 1 2 Action Select the Configuration tab. In the graphical configuration editor, double-click the device. Result: The configuration window is displayed.
3 4
Enter a Slave Address value for your device (choose a value from 1 to 247). Choose a value for the Response Timeout (in ms).
104
EIO0000000827 12/2012
Step 2
the period defined in Cycle Time (ms) field or started by a RISING EDGE on a boolean variable (this boolean variable is then created in the Modbus Master I/O Mapping tab) z Comment: Add a comment about this channel
EIO0000000827 12/2012
105
Step 2 bis
Action In the field READ Register (if your channel is a Read or a Read/Write one), you can configure the %MW to be read on the Modbus slave. Those addresses will be mapped on %IW (see Modbus Master I/O Mapping tab): z Offset: Offset of the %MW to read. 0 means that the first object that will be read will be %MW0. z Length: Number of %MW to be read. For example if Offset = 2 and Length = 3, the channel will read %MW2, %MW3 and %MW4. z Error Handling: choose the behavior of the related %IW in case of loss of communication. In the field WRITE Register (if your channel is a Write or a Read/Write one), you can configure the %MW to be written to the Modbus slave. Those addresses will be mapped on %QW (see Modbus Master I/O Mapping tab): z Offset of the %MW to write. 0 means that the first object that will be written will be %MW0. z Length: Number of %MW to be written. For example if Offset = 2 and Length = 3, the channel will write %MW2, %MW3 and %MW4.
3 4
Click the Delete button to remove a channel. Click the Edit button to change the parameters of a channel. Click OK to validate the configuration of this channel.
106
EIO0000000827 12/2012
Step 2
Click the Move up or Move down button to change the position of an initialization in the list. Click the Delete button to remove an initialization in the list. Click the Edit button to change the parameters of an initialization. Click OK to create a new Initialization Value.
EIO0000000827 12/2012
107
These next set of interface windows show the mapping of the objects generated by the defined channels. If channel 1 and channel 2 are configured as pictured in the following two graphics, then the Modbus Master I/O Mapping is as pictured in the third graphic below:
108
EIO0000000827 12/2012
EIO0000000827 12/2012
109
Modbus Manager
Introduction The Modbus Manager is used for Modbus RTU or ASCII protocol in master or slave mode. It is recommended to use the Relocation Table (see page 30) to optimize the communication between the controller and other equipment. Configuring the Manager To configure the Modbus_Manager of your controller, proceed as follows:
Step 1 Action Select the Configuration tab and double-click the controller.
Click the Communication Serial Line 1 or Serial Line 2 entry on the task selection pane.
110
EIO0000000827 12/2012
Step 3
Action Click the Protocol Settings entry. Result: The Modbus_Manager configuration window is displayed if Modbus_Manager is already configured on this serial line port.
NOTE: if the Modbus_Manager configuration window is not displayed, click Remove/Change Protocol at the bottom of the screen, remove the current protocol and select Modbus_Manager in the Add device screen.
Time between Time to avoid bus-collision. frames (ms) This parameter must be identical for each Modbus device on the link. Serial Line Settings Parameters specified in [Physical Settings] of the Serial Line configuration menu (see page 92).
EIO0000000827 12/2012
111
Modbus Master When the controller is configured as a Modbus Master, the following Function Blocks are supported from the PLCCommunication Library: z ADDM z READ_VAR z SEND_RECV_MSG z SINGLE_WRITE z WRITE_READ_VAR z WRITE_VAR For further information, see Function Block Descriptions (see SoMachine, Modbus and ASCII Read/Write Functions, PLCCommunication Library Guide) of the PLCCommunication Library (see SoMachine, Modbus and ASCII Read/Write Functions, PLCCommunication Library Guide). Modbus Slave When the controller is configured as Modbus Slave, the following Modbus requests are supported:
Types Data Access Physical Discrete (1 Bit) Inputs and Outputs Function Read Coils Read Discrete Inputs Write Multiple Coils Data Access Physical Input (16 Bits) Registers Read Holding Registers Write Single Register Write Multiple Registers Read/Write Multiple Registers Diagnostics Diagnostics Read Device Identification Function Codes Code/Sub Code 01 02 15 03 06 16 23 08 43/14
NOTE: Only located variables of the controller application can be accessed via Modbus.
112
EIO0000000827 12/2012
The following table contains the Sub-function codes supported by the diagnostic Modbus request 08:
Sub-Function Code Dec 10 11 12 13 14 15 16 17 18 Hex 0A 0B 0C 0D 0E 0F 10 11 12 Clear Counters and Diagnostic Register Return Bus Message Count Return Bus Communication Error Count Return Bus Exception Error Count Return Slave Message Count Return Slave No Response Count Return Slave NAK Count Return Slave Busy Count Return Bus Character Overrun Count Function
The table below list the objects that can be read with a read device identification request (basic identification level):
Object ID 00 hex 01 hex 02 hex Object Name Vendor code Product code Major / Minor revision Type ASCII String ASCII String ASCII String Value Schneider Electric Controller reference e.g. TM218LDA24DRN aa.bb.cc.dd (same as device descriptor)
The following section describes the differences between the Modbus memory mapping of the controller and HMI Modbus mapping. If you do not program your application to recognize these differences in mapping, your controller and HMI will not communicate correctly and it will be possible for incorrect values to be written to memory areas responsible for output operations.
WARNING
UNINTENDED EQUIPMENT OPERATION Program your application to translate between the Modbus memory mapping used by the controller and that used by attached HMI devices. Failure to follow these instructions can result in death, serious injury, or equipment damage. When the controller and the HMI are connected via Modbus (HMI is master of Modbus requests), the data exchange uses simple word requests.
EIO0000000827 12/2012
113
There is an overlap on simple words of the HMI memory while using double words but not for the controller memory (see following diagram). In order to have a match between the HMI memory area and the controller memory area, the ratio between double words of HMI memory and the double words of controller memory has to be 2.
The following gives examples of memory match for the double words: z %MD2 memory area of the HMI corresponds to %MD1 memory area of the controller because the same simple words are used by the modbus request. z %MD20 memory area of the HMI corresponds to %MD10 memory area of the controller because the same simple words are used by the modbus request.
z
The following gives examples of memory match for the bits: %MW0:X9 memory area of the HMI corresponds to %MX1.1 memory area of the controller because the simple words are split in 2 distinct bytes in the controller memory.
NOTE: If %MD is used for data exchange between PLC and HMI, the word order should be consistent between PLC and HMI. For Modicon M218 Logic Controller, the order of double word variable is low word first.
114
EIO0000000827 12/2012
Ethernet Configuration
12
Indroduction This chapter describes how to configure the Ethernet network interface of the Modicon M218 Logic Controller What Is in This Chapter? This chapter contains the following topics:
Topic Ethernet Services IP Address Configuration Modbus TCP Server/Client Page 116 117 122
EIO0000000827 12/2012
115
Ethernet Configuration
Ethernet Services
Ethernet Services The controller supports the following services: Modbus TCP Server (see page 122) z Modbus TCP Client (see page 122)
z
Ethernet Protocol The controller supports the following protocols: IP (Internet Protocol) z TCP (Transmission Control Protocol) z ARP (Address Resolution Protocol) z ICMP (Internet Control Messaging Protocol), only support Ping function.
z
TCP Server Connection The maximum number of TCP connection: 4 Modbus servers z 3 Modbus servers and 1 client
z
Each server based on TCP manages its own pool of connections. When a client tries to open a connection that exceeds the poll size, the controller closes the oldest connection. If all connections are busy (exchange in progress) when a client tries to open a new one, the new connection is denied. All server connections stay open as long as the controller stays in operational states (RUN, STOP, HALT). All server connections are closed when leaving or entering operational states (RUN, STOP, HALT), except in case of power outage (because the controller did not have time to close the connections).
116
EIO0000000827 12/2012
Ethernet Configuration
IP Address Configuration
Introduction There are 4 different ways to assign the IP address of the controller: z address assignment by DHCP server z address assignment by BOOTP server z fixed IP address z address assignment using the SetIPAddress (see Modicon M218 Logic Controller, System Functions and Variables, M218 PLCSystem Library Guide) function block NOTE: If the attempted addressing method is unsuccessful, the controller will start using a default IP address (see page 120) derived from the MAC address. You must carefully manage the IP addresses because each device on the network requires a unique address. Having multiple devices with the same IP address can cause unpredictable operation of your network and associated equipment.
WARNING
UNINTENTED EQUIPMENT OPERATION
z z z z z
Be sure that there is only one master controller configured on the network or remote link. Be sure that all devices have unique addresses. Obtain your IP address from your system administrator. Confirm that the devices IP address is unique before placing the system into service. Do not assign the same IP address to any other equipment on the network.
Failure to follow these instructions can result in death, serious injury, or equipment damage. NOTE: It is good practice to ensure that your system administrator maintains a record of all assigned IP addresses on the network and subnetwork, and to inform the system administrator of all configuration changes performed.
EIO0000000827 12/2012
117
Ethernet Configuration
Address Management The different types of address systems for the controller are shown in the following diagram:
NOTE: If a device programmed to use the DHCP or BOOTP addressing methods is unable to contact its respective server, the controller will use the default IP address. It will, however, constantly reiterate its request. The IP process automatically restarts in the following cases: Controller reboot z Ethernet cable reconnection z Application download (if IP parameters change) z DHCP or BOOTP server detection following an unsuccessful addressing attempt.
z
118
EIO0000000827 12/2012
Ethernet Configuration
Ethernet Configuration In the Devices tree of the Program tab, double-click the Ethernet item:
EIO0000000827 12/2012
119
Ethernet Configuration
Default IP Address The default IP address is based on the devices MAC address. The first two bytes are 10 and 10. The last two bytes are the last two bytes of the devices MAC address. The default subnet mask is 255.0.0.0. NOTE: A MAC address is always written in hexadecimal format, and an IP address in decimal format. You must convert the MAC address to decimal format. Example: If the MAC address is 00.80.F4.01.80.F2, the default IP address is 10.10.128.242. Address Classes The IP address is linked: to a device (known as the host) z to the network to which the device is connected
z
An IP address is always coded using 4 bytes. The distribution of these bytes between the network address and the device address may vary. This distribution is defined by the address classes. The different IP address classes are defined in the following table:
Address Class Byte 1 Class A Class B Class C Class D Class E 0 1 1 1 1 Network ID 0 1 1 1 Network ID 0 1 1 Network ID 0 1 Multicast address 0 Address reserved for subsequent use Byte 2 Host ID Host ID Host ID Byte 3 Byte 4
Subnet Mask The subnet mask is used to address several physical networks with a single network address. The mask is used to separate the sub-network and the device address in the host ID. The subnet address is obtained by retaining the bits of the IP address which correspond to the positions of the mask containing 1, and replacing the others with 0. Conversely, the subnet address of the host device is obtained by retaining the bits of the IP address which correspond to the positions of the mask containing 0, and replacing the others with 1.
120
EIO0000000827 12/2012
Ethernet Configuration
NOTE: The device does not communicate on its sub-network when there is no gateway. Gateway The gateway allows a message to be routed to a device which is not on the current network. If there is no gateway, the gateway address is 0.0.0.0.
EIO0000000827 12/2012
121
Ethernet Configuration
122
EIO0000000827 12/2012
Ethernet Configuration
Modbus TCP Server The Modbus Server supports the following Modbus requests:
Function Code Dec (Hex) 1 (1h) 2 (2h) 3 (3h) 6 (6h) 8 (8h) 15 (Fh) 16 (10h) 23 (17h) 43 (2Bh) 14 (Eh) Sub-function Dec (Hex) Function Read digital outputs (%Q) Read digital inputs (%I) Read holding register (%MW) Write single register (%MW) Diagnostic (see page 123) Write multiple digital outputs (%Q) Write multiple registers (%MW) Read/write multiple registers (%MW) Read device identification (see page 127)
Diagnostic Request The following table contains the Data Selection Code list:
Data Selection Code 0x00 0x01 0x02 0x03 0x04 0x05 - 0x7E 0x7F Description Reserved Basic Network Diagnostics (see page 124) Ethernet Port Diagnostic (see page 125) Modbus TCP/Port 502 Diagnostics (see page 126) Modbus TCP/Port 502 Connection Table (see page 126) Reserved for other public codes Data Structure Offsets
EIO0000000827 12/2012
123
Ethernet Configuration
124
EIO0000000827 12/2012
Ethernet Configuration
Ethernet Port Diagnostic Ethernet Port Diagnostic: Port Diagnostics Data Validity
Field Name Port Diagnostics Data Validity Logical/Physical Port Number Ether Control Capability Link Speed Capability Ether Control Configuration Link Speed Configuration Ether Control Operational Link Speed Operational Port MAC Address Media Counters Reserved Total: Bytes 2 2 2 2 2 2 2 2 6 72 46 140 TR Designation Cable Type - Duplex Status Speed Speed Speed MAC Address -
EIO0000000827 12/2012
125
Ethernet Configuration
Modbus TCP/Port 502 Connection Table Modbus TCP/Port 502 Connection Table:
Field Name Connection Table Validity Number of Entries (NE) Starting Entry Index (SE) Connection Table Entry 1 Connection Table Entry 2 Reserved Connection Table Entry N Total: Bytes 2 2 2 16 16 ... 16 6 + 16 * N TR Designation -
126
EIO0000000827 12/2012
Ethernet Configuration
Read Device Identification Request The table below list the objects that can be read with a read device identification request (basic identification level):
Object ID 00h 01h 02h Object Name Vendor name Product code Major / minor revision Type ASCII string ASCII string ASCII string Value Schneider Electric Controller reference eg: TM218LDA40DR2HN aa.bb.cc.dd (same as device descriptor)
EIO0000000827 12/2012
127
Ethernet Configuration
128
EIO0000000827 12/2012
Modicon M218 Logic Controller Connecting the Modicon M218 Logic Controller to a PC EIO0000000827 12/2012
13
Page 130 132
EIO0000000827 12/2012
129
NOTICE
INOPERABLE EQUIPMENT Always connect the communication cable to the PC before connecting it to the controller. Failure to follow these instructions can result in equipment damage. USB Mini-B Port Connection TSX CNA MUM3P : This USB cable is suitable for short duration connection like quick updates or retrieving data values. BMX XCA USBH045 : Grounded and shielded, this USB cable is suitable for long duration connection. NOTE: You can only connect 1 controller to the PC at the same time. The USB Mini-B Port is the programming port you can use to connect a PC with a USB host port using SoMachine software. Using a typical USB cable, this connection is suitable for quick updates of the program or short duration connections to perform maintenance and inspect data values. It is not suitable for long term connections such as commissioning or monitoring without the use of specially adapted cables to help minimize electromagnetic interference.
WARNING
INOPERABLE EQUIPMENT OR UNINTENDED EQUIPMENT OPERATION
z z
You must use a shielded USB cable such as a BMX XCAUSBH0 secured to the functional ground (FE) of the system for any long term connection. Do not connect more than one controller at a time using USB connections.
Failure to follow these instructions can result in death, serious injury, or equipment damage. The communication cable should be connected to the PC first to minimize the possibility of electrostatic discharge affecting the controller.
130
EIO0000000827 12/2012
2 3 4
EIO0000000827 12/2012
131
132
EIO0000000827 12/2012
14
Overview This manual describes how to use the Loader Device Accessory What Is in This Chapter? This chapter contains the following sections:
Section 14.1 14.2 14.3 14.4 Topic About the Loader Device Accessory Transfer From SoMachine to the USB Memory Key File Transfer with a USB Memory Key Other Functionalities Page 134 142 143 149
EIO0000000827 12/2012
133
14.1
134
EIO0000000827 12/2012
These file types are transferred as pairs. The number of file pairs that are transferred depends on the SoMachine project:
If... the SoMachine project does not contain a Symbol configuration or if the project is built with a SoMachine version superior to V3.0 Then ... one pair of files is transferred. SoMachine Default File Names
z application.app z application.crc
the SoMachine project contains a 2 pairs of files are transferred. Symbol configuration built with a SoMachine version inferior to V3.1
z application.app z application.crc
and
z application_symbol.app z application_symbol.crc
EIO0000000827 12/2012
135
Functionalities The Loader Device Accessory can be used in the following cases: Transfer from SoMachine to the USB memory key (see page 142) z Upload from the controller to the USB memory key (see page 144) z Download from the USB memory key to the controller (see page 146) z Set the controller to RUNNING state (see page 150) z Update the firmware of the Loader Device Accessory (see page 151)
z
WARNING
UNINTENDED EQUIPMENT OPERATION
z z
z z
You must have operational knowledge of your machine or process before connecting this device to your controller. Be sure that your machine or process is in a know safe state (STOP, SHUTDOWN, INERT, etc.) before transitioning the Loader Device Accessory to the On switch position while connected to your controller. Be sure that guards are in place so that any potential unintended equipment operation will not cause injury to personnel or damage to equipment. You must have read and understood the user documentation of this and other devices involved in the functions performed by the Loader Device Accessory.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
136
EIO0000000827 12/2012
Physical Description
Overview
1 2 3 4 5 6 7 8 Battery
Batteries USB port for the Controller USB-mini B programming port USB port for the USB memory key ON / OFF switch Status LED ERR LED COM LED Power LED
WARNING
INOPERABLE EQUIPMENT
z z z z z z z
Store the batteries in a cool, well ventilated area. Prolonged short circuit causes the battery to lose energy. Do not try to recharge the batteries provided with the device. Do not install the batteries backwards. Immediately discard batteries that show any sign of leakage or damage. Discard used batteries in accordance with local regulations. Do not mix with other battery types.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
EIO0000000827 12/2012
137
Operation error This error is indicated when: z the USB memory key is full or damaged (file detected corrupted), z the communication between the controller and the Loader Device Accessory has been interrupted. z the controller could not run or stop. Dialog error detected This error is indicated when there is a communication error. For example, when: z the USB memory key and the controller USB ports are swapped (wrong port used), z USB memory key cannot be read or written (write protection active). This error is indicated when the files are not found. For example, when: z the USB memory key may be defective or is otherwise incompatible with the Loader Device Accessory, z the USB memory key or the controller is not connected or not formatted, z the USB memory key already has more than the expected number of files, z the controller has not been rebooted since the last connection with SoMachine. LED 0.5s flashing LED 0.1s flashing
LED on
1
LED off
LED 2s flashing
LED 1s flashing
Battery low
138
EIO0000000827 12/2012
PWR
COM
ERR
STS
Possible Causes This error is indicated when the controller reference and the reference stored in the *.app file of the USB memory key are not compatible (see page 140). This error is indicated when a wrong USB memory key version is used (see page 135).
LED on
1
LED off
LED 2s flashing
LED 1s flashing
Battery low
EIO0000000827 12/2012
139
SoMachine Software Compatibility The device can only be used with applications from SoMachine V2.0 or greater. In order to have compatibility with versions of SoMachine prior to version 3.1, it is necessary to perform additional steps while creating the necessary files for download to a controller with a USB memory key. When using SoMachine version 3.0 or earlier, or a project created with, or a context of, a version 3.0 or earlier, follow the steps below:
Step 1 2 3 4 5 Action Open or create the project you want to transfer with the USB memory key using SoMachine. Connect your USB memory key to your computer. NOTE: The USB memory key must be empty. Select in the menu Build Clean All. Select in the menu Build Build All. Select in the menu Online Create Boot Application. NOTE: SoMachine must be running in offline mode to be able to execute this command. Define your project name and save it in the root of the USB memory key. NOTE: Save the files in the root of the USB memory key. Otherwise they will not be detected by the Loader Device Accessory.
140
EIO0000000827 12/2012
You must execute the Clean All, Build All sequence (steps 3 and 4 in the table above) in order that your Retain Data are properly initialized in your project.
WARNING
UNINTENDED MACHINE OPERATION Be sure to execute the Clean All, Build All sequence described above if using a version of SoMachine inferior to version 3.1, or a project originally created with, or in a context of, a version inferior to version 3.1. Failure to follow these instructions can result in death, serious injury, or equipment damage.
EIO0000000827 12/2012
141
14.2
NOTE: Only save one project on the USB memory key. NOTE: If your project was created with a version of SoMachine inferior to version 3.1, or created in a context of a version less than 3.1, refer to the SoMachine software compatibility (see page 140) for important information.
142
EIO0000000827 12/2012
14.3
EIO0000000827 12/2012
143
WARNING
UNINTENDED EQUIPMENT OPERATION
z z
z z
You must have operational knowledge of your machine or process before connecting this device to your controller. Be sure that your machine or process is in a know safe state (STOP, SHUTDOWN, INERT, etc.) before transitioning the Loader Device Accessory to the On switch position while connected to your controller. Be sure that guards are in place so that any potential unintended equipment operation will not cause injury to personnel or damage to equipment. You must have read and understood the user documentation of this and other devices involved in the functions performed by the Loader Device Accessory.
Failure to follow these instructions can result in death, serious injury, or equipment damage. The following procedure describes how to upload on your USB memory key the current project stored in the controller:
Step 1 Action Remove any file from the root of your USB memory key. If there is a controller pair of files in the USB memory key, the download (see page 146) function starts automatically. Power on your controller. Connect the USB memory key to the Loader Device Accessory. Connect the Loader Device Accessory to the controller with USB cable. Move the Loader Device Accessory On/Off switch to the On position. NOTE: The controller is set to STOPPED state. Wait for the files to be uploaded on the USB memory key. (LED (see page 138) at Normal operation state). At the end of the upload (LED (see page 138) at Operation complete state), move the Loader Device Accessory On/Off switch to the Off position.
2 3 4 5 6 7
144
EIO0000000827 12/2012
Step 8 9 10
Action Disconnect the Loader Device Accessory from the controller. Disconnect the USB memory key and the USB cable from the Loader Device Accessory. Execute a Run command (see page 58) or use the Set the controller to RUNNING state (see page 150) feature to set the controller to RUNNING state.
The Loader Device Accessory is automatically switched off z after 10 s, if the upload has been successfully completed. z after 60 s, if the upload has been unsuccessful.
EIO0000000827 12/2012
145
WARNING
UNINTENDED EQUIPMENT OPERATION
z z
z z
You must have operational knowledge of your machine or process before connecting this device to your controller. Be sure that your machine or process is in a know safe state (STOP, SHUTDOWN, INERT, etc.) before transitioning the Loader Device Accessory to the On switch position while connected to your controller. Be sure that guards are in place so that any potential unintended equipment operation will not cause injury to personnel or damage to equipment. You must have read and understood the user documentation of this and other devices involved in the functions performed by the Loader Device Accessory.
Failure to follow these instructions can result in death, serious injury, or equipment damage. The following procedure describes how to download to your controller the current project stored in the USB memory key:
Step 1 Action To download a project in the USB key: z without Symbol configuration: 1 pair of files (*.app and *.crc) must be stored in the root of the USB memory key. z with Symbol configuration: 2 pairs of files (*.app and *.crc, *_Symbols.app and *_Symbols.crc) must be stored in the root of the USB memory key. If there is no pair of files stored in the root of the USB memory key, the upload function (see page 144) starts automatically.
NOTICE
LOSS OF DATA
z z
Be sure if the physical controller reference and the controller reference in the application are compatible (see page 140). Be sure that all the necessary files are present before downloading any files to the controller.
146
EIO0000000827 12/2012
2 3 4 5 6
Power on the controller. Connect the USB memory key to the Loader Device Accessory. Connect the Loader Device Accessory to the controller with USB cable. Move the Loader Device Accessory On/Off switch to the On position. NOTE: The controller is set to STOPPED state. Wait until the files are downloaded to the controller. (LED (see page 138) at Normal operation state.) NOTE: The controller is in EMPTY State.
NOTICE
INOPERABLE EQUIPMENT
z z z z
Do not disconnect the USB memory key during the download. Do not disconnect the USB cable to the controller during the download. Do not switch off the Loader Device Accessory during the download. Do not remove power from the controller.
Failure to follow these instructions can result in equipment damage. NOTE: In the event that the download was interrupted, move the Loader Device Accessory switch to the off position and back to the on position to restart the download.
Step 7 8 Action At the end of the download (LED (see page 138) at Operation complete state), move the Loader Device Accessory On/Off switch to the Off position. Reboot the controller by doing a power cycle for the application to be recognized.
Depending on your controller and/or configuration, the controller may be either in a RUNNING or a STOPPED state.
WARNING
UNINTENDED EQUIPMENT OPERATION Consult the controller state and behavior diagram in your controller programming guidestate and behavior diagram (see page 46) to understand the state that will be assumed by the controller after you cycle power. Failure to follow these instructions can result in death, serious injury, or equipment damage.
EIO0000000827 12/2012
147
9 10 11
Disconnect the Loader Device Accessory from the controller. Disconnect the USB memory key and the USB cable from the Loader Device Accessory. If your controller is in a STOPPED state, execute a Run command (see page 58) or use the Set the controller to RUNNING state (see page 150) feature to set the controller to RUNNING state.
The Loader Device Accessory is automatically switched off z after 10 s, if the download has been successfully completed. z after 60 s, if the download has been unsuccessful.
148
EIO0000000827 12/2012
14.4
Other Functionalities
EIO0000000827 12/2012
149
WARNING
UNINTENDED EQUIPMENT OPERATION
z z
z z
You must have operational knowledge of your machine or process before connecting this device to your controller. Be sure that your machine or process is in a know safe state (STOP, SHUTDOWN, INERT, etc.) before transitioning the Loader Device Accessory to the On switch position while connected to your controller. Be sure that guards are in place so that any potential unintended equipment operation will not cause injury to personnel or damage to equipment. You must have read and understood the user documentation of this and other devices involved in the functions performed by the Loader Device Accessory.
Failure to follow these instructions can result in death, serious injury, or equipment damage. The following procedure describes how to set a controller to RUNNING state using the Loader Device Accessory.
Step 1 2 3 4 5 Action Disconnect the USB key from the Loader Device Accessory. Connect the Loader Device Accessory to the controller. Move the Loader Device Accessory On/Off switch to the On position. NOTE: The controller is set in RUNNING state. Move the Loader Device Accessory On/Off switch to the Off position. Disconnect the Loader Device Accessory from the controller.
The Loader Device Accessory is automatically switched off after 10 s, if the update has been successfully completed. z after 60 s, if the update has been unsuccessful.
z
150
EIO0000000827 12/2012
Where x is the product firmware version. NOTE: Connect to www.schneider-electric.com to download the latest firmware update. 2 3 4 5 Connect the USB memory key to the Loader Device Accessory. Move the Loader Device Accessory On/Off switch to the On position. At the end of the update (LED (see page 138) at Operation complete state), move the Loader Device Accessory On/Off switch to the Off position. Disconnect the USB key from the Loader Device Accessory.
The Loader Device Accessory is automatically switched off z after 10 s, if the update has been successfully completed. z after 60 s, if the update has been unsuccessful.
EIO0000000827 12/2012
151
152
EIO0000000827 12/2012
Modicon M218 Logic Controller Updating the Controller Firmware EIO0000000827 12/2012
15
Overview This chapter provides detailed instructions on using the Windows Exec Loader to update the firmware of your M218 controller. What Is in This Chapter? This chapter contains the following topics:
Topic Updating Through USB Launching the Exec Loader Wizard Step 1 - Welcome Step 2 - Settings Step 3 - File and Device Exec Properties Step 4 - Transfer Progress Page 154 156 157 158 159 161
EIO0000000827 12/2012
153
NOTICE
LOSS OF APPLICATION DATA
z z
Perform a backup of the application program to the hard disk of the PC before attempting a firmware update. Restore the application program to the device after a successful firmware update.
Failure to follow these instructions can result in equipment damage. If there is a power outage or communication interruption during the transfer of the application program or a firmware update, your device may become inoperative. If a communication interruption or a power outage occurs, reattempt the transfer.
NOTICE
INOPERABLE EQUIPMENT
z z
Do not interrupt the transfer of the application program or a firmware update once the transfer has begun. Do not place the device into service until the transfer has completed successfully.
Failure to follow these instructions can result in equipment damage. The Serial Line 1 is configured for the SoMachine protocol by default when you add a new controller or when you update the controller firmware. The SoMachine protocol is incompatible with that of other protocols such as Modbus Serial Line. Connecting a new controller to, or updating the firmware of a controller connected to, an active Modbus configured serial line can cause the other devices on the serial line to stop communicating. Make sure that the controllers Serial Line 1port is not connected to an active Modbus serial line network and that the port is properly configured for the intended protocol before downloading a valid application.
154
EIO0000000827 12/2012
NOTICE
UNINTENDED EQUIPMENT OPERATION Be sure your application has the Serial Line port(s) properly configured for Modbus before physically connecting the controller to an operational Modbus Serial Line network. Failure to follow these instructions can result in equipment damage. Before starting the firmware update procedure, ensure you have:
z z
This updating procedure is a maintenance operation. It requires that the controller be disconnected from the systems and applications it effects. The PC and the controller must stay connected during this operation. NOTE: If the PC and the controller are unintentionally disconnected during a firmware update, the controller will not function correctly until a new, successful firmware update operation is performed. Installing Cables Follow these steps to install the cables properly:
Step 1 2 3 Action Plug the TSX CNA MUM3P cable to an USB Port of your PC. (see page 130) Plug the second end of the cable to the USB port of the controller. Launch the Exec Loader Wizard USB (see page 156)
EIO0000000827 12/2012
155
When the gateway is stopped, the CoDeSys Gateway Sys Tray (stopped icon appears in the task bar:
ClickStart Programs Schneider Electric SoMachine Tools Exec Loader Wizard USB
Overview of Update Steps The wizard provides a screen for each step. The following table summarizes the 4 steps required to update your firmware:
Step 1 2 3 Screen Welcome (see page 157) Settings (see page 158) File and Device Exec Properties (see page 159) Transfer Progress (see page 161) Function Introduction to the Exec Loader wizard. Select the correct firmware file to transfer to your controller. Compare the hardware IDs and the firmware version information of the firmware file and the controller. Monitor the transfer of the firmware file to the controller.
156
EIO0000000827 12/2012
Step 1 - Welcome
Step 1 - Welcome The wizard provides a screen for each step. The Welcome screen is an introduction to the Exec Loader wizard. To continue:
z z
Select Next to continue the procedure and display the next screen, Step 2 Settings (see page 158). Select Close to close the screen without changing the firmware of your controller.
EIO0000000827 12/2012
157
Step 2 - Settings
Selecting Settings Use these steps to select the appropriate firmware:
Step 2 1 Action In Settings, click Browse and select the correct file for your controller model. Example: C:\Program Files\Schneider Electric\SoMachine\Firmware\M218\TM28LDAE40DRPHN.mfw Remove power from the Controller, as indicated on the screen. Select Next. During the progress bar, you will be prompted to re-apply power to the controller.
2 3
When the Exec Loader Wizard has successfully opened a connection with the controller, it goes automatically to step 3 (see page 159). If it doesnt, the progress bar will disappear and the Exec Loader Wizard go back to screen of Step1. Then you can select Next to try again. NOTE: Check the USB connection or reboot the controller by doing a power cycle.
158
EIO0000000827 12/2012
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.
Green check mark: OK Red cross: incorrect firmware file. Select a firmware file corresponding to your controller reference (go back to step 2 (see page 158))
EIO0000000827 12/2012
159
Exec Version Number The Exec Version Number identifies the version of the firmware:
z z
Green check mark: you will update your controller to a newer version of the firmware Yellow check mark: you will downgrade your controller to an older version of the firmware or update your controller with the same version of the current firmware
Starting the Transfer Click on the Next button to start the transfer.
160
EIO0000000827 12/2012
Yes - the wizard returns to Step 2 - Settings (see page 158) and you can set up another transfer. No - click on the Close button to exit the wizard. This completes the update procedure.
If Transfer is not Successful If the transfer is interrupted (for example, due to a loss of communication), a message box is displayed allowing a retry of the transfer. Two options are available:
z z
Yes - the wizard returns to Step 3 - Files and Device Exec Properties (see page 159) and you can try another transfer. No - click on the Close button to exit the wizard.
Your controller remains inoperative until a successful transfer has been accomplished.
NOTICE
INOPERABLE EQUIPMENT
z z
Do not interrupt the transfer of the application program or a firmware update once the transfer has begun. Do not place the device into service until the transfer has completed successfully.
EIO0000000827 12/2012
161
162
EIO0000000827 12/2012
Modicon M218 Logic Controller Modicon M218 Logic Controller - Troubleshooting and FAQ EIO0000000827 12/2012
16
Page 164 171
EIO0000000827 12/2012
163
Troubleshooting
Introduction This section describes the procedures to troubleshoot your Modicon M218 Logic Controller. Transferring the Application is not Possible Possible causes: The PC cannot communicate with the controller. z Is your application valid? z Is the CoDeSys gateway running?
z
Resolution: z Refer to the part below (Communication Between SoMachine and the Modicon M218 Logic Controller (see page 165)). z Your application program must be valid. For more information, refer to the CoDeSys online help in SoMachine: Concepts and Base Concepts Debugging z The CoDeSys gateway must be running: a. click the CoDeSys Gateway SysTray(stopped) icon in the task bar, b. select Start Gateway.
164
EIO0000000827 12/2012
Communication Between SoMachine on a Computer and the Modicon M218 Logic Controller is not Possible Possible causes: z Incorrect cable usage. z The controller is not detected by the PC. z Communication settings are not correct. z The controller is not correctly operating. Resolution:
EIO0000000827 12/2012
165
Check 1
Check that the Modicon M218 Logic Controller has been detected by your PC: 1. click Start Control Panel System, select the Hardware tab and click Device Manager,
2. check that the Modicon M218 Logic Controller node appears in the list: .
3. If the Modicon M218 Logic Controller node does not appear or if there is an node, unplug/plug the cable on the controller side. 3
Check that the active path is correct: 1. double click the Controller node in the Devices window, 2. check that the Modicon M218 Logic Controller node appears in bold and not in italic. If not: a. stop the CoDeSys Gateway: right click the CoDeSys Gateway SysTray(running) icon
in the task bar and select Stop Gateway, b. unplug/plug the cable on the controller side, c. start the CoDeSys gateway: right click the CoDeSys Gateway SysTray(stopped) icon
in the task bar and select Start Gateway , d. select the gateway in the Controller configuration window of SoMachine and click Scan network. Select the Modicon M218 Logic Controller node and click Set active path. NOTE: If your PC is connected to an Ethernet network, its address might change. In this case, the currently active path set is not correct anymore and the Modicon M218 Logic Controller node appears in italic. Select the Modicon M218 Logic Controller node and click Resolve Name. The node must not appear in italic anymore, click Set Active Path. 4 Refer to the System & I/O Diagnostic LEDs (see Modicon M218 Logic Controller, Hardware Guide) section.
Application Program is not Executed Possible causes: No POU is declared in the task. Resolution: As POUs are managed by tasks, you must at least add a POU to a task: 1. double click a task in the Devices window, 2. click Add POU in the task window, 3. select the POU you want to execute in the Input Assistant window and click OK.
166
EIO0000000827 12/2012
Possible causes: z Application does not go to RUN state. z One input is configured in RUN/STOP mode. z Run/Stop Switch is switched to Stop position. Resolution: z Use the input configured in RUN/STOP mode to run the application. z Turn Run/Stop Switch to the Run position.
EIO0000000827 12/2012
167
CoDeSys Gateway does not Start (CoDeSys Gateway SysTray icon is black) Possible cause: Connection during a long time. Resolution: If the CoDeSys Gateway SysTray icon is black (stopped): 1. Open the task Manager, 2. stop the Gatewayservice.exe, and start it again: z Reset your computer or, z in Control Panel, open Administrative Tools and Computer Management, z in Service, double click CoDeSys Gateway, z Click Start Service button. 3. Control if the CoDeSys Gateway SysTray icon is red (running). Serial Line Communication is not Possible Possible causes: z Communication settings are not identical between serial line devices. z The controller is not correctly operating. Resolution: Check that: z Protocol communication settings (baud rate, parity...) are identical for all serial line devices. z The correct communication manager is added on the Serial Line object: z Modbus manager if the line is used for Modbus protocol, z SoMachine-Network Manager if the line is used for communication to access IEC variable.
z
The controller operates correctly. Refer to the System & I/O Diagnostic LEDs (see Modicon M218 Logic Controller, Hardware Guide) section.
Creating the Boot Application is not Possible Possible cause: The operation is not possible while the controller is in RUN state. Resolution:
z z
168
EIO0000000827 12/2012
PTO Function does not Start Possible cause: The AUX input is configured as Drive ready but not used. Resolution:
z z
If the AUX variable is set to Drive_Ready, check that the Drive is correctly operating, or set the Dis_Drive_Ready variable of the PTOsimple function block to 0.
Changing Device Name do not Work Possible cause: Application is running. Resolution:
z z
Monitoring of the POU is Slow Possible cause: Task interval is too small or POUs is too great. Resolution:
z z
Increase the configured task interval. Split the application in smaller POUs.
ERR LED is Flashing Fast on the PLC Possible cause: A system error was detected. Resolution: Check your application program (pointer management, arrays management, etc...).
EIO0000000827 12/2012
169
Controller is in HALT State Possible cause: The PLC has stopped due to a watchdog event.
z
Resolution: If a task watchdog is configured: a. Run the application without task watchdog b. Get the maximum task cycle time from the task monitor c. Set the task watchdog greater than the maximum task cycle time If a task watchdog is not configured: z If a Cyclic task is configured, increase the cycle time to a value > 1.25 times the average task time z If several tasks are configured, one of these is a Freewheeling task, try reconfiguring the Freewheeling task as a Cyclic task
Possible cause: A division by 0 is detected in the application program. Resolution: Check your application program. Use POUs for implicit checks in your application to manage this kind of situation. Source Download Leads to Communication Error The following table describes the possible causes of a communication error during Source Download:
Possible Cause You attempted to download the source while the controller was in a RUN state. The source file exceeded the available memory space in the controller. Resolution Stop the controller before attempting the download.
If sending additional files with the source, considering deselecting them to reduce the overall size of the download. See Project Project Settings Source Download Additional Files... in the SoMachine main menu.
170
EIO0000000827 12/2012
What Programming Languages Are Supported by a Modicon M218 Logic Controller? Refer to key features of Modicon M218 Logic Controller (see page 13). What Variable Types Are Supported by a Modicon M218 Logic Controller? Refer to supported data types. (see page 23) When Should I Use Freewheeling or Cyclic Task Type? Freewheeling or cyclic task type usage are described in Task Types (see page 38): z Freewheeling: use this setting if you accept to have a variable cycle time. The next cycle will start after a waiting duration equals 30% of the last cycle execution duration. z Cyclic: use this mode if you want to control the cycle time. What Are the Effects of Cold/Warm Restart? Refer to Reset Cold/Reset Warm (see page 59). Can I Connect Several M218 Controllers Through Several USB Ports to My PC? No, because driver conflicts may occur.
EIO0000000827 12/2012
171
Why Is the Communication Between the HMI and the Controller Interrupted when Making Online Changes? When online changes are made to a M218 application, the Symbol Configuration is downloaded. This results in a temporary interruption of the communication. It occurs when the protocol used between the controller and the HMI is the SoMachine network protocol. Can I Simulate the Physical Controller Behavior with the Simulation Mode? No. The simulation mode is only used to simulate the logic of the user application, not the Controller hardware behavior.
172
EIO0000000827 12/2012
Appendices
Overview This appendix lists the documents necessary for technical understanding of the M218 Programming Guide. What Is in This Appendix? The appendix contains the following chapters:
Chapter A B C Chapter Name Function and Function Block Representation Functions to get/set serial line configuration in user program Controller Performance Page 175 185 191
EIO0000000827 12/2012
173
174
EIO0000000827 12/2012
Modicon M218 Logic Controller Function and Function Block Representation EIO0000000827 12/2012
Overview Each function can be represented in the following languages: z IL: Instruction List z ST: Structured Text z LD: Ladder Diagram z FBD: Function Block Diagram z CFC: Continuous Function Chart This chapter provides functions and function blocks representation examples and explains how to use them for IL and ST languages. What Is in This Chapter? This chapter contains the following topics:
Topic Differences Between a Function and a Function Block How to Use a Function or a Function Block in IL Language How to Use a Function or a Function Block in ST Language Page 176 177 181
EIO0000000827 12/2012
175
Examples: boolean operators (AND), calculations, conversion (BYTE_TO_INT) Function Block A function block: is a POU (Program Organization Unit) that returns one or more outputs z is always called through an Instance (function block copy with dedicated name and variables) z each Instance has a persistent state (outputs and internal variables) from one call to the other
z
Examples: timers, counters In the example below, Timer_ON is an instance of the Function Block TON:
176
EIO0000000827 12/2012
2 3 4
To illustrate the procedure, consider the Functions IsFirstMastCycle (without input parameter) and SetRTCDrift (with input parameters) graphically presented below:
Function without input parameter: IsFirstMastCycle Graphical Representation
177
178
EIO0000000827 12/2012
Using a Function Block in IL language The following procedure describes how to insert a function block in IL language:
Step 1 Action Open or create a new POU in Instruction List language. NOTE: The procedure to create a POU is not detailed here. For more information, refer to the SoMachine global help. Create the variables that the function block requires, including the instance name. Function Blocks are called using a CAL instruction:
z Use the Input Assistant to select the FB (right-click and select Insert Box in context menu). z Automatically, the CAL instruction and the necessary I/O are created.
2 3
4 5
In the CAL right-side field, replace ??? with the instance name. Replace other ??? with an appropriate variable or immediate value.
To illustrate the procedure, consider this example with the TON Function Block graphically presented below:
Function Block TON Graphical Representation
EIO0000000827 12/2012
179
In IL language, the function block name is used directly in the Operator Column:
Function Block TON Representation in SoMachine POU IL Editor
180
EIO0000000827 12/2012
2 3
To illustrate the procedure, consider the function SetRTCDrift graphically presented below:
Function SetRTCDrift Graphical Representation
EIO0000000827 12/2012
181
Using a Function Block in ST Language The following procedure describes how to insert a function block in ST language:
Step 1 Action Open or create a new POU in Structured Text language. NOTE: The procedure to create a POU is not detailed here. For more information, refer to the SoMachine global help. Create the input and output variables and the instance required for the function block:
z Input variables are the input parameters required by the function block z Output variables receive the value returned by the function block
Use the general syntax in the POU ST Editor for the ST language of a Function Block. The general syntax is: FunctionBlock_InstanceName(Input1:=VarInput1, Input2:=VarInput2,... Ouput1=>VarOutput1, Ouput2=>VarOutput2,...);
To illustrate the procedure, consider this example with the TON function block graphically presented below:
Function Block TON Graphical Representation
182
EIO0000000827 12/2012
EIO0000000827 12/2012
183
184
EIO0000000827 12/2012
Modicon M218 Logic Controller Functions to get/set serial line configuration in user program EIO0000000827 12/2012
Overview This section describes the functions to get/set the serial line configuration in your program. To use these functions, you must add the M218 Communication library. For further information on adding a library, refer to the SoMachine Programming Guide (see SoMachine, Programming Guide). What Is in This Chapter? This chapter contains the following topics:
Topic GetSerialConf: Get the Serial Line Configuration SetSerialConf: Change the Serial Line Configuration SERIAL_CONF: Structure of the Serial Line Configuration Data Type Page 186 187 189
EIO0000000827 12/2012
185
Parameter Description
Input Link Type LinkNumber (see SoMachine, Modbus and ASCII Read/Write Functions, PLCCommunication Library Guide) POINTER TO SERIAL_CONF (see page 189) Comment Link is the communication port number.
PointerToSerialConf
PointerToSerialConf is the address of the configuration structure (variable of SERIAL_CONF type) in which the configuration parameters are stored. The ADR standard function must be used to define the associated pointer. (See the example below.)
Output GetSerialConf
Type WORD
Comment This function returns: z 0: The configuration parameters are returned z 255: The configuration parameters are not returned because: z the function was not successful z the function is in progress
186
EIO0000000827 12/2012
NOTE: Changing the configuration of the Serial Line(s) port(s) during programming execution can interrupt ongoing communications with other connected devices.
WARNING
LOSS OF CONTROL DUE TO UNEXPECTED CONFIGURATION CHANGE Be sure to validate and test all the parameters of the SetSerialConf function before putting your program into service. Failure to follow these instructions can result in death, serious injury, or equipment damage. Parameter Description
Input Link Type LinkNumber (see SoMachine, Modbus and ASCII Read/Write Functions, PLCCommunication Library Guide) POINTER TO SERIAL_CONF (see page 189) Comment LinkNumber is the communication port number.
PointerToSerialConf
PointerToSerialConf is the address of the configuration structure (variable of SERIAL_CONF type) in which the new configuration parameters are stored. The ADR standard function must be used to define the associated pointer. (See the example below.) If 0, set the application default configuration to the serial line.
EIO0000000827 12/2012
187
Output SetSerialConf
Type WORD
Example VAR MySerialConf: SERIAL_CONF result: WORD; END_VAR (*Get current configuration of serial line 1*) GetSerialConf(1, ADR(MySerialConf)); (*Change to modbus RTU slave address 9*) MySerialConf.Protocol := 0; (*Modbus RTU/Somachine protocol (in this case CodesysCompliant selects the protocol)*) MySerialConf.CodesysCompliant := 0; (*Modbus RTU*) MySerialConf.address := 9; (*Reconfigure the serial line 1*) result := SetSerialConf(1, ADR(MySerialConf)); (*Set modbus address to 9*)
188
EIO0000000827 12/2012
FrameLengthReceived
WORD
Protocol
BYTE
CharFrameEnd1
BYTE
EIO0000000827 12/2012
189
Variable CharFrameEnd2
Type BYTE
Description In the ASCII protocol, 0 means there is no second end character in the frame. Otherwise, the corresponding ASCII character is used (along with CharFrameEnd1) to detect the end of a frame in receiving mode. In sending mode, this character is added at the end of the user frame. 0: Modbus RTU 1: SoMachine (when Protocol = 0)
CodesysCompliant CodesysNetType
BYTE BYTE
not used
190
EIO0000000827 12/2012
Controller Performance
C
Processing Performance
Introduction This chapter provides information about the M218 controller processing performance. Logic Processing The following table shows logic processing performance for various logical instructions:
IL Instruction Type Addition/subtraction/multiplication of INT Addition/subtraction/multiplication of DINT Addition/subtraction/multiplication of REAL Division of REAL Operation on BOOLEAN, e.g. Status:= Status and value LD INT + ST INT LD DINT + ST DINT LD REAL + ST REAL Duration for 1000 instructions 380 s 401 s 7608 s 15978 s 572 s 386 s 430 s 750 s
Basic System Time The following table shows the basic overhead performance for each MAST cycle:
I/O type Embedded Inputs & Internal Processing Embedded Outputs Overhead for each MAST cycle 1500 s 450 s
EIO0000000827 12/2012
191
HSC, PWM, PTO and Frequency Generator Processing The following table shows the processing performance for complex functions for each MAST cycle:
Complex function type HSC Simple HSC Main PWM PTO Simple Frequency Generator Overhead for each MAST cycle 150 s 350 s 150 s 200 s 150 s
Communication and System Processing Time The communication processing time varies, depending on the number of sent/received requests. Response Time on Event The response time shown in the following table represents the time between a signal rising edge on an input triggering an external task and the edge of an output set by this task. The event task also process 100 IL instructions before setting the output:
Minimum 950 s Typical 1200 s Maximum 2000 s
192
EIO0000000827 12/2012
Glossary
0-9
%I According to the IEC standard, %I represents an input bit (for example a language object of type digital IN).
%IW According to the IEC standard, %IW represents an input word register (for example a language object of type analog IN).
%MW According to the IEC standard, %MW represents a memory word register (for example a language object of type memory word).
%Q According to the IEC standard, %Q represents an output bit (for example a language object of type digital OUT).
%QW According to the IEC standard, %QW represents an output word register (for example a language object of type analog OUT).
EIO0000000827 12/2012
193
Glossary
A
analog input An analog input module contains circuits that convert an analog DC input signal to a digital value that can be manipulated by the processor. By implication, the analog input is usually direct. That means a data table value directly reflects the analog signal value.
analog output An analog output module contains circuits that transmit an analog DC signal proportional to a digital value input to the module from the processor. By implication, these analog outputs are usually direct. That means a data table value directly controls the analog signal value.
application source The application source file can be uploaded to the PC to reopen a SoMachine project. This source file can support a full SoMachine project (for example, one that includes HMI application).
ARP The address resolution protocol is the IP network layer protocol for Ethernet that maps an IP address to a MAC (hardware) address.
ARRAY An ARRAY is a table containing elements of a single type. The syntax is as follows: ARRAY [<limits>] OF <Type> Example 1: ARRAY [1..2] OF BOOL is a 1-dimensional table with 2 elements of type BOOL. Example 2: ARRAY [1..10, 1..20] OF INT is a 2-dimensional table with 10x20 elements of type INT. ASCII The american standard code for information interchange is a communication protocol for representing alphanumeric characters (letters, numbers, and certain graphic and control characters).
194
EIO0000000827 12/2012
Glossary
assigned variable A variable is "assigned" if its location in controller memory can be known. For example, the Water_pressure variable is said to be assigned through its association with memory location %MW102.Water_pressure. AWG The american wire gauge standard specifies wire gauges in North America.
B
BCD The binary coded decimal format represents decimal numbers between 0 and 9 with a set of 4 bits (a nybble/nibble, also titled as Halfbyte). In this format, the 4 bits used to encode decimal numbers have an unused range of combinations. For example, the number 2,450 is encoded as 0010 0100 0101 0000 BOOL A Boolean type is the basic data type in computing. A BOOL variable can have one of these values: 0 (FALSE), 1 (TRUE). A bit that is extracted from a word is of type BOOL, for example: %MW10.4 is a fifth bit a memory word number 10. Boot application Files that contain machine dependent parameters: z machine name z device name or IP address z Modbus Serial Line address z Routing table
BOOTP The bootstrap protocol is a UDP network protocol that can be used by a network client to automatically obtain an IP address (and possibly other data) from a server. The client identifies itself to the server using the clients MAC address. The server which maintains a pre-configured table of client device MAC addresses and associated IP addressessends the client its pre-configured IP address. BOOTP was originally used as a method that enabled diskless hosts to be remotely booted over a network. The BOOTP process assigns an infinite lease of an IP address. The BOOTP service utilizes UDP ports 67 and 68.
EIO0000000827 12/2012
195
Glossary
bps bit per second as a definition of transmission rate, also given in conjunction with multiplicator kilo (kbps) and mega (mbps).
BYTE When 8 bits are grouped together, they are called a BYTE. You can enter a BYTE either in binary mode or in base 8. The BYTE type is encoded in an 8-bit format that ranges from 16#00 to 16#FF (in hexadecimal format).
C
CFC The continuous function chart (an extension of the IEC61131-3 standard) is a graphical programming language that works like a flowchart. By adding simple logicals blocks (AND, OR, etc.), each function or function block in the program is represented in this graphical format. For each block, the inputs are on the left and the outputs on the right. Block outputs can be linked to inputs of other blocks in order to create complex expressions.
controller A controller (or programmable logic controller, or programmable controller) is used to automate industrial processes.
controller status output The controller status output is a special function used in circuits that are external to the controller that control the power supply to the output devices or the controllers power supply.
CRC A network messages cyclic redundancy check field contains a small number of bits that produce a checksum. The message is calculated by the transmitter according to the messages content. Receiving nodes then recalculate the field. Any discrepancy in the two CRC fields indicates that the transmitted message and the received message are different.
CTS Clear to send is a data transmission signal and acknowledges the RDS signal from the transmitting station.
196
EIO0000000827 12/2012
Glossary
cyclic task The cyclic scan time has a fixed duration (interval) specified by the user. If the current scan time is shorter than the cyclic scan time, the controller waits until the cyclic scan time has elapsed before starting a new scan.
D
data log The controller logs events relative to the user application in a data log.
DHCP The dynamic host configuration protocol is an advanced extension of BOOTP. DHCP is a more advanced, but both DHCP and BOOTP are common. (DHCP can handle BOOTP client requests.)
digital I/O A digital input or output has an individual circuit connection at the electronic module that corresponds directly to a data table bit that holds the value of the signal at that I/O circuit. It gives the control logic digital access to I/O values.
DIN Deutsches Institut fr Normung is a German institution that sets engineering and dimensional standards.
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.
EIO0000000827 12/2012
197
Glossary
DTM With device type managers representing the field device in SoMachine, direct communications are possible to every single field device via SoMachine, the controller and the field bus, thus avoiding the need for individual cable connections.
E
EDS Electronic data sheet contains for example the properties of a device e.g. parameters and settings of a drive.
EEPROM Electrically erasable programmable read-only memory is a type of non-volatile memory used to store data that must be saved when power is removed.
EIA The electronic industries alliance is the trade organization for establishing electrical/electronic and data communication standards (including RS-232 and RS485) in the United States.
EIA rack An electronic industries alliance rack is a standardized (EIA 310-D, IEC 60297 and DIN 41494 SC48D) system for mounting various electronic modules in a stack or rack that is 19 inches (482.6 mm) wide.
electronic module In a programmable controller system, most electronic modules directly interface to the sensors, actuators, and external devices of the machine/process. This electronic module is the component that mounts in a bus base and provides electrical connections between the controller and the field devices. Electronic modules are offered in a variety of signal levels and capacities. (Some electronic modules are not I/O interfaces, including power distribution modules and transmitter/receiver modules.)
198
EIO0000000827 12/2012
Glossary
EN EN identifies one of many European standards maintained by CEN (European Committee for Standardization), CENELEC (European Committee for Electrotechnical Standardization), or ETSI (European Telecommunications Standards Institute).
encoder An encoder is a device for length or angular measurement (linear or rotary encoders).
Ethernet Ethernet is a physical and data link layer technology for LANs, also known as IEE 802.3.
EtherNet/IP The ethernet industrial protocol is an open communications protocol for manufacturing automation solutions in industrial systems. EtherNet/IP is in a family of networks that implements Common Industrial Protocol at its upper layers. The supporting organization (ODVA) specifies EtherNet/IP to accomplish global adaptability and media independence.
expansion I/O module An expansion input or output module is either a digital or analog module that adds additional I/O to the base controller.
F
FAST I/O FAST I/Os are specific I/Os with some electrical features (response time, for example) but the treatment of these channels is done by the Controller CPU.
FAST task The FAST task is a periodic, high-priority task of a short duration that is run on a processor through its programming software. The tasks fast speed keeps it from interfering with the execution of lower priority master (MAST) tasks. A FAST task is useful when fast periodic changes in discrete inputs need to be monitored.
EIO0000000827 12/2012
199
Glossary
FB A function block performs a specific automation function, such as speed control, interval control, or counting. A function block comprises configuration data and a set of operating parameters.
FBD A function block diagram is a graphically oriented programming language, compliant with IEC 61131-3. It works with a list of networks whereby each network contains a graphical structure of boxes and connection lines which represents either a logical or arithmetic expression, the call of a function block, a jump, or a return instruction.
FDT Field device tool for standardized communications between field devices and SoMachine.
FE Functional ground is the point of a system or device that must be grounded to help prevent equipment damage.
FG frequency generator
Flash memory Flash memory is nonvolatile memory that can be overwritten. It is stored on a special EEPROM that can be erased and reprogrammed.
FTP File transfer protocol is a standard network protocol (built on a client-server architecture), to exchange and manipulate files over TCP/IP based networks.
200
EIO0000000827 12/2012
Glossary
function A function: z is a POU that returns 1 immediate result z is directly called with its name (as opposed to through an instance) z has no persistent state from one call to the next z can be used as an operand in expressions Examples: boolean (AND) operators, calculations, conversions (BYTE_TO_INT)
G
GVL The global variable list manages global variables that are available in every application POU.
H
HE10 Rectangular connector for electrical signals with frequencies below 3MHz, complying with IEC60807-2.
HMI A human-machine interface is an operator interface (usually graphical) for industrial equipment.
HVAC Heating ventilation and air conditioning applications monitor and control indoor environments.
EIO0000000827 12/2012
201
Glossary
I
I/O input/output
I/O scan An input/output scan continuously polls I/O modules to collect data bits and status, error, and diagnostics information. This process monitors inputs and controls outputs.
I/O terminal An input/output terminal on the front of an expansion I/O module connects input and output signals.
ICMP The internet control message protocol reports errors and provides information related to datagram processing.
IEC The international electrotechnical commission is a non-profit and non-governmental international standards organization that prepares and publishes international standards for all electrical, electronic, and related technologies.
IEC 61131-3 The IEC 61131-3 is an international electrotechnical commission standard for industrial automation equipment (like controllers). IEC 61131-3 deals with controller programming languages and defines 2 graphical and 2 textual programming language standards: z graphical: ladder diagram, function block diagram z textual: structured text, instruction list
IEEE The institute of electrical and electronics engineers is a non-profit international standards and conformity assessment body for advances in all fields of electrotechnology.
202
EIO0000000827 12/2012
Glossary
IEEE 802.3 IEEE 802.3 is a collection of IEEE standards defining the physical layer, and the media access control (MAC) sublayer of the data link layer, of wired Ethernet.
IL A program written in the instruction list language is composed of a series of instructions executed sequentially by the controller. Each instruction includes a line number, an instruction code, and an operand. (IL is IEC 61131-3 compliant.)
immediate addressing The direct method of addressing memory objects, including physical inputs and outputs, used in programming instructions as operands and parameters by using their direct address (for example, %Iwx or %QWx). The use of immediate addressing in your program may avoid the need to create symbols for these objects, but there are also disadvantages. For example, if you change the programs configuration by adding or deleting devices or I/O modules or slices, the immediate addresses used as programming instruction operands and/or parameters are not updated and must be corrected manually, which may cause extensive program modifications and lead to incorrect programming instructions. (See symbolic addressing.)
input filter An input filter is a special function that rejects input noises. It is useful for eliminating input noises and chatter in limit switches. All inputs provide a level of input filtering using the hardware. Additional filtering with software is also configurable through the programing or the configuration software.
input terminal An input terminal on the front of an expansion I/O module connects input signals from input devices (such as sensors, push buttons, and limit switches). For some modules, input terminals accept both sink and source DC input signals.
EIO0000000827 12/2012
203
Glossary
IP The internet protocol is part of the TCP/IP protocol family that tracks the Internet addresses of devices, routes outgoing messages, and recognizes incoming messages.
IP 20 Ingress protection rating according to IEC 60529. IP20 modules are protected against ingress and contact of objects larger than 12.5 mm. The module is not protected against harmful ingress of water.
IP 67 Ingress protection rating according to IEC 60529. IP67 modules are completely protected against ingress of dust and contact. Ingress of water in harmful quantity is not possible when the enclosure is immersed in water up to 1 m.
K
Kd derivative gain
Ki integral gain
Kp proportional gain
L
Ladder Diagram language See LD.
LAN A local area network local area network is a short-distance communications network that is implemented in a home, office, or institutional environment.
204
EIO0000000827 12/2012
Glossary
latching input A latching input module interfaces with devices that transmit messages in short pulses. Incoming pulses are captured and recorded for later examination by the application.
LD A program in the ladder diagram language includes a graphical representation of instructions of a controller program with symbols for contacts, coils, and blocks in a series of rungs executed sequentially by a controller. IEC 61131-3 compliant.
LED A light emitting diode is an indicator that lights up when electricity passes through it.
LINT Long integer is a 64-bit variable (4 times INT or two times DINT).
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.
EIO0000000827 12/2012
205
Glossary
M
MAC address The media access control address is a unique 48-bit number associated with a specific piece of hardware. The MAC address is programmed into each network card or device when it is manufactured.
Magelis Magelis is the commercial name for Schneider Electrics range of HMI terminals.
MAST A master (MAST) task is a processor task that is run through its programming software. The MAST task has two sections: z IN: Inputs are copied to the IN section before execution of the MAST task. z OUT: Outputs are copied to the OUT section after execution of the MAST task.
master/slave The single direction of control in a network that implements the master/slave model is always from a master device or process to one or more slave devices.
MIB The management information base is an object database that is monitored by a network management system like SNMP. SNMP monitors devices that are defined by their MIBs. Schneider has obtained a private MIB, groupeschneider (3833).
minimum I/O update time The minimum I/O update time is the minimum time it takes for the bus cycle to shut down to force an I/O update at each cycle.
Modbus The Modbus communication protocol allows communications between many devices connected to the same network.
206
EIO0000000827 12/2012
Glossary
MSB The most significant bit (or most significant byte) is the part of a number, address, or field that is written as the left-most single value in conventional hexadecimal or binary notation.
N
NAK negative acknowledge
NC A normally closed contact is a contact pair that is closed when the actuor is deenergized (no power is applied) and open when the actuor is energized (power is applied).
NEC The national electric code standard dictates the safe installation of electrical wiring and equipment.
NEMA The national electrical manufacturers association publishes standards for the performance of various classes of electrical enclosures. The NEMA standards cover corrosion resistance, ability to protect from rain and submersion, etc. For IEC member countries, the IEC 60529 standard classifies the ingress protection rating for enclosures.
network A network includes interconnected devices that share a common data path and protocol for communications.
NMT Network management protocols provide services for network initialization, error control, and device status control.
EIO0000000827 12/2012
207
Glossary
NMT state machine A network management state machine defines the communication behavior of any CANopen device. The CANopen NMT state machine consists of an initialization state, a pre-operational state, an Operational state, and a stopped state. After power-on or reset, the device enters the initialization state. After the device initialization is finished, the device automatically enters the pre-operational state and announces the state transition by sending the boot-up message. In this manner, the device indicates that it is ready to work. A device that stays in pre-operational state may start to transmit SYNC-, Time Stamp-, or Heartbeat message. In this state, the device cannot communicate through a PDO; it must do so with an SDO. In the operational state, the device can use all supported communication objects.
NO A normally open contact is a contact pair that is open when the actuor is deenergized (no power is applied) and closed when the actuor is energized (power is applied).
O
ODVA The open deviceNet vendors association supports the family of network technologies that are built on CIP (EtherNet/IP, DeviceNet, and CompoNet).
OS Operating system. Can be used for Firmware that can be uploaded/downloaded by the user.
OSI The open system interconnection reference model is a 7-layer model that describes network protocol communications. Each abstract layer receives services from the layer below it and provides services to the layer above.
output terminal An output terminal connects output signals to output devices (such as electromechanical relays and solenoid valves).
208
EIO0000000827 12/2012
Glossary
P
PCI A peripheral component interconnect is an industry-standard bus for attaching peripherals.
PE Protective ground is a return line across the bus for fault currents generated at a sensor or actuator device in the control system.
periodic execution The master task is executed either cyclically or periodically. In periodic mode, you determine a specific time (period) in which the master task must be executed. If it is executed under this time, a waiting time is generated before the next cycle. If it is executed over this time, a control system indicates the overrun. If the overrun is too high, the controller is stopped.
persistent data Value of persistent data that will be used at next application change or cold start. Only get re-initialized at a reboot of the controller or reset origin. Especially they maintain their values after a download.
PI proportional integral
PLC The programmable logic controller is the brain of an industrial manufacturing process. It automates a process, used instead of relay control systems. PLCs are computers suited to survive the harsh conditions of the industrial environment.
EIO0000000827 12/2012
209
Glossary
PLCopen The PLCopen standard brings efficiency, flexibility, and manufacturer independence to the automation and control industry through the standardization of tools, libraries, and modular approaches to software programming.
POU A program organization unit includes a variable declaration in source code and the corresponding instruction set. POUs facilitate the modular reuse of software programs, functions, and function blocks. Once declared, POUs are available to one another. SoMachine programming requires the utilization of POUs.
POU FB Program organization unit function block types are user programs that can be defined by the user in the ST, IL, LD, or FBD languages. You can use POU FB types in an application to:
z z z z
simplify the design and entry of the program make the program easier to read simplify debugging reduce the amount of generated code
power supply terminals The power supply is connected to these terminals to provide power to the controller.
protocol A protocol is a convention or standard that controls or enables the connection, communication, and data transfer between two computing endpoints.
PTO Pulse train outputs are used to control for instance stepper motors in open loop.
PWM Pulse width modulation is used for regulation processes (e.g. actuators for temperature control) where a pulse signal is modulated in its length. For these kind of signals, transistor outputs are used.
210
EIO0000000827 12/2012
Glossary
R
RAM random access memory
REAL Real is a numeric data type. The REAL type is encoded in a 32-bit format.
reflex output In a counting mode, the high speed counters current value is measured against its configured thresholds to determine the state of these dedicated outputs.
retained data A retained data value is used in the next power-on or warm start. The value is retained even after an uncontrolled shutdown of the controller or a normal switch-off of the controller.
RJ-45 This registered jack is a modular connector that is commonly implemented in communication networks.
RS-232 RS-232 (also known as EIA RS-232C or V.24) is a standard type of serial communication bus, based on three wires.
RS-485 RS-485 (also known as EIA RS-485) is a standard type of serial communication bus, based on two wires.
EIO0000000827 12/2012
211
Glossary
RTC The real-time clock option keeps the time for a limited amount of time even when the controller is not powered.
RTS Request to send is a data transmission signal and will be acknowledged by the CTS signal from the destination node.
RTU A remote terminal unit is a device that interfaces with objects in the physical world to a distributed control system or SCADA system by transmitting telemetry data to the system and/or altering the state of connected objects based on control messages received from the system.
S
SCADA A supervisory control and data acquisition system monitors, manages, and controls industrial applications or processes.
scan A controllers scanning program performs 3 basic functions: [1] It reads inputs and places these values in memory; [2] it executes the application program 1 instruction at a time and stores results in memory; [3] It uses the results to update outputs.
SEL-V A system that follows IEC 61140 guidelines for safety extra low voltage is protected in such a way that voltage between any 2 accessible parts (or between 1 accessible part and the PE terminal for Class 1 equipment) does not exceed a specified value under normal conditions or under single-fault conditions.
212
EIO0000000827 12/2012
Glossary
SFC A program written in the sequential function chart language can be used for processes that can be split into steps. SFC is composed of steps with associated actions, transitions with associated logic condition, and directed links between steps and transitions. (The SFC standard is defined in IEC 848. It is IEC 61131-3 compliant.)
sink input A sink input is a wiring arrangement in which the device provides current to the input electronic module. A sink input is referenced to 0 Vdc.
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.
EIO0000000827 12/2012
213
Glossary
Structured Text A program written in the structured text (ST) language includes complex statements and nested instructions (such as iteration loops, conditional executions, or functions). ST is compliant with IEC 61131-3.
symbol A symbol is a string of a maximum of 32 alphanumeric characters, of which the first character is alphabetic. It allows you to personalize a controller object to facilitate the maintainability of the application.
symbolic addressing The indirect method of addressing memory objects, including physical inputs and outputs, used in programming instructions as operands and parameters by first defining symbols for them using these symbols in association with the programming instructions. In contrast to immediate addressing, this is the recommended method because if the programs configuration changes, symbols are automatically updated with their new immediate address associations, whereas any immediate addresses used as operands or parameters are not. (See immediate addressing.)
system time An internal clock provides a device with the system time.
system variable A system variable structure provides controller data and diagnostic information and allows sending commands to the controller.
T
TAP A terminal access point is a junction box connected to the trunk cable that allows you to plug in drop cables.
214
EIO0000000827 12/2012
Glossary
task A group of sections and subroutines, executed cyclically or periodically for the MAST task, or periodically for the FAST task. A task possesses a level of priority and is linked to inputs and outputs of the controller. These I/O are refreshed in consequence. A controller can have several tasks.
TCP A transmission control protocol is a connection-based transport layer protocol that provides a reliable simultaneous bi-directional transmission of data. TCP is part of the TCP/IP protocol suite.
terminal block The terminal block is the component that mounts in an electronic module and provides electrical connections between the controller and the field devices.
threshold output Threshold outputs are controlled directly by the HSC according to the settings established during configuration.
trunk cable A trunk cable is the main cable that is terminated at both physical ends with line termination resistors.
U
UDINT An unsigned double integer is encoded in 32 bits.
EIO0000000827 12/2012
215
Glossary
UDP The user datagram protocol is a connectionless mode protocol (defined by IETF RFC 768) in which messages are delivered in a datagram (data telegram) to a destination computer on an IP network. The UDP protocol is typically bundled with the Internet Protocol. UDP/IP messages do not expect a response, and are therefore ideal for applications in which dropped packets do not require retransmission (such as streaming video and networks that demand real-time performance).
unlocated variable An unlocated variable does not have an address. (See located variable.)
V
VSD variable speed drive
W
WORD The WORD type is encoded in a 16-bit format.
216
EIO0000000827 12/2012
Index
B C A
Firmware Update ExecLoader Introduction, 156 File and Device Properties, 159 Settings, 158 Transfer Progress, 161 Update Through USB, 154 Welcome, 157 Functions Differences Between a Function and a Function Block, 176 How to Use a Function or a Function Block in IL Language, 177 How to Use a Function or a Function Block in ST Language, 181
C
Controller Configuration Access Controller Configuration, 68 Applications, 69 PLC Settings, 70 Services, 71
D
Download application, 63
E
Embedded Functions Configuration Embedded HSC Configuration, 78 Embedded I/O Configuration, 74 Embedded PTO_PWM Configuration, 80 Expansion Module Adding Expansion Module, 88 Configure Expansion Module, 88, 89
G
GetSerialConf, 186
I
Initialization Values, 56
F
FAQ, 171 features key features, 13
L
libraries, 21
M
M218, 13 main features, 13 Memory Mapping, 25
EIO0000000827 12/2012
217
Index
O
Output Behavior, 56, 56 Output Forcing, 56 overview, 13
P
programming languages IL, ST, FBD, SFC, LD, CFC, 13
R
Reboot, 62 Remanent variables, 66 Reset cold, 60 Reset origin, 61 Reset warm, 59 Run command, 58
S
Serial Line Serial Line Configuration, 92 SERIAL_CONF, 189 SetSerialConf, 187 State diagram, 46 Stop command, 59
T
Task Cyclic task, 38 Event task, 39 External Event Task, 40 Freewheeling task, 39 Types, 38 Watchdogs, 41 TM218LDA16DRN, 13 TM218LDA24DRHN, 13 TM218LDA24DRN, 13 TM218LDA40DR2HN, 13 TM218LDA40DR4PHN, 13 TM218LDA40DRN, 13 TM218LDA40DRPHN, 13
218
EIO0000000827 12/2012