Appendices. Schneider Electric Modicon M258
Advertisement
Advertisement
Modicon M258 Logic Controller
EIO0000004135 09/2020
Appendices
Overview
This appendix lists the documents necessary for technical understanding of the Modicon M258
Logic Controller Programming Guide.
What Is in This Appendix?
The appendix contains the following chapters:
Chapter
A
B
C
Chapter Name
Functions to Get/Set Serial Line Configuration in User Program
How to change the IP address of the controller
Controller Performance
Page
EIO0000004135 09/2020
257
258
EIO0000004135 09/2020
Modicon M258 Logic Controller
Functions to Get/Set Serial Line Configuration in User Program
EIO0000004135 09/2020
Functions to Get/Set Serial Line Configuration in User Program Appendix A
Functions to Get/Set Serial Line Configuration in User Program
Overview
This section describes the functions to get/set the serial line configuration in your program.
To use these functions, add the M2xx Communication library.
For further information on adding a library, refer to the EcoStruxure Machine Expert Programming
Guide.
What Is in This Chapter?
This chapter contains the following topics:
Topic
GetSerialConf: Get the Serial Line Configuration
SetSerialConf: Change the Serial Line Configuration
SERIAL_CONF: Structure of the Serial Line Configuration Data Type
Page
EIO0000004135 09/2020
259
Functions to Get/Set Serial Line Configuration in User Program
GetSerialConf: Get the Serial Line Configuration
Function Description
GetSerialConf returns the configuration parameters for a specific serial line communication port.
Graphical Representation
Parameter Description
Input
Link
Type
LinkNumber
PointerToSerialConf POINTER TO
Comment
Link is the communication port number.
PointerToSerialConf is the address of the configuration structure (variable of SERIAL_CONF type) in which the configuration parameters are stored. The ADR standard function must be used to define the associated pointer. (See the example below.)
Output
GetSerialConf
Type
WORD
Comment
This function returns:
0: The configuration parameters are returned
255: The configuration parameters are not returned because:
the function was not successful
the function is in progress
Example
Refer to the SetSerialConf example.
260
EIO0000004135 09/2020
Functions to Get/Set Serial Line Configuration in User Program
SetSerialConf: Change the Serial Line Configuration
Function Description
SetSerialConf is used to change the serial line configuration.
Graphical Representation
NOTE: Changing the configuration of the Serial Line(s) port(s) during programming execution can interrupt ongoing communications with other connected devices.
WARNING
LOSS OF CONTROL DUE TO CONFIGURATION CHANGE
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
PointerToSerialConf POINTER TO
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
EIO0000004135 09/2020
261
Functions to Get/Set Serial Line Configuration in User Program
Example
VAR
MySerialConf: SERIAL_CONF
result: WORD;
END_VAR
(*Get current configuration of serial line 1*)
GetSerialConf(1, ADR(MySerialConf));
(*Change to modbus RTU slave address 9*)
MySerialConf.Protocol := 0; (*Modbus RTU/Machine Expert protocol
(in this case CodesysCompliant selects the protocol)*)
MySerialConf.CodesysCompliant := 0; (*Modbus RTU*)
MySerialConf.address := 9; (*Set modbus address to 9*)
(*Reconfigure the serial line 1*) result := SetSerialConf(1, ADR(MySerialConf));
262
EIO0000004135 09/2020
Functions to Get/Set Serial Line Configuration in User Program
SERIAL_CONF: Structure of the Serial Line Configuration Data Type
Structure Description
The SERIAL_CONF structure contains configuration information about the serial line port. It contains these variables:
Variable
Bauds
Type
DWORD
InterframeDelay WORD
FrameReceivedTimeout WORD
FrameLengthReceived
Protocol
Address
Parity
Rs485
ModPol (polarizartion resistor)
BYTE
DataFormat
StopBit
BYTE
BYTE
CharFrameStart
CharFrameEnd1
WORD
BYTE
BYTE
BYTE
BYTE
BYTE
BYTE
Description baud rate minimum time (in ms) between 2 frames in Modbus (RTU, ASCII)
In the ASCII protocol, FrameReceivedTimeout allows the system to conclude the end of a frame at reception after a silence of the specified number of ms. If 0 this parameter is not used.
In the ASCII protocol, FrameLengthReceived allows the system to conclude the end of a frame at reception, when the controller received the specified number of characters. If 0, this parameter is not used.
0: Modbus RTU or EcoStruxure Machine Expert (see
CodesysCompliant )
1: Modbus ASCII
2: ASCII
Modbus address 0 to 255 (0 for Master)
0: none
1: odd
2: even
0: RS232
1: RS485
0: no
1: yes
7 bits or 8 bits
1: 1 stop bit
2: 2 stop bits
In the ASCII protocol, 0 means there is no start character in the frame.
Otherwise, the corresponding ASCII character is used to detect the beginning of a frame in receiving mode. In sending mode, this character is added at the beginning of the user frame.
In the ASCII protocol, 0 means there is no second end character in the frame. Otherwise, the corresponding ASCII character is used to detect the end of a frame in receiving mode. In sending mode, this character is added at the end of the user frame.
EIO0000004135 09/2020
263
Functions to Get/Set Serial Line Configuration in User Program
Variable
CharFrameEnd2
CodesysCompliant
CodesysNetType
Type
BYTE
BYTE
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: EcoStruxure Machine Expert (when Protocol = 0) not used
264
EIO0000004135 09/2020
Modicon M258 Logic Controller
How to change the IP address of the controller
EIO0000004135 09/2020
How to change the IP address of the controller Appendix B
How to change the IP address of the controller changeIPAddress: Change the IP address of the controller
Function Block Description
The changeIPAddress function block provides the capability to change dynamically a controller
IP address, its subnet mask and its gateway address. The function block can also save the
IP address so that it is used in subsequent reboots of the controller.
NOTE: Changing the IP addresses is only possible if the IP mode is configured to fixed IP address.
For more details, refer to IP Address Configuration ( see page 141 )
.
NOTE: For more information on the function block, use the Documentation tab of EcoStruxure
Machine Expert Library Manager Editor. For the use of this editor, refer EcoStruxure Machine
Expert Programming Guide.
Graphical Representation
EIO0000004135 09/2020
265
How to change the IP address of the controller
Parameter Description
Input xExecute xSave eChannel i_abyIPAddress i_abyIPMask i_abyIPGateway
Type
BOOL
BOOL changeIPAd dress_Channel
ARRAY[0..3] OF
BYTE
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 that an error is detected. In this case, the corresponding output values ( xDone , xError , iError ) are present at the outputs for exactly one cycle.
TRUE: save configuration for subsequent reboots of the controller.
The input eChannel is the Ethernet port to be configured.
Depending on the number of the ports available on the controller, it is one of 5 values
in changeIPAddress_Channel (0 or 1).
The new IP Address to be configured. Format: 0.0.0.0.
NOTE: If this input is set to 0.0.0.0 then the controller default IP addresses
( see page 144 ) is configured.
The new subnet mask. Format: 0.0.0.0
ARRAY[0..3] OF
BYTE
ARRAY[0..3] OF
BYTE
The new gateway IP address. Format: 0.0.0.0
Output xDone xBusy xError eError xSaved q_abyIPAddress q_abyIPMask q_abyIPGateway
Type
BOOL
BOOL
BOOL changeIPAd
dress_Error
BOOL
ARRAY[0..3]
OF BYTE
ARRAY[0..3]
OF BYTE
ARRAY[0..3]
OF BYTE
Comment
TRUE: if IP Addresses have been successfully configured or if default IP Addresses have been successfully configured because input i_abyIPAddress is set to 0.0.0.0.
Function block active.
TRUE: error detected, function block aborts action.
FALSE: no error has been detected.
Error code of the detected error
Configuration saved for the subsequent reboots of the controller.
Current controller IP address. Format: 0.0.0.0.
Current subnet mask. Format: 0.0.0.0.
Current gateway IP address. Format: 0.0.0.0.
266
EIO0000004135 09/2020
How to change the IP address of the controller changeIPAddress_Channel : Ethernet port to be configured
The changeIPAddress_Channel enumeration data type contains the following values:
Enumerator
CHANNEL_ETHERNET_NETWORK
Value Description
0 M258: Ethernet port changeIPAddress_Error : Error Codes
The changeIPAddress_Error enumeration data type contains the following values:
Enumerator
ERR_NO_ERROR
ERR_UNKNOWN
ERR_INVALID_MODE
ERR_INVALID_IP
ERR_DUPLICATE_IP
ERR_WRONG_CHANNEL
ERR_IP_BEING_SET
ERR_SAVING
Value
00 hex
01 hex
02 hex
03 hex
04 hex
05 hex
06 hex
07 hex
Description
No error detected.
Internal error detected.
IP address is not configured as a fixed IP address.
Invalid IP address.
The new IP address is already used in the network.
Incorrect Ethernet communication port.
IP address is already being changed.
IP addresses not saved due to a detected error or no non-volatile memory present.
EIO0000004135 09/2020
267
How to change the IP address of the controller
268
EIO0000004135 09/2020
Modicon M258 Logic Controller
M258 - Controller Performance
EIO0000004135 09/2020
Controller Performance Appendix C
Controller Performance
Processing Performance
Introduction
This chapter provides information about the M258 processing performance.
Logic Processing
This table presents 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, for example, Status:= Status and value
LD INT + ST INT
LD DINT + ST DINT
LD REAL + ST REAL
Duration for 1000 Instructions
42 μs
41 μs
336 μs
678 μs
75 μs
64 μs
49 μs
50 μs
Communication and System Processing Time
The communication processing time varies, depending on the number of sent/received requests.
Response Time on Event
The response time presented 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
120 μs
Typical
200 μs
Maximum
500 μs
EIO0000004135 09/2020
269
M258 - Controller Performance
270
EIO0000004135 09/2020
Download
Advertisement