M238 Programming Guide
M238 Programming Guide
M238 Programming Guide
EIO0000000384.03
www.schneider-electric.com
The information provided in this documentation contains general descriptions and/or technical characteristics of the performance of the products contained herein. This documentation is not intended as a substitute for and is not to be used for determining suitability or reliability of these products for specific user applications. It is the duty of any such user or integrator to perform the appropriate and complete risk analysis, evaluation and testing of the products with respect to the relevant specific application or use thereof. Neither Schneider Electric nor any of its affiliates or subsidiaries shall be responsible or liable for misuse of the information contained herein. If you have any suggestions for improvements or amendments or have found errors in this publication, please notify us. No part of this document may be reproduced in any form or by any means, electronic or mechanical, including photocopying, without express written permission of Schneider Electric. All pertinent state, regional, and local safety regulations must be observed when installing and using this product. For reasons of safety and to help ensure compliance with documented system data, only the manufacturer should perform repairs to components. When devices are used for applications with technical safety requirements, the relevant instructions must be followed. Failure to use Schneider Electric software or approved software with our hardware products may result in injury, harm, or improper operating results. Failure to observe this information can result in injury or equipment damage. 2011 Schneider Electric. All rights reserved.
EIO0000000384 06/2011
Table of Contents
Safety Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . About the Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Chapter 1 About the Modicon M238 Logic Controller . . . . . . . . . .
Modicon M238 Logic Controller Devices Overview. . . . . . . . . . . . . . . . . .
7 9 13
13
15
15
Chapter 3 Libraries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Libraries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19
19
21
21
23
24 27
Chapter 6 Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Maximum Number of Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Task Configuration Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Task Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . System and Task Watchdogs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Task Priorities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Default Task Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31
32 33 35 38 39 41
43
44 44 48 48 52 53 55 60 61
EIO0000000384 06/2011
63
64 65 66 68
69
70 72 76
79
79
81
81
85
86 87 90 91 93 96 103 106 107 109 112 113
115
116 120 123 124 133 138
139
139
145
146 148
149
150 153 155
EIO0000000384 06/2011
Step 1 - Welcome . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Step 2 - Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Step 3 - File and Device Exec Properties . . . . . . . . . . . . . . . . . . . . . . . . . Step 4 - Transfer Progress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
163
164 172
Appendices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Appendix A AS-Interface Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ASI_CheckSlaveBit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ASI_CmdSetAutoAddressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ASI_CmdSetDataExchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ASI_CmdSetOfflineMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ASI_MasterStatusCheck . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ASI_SlaveAddressChange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ASI_SlaveParameterUpdate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ASI_SlaveStatusCheck . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ASI_ReadParameterImage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
175
177
178 179 181 182 184 186 188 190 192
195
196 197 200
203
204 205 207
209
210 212
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
213 225
EIO0000000384 06/2011
EIO0000000384 06/2011
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.
EIO0000000384 06/2011
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.
EIO0000000384 06/2011
At a Glance
Document Scope The purpose of this document is to help you to configure your Modicon M238 Logic Controller. NOTE: Read and understand this document and all related documents (see page 9) before installing, operating, or maintaining your Modicon M238 Logic Controller. Modicon M238 Logic Controller users should read through the entire document to understand all of its features. Validity Note This document has been updated with the release of SoMachine V3.0. Related Documents
Title of Documentation SoMachine Programming Guide Reference Number EIO0000000067 (ENG); EIO0000000069 (FRE); EIO0000000068 (GER); EIO0000000071 (SPA); EIO0000000070 (ITA); EIO0000000072 (CHS) EIO0000000016 (ENG); EIO0000000017 (FRE); EIO0000000018 (GER); EIO0000000019 (SPA); EIO0000000020 (ITA); EIO0000000021 (CHS)
EIO0000000384 06/2011
EIO0000000396 (ENG); EIO0000000397 (FRE); EIO0000000398 (GER); EIO0000000399 (SPA); EIO0000000400 (ITA); EIO0000000401 (CHS) EIO0000000364 (ENG); EIO0000000757 (FRE); EIO0000000758 (GER); EIO0000000759 (SPA); EIO0000000760 (ITA); EIO0000000761 (CHS) EIO0000000362 (ENG); EIO0000000747 (FRE); EIO0000000748 (GER); EIO0000000749 (SPA); EIO0000000750 (ITA); EIO0000000751 (CHS)
Modicon M238 Logic Controller System Functions and Variables M238 PLC System Library Guide
Modicon M238 Logic Controller High Speed Counting M238 HSC Library Guide
Modicon M238 Logic Controller Pulse Train Output, Pulse EIO0000000363 (ENG); Width Modulation M238 PTOPWM Library Guide EIO0000000752 (FRE); EIO0000000753 (GER); EIO0000000755 (ITA); EIO0000000754 (SPA); EIO0000000756 (CHS) SoMachine Modbus and ASCII Read/Write Functions PLC EIO0000000361(ENG); Communication Library Guide EIO0000000742(FRE); EIO0000000743(GER); EIO0000000745(ITA); EIO0000000744(SPA); EIO0000000746(CHS) SoMachine Modem Functions Modem Library Guide EIO0000000552 (ENG); EIO0000000491 (FRE); EIO0000000492 (GER); EIO0000000494 (ITA); EIO0000000493 (SPA); EIO0000000495 (CHS)
You can download these technical publications and other technical information from our website at www.schneider-electric.com.
10
EIO0000000384 06/2011
WARNING
LOSS OF CONTROL The designer of any control scheme must consider the potential failure modes of control paths and, for certain critical control functions, provide a means to achieve a safe state during and after a path failure. Examples of critical control functions are emergency stop and overtravel stop, power outage and restart. Separate or redundant control paths must be provided for critical control functions. System control paths may include communication links. Consideration must be given to the implications of unanticipated transmission delays or failures of the link. Observe all accident prevention regulations and local safety guidelines.1 Each implementation of this equipment must be individually and thoroughly tested for proper operation before being placed into service. Failure to follow these instructions can result in death, serious injury, or equipment damage. 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.
1
WARNING
UNINTENDED EQUIPMENT OPERATION Only use software approved by Schneider Electric for use with this equipment. Update your application program every time you change the physical hardware configuration. Failure to follow these instructions can result in death, serious injury, or equipment damage. User Comments We welcome your comments about this document. You can reach us by e-mail at techcomm@schneider-electric.com.
EIO0000000384 06/2011
11
12
EIO0000000384 06/2011
EIO0000000384 06/2011
13
Modicon M238 Logic Controller Range The following table describes the M238 range (see M238 Logic Controller, Hardware Guide) and features:
Reference M238 DC Range TM238LFDC24DT 24 Vdc TM238LDD24DT 24 Vdc SL1: RS232/RS485 SL2: RS485 SL1: RS232/RS485 Yes 8 fast inputs(1) + 6 regular inputs 4 transistor fast outputs(2) + 6 transistor regular outputs 2 MB Power Supply Serial Ports CANopen Master Digital Inputs Digital Outputs Memory size
1 MB
No
M238 AC Range TM238LFAC24DR 100...240 Vac TM238LDA24DR SL1: RS232/RS485 SL2: RS485 SL1: RS232/RS485 8 fast Yes inputs(1) + 6 regular inputs 4 transistor outputs + 6 relay outputs 2 MB
100...240 Vac
No
1 MB
(1) The fast inputs can be used either as regular inputs or as fast inputs for counting or event functions. (2) The fast outputs can be used either as regular outputs or as fast outputs for PTO (Pulse Train Output), HSC (High Speed Counter), PWM (Pulse Width Modulation), or FG (Frequency Generator) functions.
14
EIO0000000384 06/2011
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:
EIO0000000384 06/2011
15
2 3 4 5
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 left hand side, entries and sub-entries let you access the different item configuration windows:
16
EIO0000000384 06/2011
Refer to... Controller Device Editor (see page 63) Embedded Functions configuration (see page 69)
Communication
Serial Line configuration (see page 115) CANopen configuration (see page 81)
Device Tree The functions of the Configuration tab are also accessible from the Program tab. In the Program tab, the device tree describes the hardware configuration (for example, the following device tree is the default one when the controller is added):
EIO0000000384 06/2011
17
Description This part shows everything related to the application: Tasks configuration Programming Library manager POUs Relocation Table
Embedded Functions This representation shows the Embedded Functions of the M238. Serial Line 1 Serial Line 2 CAN These are the embedded communications. NOTE: Serial Line 2 and CAN are available only on TM238LFDC24DT and TM238LFAC24DR
Content of Device Tree The device tree represents the objects managed by a specific target (controller or HMI). These objects are: application objects (Tasks, etc.), programming objects (POU, GVL, etc.), hardware-related objects (Embedded functions, CAN, Expansion modules, etc.) By default, the device tree includes the following hardware-related objects:
Reference TM238LDD24DT TM238LDA24DR TM238LFDC24DT TM238LFAC24DR Embedded IO IO HSC PTO_PWM Embedded communications Serial Line (SoMachine_Network_Manager) Serial Line 1 (Modbus_Manager) Serial Line 2 (SoMachine_Network_Manager) CAN (CANopen)
18
EIO0000000384 06/2011
Libraries
3
Libraries
Introduction Libraries provide functions, function blocks, data types and global variables that can be used to develop your project. The Library Manager of SoMachine provides information about the libraries included in your project and allows you to install new ones. Refer to CoDeSys online help for more information on the Library Manager. Modicon M238 Logic Controller When you select a Modicon M238 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 all functions and function blocks which are required matching IEC61131-3 as standard POUs for an IEC programming system. The standard POUs must be tied to the project (standard.library). 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
M238 PLCSystem (see Modicon M238 Logic Controller, System Functions and Variables, M238 PLCSystem Library Guide)
EIO0000000384 06/2011
19
Libraries
Library name
Description
Contains function blocks and variables to get M238 HSC (see Modicon M238 information and send commands to the Fast Logic Controller, High Speed Counting, M238 HSC Library Guide) Inputs/Outputs of the Modicon M238 Logic Controller. These function blocks permit you to implement HSC (High Speed Counting) functions on the Fast Inputs/Outputs of the Modicon M238 Logic Controller. M238 PTOPWM (see Modicon M238 Logic Controller, Pulse Train Output, Pulse Width Modulation, M238 PTOPWM Library Guide) Contains function blocks and variables to get information and send commands to the Fast Inputs/Outputs of the Modicon M238 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 M238 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.
20
EIO0000000384 06/2011
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 LREAL 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 2.2250738585072014e-308 1 character 1 character 63
Upper limit True 255 65,535 4,294,967,295 2 -1 127 255 32,767 65,535 2,147,483,647 4,294,967,295 2 -1 264-1 3.402823466e+38 1.7976931348623158e+308 255 characters 255 characters 63 64
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 64 Bit 1 character = 1 byte 1 character = 1 word 16 bit
EIO0000000384 06/2011
21
22
EIO0000000384 06/2011
Memory Mapping
5
Introduction This chapter describes the memory maps and sizes of the different memory areas in the Modicon M238 Logic Controller. These memory areas are used to store user program logic, data and the programming libraries. Whats in this Chapter? This chapter contains the following topics:
Topic Memory Organization Relocation Table Page 24 27
EIO0000000384 06/2011
23
Memory Mapping
Memory Organization
Introduction This section describes the RAM (Random Access Memory) size for different areas of the Modicon M238 Logic Controller. TM238LFDC24DT and TM238LFAC24DR Memory The RAM size is 2 Mbytes composed of 2 areas: 1048 kbytes System Area for Operating System memory 1000 kbytes Customer Area for dedicated application memory Memory containing Persistent and Retain variables is preserved and protected by an external battery during power outages. This table shows the different types of memory areas with their sizes in the TM238LFDC24DT and TM238LFAC24DR memry:
Area System Area 1048 kbytes Element %MW0...%MW59999 System variables (%MW60000...%MW60199)1 Dynamic Memory Area: Read Relocation Table (see page 27) (60200...61999) Reserved Memory Area (62000...62199) Dynamic Memory Area: Write Relocation Table (see page 27) (62200...63999) Reserved Customer Area 1000 kbytes 945152 7600
1
Variables (including Retain and Persistent variables, 8192002 see table below) Application Libraries (see page 26) Symbols 2048002
24
EIO0000000384 06/2011
Memory Mapping
10568 bytes Battery Saved RAM 8168 bytes 400 bytes 2000 bytes Retain Variables 3 Persistent Retain Variables %MW0...%MW999
1. The %MW defined in the system area as indicated are not accessible to the application but uniquely available to Modbus read/write commands. 2. Size checked at build time and must not exceed the value indicated in the table. 3. Not all the 8168 bytes are available for the customer application because some libraries may use Retain Variables. TM238LDD24DT and TM238LDA24DR Memory The RAM size is 1 Mbytes composed of 2 areas: 524 kbytes System Area for Operating System memory 500 kbytes Customer Area for dedicated application memory Memory containing Persistent and Retain variables is preserved and protected by an external battery during power outages. This table shows the different types of areas with their sizes for the TM238LDD24DT and TM238LDA24DR memory:
Area System Area 524 kbytes Element %MW0...%MW599991 System variables (%MW60000...%MW60199)1 Dynamic Memory Area: Read Relocation Table (see page 27) (60200...61999) Reserved Memory Area (62000...62199) Dynamic Memory Area: Write Relocation Table (see page 27) (62200...63999) Reserved Customer Area 500 kbytes Variables (including Retain and Persistent variables, see table below) Application Libraries (see page 26) Symbols 1024002 408576 4096002 7600 Size (bytes) 120000 400
EIO0000000384 06/2011
25
Memory Mapping
10568 bytes Battery Saved RAM 8168 bytes 400 bytes 2000 bytes Retain Variables 3 Persistent Retain Variables %MW0...%MW999
1. The %MW defined in the system area as indicated are not accessible to the application but uniquely available to Modbus read/write commands. 2. Size checked at build time and must not exceed the value indicated in the table. 3. Not all the 8168 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 M238 PLCSystem Library Guide. Library Sizes
Library Name M238 HSC (see Modicon M238 Logic Controller, High Speed Counting, M238 HSC Library Guide) Average Size 10 kbytes Comment Depends on the functions used.
25 kbytes M238 PLCSystem (see Modicon M238 Logic Controller, System Functions and Variables, M238 PLCSystem Library Guide) M238 PTOPWM (see Modicon M238 Logic Controller, Pulse Train Output, Pulse Width Modulation, M238 PTOPWM Library Guide) PLC Communication CANopen Stack 10 kbytes
Always embedded in the application. The use of the functions does not consume additional memory.
Depends on the functions used. Depends on the functions used. Each CANopen Slave consumes approximately an additional 10 kbytes of memory.
EIO0000000384 06/2011
26
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 M238 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.
EIO0000000384 06/2011
27
Memory Mapping
Relocation Table Editor The Relocation Table Editor allows you to organize your variables under the Relocation Table. To access the Relocation Table Editor, double-click the Relocation Table node in the Device tree of the Devices window:
28
EIO0000000384 06/2011
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.
EIO0000000384 06/2011
29
Memory Mapping
30
EIO0000000384 06/2011
Tasks
6
Introduction The Task Configuration node in the SoMachine device tree allows you to define one or several tasks to control the execution of your application program. The task types available are: Cyclic Freewheeling Event External Event This chapter begins with an explanation of these task types and provides information regarding the maximum number of tasks, the default task configuration, and task prioritization. In addition, this chapter introduces the system and task watchdog functions and explains their relationship to task execution. Whats 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 32 33 35 38 39 41
EIO0000000384 06/2011
31
Tasks
32
EIO0000000384 06/2011
Tasks
The following table describes the fields of the Task Configuration screen:
EIO0000000384 06/2011
33
Tasks
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 one task at a time can be running. The priority determines when the task will run: a higher priority task will preempt a lower priority task tasks with same priority will run in turn (2 ms time-slice) NOTE: Do not assign tasks with the same priority. If there are yet other tasks that attempt to preempt tasks with the same priority, the result could be indeterminate and unpredicable. For more information, refer to Task Priorities (see page 39).
Type
4 types of task are available: Cyclic (see page 35) Freewheeling (see page 36) Event (see page 36) External event (see page 37) To configure the watchdog, you must define two parameters: Time: enter the timeout before watchdog execution. Sensitivity: defines the number of expirations of the watchdog timer before the Controller stops program execution and enters into a HALT state (see page 44). The list of POUs (Programming Organization Units) controlled by the task is defined in the task configuration window
To add a POU linked to the task, use the command Add Pou and select the POU in the Input Assistant editor. To remove a POU from the list, use the command Remove POU. The command Open POU opens the currently selected POU editor. To replace the currently selected POU of the list by another one, use the command Change POU... POUs are executed in the order shown in the list. To move the POUs in the list, select a POU and use the command Move Up or Move Down. NOTE: You can create as many POUs as you want. An application with several small POUs, as opposed to one large POU, can improve the refresh time of the variables in online mode.
34
EIO0000000384 06/2011
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 input states are written to the %I input memory variable and other system operations are executed. 2. Task Processing: The user code (POU, etc.) defined in the task is processed. The %Q output memory variable is updated according to your application program instructions but not written to the physical outputs during this operation. 3. Write Outputs: The %Q output memory variable is modified with any output forcing that has been defined, however, the writing of the physical outputs depends upon the type of output and instructions used. For more information on defining the Bus cycle task refer to Modicon M238 Logic Controller Settings (see Modicon M218 Logic Controller, Programming Guide) and CoDeSys online help. For more information on I/O behavior, refer to Controller States Detailed Description (see page 48). NOTE: Expansion I/Os are always physically updated by the MAST (see Modicon M218 Logic Controller, Programming Guide)task. 4. Remaining Interval time: The controller OS carries out system processing and any other lower priority tasks. NOTE: If you define too short a period for a cyclic task, it will repeat immediately after the write of the outputs and without executing other lower priority tasks or any system processing. This will affect the execution of all tasks and cause the controller to exceed the system watchdog limits, generating a system watchdog exception. NOTE: You can get and set the interval of a Cyclic Task by application using the GetCurrentTaskCycle and SetCurrentTaskCycle function (see SoMachine, Manage a Cyclic Task Interval, Toolbox_Advance Library Guide).
EIO0000000384 06/2011
35
Tasks
Freewheeling Task A Freewheeling task does not have a fixed duration. In Freewheeling mode, each task scan begins when the previous scan has been completed and after a short period of system processing. Each Freewheeling task type executes as follows:
1. Read Inputs: The input states are written to the %I input memory variable and other system operations are executed. 2. Task Processing: The user code (POU, etc.) defined in the task is processed. The %Q output memory variable is updated according to your application program instructions but not written to the physical outputs during this operation. 3. Write Outputs: The %Q output memory variable is modified with any output forcing that has been defined, however, the writing of the physical outputs depends upon the type of output and instructions used. For more information on defining the Bus cycle task refer to Modicon M238 Logic Controller Settings (see Modicon M218 Logic Controller, Programming Guide) and CoDeSys online help. For more information on I/O behavior, refer to Controller States Detailed Description (see page 48). 4. System Processing: The controller OS carries out system processing and any other lower priority tasks. The length of the system processing period is set to 30 % of the total duration of the 3 previous operations ( 4 = 30 % x (1 + 2 + 3)). In any case, the system processing period wont be lower than 3 ms. Event Task This type of task is event-driven and is initiated by a program variable. It starts at the rising edge of the boolean variable associated to the trigger event unless preempted by a higher priority task. In that case, the Event task will start as dictated by the task priority assignments. For example, if you have defined a variable called my_Var and would like to assign it to an Event, select the Event type on the Configuration sub-tab and click on the Input Assistant button to the right of the Event name field. This will cause the Input Assistant dialog box to appear. In the Input Assistant dialog box, you navigate the tree to find and assign the my_Var variable.
36
EIO0000000384 06/2011
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 HSC4_TH3 event to an External Event task, select it from the External event dropdown list on the Configuration sub-tab. Depending on the related product, there are up to 2 types of events that can be associated with an External Event task: Rising edge on Fast input (%IX0.0 ... %IX0.7 inputs) HSC thresholds
EIO0000000384 06/2011
37
Tasks
38
EIO0000000384 06/2011
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.
EIO0000000384 06/2011
39
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.
40
EIO0000000384 06/2011
Tasks
EIO0000000384 06/2011
41
Tasks
42
EIO0000000384 06/2011
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. Whats 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 44 48 52
EIO0000000384 06/2011
43
7.1
Legend: Controller states are indicated in ALL-CAPS BOLD User and application commands are indicated in Bold System events are indicated in Italics Decisions, decision results and general information are indicated in normal text
(1)
For details on STOPPED to RUNNING state transition, refer to Run Command (see page 55). For details on RUNNING to STOPPED state transition, refer to Stop Command (see page 55).
(2)
44
EIO0000000384 06/2011
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 53) 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 this test fails the boot application will load but the controller will assume STOPPED state (see page 58). Note 5a The Starting Mode is set in the PLC settings tab of the Controller Device Editor (see page 66) . Note 5b When a power interruption occurs, the controller continues in the RUNNING state for at least 4 ms before shutting down. If you have configured and provide power to the Run/Stop input from the same source as the controller, the loss of power to this input will be detected immediately, and the controller will behave as if a STOP command was received. Therefore, if you provide power to the controller and the Run/Stop input from the same source, your controller will normally reboot into the STOPPED state after a power interruption when Starting Mode is set to Start as previous state. Note 6 During a successful application download the following events occur: The application is loaded directly into RAM. By default, the Boot application is created and saved into the Flash memory.
EIO0000000384 06/2011
45
Note 7 The default behavior after downloading an application program is for the controller to enter the STOPPED state irrespective of the Run/Stop input setting or the last controller state before the download. However, there are two important considerations in this regard: Online Change: An online change (partial download) initiated while the controller is in the RUNNING state returns the controller to the RUNNING state if successful and provided the Run/Stop input is configured and set to Run. Before using the Login with online change option, test the changes to your application program in a virtual or non-production environment and confirm that the controller and attached equipment assume their expected conditions in the RUNNING state.
WARNING
UNINTENDED EQUIPMENT OPERATION Always verify that online changes to a RUNNING application program operate as expected before downloading them to controllers. Failure to follow these instructions can result in death, serious injury, or equipment damage. NOTE: Online changes to your program are not automatically written to the Boot application, and will be overwritten by the existing Boot application at the next reboot. If you wish your changes to persist through a reboot, manually update the Boot application by selecting Create boot application in the Online menu (the controller must be in the STOPPED state to achieve this operation). 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.
46
EIO0000000384 06/2011
WARNING
UNINTENDED EQUIPMENT OPERATION Always verify that your application program will operate as expected for all targeted controllers and equipment before issuing the "Multiple Download" command with the "Start all applications after download or online change" option selected. Failure to follow these instructions can result in death, serious injury, or equipment damage. NOTE: During a multiple download, unlike a normal download, 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 to achieve this operation). Note 8 The SoMachine software platform allows many powerful options for managing task execution and output conditions while the controller is in the STOPPED or HALT states. Refer to Controller States Description (see page 48) for further details. Note 9 To exit the HALT state it is necessary to issue one of the Reset commands (Reset Warm, Reset Cold, Reset Origin), download an application or cycle power. Note 10 The RUNNING state has two exceptional conditions. They are: RUNNING with External Error: This exceptional condition is indicated by the Err Status LED, which displays 1 red flash. You may exit this state by clearing the external error. No controller commands are required. RUNNING with Breakpoint: This exceptional condition is indicated by the RUN Status LED, which displays 1 green flash. Refer to Controller States Description (see page 48) for further details.
EIO0000000384 06/2011
47
7.2
WARNING
UNINTENDED EQUIPMENT OPERATION Never assume that your controller is in a certain controller state before commanding a change of state, configuring your controller options, uploading a program, or modifying the physical configuration of the controller and its connected equipment. Before performing any of these operations, consider the effect on all connected equipment. Before acting on a controller, always positively confirm the controller state by viewing its LEDs, confirming the condition of the Run/Stop input, checking for the presence of output forcing, and reviewing the controller status information via SoMachine (1). Failure to follow these instructions can result in death, serious injury, or equipment damage.
(1)
Note: The controller states can be read in the PLC_R.i_wStatus system variable of the M238 PLCSystem Library (see Modicon M238 Logic Controller, System Functions and Variables, M238 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. 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 Upgrading an M238 Firmware (see page 149). RUN LED Off Err LED Flashing red
INVALID_OS
Off
Flashing red
48
EIO0000000384 06/2011
Controller State EMPTY EMPTY after detection of a System Error RUNNING RUNNING with Breakpoint
Description There is no application present 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.
Green
This state is the same as the RUNNING state with the following Single flash exceptions: green The task-processing portion of the program does not resume until the breakpoint is cleared. The LED indications are different. See CoDeSys online help in SoMachine for details on breakpoints management.
This state is the same as the normal RUNNING state except the LED indications are different.
Green
The controller has a valid application that is stopped. See Details Flashing of the STOPPED State (see page 49) for an explanation of the green behavior of outputs and field buses in this state. This state is the same as the normal STOPPED state except the Flashing LED indications are different. green The controller stops executing the application because it has detected an Application. This description is the same as for the STOPPED state with the following exceptions: The task responsible for the Application Error always behaves as if the Update IO while in stop option was not selected. All other tasks follow the actual setting. The LED indications are different Flashing green
Details of the STOPPED State The following statements are always true for the STOPPED state: The input configured as the Run/Stop input remains operational. Serial (Modbus, ASCII, etc.), and USB communication services remain operational and commands written by these services can continue to affect the application, the controller state, and the memory variables. 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.
EIO0000000384 06/2011
49
Task and I/O Behavior When Update IO While In Stop Is Selected When the Update IO while in stop setting is selected: The Read Inputs operation continues normally. The physical inputs are read and then written to the %I input memory variable. The Task Processing operation is not executed. The Write Outputs operation continues. The %Q output memory variable is updated to reflect either the Keep current values configuration or the Set all outputs to default configuration, adjusted for any output forcing, and then written to the physical outputs. NOTE: if Q0, Q1, Q2 or Q3 outputs are configured for PTO, PWM, FG, or HSC operation, they fallback to a value of 0 irrespective of the configured fallback setting. For PTO operation, outputs Q0, Q1, Q2, and Q3 execute a fast stop deceleration. Outputs configured for PWM, FG, and HSC go immediately to 0.
WARNING
UNINTENDED EQUIPMENT OPERATION Design and program your system so that controlled equipment assumes a safe state when the controller enters fallback mode if you use outputs Q0, Q1, Q2, or Q3 for PTO, PWM, FG, or HSC operation. Failure to follow these instructions can result in death, serious injury, or equipment damage. NOTE: Commands received by Serial, USB, and CAN communications can continue to write to the memory variables. Changes to the %Q output memory variables are written to the physical outputs. CAN Behavior When Update IO While In Stop Is Selected The following is true for the CAN buses when the Update IO while in stop setting is selected: The CAN bus remains fully operational. Devices on the CAN bus continue to perceive the presence of a functional CAN Master. TPDO and RPDO continue to be exchanged. The optional SDO, if configured, continue to be exchanged. The Heartbeat and Node Guarding functions, if configured, continue to operate. If the Behaviour for outputs in Stop field is set to Keep current values, the TPDOs continue to be issued with the last actual values. If the Behaviour for outputs in Stop field is Set all outputs to default the last actual values are updated to the default values and subsequent TPDOs are issued with these default values.
50
EIO0000000384 06/2011
Task and I/O Behavior When Update IO While In Stop Is Not Selected When the Update IO while in stop setting is not selected, the controller sets the I/O to either the Keep current values or Set all outputs to default condition (as adjusted for output forcing if used). After this, the following becomes true: The Read Inputs operation ceases. The %I input memory variable is frozen at its last values. The Task Processing operation is not executed. The Write Outputs operation ceases. The %Q output memory variables can be updated via the 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. CAN Behavior When Update IO While In Stop Is Not Selected The following is true for the CAN buses when the Update IO while in stop setting is not selected: The CAN Master ceases communications. Devices on the CAN bus assume their configured fallback states. TPDO and RPDO exchanges cease. Optional SDO, if configured, exchanges cease. The Heartbeat and Node Guarding functions, if configured, stop. The current or default values, as appropriate, are written to the TPDOs and sent once before stopping the CAN Master.
EIO0000000384 06/2011
51
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. Whats 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 53 55 60 61
52
EIO0000000384 06/2011
EIO0000000384 06/2011
53
Initialization Values This output state applies in the BOOTING, EMPTY (following power cycle with no boot application or after the detection of a system error), and INVALID_OS states. In the initialization state, analog, transistor and relay outputs assume the following values: For an analog output : Z (High Impedance) For a fast transistor output: Z (High Impedance) For a regular transistor output: 0 Vdc For a relay output: Open Output Forcing The controller allows you to force the state of selected outputs to a defined value for the purposes of system testing and commissioning. Output forcing overrides all other commands to an output irrespective of task programming. You are only able to force the value of an output while your controller is connected to SoMachine. To do so you use the Force Values command in the Debug/Watch menu. When you logout of SoMachine when output forcing has been defined, you are presented with the option to retain output forcing settings. If you select this option, the output forcing continues to control the state of the selected outputs until you download an application or use one of the Reset commands.
54
EIO0000000384 06/2011
EIO0000000384 06/2011
55
Multiple Download Command: sets the controllers into the STOPPED state if the Start all applications after download or online change option is not selected, irrespective of whether the targeted controllers were initially in the RUNNING, STOPPED, HALT or EMPTY state. The controller is restarted into the STOPPED state automatically under certain conditions. Refer to Controller State Diagram (see page 44) for further details. Reset Warm Effect: Resets all variables, except for the remanent variables, to their default values. Places the controller into the STOPPED state. Starting Conditions: RUNNING, STOPPED, or HALT states. Methods for Issuing a Reset Warm Command: SoMachine Online Menu: Select the Reset warm command. By an internal call by the application or an external call via Modbus request using the PLC_W. q_wPLCControl and PLC_W. q_uiOpenPLCControl system variables of the M238 PLCSystem Library (see Modicon M238 Logic Controller, System Functions and Variables, M238 PLCSystem Library Guide). Effects of the Reset Warm Command: 1. The application stops. 2. Forcing is erased. 3. Diagnostic indications for detected errors are reset. 4. The values of the retain variables are maintained. 5. The values of the retain-persistent variables are maintained. 6. All non-located and non-remanent variables are reset to their initialization values. 7. The values of the first 1000 %MW registers are maintained. 8. The values of %MW1000 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 61). 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.
56
EIO0000000384 06/2011
Methods for Issuing a Reset Cold Command: SoMachine Online Menu: Select the Reset cold command. By an internal call by the application or an external call via Modbus request using the PLC_W. q_wPLCControl and PLC_W. q_uiOpenPLCControl system variables of the M238 PLCSystem Library (see Modicon M238 Logic Controller, System Functions and Variables, M238 PLCSystem Library Guide). Effects of the Reset Cold Command: 1. The application stops. 2. Forcing is erased. 3. Diagnostic indications for detected errors are reset. 4. The values of the retain variables are reset to their initialization value. 5. The values of the retain-persistent variables are maintained. 6. All non-located and non-remanent variables are reset to their initialization values. 7. The values of the first 1000 %MW registers are maintained. 8. The values of %MW1000 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 61). Reset Origin Effect: Resets all variables, including the remanent variables, to their initialization values. Erases all user files on the controller. Places the controller into the EMPTY state. Starting Conditions: RUNNING, STOPPED, or HALT states. Methods for Issuing a Reset Origin Command: SoMachine Online Menu: Select the Reset origin command. Effects of the Reset Origin Command: 1. The application stops. 2. Forcing is erased. 3. The Boot application file is erased. 4. Diagnostic indications for detected errors are reset. 5. The values of the retain variables are reset. 6. The values of the retain-persistent variables are reset. 7. All non-located and non-remanent variables are reset. 8. The values of the first 1000 %MW registers are reset to 0. 9. The values of %MW1000 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 61).
EIO0000000384 06/2011
57
Reboot Effect: Commands a reboot of the controller. Starting Conditions: Any state. Methods for Issuing the Reboot Command: Power cycle. Effects of the Reboot: 1. The state of the controller depends on a number of conditions: a. The controller state will be RUNNING if: - The Reboot was provoked by a power cycle, and - If configured, the Run/Stop input is set to RUN, and - The Starting Mode is set to Start in run or - The Starting Mode is set to Start as previous state and - Controller state was RUNNING prior to the power cycle. b. The controller state will be STOPPED if: - The boot application is different than the application loaded prior to the reboot, or - If configured, the Run/Stop input is set to STOP, or - The Starting Mode is set to Start in stop or - The Starting Mode is set to Start as previous state and - Controller state was STOPPED prior to a power cycle, or - The previously saved context is invalid. c. The controller state will be EMPTY if: - There is no boot application or the boot application is invalid, or - The reboot was provoked by a detected System Error. d. The controller state will be INVALID_OS if there is no valid OS. 2. 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 1000 %MW registers are restored if saved context is valid. The values of %MW1000 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 61). NOTE: The Check context test concludes that the context is valid when the application and the remanent variables are the same as defined in the Boot application.
58
EIO0000000384 06/2011
NOTE: If you provide power to the Run/Stop input from the same source as the controller, the loss of power to this input will be detected immediately, and the controller will behave as if a STOP command was received. Therefore, if you provide power to the controller and the Run/Stop input from the same source, your controller will normally reboot into the STOPPED state after a power interruption when Starting Mode is set to Start as previous state. NOTE: If you make an online change to your application program while your controller is in the RUNNING or STOPPED state but do not manually update your Boot application, the controller will detect a difference in context at the next reboot, the remanent variables will be reset as per a Reset cold command, and the controller will enter the STOPPED state. Download Application Effect: Loads your application executable into the RAM memory. Optionally, creates a Boot application in the Flash memory. Starting Conditions: RUNNING, STOPPED, HALT, and EMPTY states. Methods for Issuing the Download Application Command: SoMachine: Two options exist for downloading a full application: Download command. Multiple Download command. For important information on the application download commands, refer to Controller State Diagram (see page 44). 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 1000 %MW registers are maintained. 9. The values of %MW1000 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 61).
EIO0000000384 06/2011
59
Application An application error is detected when improper programming is encountered or Error Detected when a task watchdog threshold is exceeded. Examples: task (software) watchdog exception execution of an unknown function etc. System Error Detected
A system error is detected when the controller enters a condition that cannot be BOOTING managed during runtime. Most such conditions result from firmware or hardware EMPTY exceptions, but there are some cases when incorrect programming can result in the detection of a system error, for example, when attempting to write to memory that was reserved during runtime. Examples: System (hardware) watchdog overflow exceeding the defined size of an array etc.
NOTE: refer to the M238 PLCSystem Library Guide (see Modicon M238 Logic Controller, System Functions and Variables, M238 PLCSystem Library Guide) for more detailed information on diagnostics.
60
EIO0000000384 06/2011
Remanent Variables
Remanent Variables Remanent variables can retain their values in the event of power outages, reboots, resets, and application program downloads. There are multiple types of remanent variables, declared individually as "retain" or "persistent", or in combination as "retain-persistent". NOTE: For this controller, variables declared as persistent have the same behavior as variables declared as retain-persistent. The following table describes the behavior of remanent variables in each case:
Action 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 VAR X X VAR RETAIN VAR PERSISTENT and RETAIN-PERSISTENT X X X X X X X X X X
NOTE: The first 1000 %MW are automatically retained and persistent if no variable is associated to them (their values are kept after a reboot / Reset warm / Reset cold). The other %MW are managed as VAR. For example if you have in your program: VAR myVariable AT %MW0 : WORD; END_VAR %MW0 will behave like myVariable (not retained and not persistent).
EIO0000000384 06/2011
61
62
EIO0000000384 06/2011
8
Introduction This chapter describes how to configure the controller. Whats in this Chapter? This chapter contains the following topics:
Topic Controller Parameters Applications PLC Settings Services Page 64 65 66 68
EIO0000000384 06/2011
63
Controller Parameters
Controller Parameters To open the controller parameters, select the Configuration tab and double-click on the controller:
Tab Descriptions
Tab Communication Settings Applications Description Restriction
Allows configuring the connection between SoMachine and the controller. Shows the application currently running on the controller and allows removing the application from the controller (see page 65). File management between the PC and the controller. Configuration of: application name I/O behavior in stop bus cycle options Lets you configure the on-line services of the controller (RTC, device identification). Displays device specific status and diagnostic messages. Displays general information about the device (name, description, provider, version, image). Online mode only Online mode only -
Applications
Overview The figure below show the Applications tab:
This dialog box serves to scan and to 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.
EIO0000000384 06/2011
65
PLC Settings
Overview The figure below shows 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 and output channels get also 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: Keep current values: The currents values will not be modified Set all outputs to default: The default (fallback) values resulting from the mapping will be assigned. NOTE: This option is not taken into account for the outputs used by the HSC, PTO, PWM or Frequency Generator. Update all variables in all devices 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.
66
EIO0000000384 06/2011
Description This configuration setting is the parent for all Bus cycle task parameters used in the application device tree. Some devices with cyclic calls, such as a CANopen manager, can be attached to a specific task. In the device, when this setting is set to Use parent bus cycle setting, the setting set for the controller is used. The selection list offers all tasks currently defined in the active application. The default setting is the MAST task. NOTE: <unspecified> means that the task is in "slowest cyclic task" mode. This option defines the starting mode on a power on, for further information refer to State behavior diagram (see page 44).) Select by means of this option one of the following starting modes: Start as previous state Start in stop Start in run
EIO0000000384 06/2011
67
Services
Services Tab The Services tab is divided in 2 parts: RTC Configuration Device Identification The figure below shows the Services tab:
68
EIO0000000384 06/2011
9
Overview This chapter describes the embedded functions of the Modicon M238 Logic Controller. Each embedded function uses inputs and outputs. The Modicon M238 Logic Controller with DC power supply has: 14 digital inputs, including 8 fast inputs (see M238 Logic Controller, Hardware Guide) 10 digital outputs, including 4 fast outputs (see M238 Logic Controller, Hardware Guide) The Modicon M238 Logic Controller with AC power supply has: 14 digital inputs, including 8 fast inputs (see M238 Logic Controller, Hardware Guide) 10 digital outputs, including 6 relay outputs (see M238 Logic Controller, Hardware Guide) Whats in this Chapter? This chapter contains the following topics:
Topic HSC Embedded Function I/O Embedded Function PTO_PWM Embedded Function Page 70 72 76
EIO0000000384 06/2011
69
Double click on the controller you want. NOTE: You can also right-click on the controller you want and select Edit Parameters. In the Task Pane click on Embedded Functions HSC:
70
EIO0000000384 06/2011
HSC Configuration Window This figure is a sample HSC configuration window used to configure the HSC:
The following table describes the fields of the HSC configuration window:
Mark 1 2 3 4 5 6 Action Select the HSC tab to access each of the HSC Configuration window. Select one of these tabs according to 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. If the parameters are collapsed, you can expand them by clicking the plus signs. You then have access to the settings of each parameter. Configuration window where the HSC parameters are determined depending on the mode used. When you click on the IO Summarize button, the IO summary window appears. It allows to check your configuration I/O mapping.
For detail information on configuration parameters, refer to M238 HSC choice matrix (see Modicon M238 Logic Controller, High Speed Counting, M238 HSC Library Guide).
EIO0000000384 06/2011
71
Double click on the controller you want. NOTE: You can also right-click on the controller you want and select Edit Parameters. In the Task Pane click on Embedded Functions IO:
72
EIO0000000384 06/2011
Input Configuration Window The following window allows you to configure the embedded inputs:
NOTE: For more information on the I/O Mapping tab, refer to the CoDeSys online help .
EIO0000000384 06/2011
73
When you click on the IO Summarize button, the IO summary window appears. It allows to check your configuration I/O mapping:
Latch
Allows incoming pulses with amplitude widths shorter than the controller scan time to be captured and recorded. Event detection
Event
Legend
74
EIO0000000384 06/2011
Constraint Available if Latch is enabled or Event is enabled. In the other cases, this parameter is disabled and its value is No. Any of the inputs can be configured as Run/Stop, but only one at a time.
Run/Stop
The Run/Stop input can be used to run or stop a program in the controller
Legend
EIO0000000384 06/2011
75
Double click on the controller you want. NOTE: You can also right-click on the controller you want and select Edit Parameters. In the Task Pane click on Embedded Functions PTO_PWM:
76
EIO0000000384 06/2011
PTO_PWM Configuration Window This figure is a sample PTO_PWM configuration window used to configure a PTO, PWM or FG:
The following table describes the fields of the PTO_PWM configuration window:
Mark 1 2 3 4 Action Select the PTO tab to access each of the PTO_PWM Configuration window. Select one of these tabs according to 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. If the parameters are collapsed, you can expand them by clicking the plus signs. You then have access to the settings of each parameter.
EIO0000000384 06/2011
77
Mark 5
Action Configuration window where the embedded function is used for: a PTO (see Modicon M238 Logic Controller, Pulse Train Output, Pulse Width Modulation, M238 PTOPWM Library Guide) a PWM (see Modicon M238 Logic Controller, Pulse Train Output, Pulse Width Modulation, M238 PTOPWM Library Guide) a Frequency Generator (see Modicon M238 Logic Controller, Pulse Train Output, Pulse Width Modulation, M238 PTOPWM Library Guide) When you click on the IO Summarize button, the IO summary window appears. It allows to check your configuration I/O mapping.
For detail information on configuration parameters, refer to: PTO configuration. (see Modicon M238 Logic Controller, Pulse Train Output, Pulse Width Modulation, M238 PTOPWM Library Guide) PWM and FG configuration. (see Modicon M238 Logic Controller, Pulse Train Output, Pulse Width Modulation, M238 PTOPWM Library Guide)
78
EIO0000000384 06/2011
10
Adding Expansion Modules
Introduction In your project, you can add analog, digital, high-speed counting and AS-Interface expansion modules to a controller. Use the GetRightBusStatus (see Modicon M238 Logic Controller, System Functions and Variables, M238 PLCSystem Library Guide) function regularly to monitor the expansion bus status. Expansion Module Configuration For more information about modules configuration, refer to the hardware and programming guides of each Expansion Module:
Expansion Module Programming Guide Hardware Guide TM2 Digital I/O Modules Hardware Guide (see Modicon TM2, Digital I/O Modules, Hardware Guide) TM2 Analog I/O Modules Hardware Guide (see Modicon TM2, Analog I/O Modules, Hardware Guide) TM2 High Speed Counter Modules Hardware Guide (see Modicon TM2, High Speed Counter Modules, Hardware Guide) AS-Interface Master Communication Module Hardware Guide (see Modicon TWDNOI10M3, AS-Interface Master Module, Hardware Guide)
TM2 Digital I/O Modules TM2 I/O Modules Configuration Programming Guide (see Modicon TM2, Expansion Modules Configuration, Programming Guide) TM2 Analog I/O Modules TM2 I/O Modules Configuration Programming Guide (see Modicon TM2, Expansion Modules Configuration, Programming Guide) TM2 I/O Modules Configuration Programming Guide (see Modicon TM2, Expansion Modules Configuration, Programming Guide)
AS-Interface Modicon M238 Logic Controller Communication Module Programming Guide (see page 86)
EIO0000000384 06/2011
79
Maximum Number of Expansion Modules Up to 7 expansion modules can be added to the Controller.
80
EIO0000000384 06/2011
CANopen Configuration
11
CANopen Interface Configuration
2 3 4
Click the Communication entry on the left hand side of the screen. Click the CAN entry. Click the Physical Settings entry. Result: The tabbed configuration dialog box for CANopen networks is displayed on the right hand side of the screen. Configure the baudrate (by default: 250000 bits/s):
NOTE: The Online Bus Access option allows you to block SDO and NMT sending through the status screen.
EIO0000000384 06/2011
81
CANopen Configuration
CANopen Manager Creation and Configuration To create and configure the CANopen Manager, proceed as follows:
Step 1 2 Action Click the Protocol Settings entry and select CANopen Optimized. Click the Add and close button. Result: The CANopen Manager configuration window appears:
Refer to the CoDeSys online help. Adding a CANopen Device To add a CANopen slave device, refer to Adding Slave Devices to a Communication Manager (see SoMachine, Programming Guide). Refer to the CoDeSys online help.
82
EIO0000000384 06/2011
CANopen Configuration
CANopen Operating Limits The Modicon M238 Logic Controller CANopen master has the following operating limits:
Maximum number of slave devices Maximum number of Received PDO (RPDO) Maximum number of Transmitted PDO (TPDO) 16 32 32
WARNING
UNINTENDED EQUIPMENT OPERATION Do not connect more than 16 CANopen slave devices to the controller Program your application to use 32 or fewer Transmit PDO (TPDO) Program your application to use 32 or fewer Receive PDO (RPDO) Failure to follow these instructions can result in death, serious injury, or equipment damage.
EIO0000000384 06/2011
83
CANopen Configuration
84
EIO0000000384 06/2011
AS-Interface Configuration
12
Overview This chapter explains how to configure and use the AS-Interface Master Module, and the module limitations. Whats in this Chapter? This chapter contains the following topics:
Topic Presentation of the AS-Interface V2 Fieldbus General Functional Description Software Setup Principles Add an AS-Interface Master Module Configure an AS-Interface Master Add an AS-Interface Slave Configure an AS-Interface Slave Automatic Addressing of an AS-Interface V2 Slave Modification of Slave Address System Diagnostic in Online Mode Programming for the AS-Interface V2 Fieldbus Configuration of a Replaced AS-Interface V2 Slave Page 86 87 90 91 93 96 103 106 107 109 112 113
EIO0000000384 06/2011
85
AS-Interface Configuration
86
EIO0000000384 06/2011
AS-Interface Configuration
AS-Interface bus
3 4 5 6 7
The following table describes the data field stored in volatile memory:
Address 1 Item I/O data (IDI, ODI) Description Input/Output Data Image Images of 248 inputs and 186 outputs of ASInterface V2 Fieldbus, configured in SoMachine and detected on the bus. Parameter Image / Permanent Parameter. Image of the parameters of all the slaves. 87
EIO0000000384 06/2011
AS-Interface Configuration
Address 3 4 5 6 7
Description This field contains all the I/O codes and the identification codes for all the slaves detected. List of Detected Slaves. List of all slaves detected on the Fieldbus. List of Active Slaves. List of slaves activated on the Fieldbus. List of Projected Slaves. List of slaves configured with SoMachine. List of Peripheral Faults. List of slaves determined to have generated peripheral errors.
Structure of Slave Devices The standard address slaves each have: 4 input/output bits 4 parameter bits The slaves with extended addresses each have: 4 input/output bits (the last bit is reserved for inputs only) 3 parameter bits Each slave has its own address, profile and sub-profile (defines variables exchange). The figure below shows the structure of an extended address slave:
AS-Interface slave 1 (D3) I/O data D0 P2 P0 Input Bit Only
Parameters
AS-Interface bus
88
EIO0000000384 06/2011
AS-Interface Configuration
2 3
Configuration/ This field contains: Identification the I/O configuration code (IO code) the slave identification code (ID code) the slave extended identification codes (ID1 and ID2 codes) Address Physical address of slave.
Note: The operating parameters, address, configuration and identification data are saved in a non-volatile memory.
EIO0000000384 06/2011
89
AS-Interface Configuration
Logged out Declaration of module (see page 91) Declaration of slave devices (see page 109) Logged out Programming or logged in (see page 112) Logged in Transfer Diagnostic / Debugging (see page 109)
NOTE: The declaration and deletion of the AS-Interface Master module on the expansion bus is the same as for other expansion modules. However, once two ASInterface Master modules have been declared on the expansion bus, SoMachine will not permit any other AS-Interface Master modules to be declared. Considerations Prior to Connection You must ensure that all slaves have a unique address. In addition, the address of 0 is reserved for automatic addressing mode. If there is a slave with an address of 0 detected on the bus at start-up, the master will change to the offline phase and try to restart. You must ensure that all addresses are unique and that none are 0.
WARNING
UNINTENDED EQUIPMENT OPERATION Ensure that each slave has a unique address greater than 0. Failure to follow these instructions can result in death, serious injury, or equipment damage.
90
EIO0000000384 06/2011
AS-Interface Configuration
EIO0000000384 06/2011
91
AS-Interface Configuration
Step 3
Action In the Vendor field: choose Schneider Electric. Click on Communication Expansion Modules TWDNOI10M3. Click on the Add and close button.
92
EIO0000000384 06/2011
AS-Interface Configuration
Double click on your controller and select Communication ASi Master Device Physical Settings on the menu pane of the SoMachine software:
EIO0000000384 06/2011
93
AS-Interface Configuration
Description of the Configuration Window when Logged Out The configuration window of the AS-Interface Master gives you access to the Automatic addressing parameters.
Tab Name ASi Master Configuration Configuration Window Description
Enable automatic addressing (selected by default): Activate this option to enable automatic addressing. For more information, refer to Automatic Addressing of an AS-Interface V2 Slave (see page 106). ASi Slave Device I/O Mapping
This configuration window contains the following fields: Channels IEC Objects Bus cycle options For more information about I/O mapping, refer to the CoDeSys online help.
94
EIO0000000384 06/2011
AS-Interface Configuration
Configuration Window Description This tab provides status information (for example Running, Stopped) and device-specific diagnostic messages. If available for the current module, the following general information will be displayed: Name, Vendor, Type, Version Number, Categories, Order Number, Description, Image.
EIO0000000384 06/2011
95
AS-Interface Configuration
96
EIO0000000384 06/2011
AS-Interface Configuration
The procedure below shows you how to add slave devices using the SoMachine software catalog:
Step 1 Action Go to the Program menu of SoMachine:
In the Devices window, the device tree of the SoMachine, right-click on the ASi_Master module, then select Add Device:
EIO0000000384 06/2011
97
AS-Interface Configuration
Step 3
Action In the Vendor field, choose <All Vendors> or filter on the desired vendor. Click on Fieldbuses AS-Interface AS-Interface Slave. Choose your ASInterface Slave and click the Add Device button.
With the Add Device utility window remaining open, add all desired ASInterface slave devices. When finished, click the Close button.
Add a Slave Device with the Scan For Devices Command The Scan For Devices command will search all AS-Interface Slave devices connected to the TWDNOI10M3 master module. This function requires that the master module is configured before executing the Scan For Devices command.
98
EIO0000000384 06/2011
AS-Interface Configuration
The procedure below shows you how to add slave devices with the SoMachine software Scan For Devices command:
Step 1 Action Log in to your Controller. NOTE: Only the right-bus configuration including your master module must be correctly set up for this step. No application program is needed. In the Devices window, the device tree of the SoMachine, right-click on the ASi Master module, then select Scan For Devices:
EIO0000000384 06/2011
99
AS-Interface Configuration
Step 3
Action Slave devices detected on the Fieldbus are displayed with their address and profile.
Click on the Scan Devices button to refresh the list of slaves. 4 Activate the checkbox show only differences to project. This will display only the mismatching devices (physical versus configured). The Status column can accept the following values: OK: If address and profile are matching. Configuration Mismatch: if there is a matching address and a mismatching profile. New: a slave is detected on the Fieldbus but there is no slave device at this address in the configuration. If necessary, modify the addresses under the column Address of the Scan Devices window. Click the Set Address button to readdress the selected slave with a new address (see page 107). Click on the Copy to project button. The Copy to project function allows you to copy a slave detected on the network to the project Device tree. You can select several slaves using SHIFT+click, then use the Copy to project button to copy all selected devices to the project Device tree. Slaves with the same address will be overwritten Your project is now updated with all connected slave devices under the Device tree. You need to download the application again to make these changes operational. If you want to add another AS-Interface slave, connect it to your Fieldbus and run a new scan (Step 3).
EIO0000000384 06/2011
100
AS-Interface Configuration
Manually Add a Generic Slave Device If you want to manually configure your AS-Interface Slave device, you can add a generic AS-Interface Slave and configure its profile. This procedure is similar to the catalog method, but in this case you must choose a special device from the list. The procedure shows you how to add generic slave devices to your project:
Step 1 Action Go to the Program menu of SoMachine:
In the Devices window, the device tree of the SoMachine, right-click on the ASi Master module, then select Add Device:
EIO0000000384 06/2011
101
AS-Interface Configuration
Step 3
Action Select the devices named 0/Generic ASi slave in the list:
Click on the Add Device button. 4 5 Configure your ASi Slave (see page 103). The Add Device utility window remains open and allows you to add all desired AS-Interface Slave devices. When finished, click the Close button.
102
EIO0000000384 06/2011
AS-Interface Configuration
To access the configuration window of your AS-Interface Slave module, you can: Double-click on the AS-Interface Slave module. Right-click on the ASi_Slave module, and click Edit Device Parameters in the menu.
To access configuration window with the SoMachine software Program menu, complete the following steps:
Step 1 Action Go to the Program menu of SoMachine:
In the device tree of the Devices window, right click on the desired AS-Interface Slave device, then click Edit Object. You can also access the configuration window by double-clicking on the AS-Interface Slave device.
EIO0000000384 06/2011
103
AS-Interface Configuration
Description of the AS-Interface Slave Configuration Window The AS-Interface Slave Configuration tab provides access to all relevant slave configuration data: address, profile and parameters. For devices from the catalog, profile information is greyed out, and not available for modification. Every slave must have a unique address. It can have any value from 1A to 31A and 1B to 31B (B addresses are only allowed with extended addressing slaves). In total, no more than 62 slaves are allowed. The slave profile determines if standard or extended addressing is available. For some slaves, more than one address is needed.
WARNING
UNINTENDED EQUIPMENT OPERATION Ensure that each slave has a unique address greater than 0. Failure to follow these instructions can result in death, serious injury, or equipment damage. The configuration window is shown below:
104
EIO0000000384 06/2011
AS-Interface Configuration
The table below describes the AS-Interface Slave Configuration window fields:
Field Name Address Field Description In this field the slave address has to be set. Use the Browser Button [...] to open a choice of available AS-Interface addresses not yet used by slave configurations in the project. Use this selection list to configure the AS-Interface Slave profile: IO-Code: Defines the I/O configuration of the slave. There are16 different I/O configuration modes available from 00 hex (4 Inputs) to 0F hex (Tristate). Id Code0..2: Used for further distinction of slaves with the same I/O configuration. Use either the selection list or the check boxes to set the configured parameters (AS-interface Permanent Parameters) of the slave. The slave profile defines if parameters are being used and, if so, the meaning of each parameter. Clicking on the Project Slave button sends the parameter bits to the slave (when logged in). To change slave parameters without downloading the entire application, you can set the new parameters and then press the Project Slave button. The new parameters will be written to the Parameter Image table. NOTE: Slave parameters changes through the Project Slave button are only written into the slave. The changes are not written in the controller current application, and will be overwritten by a reset or reboot. If you wish your changes to persist through a reset, update the current application by selecting Download in the Online menu. If you wish your changes to persist through a reboot, the Boot application (see SoMachine, Programming Guide) must also be updated.
Profile
Parameter
Project Slave
NOTE: The profile and parameters of a slave are not associated with a name. Several slaves with different names can have the same profile and parameters. Description of the AS-Interface Slave I/O Mapping Window The AS-Interface Slave I/O Mapping tab allows you assign project variables to the AS-Interface outputs or inputs. NOTE: For more information about these fields, refer to the CoDeSys online help.
EIO0000000384 06/2011
105
AS-Interface Configuration
Result: The Enable automatic addressing function is activated (box checked) or disabled (box not checked). NOTE: By default, the Automatic addressing parameter is selected in the configuration window. 106
EIO0000000384 06/2011
AS-Interface Configuration
EIO0000000384 06/2011
107
AS-Interface Configuration
Step 3
Description In the Scan Devices window, select an available slave address under the list box.
The addresses already used by another slave are noted as used under the list box. NOTE: Address 0 is not proposed in the drop-down list because a slave should not be changed to an address of 0 normally (0 being used for fast device replacement). However, it is possible to do so manually by writing the value 0 in the address field. If Automatic addressing is enabled, the slave set to 0 address will be immediately reassigned to another address. 4 The new address is displayed in blue until you click on the Set Address button to confirm. Click on Scan Devices to refresh the window and see the modification (new address is shown in black). Exit the Scan Devices window (click on the Close button).
108
EIO0000000384 06/2011
AS-Interface Configuration
The status of each slave is indicated by an icon: Green icon: parameters are OK. Device is operational. Red icon: detected error in the device configuration. To get more information, go to the Status tab of the device editor.
EIO0000000384 06/2011
109
AS-Interface Configuration
Diagnostic of AS-Interface Master Device when Logged In The Master device configuration window when logged in is shown in the following tables:
Tab Name Description
ASi Master When you are logged in, a new field named Status Flags appears: Configuration
Enable automatic addressing: Activate this option to enable automatic addressing. For more information, refer to Automatic Addressing of an ASInterface V2 Slave (see page 106). The Status Flags section shows the current state of the master: Config OK: Target and actual configuration match. Slave with Address 0 present: The master module has detected one slave module with the address 0. This address is typical of a new slave module with factory configuration. AS-Interface Power failure: AS-Interface system power is low. Check your AS-interface power supply. Periphery failure: A periphery error has been detected. Read LPF (List of Peripheral Fault) to search for the affected device(s). Automatic addressing enabled: The automatic addressing function is enabled. Status This tab of the Configuration Editor provides information about the status of an AS-Interface Master device.
The fields of this tab show status information (for example n/a, Running, Stopped). 110
EIO0000000384 06/2011
AS-Interface Configuration
Diagnostic of AS-Interface Slave Device in Online Mode The slave device configuration window is shown below:
Tab Name Status Description This tab of the Configuration Editor provides information about the status of an AS-Interface Slave device:
The fields of this tab show status information (for example n/a, Running, Stopped).
EIO0000000384 06/2011
111
AS-Interface Configuration
Function Blocks The IoDrvASI library includes the following function blocks:
Function Block Name ASI_CmdSetAutoAddressing (see page 179) ASI_CmdSetDataExchange (see page 181) ASI_CmdSetOfflineMode (see page 182) ASI_MasterStatusCheck (see page 184) ASI_SlaveAddressChange (see page 186) ASI_SlaveParameterUpdate (see page 188) ASI_SlaveStatusCheck (see page 190) ASI_ReadParameterImage (see page 192) Description Activate/Deactivate the master device with the automatic addressing mode. Enable data exchange between master and slave devices. Set the bus in offline mode. Provide master flags, which indicate the state of the master. Replace current slave address by a new user-determined address. Update the image of the slave device. Provides information about slave devices (LAS, LDS, LPF). Read or refresh the parameter image table.
112
EIO0000000384 06/2011
AS-Interface Configuration
EIO0000000384 06/2011
113
AS-Interface Configuration
114
EIO0000000384 06/2011
13
Overview This chapter explains the Serial Lines configuration of the Modicon M238 Logic Controller (supported managers, Serial Line type, parameters, etc.). Whats in this Chapter? This chapter contains the following topics:
Topic Serial Lines Configuration ASCII Manager SoMachine Network Manager Modbus IOScanner Modbus Manager Adding a Modem to a Manager Page 116 120 123 124 133 138
EIO0000000384 06/2011
115
WARNING
UNINTENDED EQUIPMENT OPERATION Verify that 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 death, serious injury, or equipment damage.
116
EIO0000000384 06/2011
Serial Line Configuration for TM238LDD24DT and TM238LDA24DR To configure the Serial Line, proceed as follows:
Step 1 2 3 Action Select the Configuration tab and double-click on the controller. Click the Communication Serial Line entry on the left hand side. Click the Physical Settings entry. Result: The configuration window is displayed.
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 the medium to use: RS485 (using polarization resistor or not) RS232 NOTE: Two line polarization resistors are integrated in the controller, they are switched on or off by this parameter.
EIO0000000384 06/2011
117
Serial Line Configuration for TM238LFDC24DT and TM238LFAC24DR To configure the Serial Line 1 and Serial Line 2, proceed as follows:
Step 1 2 3 Action Select the Configuration tab and double-click on the controller. Click the Communication Serial Line 1 entry on the left hand side. Click the Physical Settings entry. Result: The configuration window is displayed.
4 5
Click the Communication Serial Line 2 entry on the left hand side. Click the Physical Settings entry. Result: The configuration window is displayed.
118
EIO0000000384 06/2011
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 the medium to use: SL1: select RS485 (using polarization resistor or not) or RS232 SL2: only RS485 is available
EIO0000000384 06/2011
119
ASCII Manager
Introduction The ASCII Manager is used to transmit and/or receive data with a simple device. Adding the Manager To add a Manager on Serial Line, proceed as follows:
Step 1 2 Action Select the Configuration tab and double-click on the controller. For the TM238LDD24DT and TM238LDA24DR: click the Communication Serial Line entry on the left hand side. For the TM238LFDC24DT and TM238LFAC24DR: 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 ASCII_Manager object and click Add and close:
3 4
120
EIO0000000384 06/2011
Configure the Manager To configure the ASCII Manager of your controller, proceed as follows:
Step 1 2 Action Select the Configuration tab and double-click on the controller. For the TM238LDD24DT and TM238LDA24DR: click the Communication Serial Line entry on the left hand side. For the TM238LFDC24DT and TM238LFAC24DR: click the Communication Serial Line 1 or Serial Line 2 entry on the left hand side. Click the Protocol Settings entry. Result: The ASCII_Manager configuration window is displayed.
EIO0000000384 06/2011
121
Description If 0, this parameter is not used. This parameter allows the system to conclude an end of frame at reception, when the controller received the specified number of characters. NOTE: This parameter cannot be used simultaneously with Frame Received Timeout (ms). If 0, this parameter is not used. This parameter allows the system to conclude the end of frame at reception after a silence of the specified number of ms. Parameters specified in the Serial Line configuration window (see page 116).
NOTE: In the case of using several frame termination conditions, the first condition to be TRUE will terminate the exchange. Adding a Modem For more details about how to add a Modem to the ASCII Manager, refer to the Adding Modem to a Manager section (see page 138).
122
EIO0000000384 06/2011
3 4
Configure the Manager There is no configuration for SoMachine Network Manager. Adding a Modem For more details about how to add a Modem to the SoMachine Network Manager, refer to the Adding Modem to a Manager section (see page 138).
EIO0000000384 06/2011
123
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 Action Select the Configuration tab and double-click on the controller. For the TM238LDD24DT and TM238LDA24DR: click the Communication Serial Line entry on the left hand side. For the TM238LFDC24DT and TM238LFAC24DR: 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:
3 4
124
EIO0000000384 06/2011
Configure the Manager To configure a Modbus IOScanner on Serial Line, proceed as follows:
Step 1 2 Action Select the Configuration tab and double-click on the controller. For the TM238LDD24DT and TM238LDA24DR: click the Communication Serial Line entry on the left hand side. For the TM238LFDC24DT and TM238LFAC24DR: 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:
Time between Time to avoid bus-collision. frames (ms) This parameter must be identical for each Modbus device on the link.
EIO0000000384 06/2011
125
Adding a Device on the Modbus IOScanner To add a device on the Modbus IOScanner, proceed as follow:
Step 1 2 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:
Click the device to add and click the Add and close button.
126
EIO0000000384 06/2011
Configure a Device Added on the Modbus IOScanner To configure the device added on the Modbus IOScanner, proceed as follow:
Step 1 2 Action Select the Configuration tab. In the graphical configuration editor, double-click on the device. Result: The configuration window will be 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).
EIO0000000384 06/2011
127
Step 2
In the field Channel, you can add the following values: Channel: Enter a name for your channel Access Type: Read or Write or Read/Write multiple registers. Trigger: Choose the trigger of the exchange. It can be either CYCLIC with the period defined in Cycle Time (ms) field or started by a RISING EDGE on a boolean variable (this boolean variable is then created in the Modbus Master I/O Mapping tab) Comment: Add a comment about this channel
128
EIO0000000384 06/2011
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): Offset: Offset of the %MW to read. 0 means that the first object that will be read will be %MW0 Length: Number of %MW to be read. For example if Offset = 2 and Length = 3, the channel will read %MW2, %MW3 and %MW4 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): Offset of the %MW to write. 0 means that the first object that will be written will be %MW0 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 on the Delete button to remove a channel. Click on the Edit button to change the parameters of a channel. Click OK to validate the configuration of this channel.
EIO0000000384 06/2011
129
Step 2
The Initialization Value window contains the following parameters: Access Type: Only Write Multiple Register is allowed Register Offset: Offset of the %MW that will be initialized Length: Number of %MW that will be initialized. For example if Offset = 2 and Length = 3, %MW2, %MW3 and %MW4 wil be initialized Initialization Value: Value the registers are initialized with Comment: Add a comment about this initialization 3 Click on the Move up or Move down button to change the position of an initialization in the list. Click on the Delete button to remove an initialization in the list. Click on the Edit button to change the parameters of an initialization. Click OK to create a new Initialization Value.
130
EIO0000000384 06/2011
These screenshots show the mapping of the objects generated by the defined channels. If channels 1 and channels 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::
EIO0000000384 06/2011
131
132
EIO0000000384 06/2011
Modbus Manager
Introduction The Modbus Manager is used for Modbus RTU or ASCII protocol in master or slave mode. Adding the Manager To add a Manager on Serial Line, proceed as follows:
Step 1 2 Action Select the Configuration tab and double-click on the controller. For the TM238LDD24DT and TM238LDA24DR: click the Communication Serial Line entry on the left hand side. For the TM238LFDC24DT and TM238LFAC24DR: 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 Manager object and click Add and close:
3 4
EIO0000000384 06/2011
133
Configure the Manager To configure the Modbus_Manager of your controller, proceed as follows:
Step 1 2 Action Select the Configuration tab and double-click on the controller. For the TM238LDD24DT and TM238LDA24DR: click the Communication Serial Line entry on the left hand side. For the TM238LFDC24DT and TM238LFAC24DR: click the Communication Serial Line 1 or Serial Line 2 entry on the left hand side. Click the Protocol Settings entry. Result: The Modbus_Manager configuration window will be displayed.
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 the Serial Line configuration window.
134
EIO0000000384 06/2011
Modbus Master When the controller is configured as a Modbus Master, the following Function Blocks are supported from the PLCCommunication Library: ADDM READ_VAR SEND_RECV_MSG SINGLE_WRITE WRITE_READ_VAR WRITE_VAR For further information, see Function Block Descriptions (see SoMachine, Modbus and ASCII Read/Write Functions, PLCCommunication Library Guide) of the PLCCommunication Library (see SoMachine, Modbus and ASCII Read/Write Functions, PLCCommunication Library Guide). Modbus Slave When the controller is configured as Modbus Slave, the following Modbus requests are supported:
Types 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. The following table contains the Sub-function codes supported by the diagnostic Modbus request 08:
Sub-Function Code Dec 10 11 12 Hex 0A 0B 0C Clear Counters and Diagnostic Register Return Bus Message Count Return Bus Communication Error Count Function
EIO0000000384 06/2011
135
Sub-Function Code 13 14 15 16 17 18 0D 0E 0F 10 11 12
Function 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
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 Object Name Vendor code Product code Type ASCII String ASCII String Value Schneider Electric Controller reference e.g. TM238LFDC24DT aa.bb.cc.dd (same as device descriptor)
02 hex
ASCII String
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.
136
EIO0000000384 06/2011
There is an overlap on simple words of the HMI memory while using double words but not for the controller memory (see following diagram). In order to have a match between the HMI memory area and the controller memory area, the ratio between double words of HMI memory and the double words of controller memory has to be 2.
The following gives examples of memory match for the double words: %MD2 memory area of the HMI corresponds to %MD1 memory area of the controller because the same simple words are used by the Modbus request. %MD20 memory area of the HMI corresponds to %MD10 memory area of the controller because the same simple words are used by the Modbus request. The following gives examples of memory match for the bits: %MW0:X9 memory area of the HMI corresponds to %MX1.1 memory area of the controller because the simple words are split in 2 distinct bytes in the controller memory. Adding a Modem For more details about how to add a Modem to the Modbus Manager, refer to the Adding Modem to a Manager section (see page 138). Adding the Ethernet Gateway For more details about how to add a 499TWD01100, refer to the Declaring the Ethernet Gateway section (see page 140).
EIO0000000384 06/2011
137
The Add object window is displayed. Click the Modem to add and click the Add and close button.
For further information, refer to Modem Library (see SoMachine, Modem Functions, Modem Library Guide).
138
EIO0000000384 06/2011
14
1 Preparation
EIO0000000384 06/2011
139
Ethernet/Modbus Gateway
Step
Description
Action Connect the gateway-to-controller XBT Z9980 cable (supplied) to the serial port of the Ethernet Gateway, and connect the other end to the appropriate serial port of the Controller: SL1 for TM238LDD24DT & TM238LDA24DR SL2 for TM238LFDC24DT & TM238LFAC24DR Connect the RJ45 connector from a standard Ethernet network cable (not supplied) into the Ethernet port of the Gateway.
Declaring the 499TWD01100 Ethernet Gateway Module The table below shows the different steps when declaring the 499TWD01100 gateway module.
Step 1 2 Action Click on the Program menu Right click the Modbus_Manager of Serial Line and select Add Device. Comment Modbus_Manager of SL1 for TM238LDD24DT & TM238LDA24DR Modbus_Manager of SL2 for TM238LFDC24DT & TM238LFAC24DR
140
EIO0000000384 06/2011
Ethernet/Modbus Gateway
Step 3
Comment
4 5
EIO0000000384 06/2011
141
Ethernet/Modbus Gateway
Configuring the 499TWD01100 Ethernet Gateway Module You must carefully manage the IP addresses because each device on the network requires a unique address. Having multiple devices with the same IP address can cause unpredictable operation of your network and associated equipment.
WARNING
UNINTENTED EQUIPMENT OPERATION Be sure that there is only one master controller configured on the network or remote link. Be sure that all slave devices have unique addresses. Be sure that all slave devices have unique addresses. You cannot have duplicated addresses. Obtain your IP address from your system administrator. Confirm that the 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. To configure Ethernet parameters, follow this procedure:
Step 1 Action Double click the 499TWD01100 node to access the configuration window. Comment The Ethernet Configuration dialog box appears, as shown in the example below.
Enter the static IP Address for the gateway in dotted decimal notation. (See notes 1 and 2.)
142
EIO0000000384 06/2011
Ethernet/Modbus Gateway
Step 3
Action Enter the valid Subnet mask assigned to the gateway by your network administrator. Please note that you cannot leave this field blank; you must enter a value. (See notes 1 and 3.)
Comment By default, the programming software automatically computes and displays a default subnet mask based on the network class that you have provided in the IP Address field above. Default subnet mask values, according to the category of the gateway network IP address, follow these rules: Class A network -> Default subnet mask: 255.0.0.0 Class B network -> Default subnet mask: 255.255.0.0 Class C network -> Default subnet mask: 255.255.255.0 On the LAN, the gateway must be on the same segment as the 499TWD01100. This information typically is provided to you by your network administrator. Please note that no default value is provided by the application, and that you must enter a valid gateway address in this field. A power cycle is required to force the M238 to transfer the IP address to the 499TWD01100.
5 6
Check and validate your configuration. Power off the Controller, then power on again.
NOTE: 1. Consult your network or system administrator to obtain valid IP parameters for your network. 2. Each connected device on an Ethernet network segment must have a unique IP address. When connected to the network, the gateway runs a check for duplicate IP address. If a duplicate IP address is located over the network, the STATUS LED will emit 4 flashes periodically. You must then enter a new duplicate-free IP address in this field. 3. Unless the gateway has special subnet requirements, use the default subnet mask. 4. If there is no gateway device on your network, simply enter the gateways IP address in the Gateway Address field.
EIO0000000384 06/2011
143
Ethernet/Modbus Gateway
144
EIO0000000384 06/2011
15
Introduction This chapter provides rules to connect a Modicon M238 Logic Controller to PC. Whats in this Chapter? This chapter contains the following topics:
Topic Connecting the Controller to a PC Active Path of the Controller Page 146 148
EIO0000000384 06/2011
145
CAUTION
INOPERABLE EQUIPMENT Always connect the communication cable to the PC before connecting it to the controller. Failure to follow these instructions can result in equipment damage. USB Mini-B Port Connection TCS XCNA MUM3P : This USB cable is suitable for short duration connection like quick updates or retrieving data values. BMX XCA USBH045 : Grounded and shielded, this USB cable is suitable for long duration connection. NOTE: You can only connect 1 controller to the PC at the same time. The USB Mini-B Port is the programming port you can use to connect a PC with a USB host port using SoMachine software. Using a typical USB cable, this connection is suitable for quick updates of the program or short duration connections to perform maintenance and inspect data values. It is not suitable for long term connections such as commissioning or monitoring without the use of specially adapted cables to help minimize electromagnetic interference.
WARNING
INOPERABLE EQUIPMENT OR UNINTENDED EQUIPMENT OPERATION You must use a shielded USB cable such as a BMX XCAUSBH0 secured to the functional ground (FE) of the system for any long term connection. Do not connect more than one controller at a time using USB connections. Failure to follow these instructions can result in death, serious injury, or equipment damage. The communication cable should be connected to the PC first to minimize the possibility of electrostatic discharge affecting the controller.
146
EIO0000000384 06/2011
BMXXCAUSBH045 USB (4.5 m / 14.8 ft) TCSXCNAMUM3P USB (3 m / 9.8 ft) USB Mini-B
CANopen SL1 SL2
100-240VAC
TRANSISTOR OUTPUTS RELAY OUTPUTS
USB Mini-B
FAST INPUTS INPUTS
Prog. Port
8 23
BAT PW R ERR NR CA NE T
. prg . rt po
RU
SL1 SL2
CA
CAN
ope
SL1 24 C VD
SL2
1 2 3 4
Push horizontally on the USB cover and hold down. Slide the USB cover downward.
Connect the USB cable connector to the PC. Connect the Mini connector of your USB cable to the M238 USB connector.
EIO0000000384 06/2011
147
148
EIO0000000384 06/2011
16
Overview Detailed instructions are provided for using the M238 Windows Exec Loader to update the firmware of your controller. Whats in this Chapter? This chapter contains the following topics:
Topic Upgrading Through Serial Line Upgrading 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 150 153 155 156 157 159 161
EIO0000000384 06/2011
149
Performing a firmware update will delete the current application program in the device, including the Boot Application in Flash memory.
CAUTION
LOSS OF APPLICATION DATA Perform a backup of the application program to the hard disk of the PC before attempting a firmware update. Restore the application program to the device after a successful firmware update. Failure to follow these instructions can result in injury or equipment damage. If there is a power outage or communication interruption during the transfer of the application program or a firmware update, your device may become inoperative. If a communication interruption or a power outage occurs, reattempt the transfer.
CAUTION
INOPERABLE EQUIPMENT Do not interrupt the transfer of the application program or a firmware update once the transfer has begun. Do not place the device into service until the transfer is completed successfully. Failure to follow these instructions can result in equipment damage. Updating the firmware requires one of the following cable: The TSX CUSB 485 the VW3 A8 306 Rxx cable or the TCS MCNA M3M002P cable.
150
EIO0000000384 06/2011
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 the firmware update, the controller will not function correctly until a new, successful firmware update operation is performed. Installing the USB Cable Follow these steps to install the TSX CUSB 485 cable properly:
Step 1 2 Action On the TSX CUSB 485 adaptor, select the OTHER MULTI mode on rotary switch and the OFF position for polarization. Connect the TSX CUSB 485 adaptor into an USB Port of your PC. NOTE: On first connection to the computer, it could be required to install the driver (see below). Connect the VW3 A8 306 Rxx cable to the RJ45 connector of the TSX CUSB 485. Connect the second end of the VW3 A8 306 Rxx cable into SL1 port of the Modicon M238 Logic Controller. Launch the Exec Loader wizard serial (see page 155)
3 4 5
Follow these steps to install the TCS MCNA M3M002P cable properly:
Step 1 Action Connect the TCS MCNA M3M002P adaptor into an USB Port of your PC. NOTE: On first connection to the computer, it could be required to install the driver (see below). Connect the second end of the TCS MCNA M3M002P cable into SL1 port of the Modicon M238 Logic Controller. Launch the Exec Loader wizard serial (see page 155)
2 3
EIO0000000384 06/2011
151
USB Cable Driver Installation After connection, the USB cable is detected by the PC. If the cable driver is not installed, a popup saying new hardware has been found is displayed. In this case, install the driver.
Step 1 Screen Found New Hardware Wizard Found New Hardware Wizard Hardware installation Completing the Found New Hardware Wizard. Action Can Windows connect to Windows Update to search for software? Select No, not this time and click Next. What do you want the Wizard to do? Select Install the software automatically (Recommended) and click Next. Click continue anyway. Click Finish.
3 4
152
EIO0000000384 06/2011
Performing a firmware update will delete the current application program in the device, including the Boot Application in Flash memory.
CAUTION
LOSS OF APPLICATION DATA Perform a backup of the application program to the hard disk of the PC before attempting a firmware update. Restore the application program to the device after a successful firmware update. Failure to follow these instructions can result in injury or equipment damage. If there is a power outage or communication interruption during the transfer of the application program or a firmware update, your device may become inoperative. If a communication interruption or a power outage occurs, reattempt the transfer.
CAUTION
INOPERABLE EQUIPMENT Do not interrupt the transfer of the application program or a firmware update once the transfer has begun. Do not place the device into service until the transfer is completed successfully. Failure to follow these instructions can result in equipment damage.
EIO0000000384 06/2011
153
The Serial Line port(s) of your controller are configured for the SoMachine protocol by default when new or when you update the controller firmware. The SoMachine protocol is incompatible with that of other protocols such as Modbus Serial Line. Connecting a new controller to, or updating the firmware of a controller connected to, an active Modbus configured serial line can cause the other devices on the serial line to stop communicating. Make sure that the controller is not connected to an active Modbus serial line network before first downloading a valid application that has the concerned port or ports properly configured for the intended protocol.
CAUTION
UNINTENDED EQUIPMENT OPERATION Be sure your application has the Serial Line port(s) properly configured for Modbus before physically connecting the controller to an operational Modbus Serial Line network. Failure to follow these instructions can result in equipment damage. Before starting the firmware update procedure, ensure you have: USB cable TCS XCNA MUM3P Modicon M238 Logic Controller This updating procedure is a maintenance operation. It requires that the controller be disconnected from the systems and applications it effects. The PC and the controller must stay connected during this operation. NOTE: If the PC and the controller are unintentionally disconnected during a firmware update, the controller will not function correctly until a new, successful firmware update operation is performed. Installing Cables Follow these steps to install the cables properly:
Step 1 2 3 Action Plug the TCS XCNA MUM3P cable to an USB Port of your PC. Plug the second end of the cable to the USB port of the controller. Launch the Exec Loader Wizard USB (see page 155)
NOTE: For more information about connecting USB cable, refer to the M238 Hardware Guide.
154
EIO0000000384 06/2011
When the gateway is stopped, the CoDeSys Gateway Sys Tray (stopped icon appears in the task bar:
If your Controller and the PC are connected with: USB Interface, click Start Programs Schneider Electric SoMachine Tools Exec Loader Wizard USB Serial Interface, click Start Programs Schneider Electric SoMachine Tools Exec Loader Wizard Serial
Overview of Upgrade Steps The wizard provides a screen for each step. The following table summarizes the 4 steps required to upgrade your firmware:
Step 1 2 3 Screen Welcome (see page 156) Settings (see page 157) 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.
EIO0000000384 06/2011
155
Step 1 - Welcome
Step 1 - Welcome The wizard provides a screen for each step. The Welcome screen is an introduction to the Exec Loader wizard. To continue: Select Next to continue the procedure and display the next screen, Step#2 Settings (see page 157). Select Close to close the screen without changing the firmware on your controller.
156
EIO0000000384 06/2011
Step 2 - Settings
Selecting Settings Use these steps to select the appropriate firmware:
Step 1 Action In Settings, click on the Browse button and select the correct file for your controller model. Example: C:\Program Files\Schneider Electric\SoMachine\Firmware\M238\TM238LFDC24DT.mfw Power off the Controller, as indicated on the screen. Select Next. During the progress bar, turn on the power of 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).
Troubleshooting with the TSX CUSB 485 cable If the controller is not detected during Step 2, start the Modbus Driver by clicking Start Programs Schneider Electric Communication Drivers Modbus Driver. Double-click the corresponding icon in the task bar to open the Modbus Driver screen, and check that the USB cable is connected to the selected COM port.
EIO0000000384 06/2011
157
Baud Rate
Stop bits
1 Bit 2 Bits
COM3(TSXCUSB485)
Even Odd
None
Phone number
Apply
Undo
Default
OK
158
EIO0000000384 06/2011
Hardware ID The Hardware ID is a unique identifier for each controller reference: Green check mark: OK Red cross: incorrect firmware file. Select a firmware file corresponding to your controller reference (go back to step 2 (see page 157))
EIO0000000384 06/2011
159
Exec Version Number The Exec Version Number identifies the version of the firmware: Green check mark: you will upgrade your controller to a newer version of the firmware Yellow check mark: you will downgrade your controller to an older version of the firmware or update your controller with the same version of the current firmware Starting the Transfer Click on the Next button to start the transfer.
160
EIO0000000384 06/2011
CAUTION
INOPERABLE EQUIPMENT Do not interrupt the transfer of the application program or a firmware update once the transfer has begun. Do not place the device into service until the transfer is completed successfully. Failure to follow these instructions can result in equipment damage.
EIO0000000384 06/2011
161
162
EIO0000000384 06/2011
17
Page 164 172
EIO0000000384 06/2011
163
Troubleshooting
Introduction This section describes the procedures to troubleshoot your Modicon M238 Logic Controller. Transferring the Application is not Possible Possible causes: PC cannot communicate with the controller. Is your application valid? Is the CoDeSys gateway running? Resolution: Refer to the part below (Communication Between SoMachine and the Modicon M238 Logic Controller (see page 164)). Your application program must be valid. Refer to the debugging part of the CoDeSys onlin help. The CoDeSys gateway must be running: a. click the CoDeSys Gateway SysTray (stopped) icon in the task bar, b. select Start Gateway. Communication Between SoMachine on a Computer and the Modicon M238 Logic Controller is not Possible. Possible causes: Incorrect cable usage. PLC not detected by the PC. Communication settings are not correct. The controller is not operating correctly.
164
EIO0000000384 06/2011
Resolution:
EIO0000000384 06/2011
165
Check 1
Action Check that: the cable is correctly linked to the controller and to the PC and not damaged, you use the specific cable or adapter depending on the connection type: TCS XCNA MUM3P cable for an USB connection. TSX CUSB 485 and an Ethernet cable for a serial line RS485/RS232 connection. Check that the Modicon M238 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 M238 Logic Controller node appears in the list: if you use the USB connector:
3. If the Modicon M238 Logic Controller node does not appear or if there is an node, unplug/plug the cable on the controller side.
166
EIO0000000384 06/2011
Check 3
Action Check that the active path is correct: 1. double click the Controller node in the Devices window, 2. check that the Modicon M238 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 M238 Logic Controller node and click Set active path. NOTE: If the PC is connected to an Ethernet network, the IP address might change. In this case, the Modicon M238 Logic Controller node appears in italics (the path set to the controller is incorrect). To refresh the active path: 1. Select the Modicon M238 Logic Controller node 2. Click Resolve Name: if the PC detects the controller on the network, a new path is defined and the node does not appear in italics anymore 3. Click Set Active Path 4 Refer to the System Diagnostic using LED Display section (see M238 Logic Controller, Hardware Guide).
Application program is not executed Possible causes: No POU declared in the task. Resolution: As POUs are managed by tasks, you must add at least one 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. Possible causes: Application does not go to RUN state. One input is configured in RUN/STOP mode. Resolution: Use the input configured in RUN/STOP mode to run the application.
EIO0000000384 06/2011
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: Restart your computer or, in Control Panel, open Administrative Tools and Computer Management, in Service, double click CoDeSys Gateway, Click Start Service button. 3. Check if the CoDeSys Gateway SysTray icon is red (running). Serial Line Communication is not Possible Possible causes: Communication settings are not identical between serial line devices. The controller is not operating correctly. Resolution: Check that: protocol communication settings (baud rate, parity...) are identical for all serial line devices. The correct communication manager is added on the Serial Line object: Modbus manager if the line is used for Modbus protocol, SoMachine-Network Manager if the line is used for communication to access IEC variables. the controller operates correctly. Refer to the System Diagnostic using LED Display part (see M238 Logic Controller, Hardware Guide). Creating the Boot Application is not Possible Possible cause: Operation not possible while the controller is in RUN state. Resolution: Select Stop Application, Select Create Boot Project.
168
EIO0000000384 06/2011
PTO Function does not Start Possible cause: The AUX input is configured as the Drive Ready input but no signal is being supplied. Resolution: If the AUX variable is set to Drive Ready, check that the drive is correctly operating or set the Dis_Drive_Ready variable of the PTOsimple function block to 0. Changing Device Name do not work Possible cause: Application is running. Resolution: Select Stop Application, Change device name. CANopen Heartbeat is not sent on a regular basis Possible cause: The Heartbeat configured value is not a multiple of the CANopen bus Cycle Task interval. Resolution: Change the Heartbeat value to a multiple of the CANopen bus Cycle Task interval. Monitoring of the POU is slow Possible cause: Task interval is too small or the number/size of POUs is too great. Resolution: Increase the configured task interval. Split the application into 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...).
EIO0000000384 06/2011
169
Controller is in HALT State Possible cause: The PLC has stopped due to a watchdog event. Resolution: If a task watchdog is configured: a. Run the application without task watchdog b. Get the maximum task cycle time from the task monitor c. Set the task watchdog greater than the maximum task cycle time If a task watchdog is not configured: If a Cyclic task is configured, increase the cycle time to a value > 1.25 times the average task time If several tasks are configured, and one of these is a Freewheeling task, try reconfiguring the Freewheeling task as a Cyclic task Possible cause: The cycle time is extended when the CANopen configurator is called, leading to a task watchdog exception. The controller may report a watchdog exception during the following events: downloading of configuration data to the modules of the network (i.e. when downloading the application to the controller, after a power-on of the controller when a boot application is valid, or after a reset warm/cold). CANopen cables connection may have been disconnected or dislodged. Resolution: 1. Run the application without task watchdogs 2. Get the maximum task cycle time from the task monitor 3. Set the task watchdog greater than the maximum task cycle time Possible cause: A division by 0 is detected in the application program. Resolution: Check your application program.
170
EIO0000000384 06/2011
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, consider deselecting them to reduce the overall size of the download. See Project Project Settings Source Download Additional Files... in the SoMachine main menu. NOTE: The M238 controllers with Product Version equal to or superior 20 have more available memory for source download.
EIO0000000384 06/2011
171
What Programming Languages are supported by a Modicon M238 Logic Controller? Refer to Supported Standard Data Types (see page 21). What Variable Types are supported by a Modicon M238 Logic Controller? The following variable types are supported: BOOL Integer data types REAL LREAL STRING WSTRING Time data types When should I use Freewheeling or Cyclic Task Type? Freewheeling or cyclic task type usage Task Configuration (see page 33): Freewheeling: use this setting if a variable cycle time is permissible for your application. The next cycle will start after a waiting duration equal to 30% of the last cycle execution duration. Cyclic: use this mode if you want to control the cycle time. What are the Effects of Cold/Warm Restart? Refer to the effects of reset cold/warm section (see page 55). Can I connect the PC (SoMachine) and the Controller through 499TWD01100 Ethernet Gateway? No, because the Ethernet Gateway only supports Modbus protocol.
172
EIO0000000384 06/2011
Can I connect several M238, through several USB ports of my PC? No, because driver conflicts may occur. Why the communication between the HMI and the controller is interrupted when making online changes? When online changes are made to a M238 application, the Symbol Configuration is downloaded. This results in a temporary interruption of the communication.
EIO0000000384 06/2011
173
174
EIO0000000384 06/2011
EIO0000000384 06/2011
Appendices
Overview This appendix lists the documents necessary for technical understanding of the M238 Programming Guide. Whats in this Appendix? The appendix contains the following chapters:
Chapter A B C D AS-Interface Library Function and Function Block Representation Functions to Get/Set Serial Line Configuration in User Program Controller Performance Chapter Name Page 177 195 203 209
EIO0000000384 06/2011
175
176
EIO0000000384 06/2011
AS-Interface Library
A
Overview This chapter describes the function blocks included in the IoDrvASI library. Whats in this Chapter? This chapter contains the following topics:
Topic ASI_CheckSlaveBit ASI_CmdSetAutoAddressing ASI_CmdSetDataExchange ASI_CmdSetOfflineMode ASI_MasterStatusCheck ASI_SlaveAddressChange ASI_SlaveParameterUpdate ASI_SlaveStatusCheck ASI_ReadParameterImage Page 178 179 181 182 184 186 188 190 192
EIO0000000384 06/2011
177
AS-Interface Library
ASI_CheckSlaveBit
Function Description This function returns the status bit of a specified AS-Interface slave from a specified AS-Interface status table (LDS, LAS, or LPF). This function is to be used in combination with ASI_SlaveStatusCheck (see page 190) function block used to read LDS, LAS, and LPF status tables from the AS-Interface master. Graphical Representation
IL and ST Representation To see the general representation in IL or ST language, refer to the chapter Function and Function Block Representation (see page 195). I/O Variables Description The following table describes the input variables:
Input Type Comment AS-Interface Slave address (bit offset 0 to 63). 0 = address 0 1...31 = address 1...31 for standard addressing mode, or 1 A...31 A for extended addressing mode 32 = not used 33 to 63 = 1B...31B for extended addressing mode
byAddress BYTE
ASI_CheckSlaveBit BOOL
abyStatusBytes ARRAY[0..7] OF BYTE AS-Interface status table (e.g.: LDS, LAS, or LPF (see page 190))
178
EIO0000000384 06/2011
AS-Interface Library
ASI_CmdSetAutoAddressing
Function Description This function blocks allows to activate or deactivate the auto-addressing mode. By default, auto-addressing is set to the value that is configured in AS-Interface Master module configuration window (see page 94). Graphical Representation (LD/FBD)
IL and ST Representation To see the general representation in IL or ST language, refer to the chapter Function and Function Block Representation (see page 195). I/O Variables Description The following table describes the input variables:
Input xExecute Type BOOL Comment Rising edge: action starts. Falling edge: resets outputs. If a falling edge occurs before the function block has completed its action, the outputs operate in the usual manner and are only reset if either the action is completed or in the event of an error has been detected. In this case, the corresponding output values (xDone,xError, iError) are present at the outputs for exactly one cycle. TRUE= enables auto-addressing mode. FALSE= disables auto-addressing mode.
xAutoAddressingActive BOOL
xBusy xError
BOOL BOOL
EIO0000000384 06/2011
179
AS-Interface Library
180
EIO0000000384 06/2011
AS-Interface Library
ASI_CmdSetDataExchange
Description This function enables or disables the data exchange between AS-Interface Master and Slave Modules. The data exchange is active after reset. Graphical Representation
IL and ST Representation To see the general representation in IL or ST language, refer to the chapter Function and Function Block Representation (see page 195). I/O Variables Description The following table describes the input variables:
Input xExecute Type BOOL Comment Rising edge: action starts. Falling edge: resets outputs. If a falling edge occurs before the function block has completed its action, the outputs operate in the usual manner and are only reset if either the action is completed or in the event of an error has been detected. In this case, the corresponding output values (xDone,xError, iError) are present at the outputs for exactly one cycle. TRUE= enables the data exchange. FALSE= disables the data exchange.
xDataExchangeActive
BOOL
EIO0000000384 06/2011
181
AS-Interface Library
ASI_CmdSetOfflineMode
Description This function block permits to set the AS-Interface Master Module in offline mode. After a reset of the application, offline mode is disabled. Graphical Representation
IL and ST Representation To see the general representation in IL or ST language, refer to the chapter Function and Function Block Representation (see page 195). I/O Variables Description The following table describes the input variables:
Input xExecute Type BOOL Comment Rising edge: action starts. Falling edge: resets outputs. If a falling edge occurs before the function block has completed its action, the outputs operate in the usual manner and are only reset if either the action is completed or in the event of an error has been detected. In this case, the corresponding output values (xDone,xError, iError) are present at the outputs for exactly one cycle. TRUE= enables offline mode. FALSE= disables offline mode.
xOfflineModeActive BOOL
xDone BOOL
xBusy
BOOL
xError BOOL
182
EIO0000000384 06/2011
AS-Interface Library
EIO0000000384 06/2011
183
AS-Interface Library
ASI_MasterStatusCheck
Description This function block returns the status of the AS-Interface Master Module. Graphical Representation
IL and ST Representation To see the general representation in IL or ST language, refer to the chapter Function and Function Block Representation (see page 195). I/O Variables Description The following table describes the input variable:
Input xEnable Type BOOL Comment TRUE: action running FALSE: action stopped. Outputs xDone, xBusy,xError and iError are reset.
184
AS-Interface Library
Output Config_OK LDS_0 Auto_Address_Assign Auto_Address_Available Configuration_Active Normal_Operation_Active APF_or_not_APO Offline_Ready Periphery_OK
Type BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL
Comment Config OK (bit 0) Address 0 Slave (bit 1) Auto-addressing mode enabled (bit 2) Auto-addressing will be processed as soon as a slave with zero address and valid configuration data is connected (bit 3) Configuration mode active (bit 4) Normal operation mode active (bit 5) Power outage (bit 6) Offline mode active (bit 7) No peripheral error detected (all entries in LPF are 0) (bit 8)
EIO0000000384 06/2011
185
AS-Interface Library
ASI_SlaveAddressChange
Description This function block enables to change the address of an AS-Interface Slave Module. Graphical Representation
IL and ST Representation To see the general representation in IL or ST language, refer to the chapter Function and Function Block Representation (see page 195). I/O Variables Description The following table describes the input variables:
Input Type Comment Rising edge: action starts. Falling edge: resets outputs. If a falling edge occurs before the function block has completed its action, the outputs operate in the usual manner and are only reset if either the action is completed or in the event of an error has been detected. In this case, the corresponding output values (xDone, xError,eError) are present at the outputs for exactly one cycle. Address of Slave to be readdressed 0 = address 0 1...31 = address 1...31 for standard addressing mode, or 1 A...31 A for extended addressing mode 32 = not used 33...63 = 1 B...31 B for extended addressing mode New address of Slave 0 = address 0 1...31 = address 1...31 for standard addressing mode, or 1 A...31 A for extended addressing mode 32 = not used 33...63 = 1 B...31 B for extended addressing mode
xExecute BOOL
186
EIO0000000384 06/2011
AS-Interface Library
eError
ERROR
ERROR: Detected Error Codes The ERROR enumeration data type contains the following values:
Enumerator NO_ERROR FIRST_ERROR TIME_OUT ADDRESS_IN_USE INVALID_ADDRESS NO_SLAVE INVALID_PARAMETER NO_EXT_ADDR_SUPP FIRST_MF LAST_ERROR Value 00 hex 64 hex 65 hex 66 hex 67 hex 68 hex 69 hex 6A hex 78 hex 96 hex Operation aborted on Time Out New slave address parameter already assigned Invalid old or new slave address parameter Old slave address parameter not assigned Parameter value out of range Extend address not support Manufacturer specific error Library specific error stop delimiter Description No error detected
EIO0000000384 06/2011
187
AS-Interface Library
ASI_SlaveParameterUpdate
Description This function block permits to set the parameters of an AS-Interface Slave Module. Graphical Representation
IL and ST Representation To see the general representation in IL or ST language, refer to the chapter Function and Function Block Representation (see page 195). I/O Variables Description The following table describes the input variables:
Input xExecute Type BOOL Comment Rising edge: action starts. Falling edge: resets outputs. If a falling edge occurs before the function block has completed its action, the outputs operate in the usual manner and are only reset if either the action is completed or in the event of an error has been detected. In this case, the corresponding output values (xDone, xError,eError) are present at the outputs for exactly one cycle. Address of the AS-Interface Slave. 0 = address 0 1...31 = address 1...31 for standard addressing mode, or 1 A...31 A for extended addressing mode 31 = not used 33...63 = 1 B...31 B for extended addressing mode New value of the Slave parameters (value from 00h to 0Fh).
slaveAddress
BYTE
parameters
BYTE
188
EIO0000000384 06/2011
AS-Interface Library
EIO0000000384 06/2011
189
AS-Interface Library
ASI_SlaveStatusCheck
Description This function block reads the local lists dedicated to AS-Interface Slave Modules: detected slaves, activated slaves, and slaves reporting the detection of a peripheral error. Graphical Representation
IL and ST Representation To see the general representation in IL or ST language, refer to the chapter Function and Function Block Representation (see page 195). I/O Variables Description The following table describes the input variable:
Input xEnable Type BOOL Comment Enable execution.
190
EIO0000000384 06/2011
AS-Interface Library
Output LAS
Comment List of Activated Slaves (LAS): one bit is set for each activated slave. LAS[0] bit 0 = slave at address 0 LAS[0] bit 1 = slave at address 1A ... LAS[3] bit 7 = slave at address 31A LAS[4] bit 0 =not used LAS[4] bit 1 =slave at address 1B ... LAS[7] bit 7 =slave at address 31B List of Detected Slaves (LDS): one bit is set for each slave that is detected by the master. LDS[0] bit 0 = slave at address 0 LDS[0] bit 1 = slave at address 1A ... LDS[3] bit 7 = slave at address 31A LDS[4] bit 0 =not used LDS[4] bit 1 =slave at address 1B ... LDS[7] bit 7 =slave at address 31B List of Peripheral errors (LPF): one bit is set for each slave that has detected a peripheral error. LPF[0] bit 0 = slave at address 0 LPF[0] bit 1 = slave at address 1A ... LPF[3] bit 7 = slave at address 31A LPF[4] bit 0 =not used LPF[4] bit 1 =slave at address 1B ... LPF[7] bit 7 =slave at address 31B
LDS
ARRAY[0..7] OF BYTE
LPF
ARRAY[0..7] OF BYTE
EIO0000000384 06/2011
191
AS-Interface Library
ASI_ReadParameterImage
Description This function block allows to read and refresh the parameter image table. Graphical Representation
IL and ST Representation To see the general representation in IL or ST language, refer to the chapter Function and Function Block Representation (see page 195). I/O Variables Description The following table describes the input variables:
Input xExecute Type BOOL Comment Rising edge: action starts. Falling edge: resets outputs. If a falling edge occurs before the function block has completed its action, the outputs operate in the usual manner and are only reset if either the action is completed or in the event of an error. In this case, the corresponding output values (xDone, xError,iError) are present at the outputs for exactly one cycle.
192
EIO0000000384 06/2011
AS-Interface Library
Output pPITable
Comment Parameter image: contains the actual copies of the parameter output of all active slaves. pPITable^[0] bit 0...3 = slave at address 0 pPITable^[0] bit 4...7 = slave at address 1A ... pPITable^[15] bit 4...7 = slave at address 31A pPITable^[16] bit 0...3 = not used pPITable^[16] bit 4...7 = slave at address 1B ... pPITable^[31] bit 4...7 = slave at address 31B
EIO0000000384 06/2011
193
AS-Interface Library
194
EIO0000000384 06/2011
Overview Each function can be represented in the following languages: IL: Instruction List ST: Structured Text LD: Ladder Diagram FBD: Function Block Diagram CFC: Continuous Function Chart This chapter provides functions and function blocks representation examples and explains how to use them for IL and ST languages. Whats 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 196 197 200
EIO0000000384 06/2011
195
196
EIO0000000384 06/2011
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
EIO0000000384 06/2011
197
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.
198
EIO0000000384 06/2011
Step 3
Action Function Blocks are called using a CAL instruction: Use the Input Assistant to select the FB (right-click and select Insert Box in context menu). Automatically, the CAL instruction and the necessary I/O are created. Each parameter (I/O) is an instruction: Value to inputs are set by ":=". Values to outputs are set by "=>".
4 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
In IL language, the function block name is used directly in the Operator Column:
Function Block TON Representation in SoMachine POU IL Editor
EIO0000000384 06/2011
199
2 3
To illustrate the procedure, consider the function SetRTCDrift graphically presented below:
Function SetRTCDrift Graphical Representation
200
EIO0000000384 06/2011
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: Input variables are the input parameters required by the function block 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
EIO0000000384 06/2011
201
202
EIO0000000384 06/2011
Overview This section describes the functions to get/set the serial line configuration in your program. To use these functions, you must add the M2xx Communication library. For further information on adding a library, refer to the SoMachine Programming Guide (see SoMachine, Programming Guide). Whats 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 204 205 207
EIO0000000384 06/2011
203
Parameter Description
Input Link Type LinkNumber Comment Link is the communication port number.
PointerToSerialConf is the address of the configuration PointerToSerialConf POINTER TO structure (variable of SERIAL_CONF type) in which the configuration SERIAL_CONF (see page 207) 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: 0: The configuration parameters are returned 255: The configuration parameters are not returned because: the function was not successful the function is in progress
204
EIO0000000384 06/2011
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 Comment LinkNumber is the communication port number. 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.
Output SetSerialConf
Type WORD
Comment This function returns: 0: The new configuration is set 255: The new configuration is refused because: the function is in progress the input parameters are not valid
EIO0000000384 06/2011
205
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*)
206
EIO0000000384 06/2011
FrameLengthReceived
WORD
Protocol
BYTE
CharFrameEnd1
BYTE
EIO0000000384 06/2011
207
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
208
EIO0000000384 06/2011
Controller Performance
D
Introduction This chapter provides informations about Modicon M238 Logic Controller processing performance. Whats in this Chapter? This chapter contains the following topics:
Topic Processing Performance RTC Drift Page 210 212
EIO0000000384 06/2011
209
Processing Performance
Introduction This chapter provides information about the Modicon M238 Logic 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 439 s 506 s 5111 s 7250 s 971 s 420 s 459 s 648 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 700 s 200 s
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
210
EIO0000000384 06/2011
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 750 s Typical 950 s Maximum 1750 s
EIO0000000384 06/2011
211
RTC Drift
Overview The controller includes an RTC to provide system date and time information, and to support related functions requiring a real-time clock. Backup batteries retain the internal clock when power is off. RTC Characteristics The following table shows how RTC drift is managed:
RTC characteristics RTC drift Description Less than 30 seconds per month without any user calibration at 25 C (77 F)
RTC drift with user logic Less than or equal to 6 seconds per month with user calibration assistance through application software when the controller is in RUN mode.
212
EIO0000000384 06/2011
Glossary
A
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.
ASCII The american standard code for information interchange is a communication protocol for representing alphanumeric characters (letters, numbers, and certain graphic and control characters).
B
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.
EIO0000000384 06/2011
213
Glossary
C
CAN The controller area network protocol (ISO 11898) for serial bus networks is designed for the interconnection of smart devices (from multiple manufacturers) in smart systems for real-time industrial applications. CAN multi-master systems ensure high data integrity through the implementation of broadcast messaging and advanced diagnostic mechanisms. Originally developed for use in automobiles, CAN is now used in a variety of industrial automation control environments.
CANmotion CANmotion is a CANopen-based motion bus with an additional mechanism that provides synchronization between the motion controller and the drives.
CANopen CANopen is an open industry-standard communication protocol and device profile specification.
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.
CiA CAN in automation is a non-profit group of manufacturers and users dedicated to developing and supporting CAN-based higher layer protocols.
CIP When the common industrial protocol is implemented in a networks application layer, it can communicate seamlessly with other CIP-based networks without regard to the protocol. For example, the implementation of CIP in the application layer of an Ethernet TCP/IP network creates an EtherNet/IP environment. Similarly, CIP in the application layer of a CAN network creates a DeviceNet environment. In that case, devices on the EtherNet/IP network can communicate with devices on the DeviceNet network through CIP bridges or routers.
214
EIO0000000384 06/2011
Glossary
controller A controller (or programmable logic controller, or programmable controller) is used to automate industrial processes.
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.)
E
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 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.
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.
EIO0000000384 06/2011
215
Glossary
expansion bus The expansion bus is an electronic communication bus between expansion modules and a CPU.
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.
expert I/O Expert I/Os are dedicated modules or channels for advanced features. These features are generally embedded in the module in order to not use the resources of the PLC Controller and to allow a fast response time, depending of the feature. Regarding the function, it could be considered as a stand alone module, because the function is independent of the Controller processing cycle, it just exchanges some information with the Controller CPU.
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.
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.
FG frequency generator
EIO0000000384 06/2011
Glossary
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.
G
GVL The global variable list manages global variables that are available in every application POU.
H
HSC high-speed counter
I
ICMP The internet control message protocol reports errors and provides information related to datagram processing.
EIO0000000384 06/2011
217
Glossary
IEC 61131-3 The IEC 61131-3 is an international electrotechnical commission standard for industrial automation equipment (like controllers). IEC 61131-3 deals with controller programming languages and defines 2 graphical and 2 textual programming language standards: graphical: ladder diagram, function block diagram textual: structured text, instruction list
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.)
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.
L
Ladder Diagram Language See LD.
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.
218
EIO0000000384 06/2011
Glossary
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.
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.
MAST A master (MAST) task is a processor task that is run through its programming software. The MAST task has two sections: IN: Inputs are copied to the IN section before execution of the MAST task. OUT: Outputs are copied to the OUT section after execution of the MAST task.
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).
Modbus The Modbus communication protocol allows communications between many devices connected to the same network.
EIO0000000384 06/2011
219
Glossary
N
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.
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.
P
PDO A process data object is transmitted as an unconfirmed broadcast message or sent from a producer device to a consumer device in a CAN-based network. The transmit PDO from the producer device has a specific identifier that corresponds to the receive PDO of the consumer devices.
220
EIO0000000384 06/2011
Glossary
periodic execution The master task is executed either cyclically or periodically. In periodic mode, you determine a specific time (period) in which the master task must be executed. If it is executed under this time, a waiting time is generated before the next cycle. If it is executed over this time, a control system indicates the overrun. If the overrun is too high, the controller is stopped.
persistent data Value of persistent data that will be used at next application change or cold start. Only get re-initialized at a reboot of the controller or reset origin. Especially they maintain their values after a download.
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.
post configuration Post-configuration files contain machine-independent parameters, including: machine name device name or IP address Modbus serial line address routing table
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.
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.
EIO0000000384 06/2011
221
Glossary
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.
R
real-time clock (RTC) See RTC
reflex output In a counting mode, the high speed counters current value is measured against its configured thresholds to determine the state of these dedicated outputs.
retained data A retained data value is used in the next power-on or warm start. The value is retained even after an uncontrolled shutdown of the controller or a normal switch-off of the controller.
RFID Radio-frequency identification is an automatic identification method that relies on the storage and remote retrieval of data using RFID tags or transponders.
RTC The real-time clock option keeps the time for a limited amount of time even when the controller is not powered.
S
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.
222
EIO0000000384 06/2011
Glossary
SDO A service data object message is used by the fieldbus master to access (read/write) the object directories of network nodes in CAN-based networks. SDO types include service SDOs (SSDOs) and client SDOs (CSDOs).
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.)
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
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.
system variable A system variable structure provides controller data and diagnostic information and allows sending commands to the controller.
EIO0000000384 06/2011
223
Glossary
T
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.
threshold output Threshold outputs are controlled directly by the HSC according to the settings established during configuration.
U
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.)
224
EIO0000000384 06/2011
Index
B C A
C
Controller Configuration Applications, 65 PLC Settings, 66 Services, 68
A
AS-Interface Library ASI_CheckSlaveBit, 178 ASI_CmdSetAutoAddressing, 179 ASI_CmdSetOfflineMode, 182 ASI_MasterStatusCheck, 184 ASI_ReadParameterImage, 192 ASI_SlaveAddressChange, 186 ASI_SlaveParameterUpdate, 188 ASI_SlaveStatusCheck, 190 AS-Interface Library ASI_CmdSetDataExchange, 181 AS-Interface V2 Fieldbus Add a Slave with Scan Devices, 98 Add an AS-Interface Slave, 96 Add an Slave With Catalog, 96 Add AS-Interface Module, 91 Automatic Slave Addressing, 106 Configure an AS-Interface Master, 93 Configure an AS-Interface Slave, 103 Diagnostic, 109 General Functional Description, 87 Inoperative Slave, 113 Manually Add a Generic Slave, 101 Modification of Slave Address, 107 Presentation, 86 Programming, 112 Software Setup Principle, 90
D
Download application, 59
E
Embedded Functions Configuration Embedded HSC Configuration, 70 Embedded I/O Configuration, 72 Embedded PTO_PWM Configuration, 76 Ethernet Gateway Configuration Connection and Configuration of the Ethernet Gateway, 139 Expansion Module Adding Expansion Module, 79 Configure Expansion Module, 79
F
FAQ, 172 features key features, 13
EIO0000000384 06/2011
225
Index
Firmware Update ExecLoader Introduction, 155 File and Device Properties, 159 Settings, 157 Transfer Progress, 161 Update Through Serial Link, 150 Update Through USB, 153 Welcome, 156 Functions Differences Between a Function and a Function Block, 196 How to Use a Function or a Function Block in IL Language, 197 How to Use a Function or a Function Block in ST Language, 200
R
Reboot, 58 Remanent variables, 61 Reset cold, 56 Reset origin, 57 Reset warm, 56 Run command, 55
S
Serial Line Serial Line Configuration, 116 SERIAL_CONF, 207 SetSerialConf, 205 State diagram, 44 Stop command, 55
G
GetSerialConf, 204
T
Task Cyclic task, 35 Event task, 36 External Event Task, 37 Freewheeling task, 36 Types, 35 Watchdogs, 38 Troubleshooting, 164
I
Initialization Values, 54
L
libraries, 19
M
main features, 13 Memory Mapping, 23
O
Output Behavior, 54, 54 Output Forcing, 54 overview, 13
P
programming languages IL, ST, FBD, SFC, LD, CFC, 13
226
EIO0000000384 06/2011