Blocos de Comunicação Schneider
Blocos de Comunicação Schneider
Blocos de Comunicação Schneider
33002527 10/2019
EcoStruxure™ Control
Expert
Communication
Block Library
Original instructions
10/2019
33002527.22
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.
You agree not to reproduce, other than for your own personal, noncommercial use, all or part of
this document on any medium whatsoever without permission of Schneider Electric, given in
writing. You also agree not to establish any hypertext links to this document or its content.
Schneider Electric does not grant any right or license for the personal and noncommercial use of
the document or its content, except for a non-exclusive license to consult it on an "as is" basis, at
your own risk. All other rights are reserved.
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.
© 2019 Schneider Electric. All rights reserved.
2 33002527 10/2019
Table of Contents
Safety Information. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
About the Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Part I General Information . . . . . . . . . . . . . . . . . . . . . . . . . 19
Chapter 1 Block Types and their Applications. . . . . . . . . . . . . . . . . 21
Block Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
FFB Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
EN and ENO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Chapter 2 Block Availability on the Various Hardware Platforms . . 31
Block Availability on Various Hardware Platforms . . . . . . . . . . . . . . . . 31
Chapter 3 Operation of the Communication EFs. . . . . . . . . . . . . . . 35
3.1 Structure and Management of Communication Functions . . . . . . . . . 36
Communication Functions Management . . . . . . . . . . . . . . . . . . . . . . . 37
Structure of Communication Functions . . . . . . . . . . . . . . . . . . . . . . . . 40
Destination Address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Structure of the Management Parameters . . . . . . . . . . . . . . . . . . . . . 42
Management Parameters: Communication and Operation Reports . . 45
Management Parameters: Length and Timeout . . . . . . . . . . . . . . . . . 48
3.2 General Information on Premium and Atrium Communication
Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Rules for Using the Communication Functions of Premium and Atrium
PLCs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Communication Functions on Premium and Atrium PLCs . . . . . . . . . 52
Server Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
3.3 General Information on Quantum Communication Functions . . . . . . . 56
Rules for Using the Communication Functions of Quantum PLCs . . . 57
Communication Functions on Quantum PLCs . . . . . . . . . . . . . . . . . . 60
3.4 General Information on M340 Communication Functions . . . . . . . . . . 63
Communication Functions on M340 CPUs . . . . . . . . . . . . . . . . . . . . . 63
3.5 General Information on M580 Communication Functions . . . . . . . . . . 65
Rules for using the Communication Functions of M580 CPUs . . . . . . 66
Communication Functions on M580 CPUs . . . . . . . . . . . . . . . . . . . . . 68
3.6 General Information on Momentum Communication Functions . . . . . 70
Communication Functions on Momentum PLCs . . . . . . . . . . . . . . . . 70
33002527 10/2019 3
Part II Extended . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Chapter 4 ADDM: Address Conversion. . . . . . . . . . . . . . . . . . . . . . . 73
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Chapter 5 ADDMX: Address Conversion . . . . . . . . . . . . . . . . . . . . . 79
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Chapter 6 ADDR: Address Conversion . . . . . . . . . . . . . . . . . . . . . . . 87
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Chapter 7 CANCEL: Stopping an Exchange in Progress . . . . . . . . . 89
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Example of How to Cancel an Exchange. . . . . . . . . . . . . . . . . . . . . . . 92
Chapter 8 CLOSE_TCP_CNX: Close TCP Connections. . . . . . . . . . 93
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Chapter 9 CREAD_REG: Continuous Register Reading . . . . . . . . . 97
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Derived Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Function Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Parameter Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Chapter 10 CWRITE_REG: Continuous Register Writing . . . . . . . . . . 105
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Derived Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Function Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Parameter Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Chapter 11 DATA_EXCH: Exchanging Data between Applications . . 113
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Assisted Entry Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Example of How to Use a Fipway Network . . . . . . . . . . . . . . . . . . . . . 122
Example of How to Enable/Disable HTTP or FTP/TFTP Services. . . . 125
Chapter 12 ETH_PORT_CTRL: Activating or Deactivating a Protocol 129
ETH_PORT_CTRL: Executing a Security Command in an Application . 129
Chapter 13 EthPort_Control_MX: Activating or Deactivating a
Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
EthPort_Control_MX: Deactivating or Activating a Protocol. . . . . . 133
Chapter 14 EXCH_QX: Exchanging Data between Applications on
EIO Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Chapter 15 INPUT_BYTE: Receiving Character Strings. . . . . . . . . . . 141
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
4 33002527 10/2019
Chapter 16 INPUT_CHAR: Receiving Character Strings . . . . . . . . . 147
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
Assisted Entry Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Example of Reading Character Strings via Fipway Network . . . . . . . . 155
Example of Reading Character Strings via Serial Link of
Modicon M340 Processors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Chapter 17 INPUT_CHAR_QX: Receiving Character Strings on EIO
Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Chapter 18 MBP_MSTR: Modbus Plus Master . . . . . . . . . . . . . . . . . 165
Block Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
Operational Function Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
Network Control Block Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Read Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Write Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Get Local Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Clear Local Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
Write Global Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Read Global Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
Get Remote Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
Clear Remote Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
Peer Cop Health . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
Reset Optional Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Read CTE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
Write CTE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
Send Email . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
Send Modbus Request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
Close Connection Request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
Read/Write Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
Enable / Disable HTTP or FTP/TFTP Services . . . . . . . . . . . . . . . . . . 200
Peer Cop Communications Health Status . . . . . . . . . . . . . . . . . . . . . . 202
Modbus Plus Network Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
TCP/IP Ethernet Network Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
Chapter 19 ModbusP_ADDR: Modbus Plus Address . . . . . . . . . . . . 213
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
33002527 10/2019 5
Chapter 20 OUT_IN_CHAR: Sending/Receiving Character Strings . . 219
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
Assisted Entry Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
Example of How to Send/Receive a Character String . . . . . . . . . . . . . 225
Chapter 21 OUT_IN_MBUS: Modbus Communication Function. . . . . 227
21.1 General Presentation of the OUT_IN_MBUS Communication Block. . . 228
Function Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
Sample Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
Functionalities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
21.2 Description of the OUT_IN_MBUS Communication Block. . . . . . . . . . . 233
Representations and Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
The MbusCmd Parameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
The RetryLmt Parameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
The DataBits Parameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
The RespTout Parameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
The MasterDataArea Parameter . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
The Status Parameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
21.3 Installing the OUT_IN_MBUS Communication Block . . . . . . . . . . . . . . 244
Configuration of the Serial Link . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
Procedure for Programming. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
Using a Modem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
21.4 Sample Use of a OUT_IN_MBUS Communication Block . . . . . . . . . . . 252
Example Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
Programming Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
Declaration of Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
Chapter 22 PRINT_CHAR: Sending character strings . . . . . . . . . . . . 265
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
Assisted entry screen. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
Example of Sending Character Strings via Fipway Network . . . . . . . . 272
Example of Sending Character Strings via Serial Link of Modicon M340
Processors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
Chapter 23 PRINT_CHAR_QX: Sending Character Strings on EIO
Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
Chapter 24 RCV_TLG: Receiving telegrams. . . . . . . . . . . . . . . . . . . . 281
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
Example of how to receive a telegram . . . . . . . . . . . . . . . . . . . . . . . . . 285
6 33002527 10/2019
Chapter 25 READ_ASYN: Reading data asynchronously . . . . . . . . . 287
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
Chapter 26 READ_DDT: Reading DDT. . . . . . . . . . . . . . . . . . . . . . . 291
Configuring the READ_DDT Elementary Function . . . . . . . . . . . . . . . 291
Chapter 27 READ_GDATA: Reading Modbus Plus Global Data . . . 295
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Chapter 28 READ_REG: Read Register . . . . . . . . . . . . . . . . . . . . . . 297
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
Derived Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
Function mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
Parameter description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
Chapter 29 READ_REG_QX: Read Register on EIO Bus . . . . . . . . . 305
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
Chapter 30 READ_SDO: Reading Service Data Object . . . . . . . . . . 309
READ_SDO: Reading Service Data Object. . . . . . . . . . . . . . . . . . . . . 309
Chapter 31 READ_VAR: Reading variables . . . . . . . . . . . . . . . . . . . 313
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
Assisted entry screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
Example of use on a Uni-Telway bus . . . . . . . . . . . . . . . . . . . . . . . . . 323
Example of Reading Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
Example of use in a network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
Example of Reading Words via Serial Link of Modicon M340
Processors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
Example including execution check. . . . . . . . . . . . . . . . . . . . . . . . . . . 331
Chapter 32 SEND_EMAIL: Sending Email . . . . . . . . . . . . . . . . . . . . 333
Send Email . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
Chapter 33 SEND_REQ: Sending requests . . . . . . . . . . . . . . . . . . . 337
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
List of UNI-TE Requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
Assisted entry screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
Example of how to send a UNI-TE request . . . . . . . . . . . . . . . . . . . . . 350
Changing IP Parameters with SEND_REQ (Example) . . . . . . . . . . . . 352
Using the SEND_REQ function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
Chapter 34 SEND_TLG: Sending telegrams . . . . . . . . . . . . . . . . . . . 355
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
Example of how to send a telegram . . . . . . . . . . . . . . . . . . . . . . . . . . 359
33002527 10/2019 7
Chapter 35 SYMAX_IP_ADDR: SY/MAX IP Address . . . . . . . . . . . . . 361
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362
Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
Chapter 36 TCP_IP_ADDR: TCP/IP Address . . . . . . . . . . . . . . . . . . . 367
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
Chapter 37 UNITE_SERVER: Immediate server . . . . . . . . . . . . . . . . 373
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374
Example of immediate server. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
Chapter 38 WRITE_ASYN: Writing data asynchronously . . . . . . . . . . 379
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
Chapter 39 WRITE_GDATA: Writing the Global Data Modbus Plus. . 385
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
Chapter 40 WRITE_REG: Write Register . . . . . . . . . . . . . . . . . . . . . . 387
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388
Derived Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391
Function mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
Parameter description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
Chapter 41 WRITE_REG_QX: Write Register on EIO Bus . . . . . . . . . 395
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
Chapter 42 WRITE_SDO: Writing Service Data Object . . . . . . . . . . . 399
WRITE_SDO: Writing Service Data Object . . . . . . . . . . . . . . . . . . . . . 399
Chapter 43 WRITE_VAR: Writing variables . . . . . . . . . . . . . . . . . . . . 403
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
Assisted entry screen. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
Example of how to write words on a network. . . . . . . . . . . . . . . . . . . . 412
Example of Writing Words via Serial Link of Modicon M340 PLCs . . . 414
Example including execution check . . . . . . . . . . . . . . . . . . . . . . . . . . . 416
Chapter 44 XMIT: Transmit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
Brief Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420
Representation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
Parameter Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424
Description of Data Structure XMIT_SET. . . . . . . . . . . . . . . . . . . . . . . 426
Description of Data Structure XMIT_CFG . . . . . . . . . . . . . . . . . . . . . . 427
Application Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433
Chapter 45 XXMIT: Transmit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
45.1 Introduction to XXMIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440
XXMIT Functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440
8 33002527 10/2019
45.2 XXMIT:Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441
Brief Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442
Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443
Detailed Parameter Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446
XXMIT Communication Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455
XXMIT ASCII Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456
XXMIT Modem Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
XXMIT Modbus Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463
FIFO and Flow Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469
Application Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472
45.3 XXMIT: Programming Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483
XXMIT Programming Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483
45.4 Technical References for XXMIT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485
Modbus Query/Response Parameter Limits . . . . . . . . . . . . . . . . . . . . 486
XXMIT Configuration using Hayes Compatible Dial-Up Modems (Only) 487
Hayes Application Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491
45.5 Cabling Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 496
Cable Pinouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497
Cable Adapter Kits. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510
Appendices ......................................... 515
Appendix A EFB Error Codes and Values . . . . . . . . . . . . . . . . . . . . . 517
Tables of Error Codes for the Communication Library . . . . . . . . . . . . 518
Common Floating Point Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519
Error Codes of EFBs with STATUS parameter . . . . . . . . . . . . . . . . . . 520
Details of STATUS error code from 31ss to 37ss . . . . . . . . . . . . . . . . 523
Details of EFB TCP/IP Ethernet Error Codes 5mss . . . . . . . . . . . . . . 530
Details of EFB Modbus Plus Error Codes 6mss . . . . . . . . . . . . . . . . . 534
Quantum EFB SY/MAX Specific Error Codes . . . . . . . . . . . . . . . . . . . 535
EtherNet/IP Detected Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . 537
CANopen SDO Abort Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540
Glossary ......................................... 543
Index ......................................... 547
33002527 10/2019 9
10 33002527 10/2019
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, service, 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.
33002527 10/2019 11
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.
WARNING
UNGUARDED EQUIPMENT
Do not use this software and related automation equipment on equipment which does not have
point-of-operation protection.
Do not reach into machinery during operation.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
This automation equipment and related software is used to control a variety of industrial processes.
The type or model of automation equipment suitable for each application will vary depending on
factors such as the control function required, degree of protection required, production methods,
unusual conditions, government regulations, etc. In some applications, more than one processor
may be required, as when backup redundancy is needed.
Only you, the user, machine builder or system integrator can be aware of all the conditions and
factors present during setup, operation, and maintenance of the machine and, therefore, can
determine the automation equipment and the related safeties and interlocks which can be properly
used. When selecting automation and control equipment and related software for a particular
application, you should refer to the applicable local and national standards and regulations. The
National Safety Council's Accident Prevention Manual (nationally recognized in the United States
of America) also provides much useful information.
In some applications, such as packaging machinery, additional operator protection such as point-
of-operation guarding must be provided. This is necessary if the operator's hands and other parts
of the body are free to enter the pinch points or other hazardous areas and serious injury can occur.
Software products alone cannot protect an operator from injury. For this reason the software
cannot be substituted for or take the place of point-of-operation protection.
Ensure that appropriate safeties and mechanical/electrical interlocks related to point-of-operation
protection have been installed and are operational before placing the equipment into service. All
interlocks and safeties related to point-of-operation protection must be coordinated with the related
automation equipment and software programming.
12 33002527 10/2019
NOTE: Coordination of safeties and mechanical/electrical interlocks for point-of-operation
protection is outside the scope of the Function Block Library, System User Guide, or other
implementation referenced in this documentation.
WARNING
EQUIPMENT OPERATION HAZARD
Verify that all installation and set up procedures have been completed.
Before operational tests are performed, remove all blocks or other temporary holding means
used for shipment from all component devices.
Remove tools, meters, and debris from equipment.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
Follow all start-up tests recommended in the equipment documentation. Store all equipment
documentation for future references.
Software testing must be done in both simulated and real environments.
Verify that the completed system is free from all short circuits and temporary grounds that are not
installed according to local regulations (according to the National Electrical Code in the U.S.A, for
instance). If high-potential voltage testing is necessary, follow recommendations in equipment
documentation to prevent accidental equipment damage.
Before energizing equipment:
Remove tools, meters, and debris from equipment.
Close the equipment enclosure door.
Remove all temporary grounds from incoming power lines.
Perform all start-up tests recommended by the manufacturer.
33002527 10/2019 13
OPERATION AND ADJUSTMENTS
The following precautions are from the NEMA Standards Publication ICS 7.1-1995 (English
version prevails):
Regardless of the care exercised in the design and manufacture of equipment or in the selection
and ratings of components, there are hazards that can be encountered if such equipment is
improperly operated.
It is sometimes possible to misadjust the equipment and thus produce unsatisfactory or unsafe
operation. Always use the manufacturer’s instructions as a guide for functional adjustments.
Personnel who have access to these adjustments should be familiar with the equipment
manufacturer’s instructions and the machinery used with the electrical equipment.
Only those operational adjustments actually required by the operator should be accessible to
the operator. Access to other controls should be restricted to prevent unauthorized changes in
operating characteristics.
14 33002527 10/2019
About the Book
At a Glance
Document Scope
This document describes the functions and function blocks of the communication library.
Validity Note
This documentation is valid for EcoStruxure™ Control Expert 14.1 or later.
Related Documents
33002527 10/2019 15
Title of documentation Reference number
EcoStruxure™ Control Expert, I/O Management, 33002531 (English), 33002532 (French),
Block Library 33002533 (German), 33003684 (Italian),
33002534 (Spanish), 33003685 (Chinese)
EcoStruxure™ Control Expert, System, Block Library 33002539 (English), 33002540 (French),
33002541 (German), 33003688 (Italian),
33002542 (Spanish), 33003689 (Chinese)
EcoStruxure™ Control Expert, Obsolete, Block 33002543 (English), 33002544 (French),
Library 33002545 (German), 33003690 (Italian),
33002546 (Spanish), 33003691 (Chinese)
EcoStruxure™ Control Expert, UnityLL984, Block EIO0000000550 (English),
Library EIO0000000807 (French),
EIO0000000808 (German),
EIO0000000809 (Italian),
EIO0000000810 (Spanish),
EIO0000000811 (Chinese)
Quantum EIO, Remote I/O Modules, Installation and S1A48978 (English), S1A48981 (French),
Configuration Guide S1A48982 (German), S1A48983 (Italian),
S1A48984 (Spanish), S1A48985 (Chinese)
Quantum using EcoStruxure™ Control Expert, 31008209 (English), 31008210 (French)
140 NOC 771 00 EtherNet/IP Communication
Module, User Manual
Quantum using EcoStruxure™ Control Expert, 33002467 (English), 33002468 (French),
TCP/IP Configuration, User Manual 33002469 (German), 31008078 (Italian),
33002470 (Spanish), 31007110 (Chinese)
Quantum using EcoStruxure™ Control Expert, 33002479 (English), 33002480 (French),
Ethernet Network Modules, User Manual 33002481 (German), 31007213 (Italian),
33002482 (Spanish), 31007112 (Chinese)
Modicon M580 BMENOC0301/11, Ethernet HRB62665 (English), HRB65311 (French),
Communication Module, Installation and HRB65313 (German), HRB65314 (Italian),
Configuration Guide HRB65315 (Spanish), HRB65316 (Chinese)
Modicon M580, Hardware, Reference Manual EIO0000001578 (English),
EIO0000001579 (French),
EIO0000001580 (German),
EIO0000001582 (Italian),
EIO0000001581 (Spanish),
EIO0000001583 (Chinese)
16 33002527 10/2019
Title of documentation Reference number
Modicon M580, RIO Modules, Installation and EIO0000001584 (English),
Configuration Guide EIO0000001585 (French),
EIO0000001586 (German),
EIO0000001587 (Italian),
EIO0000001588 (Spanish),
EIO0000001589 (Chinese),
You can download these technical publications and other technical information from our website
at www.schneider-electric.com/en/download.
33002527 10/2019 17
18 33002527 10/2019
EcoStruxure™ Control Expert
General Information
33002527 10/2019
Part I
General Information
General Information
Overview
This section contains general information about the communication library.
NOTE: For a detailed description of system objects (%S and %SW), refer to EcoStruxure™ Control
Expert, System Bits and Words, Reference Manual.
33002527 10/2019 19
General Information
20 33002527 10/2019
EcoStruxure™ Control Expert
Block Types and their Applications
33002527 10/2019
Chapter 1
Block Types and their Applications
Overview
This chapter describes the different block types and their applications.
33002527 10/2019 21
Block Types and their Applications
Block Types
Block Types
Different block types are used in Control Expert. The general term for the block types is FFB.
There are the following types of block:
Elementary Function (EF)
Elementary Function Block (EFB)
Derived Function Block (DFB)
Procedure
NOTE: Motion Function Blocks are not available on the Quantum platform.
Elementary Function
Elementary functions (EF) have no internal status and one output only. If the input values are the
same, the output value is the same for the executions of the function, for example the addition of
two values gives the same result at every execution.
An elementary function is represented in the graphical languages (FBD and LD) as a block frame
with inputs and an output. The inputs are represented on the left and the outputs on the right of the
block frame. The name of the function, that is the function type, is shown in the center of the block
frame.
The number of inputs can be increased with some elementary functions.
NOTE: Unity Pro is the former name of Control Expert for version 13.1 or earlier.
CAUTION
UNEXPECTED BEHAVIOR OF EQUIPMENT
For Unity Pro V4.0 and earlier versions, do not use links to connect function blocks outputs, when
your application relies on persistent output data of an EF.
Failure to follow these instructions can result in injury or equipment damage.
NOTE: With Unity Pro V4.0 and earlier versions the deactivation of an EF (EN=0) causes links
connected to its Input/Output to be reset. To transfer the state of the signal do not use a link. A
variable must be connected to the EF’s output and must be used to connect the input of the
element. With Unity Pro V4.1 and later versions you can maintain the output links even if an EF is
deactivated by activating the option Maintain output links on disabled EF (EN=0) via the menu
Tools → Program → Languages → Common.
22 33002527 10/2019
Block Types and their Applications
Procedure
Procedures are functions with several outputs. They have no internal state.
The only difference from elementary functions is that procedures can have more than one output
and they support variables of the VAR_IN_OUT data type.
Procedures do not return a value.
Procedures are a supplement to IEC 61131-3 and must be enabled explicitly.
There is no visual difference between procedures and elementary functions.
NOTE: Unity Pro is the former name of Control Expert for version 13.1 or earlier.
CAUTION
UNEXPECTED BEHAVIOR OF EQUIPMENT
For Unity Pro V4.0 and earlier versions, do not use links to connect function blocks outputs, when
your application relies on persistent output data of an EF.
Failure to follow these instructions can result in injury or equipment damage.
NOTE: With Unity Pro V4.0 and earlier versions the deactivation of an EF (EN=0) causes links
connected to its Input/Output to be reset. To transfer the state of the signal do not use a link. A
variable must be connected to the EF’s output and must be used to connect the input of the
element. With Unity Pro V4.1 and later versions you can maintain the output links even if an EF is
deactivated by activating the option Maintain output links on disabled EF (EN=0) via the menu
Tools → Program → Languages → Common.
33002527 10/2019 23
Block Types and their Applications
FFB Structure
Structure
Each FFB is made up of an operation (name of the FFB), the operands are required for the
operation (formal and actual parameters) and an instance name for elementary/derived function
blocks.
Call of a function block in the FBD programming language:
CAUTION
UNEXPECTED APPLICATION BEHAVIOR
Do not call several times the same block instance within a PLC cycle
Failure to follow these instructions can result in injury or equipment damage.
24 33002527 10/2019
Block Types and their Applications
Operation
The operation determines which function is to be executed with the FFB, e.g. shift register,
conversion operations.
Operand
The operand specifies what the operation is to be executed with. With FFBs, this consists of formal
and actual parameters.
Formal/actual parameters
Inputs and outputs are required to transfer values to or from an FFB. These are called formal
parameters.
Objects are linked to formal parameters; these objects contain the current process states. They are
called actual parameters.
At program runtime, the values from the process are transferred to the FFB via the actual
parameters and then output again after processing.
The data type of the actual parameters must match the data type of the input/output (formal
parameters). The only exceptions are generic inputs/outputs whose data type is determined by the
actual parameter. If the actual parameters consist of literals, a suitable data type is selected for the
function block.
33002527 10/2019 25
Block Types and their Applications
26 33002527 10/2019
Block Types and their Applications
VAR_IN_OUT variable
FFBs are often used to read a variable at an input (input variables), to process it and to output the
altered values of the same variable (output variables).
This special type of input/output variable is also called a VAR_IN_OUT variable.
The input and output variable are linked in the graphic languages (FBD and LD) using a line
showing that they belong together.
Function block with VAR_IN_OUT variable in FBD:
The following additional limitations apply to the graphic languages (FBD and LD):
When using graphic connections, VAR_IN_OUT outputs can only be connected with
VAR_IN_OUT inputs.
Only one graphical link can be connected to a VAR_IN_OUT input/output.
Different variables/variable components can be connected to the VAR_IN_OUT input and the
VAR_IN_OUT output. In this case the value of the variables/variable component on the input is
copied to the output variables/variable component.
No negations can be used on VAR_IN_OUT inputs/outputs.
A combination of variable/address and graphic connections is not possible for VAR_IN_OUT
outputs.
33002527 10/2019 27
Block Types and their Applications
EN and ENO
Description
An EN input and an ENO output can be configured for the FFBs.
If the value of EN is equal to "0" when the FFB is invoked, the algorithms defined by the FFB are
not executed and ENO is set to "0".
If the value of EN is equal to "1" when the FFB is invoked, the algorithms defined by the FFB will
be executed. After the algorithms have been executed successfully, the value of ENO is set to "1".
If certain error conditions are detected when executing these algorithms, ENO is set to "0".
If the EN pin is not assigned a value, when the FFB is invoked, the algorithm defined by the FFB is
executed (same as if EN equals to "1"), Please refer to Maintain output links on disabled EF
(see EcoStruxure™ Control Expert, Operating Modes).
If the algorithms are executed successfully, then value of ENO is set to "1", else ENO is set to "0".
If ENO is set to "0" (caused by EN=0 or a detected error condition during execution or unsuccessful
algorithm execution):
Function blocks
EN/ENO handling with function blocks that (only) have one link as an output parameter:
If EN from FunctionBlock_1 is set to "0", the output connection OUT from Function-
Block_1 retains the status it had in the last correctly executed cycle.
EN/ENO handling with function blocks that have one variable and one link as output
parameters:
If EN from FunctionBlock_1 is set to "0", the output connection OUT from Function-
Block_1 retains the status it had in the last correctly executed cycle. The variable OUT1 on
the same pin, either retains its previous status or can be changed externally without
influencing the connection. The variable and the link are saved independently of each other.
28 33002527 10/2019
Block Types and their Applications
Functions/Procedures
NOTE: Unity Pro is the former name of Control Expert for version 13.1 or earlier.
CAUTION
UNEXPECTED BEHAVIOR OF EQUIPMENT
For Unity Pro V4.0 and earlier versions, do not use links to connect function blocks outputs,
when your application relies on persistent output data of an EF.
Failure to follow these instructions can result in injury or equipment damage.
NOTE: With Unity Pro V4.0 and earlier versions the deactivation of an EF (EN=0) causes links
connected to its Input/Output to be reset. To transfer the state of the signal do not use a link. A
variable must be connected to the EF’s output and must be used to connect the input of the
element. With Unity Pro V4.1 and later versions you can maintain the output links even if an EF
is deactivated by activating the option Maintain output links on disabled EF (EN=0) via the menu
Tools → Program → Languages → Common.
As defined in IEC61131-3, the outputs from deactivated functions (EN-input set to "0") is
undefined. (The same applies to procedures.)
Here is an explanation of the output status in this case:
EN/ENO handling with functions/procedures that (only) have one link as an output
parameter:
33002527 10/2019 29
Block Types and their Applications
CAUTION
UNEXPECTED APPLICATION EQUIPMENT
Do not disable function blocks with internal time function during their operation.
Failure to follow these instructions can result in injury or equipment damage.
30 33002527 10/2019
EcoStruxure™ Control Expert
Availability of the Blocks
33002527 10/2019
Chapter 2
Block Availability on the Various Hardware Platforms
Introduction
Not all blocks are available on all hardware platforms. Block availability by hardware platform can
be found in the following table.
NOTE: The functions, procedures, and function blocks in this library are not defined in
IEC 61131–3.
NOTE: It is not recommended to use the communication functions in FAST task. To avoid
dysfunctions, the best solution is to use them in MAST task.
Extended
Availability of the blocks:
33002527 10/2019 31
Availability of the Blocks
32 33002527 10/2019
Availability of the Blocks
33002527 10/2019 33
Availability of the Blocks
34 33002527 10/2019
EcoStruxure™ Control Expert
Operation of the Communication EFs
33002527 10/2019
Chapter 3
Operation of the Communication EFs
Overview
This chapter describes the operation and management of the communication functions.
33002527 10/2019 35
Operation of the Communication EFs
Section 3.1
Structure and Management of Communication Functions
Overview
This section describes the management of the two main communication function types. It also
provides general information about the structure of communication functions.
36 33002527 10/2019
Operation of the Communication EFs
At a Glance
The communication functions allow one device to communicate with another device.
Some of these functions are common to several types of communication channels, others may be
specific to a single communication channel.
Communication functions are processed asynchronously regarding the application task that is
used to activate them (except SEND_TLG and RCV_TLG). A communication function is
asynchronous when it is executed during one or several cycles after the cycle in which it has been
activated.
Several communication function blocks can be programmed on the same communication port. If
the maximum number of communication blocks is exceeded on a port, the exceeding blocks are
not serviced until a transaction path is released. When the transaction path resource becomes free,
the next block on the same port becomes active and uses the released path.
The purpose of this topic is to describe the management of the communication functions according
to their type:
EF and procedure type functions
EFB type functions
NOTE: Placing a communication EF in the FAST task does not increase the EF processing speed,
nor does it increase the communication execution speed. All communications – including the
physical release of the messages over all communication links -– are executed at the end of the
MAST task, even if the communication EF is processed in the FAST task.
33002527 10/2019 37
Operation of the Communication EFs
38 33002527 10/2019
Operation of the Communication EFs
Launching a new communication: The function is cyclically called in a task for monitoring
purposes.
When the function is called, the activity is tested by the function itself. If the function is not active
(previous communication has ended), the ENABLE and EN inputs must be set to 1 to launch a
new communication.
To launch the communication function only once, the ENABLE input needs to be set to 0 when
the ACTIVE output is read at 0.
The following figure shows in detail the role and operation of ENABLE, ACTIVE, DONE (or SUCCESS)
and ERROR parameters:
The ENABLE parameter is written by the application. The ACTIVE, DONE, and ERROR parameters
are read by the application.
33002527 10/2019 39
Operation of the Communication EFs
At a Glance
A communication function uses:
an address parameter
parameters specific to a communication operation
management parameters
Syntax
The syntax of a communication function is as follows:
Function (Destination address, Specific parameters, Management
parameters)
The following table describes the different entities that make up a function:
Entity Description
Function Corresponds to the type of communication function.
Destination address Indicates the address of the exchange destination.
Specific parameters Depend on the type of communication function. A description of
these is provided for each communication function.
Management Management parameters are common to all asynchronous
parameters communication functions. These are made up of:
a parameter providing data on the activity of the function
a parameter specifying the exchange number that identifies the
transaction in progress
a parameter containing the exchange report (communication
report and operation report)
a timeout parameter that can be used to check if there is no
response
a length parameter that can be used to store the number of
bytes to be sent or the number of bytes received
40 33002527 10/2019
Operation of the Communication EFs
Destination Address
At a Glance
This parameter indicates the exchange's destination device address (see Communication
Services and Architectures, Reference Manual).
It can be located:
either using internal words (%MW) or internal constants (%KW)
or by being written directly as an immediate value
In order to facilitate the preparation phase of the exchange, there is the ADDR function (only
Control Expert M or higher), which converts an address-type immediate value (character string)
into a table which is always comprised of six internal words (%MW).
Example
%MWi:6:=ADDR('{2.4}SYS');
33002527 10/2019 41
Operation of the Communication EFs
At a Glance
Management parameters are grouped together in the form of an array of four integers. The values
contained in this array can be used to manage communication functions.
NOTE: In technical documentation, these management parameters are also called a management
table or report.
NOTE: The first two words are managed by the system. You are responsible for managing the last
two words.
NOTE:
For M580 Hot Standby systems, make the following edits to the management parameters in the
Data Editor:
Uncheck the Exchange On STBY attribute for each of the four management parameters.
Initialize the Length parameter each time the function is called.
Set the Timeout parameter accordingly to your application:
If the communication function is send through the CPU, the typical timeout value is 500 ms.
If the communication function is send through a NOC module, the typical timeout value is 2 s.
Structure
The following table describes the structure of the data in the communication management table:
42 33002527 10/2019
Operation of the Communication EFs
Activity Bit
This bit indicates the execution status of the communication function.
It is set to 1 when launched and returns to 0 when its execution is complete.
This is the first bit of the first element of the table.
Declaration: If the management table has been declared as follows:
Tab_Gest ARRAY [1..4] OF INT, the activity bit is the bit with the notation Tab_Gest[1].0.
NOTE: the notation previously used requires configuration of the project properties in such a way
as to authorize the extraction of bits on integer types. If this is not the case Tab_Gest[1].0
cannot be accessed in this manner.
Cancel Bit
To cancel the communication function (for Modicon M340 and Modicon M580 PLCs only) set this
bit to 1 and relaunch the EF. This is another way than using the CANCEL (see page 90) EF.
Declaration: If the management table has been declared as follows:
Tab_Gest ARRAY [1..4] OF INT, the cancel bit is the bit with the notation Tab_Gest[1].1.
Programming example in ST: cancelling a READ_VAR function
IF (%MW40.0) THEN
SET(%MW40.1);
READ_VAR(ADDM('0.0.0.6'), '%MW', 100, 10, %MW40:4, %MW10:10);
END_IF;
%MW40 is the GEST parameter (management table).%MW40.0 corresponds to the activity bit of the
READ_VAR function and is set to 1 when the communication function is active. If this bit is set to 1,
the program sets the %MW40.1 bit, the function cancel bit, to 1. This stops communication of the
READ_VAR function.
NOTE: When using the communication function cancel bit contained in the function exchange
management word (%MW40 in this example), the function (READ_VAR in this example) must be
called in order to activate the cancellation of the exchange.
NOTE: When using the communication function cancel bit, it is possible to cancel a communication
from an animation table. This can be done by simply setting the function cancel bit to 1 (%MW40.1
in this example) and then start again the communication function.
33002527 10/2019 43
Operation of the Communication EFs
Exchange Number
When a communication function is sent, the system automatically allocates it a number, enabling
the exchange to be identified.
This number can be used where necessary to stop the exchange in progress (using the CANCEL
(see page 90) function).
44 33002527 10/2019
Operation of the Communication EFs
At a Glance
Communication and operation reports are part of the management parameters.
NOTE: It is recommended that communication function reports always be tested at the end of their
execution and before the next activation. On cold start-up, it is imperative that all communication
function management parameters be checked and reset to 0.
Communication Report
This report is common to all functions. It is significant when the value of the activity bit switches
from 1 to 0.
The reports with a value between 16#01 and 16#FE concern errors detected by the processor that
executed the function.
The different values of this report are indicated in the following table:
33002527 10/2019 45
Operation of the Communication EFs
NOTE: The function can detect a parameter error before activating the exchange. In this case the
activity bit remains at 0, and the report is initialized with values corresponding to the error.
NOTE: 16#FF value is returned to indicate a correct exchange using WRITE_VAR function in a
Modbus broadcast request. This report value is implemented in TSX SCY 21601 from V2.8 IE46,
in TSX SCY 11601 from V1.2 IE11 and in TSX SCP 111/114 from V3.2 IR25.
Operation Report
This report byte is specific to each function, and specifies the result of the operation on the remote
application.
It is significant only if the communication report has the following values:
16#00 (correct exchange),
16#FF (message refused).
If the value of the communication report is 16#00, the operation report will have the following
values:
46 33002527 10/2019
Operation of the Communication EFs
This list is not exhaustive and depends on the communication function used. Refer to the
corresponding communication function for specific values:
Operation report when using SEND_REQ to exchange an UNI-TE request (see page 342).
Operation report when using SEND_REQ to exchange a Modbus request (see Premium and
Atrium using EcoStruxure™ Control Expert, Asynchronous Serial Link, User Manual).
If the value of the communication report is 16#FF, the operation report will have the following
values:
Legend:
(*) Code only managed by PCMCIA cards: TSX FPP20 and TSX FPP10
33002527 10/2019 47
Operation of the Communication EFs
At a Glance
You are responsible for these two parameters.
Length
The length parameter is used both to specify the number of characters (in bytes) to be sent during
transmission, but also to store the number of characters (in bytes) received after reception of a
message.
Before certain communication functions are launched (SEND_REQ, DATA_EXCH, PRINT_CHAR,
SEND_TLG), it is compulsory for some of these functions, and advisable for others, to update the
length parameter.
NOTE: With the PRINT_CHAR function, for example, if another function in the application is using
the same report table where the number of bytes to send is different to the previous function, it is
imperative to initialize the length parameter with the new number of bytes to transmit. Otherwise it
keeps the same number of bytes sent by the previous function.
48 33002527 10/2019
Operation of the Communication EFs
Timeout
Timeout determines the maximum waiting time for the response. The time base for this parameter
is 100 ms (the value 0 corresponds to an infinite waiting value).
When the timeout elapses, the exchange is ended with an error report. Also, the system does not
accept any responses after the end of the timeout.
Example
NOTE:
The timeout is evaluated every second.
The value of a communication function's timeout must be sufficient to ensure that the response
to the question asked is received (use of an external modem on a protocol-based link, for
example).
For Modbus master communication, application timeout set under the communication functions
must be greater than the configuration screen timeout multiplied by the number of retries
(hardware timeout).
Communication EFs timeout (as WRITE_VAR or READ_VAR) must be greater than
communication master equipment timeout (answer delay).
33002527 10/2019 49
Operation of the Communication EFs
Section 3.2
General Information on Premium and Atrium Communication Functions
Overview
This section describes the operation and management of the communication functions for
Premium and Atrium PLCs.
50 33002527 10/2019
Operation of the Communication EFs
Rules for Using the Communication Functions of Premium and Atrium PLCs
At a Glance
The communication functions used with Premium and Atrium PLCs have certain unique character-
istics which set them apart from the other functions of the library. This documentation complies with
the documentation charter concerning the function library, but also contains additional information
relating to the particularities of the communication specific-application.
Located Variables
All communication functions that do not require programming in the server PLC (READ_VAR,
WRITE_VAR, etc.) provide access to the located variables of remote PLCs. Unlocated variables
are not accessible.
NOTE: To perform inter-PLC transfers of unlocated variables, it is necessary to use the
DATA_EXCH function. Another solution is to make local copies in the located variable zones.
Apart from the first example of the WRITE_VAR function (only Control Expert M and higher), all of
the other examples are made using direct addressing (see EcoStruxure™ Control Expert, Program
Languages and Structure, Reference Manual) variables (use of addresses, located variables).
Programming Language
The most concise programming language for creating communication applications is Structured
Text language (ST). All of the examples, except that of the READ_VAR (see page 313) function, are
therefore written in ST.
33002527 10/2019 51
Operation of the Communication EFs
At a Glance
These functions allow one device to communicate with another. Certain of these are common to
several types of communication channels, others may be specific to a single communication
channel.
NOTE: Communication functions are processed asynchronously regarding the application task
that was used to activate them. The only exceptions are the telegram send/receive and operation
stop functions, which are executed in total synchronization with the execution of the activation task.
Function Role
DATA_EXCH Send/request receipt of data.
ETH_PORT_CTRL Activate or deactivate a protocol.
INPUT_BYTE Read an array of bytes.
INPUT_CHAR Read a character string.
OUT_IN_CHAR Send a character string and wait for a response.
OUT_IN_MBUS Emulate a Modbus master communication from a serial link configured in character
mode.
PRINT_CHAR Write a character string.
READ_ASYN Read 1 Kbyte of messaging.
READ_GDATA Read common Modbus Plus data.
READ_VAR Read standard language objects: internal words and bits, system words and bits, timers,
monostables, drums, registers, counters.
SEND_REQ Send UNI-TE requests.
UNITE_SERVER Process immediately READ_VAR and WRITE_VAR requests on Modbus (Immediate
server).
WRITE_ASYN Write 1 Kbyte of messaging.
WRITE_GDATA Write common Modbus Plus data.
WRITE_VAR Write standard language objects: internal words and bits, system words and bits.
52 33002527 10/2019
Operation of the Communication EFs
NOTE: It is recommended that asynchronous functions be triggered on edge and not on state to
avoid saturating the communication buffers by sending multiple requests. You are also advised,
for the same reason, to manage the activity bit (see page 43) and report words (see page 45)
during the execution of each communication function.
Function Role
CANCEL Stop an exchange in progress.
RCV_TLG Receive a telegram.
SEND_TLG Send a telegram.
Function Role
ADDR Convert a character string into an address (table of 6 integers) that can be directly exploited
by the communication function.
33002527 10/2019 53
Operation of the Communication EFs
Server Function
At a Glance
The server function can be used to respond to requests from client devices.
The TSX 57 35• and PCX 57 35• processors provide two request servers:
a main server (recommended for requests of less than 256 bytes)
an auxiliary server (recommended for requests of up to 1024 bytes)
Illustration
The following diagram shows the requests sent to the servers in the PLC cycle:
54 33002527 10/2019
Operation of the Communication EFs
Main Server
This server corresponds to port 0 (UNI-TE server). It is activated at the start of the PLC's MAST
cycle.
The response time of the client PLC depends on the cycle time of the server PLC. This can be used
to process up to 4 simultaneous requests per PLC cycle.
All UNI-TE requests are supported. The size of the request must be less than 256 bytes.
This entity can be addressed at the topological address SYS or {network.station}SYS.
Auxiliary Server
This server corresponds to port 7 (asynchronous server). It is activated only for periodical tasks at
the end of the PLC cycle, after the MAST task has been processed whilst awaiting the start of the
next cycle.
The start of the next, higher priority cycle could interrupt a request in progress. Access to this
server is therefore reserved for applications requiring no consistency in their read/write data.
The application response time will essentially depend on the PLC cycle time. The size of the
request may be up to 1024 bytes. It cannot be accessed from a communication function; the server
processes object (bit or word) READ/WRITE requests, etc.
33002527 10/2019 55
Operation of the Communication EFs
Section 3.3
General Information on Quantum Communication Functions
Overview
This section describes the operation and management of the communication functions for
Quantum PLCs.
56 33002527 10/2019
Operation of the Communication EFs
33002527 10/2019 57
Operation of the Communication EFs
58 33002527 10/2019
Operation of the Communication EFs
33002527 10/2019 59
Operation of the Communication EFs
Function Role
CREAD_REG Continuously read a register area from a slave addressed via Modbus Plus, TCP/IP-
Ethernet or SY/MAX-Ethernet
CWRITE_REG Continuously write a register area to a slave addressed via Modbus Plus, TCP/IP-
Ethernet or SY/MAX-Ethernet
MBP_MSTR Perform various network communication operations on Modbus Plus, TCP/IP-
Ethernet or SY/MAX-Ethernet
READ_REG (1) Read a register area from a slave addressed via Modbus Plus, TCP/IP-Ethernet or
SY/MAX-Ethernet
WRITE_REG (1) Write a register area to a slave addressed via Modbus Plus, TCP/IP-Ethernet or
SY/MAX-Ethernet
XXMIT Modbus messages from master PLC and ASCII input/output strings.
(1) READ_REG and WRITE_REG communication functions are launched when an edge appears on the REG
input. The communication is launched when REG is set to 1; then REG needs to be reset (0) and set to
1 again to launch the communication again.
60 33002527 10/2019
Operation of the Communication EFs
Function Role
CREAD_REG Continuously read a register area from a slave addressed via Modbus Plus, TCP/IP-
Ethernet or SY/MAX-Ethernet
CWRITE_REG Continuously write a register area to a slave addressed via Modbus Plus, TCP/IP-
Ethernet or SY/MAX-Ethernet
EXCH_QX Perform data transfers through an EIO bus to and from Modbus slaves connected to
a Modicon X80 rack
GET_TS_EVT_Q (2) Get the time stamped data in a Modicon BMX ERT 1604T or BMX CRA ••••• module
in an EIO drop.
INPUT_CHAR_QX Receive a character string from a Modicon X80 serial communication module
through an EIO bus
MBP_MSTR Perform various network communication operations on Modbus Plus, TCP/IP-
Ethernet or SY/MAX-Ethernet
PRINT_CHAR_QX Send a character string of 1000 bytes maximum from a Modicon X80 Modbus master
through an EIO bus
READ_REG (1) Read a register area from a slave addressed via Modbus Plus, TCP/IP-Ethernet or
SY/MAX-Ethernet
READ_REG_QX Read registers in a Modbus slave connected to a Modicon X80 Modbus master
through an EIO bus
READ_STS_QX (*) Read the status words of a Modicon X80 Ethernet I/O module by performing an
explicit exchange with the processor memory
WRITE_CMD_QX (*) Send a command to a Modicon X80 Ethernet I/O module with a command word by
performing an explicit exchange
WRITE_REG (1) Write a register area to a slave addressed via Modbus Plus, TCP/IP-Ethernet or
SY/MAX-Ethernet
WRITE_REG_QX Write registers in a Modbus slave connected to a Modicon X80 Modbus master
through an EIO bus
XXMIT Modbus messages from master PLC and ASCII input/output strings.
*: READ_STS_QX and WRITE_CMD_QX are part of the I/O Management Library (Explicit Exchange Family)
(see EcoStruxure™ Control Expert, I/O Management, Block Library)
1: READ_REG and WRITE_REG communication functions are launched when an edge appears on the REG
input. The communication is launched when REG is set to 1; then REG needs to be reset (0) and set to 1
again to launch the communication again.
2: GET_TS_EVT_Q is part of the System Library (SysClock family (see EcoStruxure™ Control Expert,
System, Block Library)).
33002527 10/2019 61
Operation of the Communication EFs
Utility Functions
Those functions are common to low end and high end CPUs and are synchronous functions. A
function is said to be synchronous when it is completed during the CPU task that has activated it.
Communication function roles:
Function Role
ADDMX Convert a character string (respecting the Control Expert device address syntax) into
an array of integers in order to manage Modicon X80 serial link modules in an
Ethernet I/O drop
ModbusP_ADDR Convert a Modbus Plus address into an address that can be directly used by the
communication functions
SYMAX_IP_ADDR Convert a SYMAX/IP address into an address that can be directly used by the
communication functions
TCP_IP_ADDR Convert a TCP/IP address into an address that can be directly used by the
communication functions
62 33002527 10/2019
Operation of the Communication EFs
Section 3.4
General Information on M340 Communication Functions
Name Role
DATA_EXCH Transmit or receive data.
INPUT_BYTE Receive an array of bytes on a character mode link of a BMX NOM module in a local rack
or linked to a CPU embedded communication channel.
INPUT_CHAR Receive a character string on a character mode link of a BMX NOM module in a local rack
or linked to a CPU embedded communication channel.
PRINT_CHAR Send a character string on a character mode link of a BMX NOM module in a local rack or
linked to a CPU embedded communication channel.
READ_VAR Read the value of one or more language objects via a communication module in a local
rack or linked to a CPU embedded communication channel.
SEND_EMAIL Send an email over an Ethernet port of a communication module plugged in a local rack.
WRITE_VAR Write the value of one or more language objects via a communication module in a local
rack or linked to a CPU embedded communication channel.
Name Role
ETH_PORT_CTRL Activate or deactivate a protocol.
GET_TS_EVT_M (1) Get the time stamped data in a Modicon BMX ERT 1604T module plugged in a
local rack.
1: GET_TS_EVT_M is part of the System Library (SysClock family (see EcoStruxure™ Control Expert,
System, Block Library)).
33002527 10/2019 63
Operation of the Communication EFs
Name Role
ADDM Convert a character string into an address that can be used directly by the communication
functions READ_VAR, WRITE_VAR, DATA_EXCH and PRINT_CHAR.
CANCEL Interrupt an asynchronous communication function in progress.
NOTE: Another way to cancel an asynchronous communication function in progress is to use
the cancel bit (see page 43) of the management parameters.
64 33002527 10/2019
Operation of the Communication EFs
Section 3.5
General Information on M580 Communication Functions
Overview
This section describes the operation and management of the communication functions for M580
CPUs.
33002527 10/2019 65
Operation of the Communication EFs
Overview
M580 CPUs use both types of communication functions:
EF and procedure type functions
EFB type functions
For general description of the management of the communication functions according to their type,
refer to Communication Functions Management (see page 38).
66 33002527 10/2019
Operation of the Communication EFs
33002527 10/2019 67
Operation of the Communication EFs
Name Role
DATA_EXCH End any requests (Modbus, Umas …) to any Modbus slave via a
communication module plugged in a local rack or in an EIO drop.
INPUT_BYTE Receive an array of bytes on a character mode link of a BMX NOM module
plugged in a local rack or in an EIO drop.
INPUT_CHAR Receive a character string on a character mode link of a BMX NOM module
plugged in a local rack or in an EIO drop.
PRINT_CHAR Send a character string on a character mode link of a BMX NOM module
plugged in a local rack or in an EIO drop.
READ_VAR Read the value of one or more language objects via a communication module
plugged in a local rack or in an EIO drop.
SEND_EMAIL Send an email over an Ethernet port of a communication module plugged in a
local rack (Ethernet modules cannot be plugged in an EIO drop).
WRITE_VAR Write the value of one or more language objects via a communication module
plugged in a local rack or in an EIO drop.
Name Role
ETH_PORT_CTRL Activate or deactivate a protocol.
EthPort_Control_MX Enable or disable the configured Ethernet services.
GET_TS_EVT_M (1) Get the time stamped data in a Modicon BMX ERT 1604T or BMX CRA •••••
module plugged in a local rack or in an EIO drop.
READ_PARAM_MX (2) (3) Read the parameter words of a Modicon X80 I/O module plugged in a local rack
by performing an explicit exchange.
READ_STS_MX (2) Read the status words of a Modicon X80 I/O module plugged in a local rack or
in an EIO drop by performing an explicit exchange.
1: GET_TS_EVT_M is part of the System Library (SysClock family (see EcoStruxure™ Control Expert,
System, Block Library)).
2: READ_STS_MX, WRITE_CMD_MX, READ_PARAM_MX, WRITE_PARAM_MX, SAVE_PARAM_MX, and
RESTORE_PARAM_MX are part of the I/O Management Library (Explicit Exchange family (see EcoStruxure™
Control Expert, I/O Management, Block Library)).
3: READ_PARAM_MX, WRITE_PARAM_MX, SAVE_PARAM_MX, and RESTORE_PARAM_MX can only be used
with I/O modules plugged in a local rack. When sent to a module on an EIO drop, error code 16#2007
(Unauthorized network field on slave) is returned.
68 33002527 10/2019
Operation of the Communication EFs
Name Role
RESTORE_PARAM_MX (2) (3) Restore the parameter words of a Modicon X80 I/O module plugged in a local
rack by performing an explicit exchange.
SAVE_PARAM_MX (2) (3) Save the parameter words of a Modicon X80 I/O module plugged in a local rack
by performing an explicit exchange.
WRITE_CMD_MX (2) Send a command to a Modicon X80 I/O module plugged in a local rack or in an
EIO drop by performing an explicit exchange.
WRITE_PARAM_MX (2) (3) Write the parameter words of a Modicon X80 I/O module plugged in a local rack
by performing an explicit exchange.
1: GET_TS_EVT_M is part of the System Library (SysClock family (see EcoStruxure™ Control Expert,
System, Block Library)).
2: READ_STS_MX, WRITE_CMD_MX, READ_PARAM_MX, WRITE_PARAM_MX, SAVE_PARAM_MX, and
RESTORE_PARAM_MX are part of the I/O Management Library (Explicit Exchange family (see EcoStruxure™
Control Expert, I/O Management, Block Library)).
3: READ_PARAM_MX, WRITE_PARAM_MX, SAVE_PARAM_MX, and RESTORE_PARAM_MX can only be used
with I/O modules plugged in a local rack. When sent to a module on an EIO drop, error code 16#2007
(Unauthorized network field on slave) is returned.
Name Role
ADDM Convert a character string into an address that can be used directly by the communication
functions.
ADDMX Convert a character string respecting the Control Expert device address syntax into an array
of integers.
CANCEL Interrupt an asynchronous communication function in progress.
NOTE: Another way to cancel an asynchronous communication function in progress is to use
the cancel bit (see page 43) of the management parameters.
NOTE:
To address a module on an EIO drop, address string to be used with ADDMX needs to be 0.0.3
{xx.xx.xx.xx} (3: channel 3 of CPU correspond to the embedded Ethernet port of the CPU,
xx.xx.xx.xx corresponds to the IP address of the drop).
To address a module in a local rack with ***_MX functions, address string needs to be 0.0.10
(address of the CPU main server).
33002527 10/2019 69
Operation of the Communication EFs
Section 3.6
General Information on Momentum Communication Functions
Rules for Using EFB or DFB Type Communication Functions on Momentum PLCs
Momentum PLCs use EFB type communication functions. For more details on those
communication functions managements, refer to section Communication Function Management
(see page 36).
Function Role
MBP_MSTR Perform various network communication operations on Modbus Plus,
TCP/IP-Ethernet.
XMIT Modbus messages from master PLC and ASCII input/output strings.
XXMIT Modbus messages from master PLC and ASCII input/output strings.
70 33002527 10/2019
EcoStruxure™ Control Expert
Extended
33002527 10/2019
Part II
Extended
Extended
Overview
This section describes the elementary functions and elementary function blocks of the Extended
family.
33002527 10/2019 71
Extended
72 33002527 10/2019
EcoStruxure™ Control Expert
ADDM
33002527 10/2019
Chapter 4
ADDM: Address Conversion
Description
Function Description
The ADDM function is used to convert a character string into an address that can be used directly
by the following communication functions: READ_VAR, WRITE_VAR, INPUT_CHAR, PRINT_CHAR,
DATA_EXCH, SEND_EMAIL.
The additional parameters EN and ENO can be configured.
FBD Representation
LD Representation
IL Representation
LD Addr_String
ADDM
ST Addr_Array
ST Representation
Addr_Array := ADDM(Addr_String);
33002527 10/2019 73
ADDM
The input is the concatenation of up to three elements that can take various values. Each element
is optional:
Output port used locally to reach Target equipment Service to reach in the target
the target equipment: equipment:
r.m.c SYS
Netlink {hostAddr} MBS
node SMTP
NOTE: in the first case, the TCP.MBS
{hostAddr}node
channel number c is optional CON.CIP
UNC.CIP
Definitions:
Netlink: network name set in the Net Link field of Ethernet channel
hostAddr: IP address of the host we want to reach.
r: rack number of the communication channel
m: module position of the communication channel
c: communication channel number
node: Modbus or CANopen node behind a gateway (gateway identified with hostAddr)
SYS: for addressing the system server
MBS: for addressing the Modbus system server (same as SYS)
SMTP: for addressing the SMTP server
TCP.MBS: for addressing a TCP Modbus server
CON.CIP: for addressing a connected equipment through Ethernet/IP
UNC.CIP: for addressing an unconnected equipment through Ethernet/IP
NOTE: For Modicon M580 CPU, to configure a communication through the CPU Ethernet port,
r=0, m=0 and c=3.
74 33002527 10/2019
ADDM
33002527 10/2019 75
ADDM
For further information, please refer to M340 PLCs addressing (see Communication Services and
Architectures, Reference Manual) overview of user manual Communication Architectures.
CAUTION
UNEXPECTED BEHAVIOR OF APPLICATION
Do not use wrong address parameters. For instance, do not set an address parameter that does
not correspond to the targeted equipment.
Failure to follow these instructions can result in injury or equipment damage.
76 33002527 10/2019
ADDM
The ADDM block analyses the addressing string syntax (parameter IN) and puts the result into an
8 single integers array which defines the destination address. The destination address can be
provided either by the OUT parameter of the ADDM function or directly by an array of 8 INT objects.
However, it is strongly recommended to use the ADDM function to address a communication EF.
The destination address’ structure is as follows:
33002527 10/2019 77
ADDM
78 33002527 10/2019
EcoStruxure™ Control Expert
ADDMX
33002527 10/2019
Chapter 5
ADDMX: Address Conversion
Description
Function Description
The ADDMX function is used to convert a character string respecting the Control Expert device
address syntax into an array of integers in order to manage (e)X80 serial link modules in an
Ethernet I/O drop.
The ADDMX function can be used directly by the following communication functions with a local
Modicon M340 CPU or a remote M340 module in a Quantum system:
READ_STS_QX
WRITE_CMD_QX
EXCH_QX
READ_REG_QX
WRITE_REG_QX
PRINT_CHAR_QX
The ADDMX function can be used directly by the following communication functions in an M580
system:
READ_STS_MX
WRITE_CMD_MX
READ_PARAM_MX
RESTORE_PARAM_MX
SAVE_PARAM_MX
WRITE_PARAM_MX
INPUT_CHAR
PRINT_CHAR
READ_VAR
WRITE_VAR
INPUT_BYTE
DATA_EXCH
SEND_EMAIL
33002527 10/2019 79
ADDMX
FBD Representation
LD Representation
IL Representation
ADDMX (
IN := InputADDMX
)
ST OutputADDMX
ST Representation
OutputADDMX := ADDMX (IN := InputADDMX);
80 33002527 10/2019
ADDMX
Parameter Description
The following table describes the input parameter:
To address a BMX CRA 312 •0 or BME CRA 312 •0 module directly with its IP address, the IN
parameter takes one of the 2 following forms:
‘r0.s0.ch0.{ip.ip.ip.ip}’
‘r0.s0.ch0.{ip.ip.ip.ip}TCP.MBS’
To address a Modbus server or slave using Modbus protocol (see Communication Services and
Architectures, Reference Manual), the IN parameter takes one of the 2 following forms:
‘r0.s0.ch0.{ip.ip.ip.ip}TCP.MBS\\r1.s1.ch1.d’
‘r0.s0.ch0.{ip.ip.ip.ip}TCP.MBS\\r1.s1.ch1.d.MBS’
Field Value
r0.s0.ch0 Topological address of the Quantum CRP or Quantum NOE module or M580 Ethernet
port that will send the TCP/Modbus request (rack, slot, and channel number).
NOTE: In a Quantum rack: r0 = 1 and ch0 = 1.
NOTE: For a M580: to configure a communication through the CPU Ethernet port, set
channel number to 3 (0.0.3).
{ip.ip.ip.ip} BMX CRA 312 00 or BMX CRA 312 10 module with ip.ip.ip.ip address (protocol TCP port
502, default IP protocol, and port).
TCP.MBS Optional, used to address a Modbus server
\\ Separator
r1.s1.ch1.d Modbus server module rack, slot, channel, and Modbus slave number
Depending on the addressing mode, the parameters can be partly used as described:
r1.s1 Module server addressing mode: module server topological address in
a rack with a BMX CRA 312 10 module.
NOTE: Modicon M340 first rack number = 0 (r0 = 0).
r1.s1.ch1 Channel server addressing mode: channel server address in the rack.
NOTE: Modicon M340 first channel number = 0 (ch1 = 0).
r1.s1.ch1.d Modbus slave addressing mode: address Modbus slave n° d, using
channel ch1 Modbus Master from a NOM module located in a rack with
a BMX CRA 312 10 module.
MBS Optional. To address a Modbus server if the NOM module is not a Modbus master.
33002527 10/2019 81
ADDMX
82 33002527 10/2019
ADDMX
33002527 10/2019 83
ADDMX
The ADDMX block analyses the addressing string syntax (IN parameter) and puts the result into
an array of array which defines the destination address. The destination address can be provided
either by the OUT parameter of the ADDMX function or directly by an array of array (n x 8 INT
objects). However, it is strongly recommended to use the ADDMX function to address a
communication EF.
Detailed description of ADDM_TYPE array:
WARNING
UNEXPECTED BEHAVIOR OF APPLICATION
The use of reserved parameters is the responsibility of users and can lead to malfunctions.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
84 33002527 10/2019
ADDMX
CAUTION
UNEXPECTED BEHAVIOR OF APPLICATION
Do not use wrong address parameters. For instance, do not set an address parameter that does
not correspond to the targeted equipment.
Failure to follow these instructions can result in injury or equipment damage.
33002527 10/2019 85
ADDMX
86 33002527 10/2019
EcoStruxure™ Control Expert
ADDR
33002527 10/2019
Chapter 6
ADDR: Address Conversion
Description
Function Description
The ADDR function is used to convert a character string into an address that can be used directly
by communication functions.
The additional parameters EN and ENO can be configured.
FBD Representation
Representation:
LD Representation
Representation:
IL Representation
Representation:
LD Addr_String
ADDR
ST Addr_Array
33002527 10/2019 87
ADDR
ST Representation
Representation:
Addr_Array := ADDR(Addr_String);
Parameter Description
The following table describes the input parameters:
CAUTION
UNEXPECTED BEHAVIOR OF APPLICATION
Do not use wrong address parameters. For instance, do not set an address parameter that does
not correspond to the targeted equipment.
Failure to follow these instructions can result in injury or equipment damage.
88 33002527 10/2019
EcoStruxure™ Control Expert
CANCEL
33002527 10/2019
Chapter 7
CANCEL: Stopping an Exchange in Progress
33002527 10/2019 89
CANCEL
Description
Function Description
The CANCEL function is used to interrupt an asynchronous communication function in progress.
The exchange number assigned to each communication can be used to identify the function to be
stopped.
The time between the CANCEL function request and the CANCEL action depends on the number of
communication functions in progress. The use of a CANCEL function means that for all channels
and EFs:
The assigned asynchronous communication functions in progress are cancelled.
The dedicated frames buffered before using the CANCEL function may be sent.
FBD Representation
Representation:
90 33002527 10/2019
CANCEL
Ladder Representation
Representation:
IL Representation
Representation:
LD Exchange_Num
CANCEL
ST Report
ST Representation
Representation:
CANCEL(Exchange_Num, Report);
Parameter Description
The following table describes the input parameters:
33002527 10/2019 91
CANCEL
At a Glance
This example covers canceling an exchange carried out with the OUT_IN_CHAR function.
When the exchange is launched, a unique number is assigned to it. This number remains valid until
the end of the exchange.
The CANCEL function uses this number to interrupt the exchange to which it is assigned.
Parameters Description
%MW180 The least significant bit contains the number of the exchange to be
cancelled. NOTE: The most significant byte must be zero.
%MW185 Function report.
92 33002527 10/2019
EcoStruxure™ Control Expert
CLOSE_TCP_CNX
33002527 10/2019
Chapter 8
CLOSE_TCP_CNX: Close TCP Connections
Description
Functional Description
Use the the CLOSE_TCP_CNX elementary function block to close open TPC connections.
EFB Representation
This is the CLOSE_TCP_CNX elementary function block:
Parameter Description
The following tables describe the parameters in the CLOSE_TCP_CNX elementary function block.
Input parameters:
33002527 10/2019 93
CLOSE_TCP_CNX
Input/output parameters:
Rank 3 word: a word managed by the user that defines the maximum
response time using a time base of 100 ms
Rank 4 word: a word (managed by the system to suppress) that defines
the length of the exchange (For more information, refer to description of
the management parameter structure (see page 42).)
NOTE: For CLOSE_TCP_CNX, the length parameter in rank 4 is not
specified by the user. Immediately after the execution of the logic, the
activity bit is set to 0 and the length is assigned a value of 2 (to
correspond to the length of the returned CNX_STATUS value) if no error
is detected for the rank 2 word. Otherwise, the length value is set to an
additional status code in the case of operation report 16#01 (request not
processed) or 16#02 (incorrect response). Status codes in this field
correspond to a subrange of possible STATUS parameter codes for
communication EFBs with the STATUS parameter. Possible values for
CLOSE_TCP_CNX include 0x30ss, 0x31ss, 0x4001, and 0x4002. Refer
to the descriptions of detected error codes for the STATUS parameter
(see page 520).
Output parameters:
94 33002527 10/2019
CLOSE_TCP_CNX
Step Action
1 Set the address of the communication channel that manages the connection in ADR. (Use the
ADDM block to specify this address in an explicit string format.)
2 Specify the connection to close in the TCPIP parameter.
3 Call the function to launch the communication (with the EN input pin set to 1, if configured).
4 Monitor the activity bit (in the GEST parameter) until the communication is completed (the
activity bit is set to 0 by the system). Execute this function only once to retain the status values.
The function is not called when the activity bit is set to 0 (by setting EN pin to 0 for instance).
5 Check the CNX_STATUS word. If CNX_STATUS = 16#FFFF, check the report parameter in
GEST[1].
33002527 10/2019 95
CLOSE_TCP_CNX
96 33002527 10/2019
EcoStruxure™ Control Expert
CREAD_REG
33002527 10/2019
Chapter 9
CREAD_REG: Continuous Register Reading
Introduction
This chapter describes the CREAD_REG block.
33002527 10/2019 97
CREAD_REG
Description
Function Description
This function block reads a register area continuously. It reads data from an addressed node via
Modbus Plus, TCP/IP Ethernet, or SY/MAX Ethernet.
EN and ENO can be configured as additional parameters.
CREAD_REG, CWRITE_REG, READ_REG, WRITE_REG, and MBP_MSTR function blocks use one data
transaction path and require multiple cycles to complete an operation. The number of transaction
paths available by module and by MAST cycle depends on the communication port used:
Modbus Plus embedded port or NOM modules support up to 4 blocks at the same time.
TCP/IP Ethernet embedded port support up to 4 blocks at the same time.
TCP/IP Ethernet NOE, NOC, and 140 CRP 312 00 modules support up to 16 blocks at the same
time.
More communication function blocks may be programmed on the same communication port.
However, a communication block exceeding the maximum number on that port is not serviced until
one of the transaction paths is available. Then, the next block on the same port becomes active
and begins using an available path.
NOTE: When programming a CREAD_REG function, you must be familiar with the routing
procedures used by your network. Modbus Plus routing path structures are described in detail in
the communication architectures manual (see Communication Services and Architectures,
Reference Manual) and the Modbus Plus Network Planning and Installation Guide (Reference
31003525). If TCP/IP or SY/MAX Ethernet routing is implemented (see Quantum using
EcoStruxure™Control Expert, TCP/IP Configuration, User Manual), standard Ethernet IP router
products must be used.
NOTE: Several copies of this function block can be used in the program. However, multiple
instancing of these copies is not possible.
Representation in FBD
Representation:
98 33002527 10/2019
CREAD_REG
Representation in LD
Representation:
Representation in IL
Representation:
CAL CREAD_REG_Instance (SLAVEREG:=OffsetAddress, NO_REG:=NumberOfReg
isters, ADDRFLD:=DataStructure, REG_READ=>RegisterToRead, STATUS=>Er
rorCode)
Representation in ST
Representation:
CREAD_REG_Instance (SLAVEREG:=OffsetAddress, NO_REG:=NumberOfRegiste
rs, ADDRFLD:=DataStructure, REG_READ=>RegisterToRead, STATUS=>ErrorC
ode) ;
33002527 10/2019 99
CREAD_REG
Parameter Description
Description of input parameters:
Runtime Error
Table of error codes for the Communication Library (see page 518)
Function Mode
NOTE: The WordArr5 data structure can also be used with constants.
NOTE: This function block puts a heavy load on the network; therefore the network load must be
carefully monitored. If the network load is too high, the program logic should be reorganized in
order to work with the READ_REG function block, a variation of this function block that does not
operate in a continuous mode, but under command control.
Parameter Description
SLAVEREG
Start of the area in the addressed slave from which the source data is read. The source area
always resides within the %MW register area.
NOTE: For slaves for a non-Control Expert PLC:
The source area always resides within the 4x register area. SLAVEREG expects the source
reference as offset within the 4x area. The leading "4" must be omitted (e.g. 59 (contents of the
variables or value of the literal) = 40059).
The parameter can be entered as an address, located variable, unlocated variable or literal.
NO_REG
Number of addresses to be read from the addressed slave (1 ... 100).
The parameter can be entered as an address, located variable or unlocated variable.
REG_READ
An ARRAY that is the same size as the requested transmission must be agreed upon (≥ NO_REG)
for this parameter. The name of this array is defined as a parameter. If the array is defined too
small, then only the amount of data is transmitted that is present in the array.
The parameter must be defined as a located variable.
STATUS
If an error occurs while the function is being executed, an error code (see page 520) remains at
this output for one cycle.
The parameter can be entered as an address, located variable or unlocated variable.
Chapter 10
CWRITE_REG: Continuous Register Writing
Introduction
This chapter describes the CWRITE_REG block.
Description
Function Description
This function block writes continuously to the register area. It transfers data from the PLC via
Modbus Plus, TCP/IP Ethernet or SY/MAX Ethernet to an addressed slave.
EN and ENO can be configured as additional parameters.
CREAD_REG, CWRITE_REG, READ_REG, WRITE_REG, and MBP_MSTR function blocks use one data
transaction path and require multiple cycles to complete an operation. The number of transaction
paths available by module and by MAST cycle depends on the communication port used:
Modbus Plus embedded port or NOM modules support up to 4 blocks at the same time.
TCP/IP Ethernet embedded port support up to 4 blocks at the same time.
TCP/IP Ethernet NOE, NOC, and 140 CRP 312 00 modules support up to 16 blocks at the same
time.
More communication function blocks may be programmed on the same communication port.
However, a communication block exceeding the maximum number on that port is not serviced until
one of the transaction paths is available. Then, the next block on the same port becomes active
and begins using an available path.
NOTE: You must be familiar with the routing procedures of the network when programming a
CWRITE_REG function. Modbus Plus routing path structures are described in detail in the
communication architectures manual (see Communication Services and Architectures, Reference
Manual) and the Modbus Plus Network Planning and Installation Guide (Reference 31003525). If
TCP/IP or SY/MAX Ethernet routing is implemented (see Quantum using EcoStruxure™Control
Expert, TCP/IP Configuration, User Manual), standard Ethernet IP router products must be used.
NOTE: Several copies of this function block can be used in the program. However, multiple
instancing of these copies is not possible.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
CAL CWRITE_REG_Instance (SLAVEREG:=OffsetAddress, NO_REG:=NumberOfRe
gisters, REG_WRIT:=SourceDataArea, ADDRFLD:=DataStructure, STATUS=>E
rrorCode)
Representation in ST
Representation:
CWRITE_REG_Instance ( SLAVEREG:=OffsetAddress, NO_REG:=NumberOfRegis
ters, REG_WRIT:=SourceDataArea, ADDRFLD:=DataStructure, STATUS=>Erro
rCode) ;
Parameter Description
Description of input parameters:
Runtime Error
Table of error codes for the Communication Library (see page 518)
Function Mode
NOTE: The WordArr5 data structure can also be used with constants.
NOTE: This function block puts a heavy load on the network; therefore the network load must be
carefully monitored. If the network load is too high, the program logic should be reorganized, in
order to work with the WRITE_REG function block, a variation of this function block that does not
operate in a continuous mode, but under command control.
Parameter Description
SLAVEREG
Start of the area in the addressed slave to which the source data is written. The source area always
resides within the %MW address area.
NOTE: For slaves for a non-Control Expert PLC:
The destination area always resides within the 4x register area. SLAVEREG expects the target
address as an offset within the 4x area. The leading "4" must be omitted (e.g. 59 (contents of the
variables or value of the literal) = 40059).
The parameter can be entered as an address, located variable, unlocated variable or literal.
NO_REG
Number of registers to be written to slave processor (1 ... 100). The parameter can be entered as
an address, located variable, unlocated variable or literal.
STATUS
If an error occurs while the function is being executed, an error code (see page 520) remains at
this output for one cycle.
The parameter can be entered as an address, located variable or unlocated variable.
REG_WRIT
An ARRAY that is the same size as the requested transmission must be agreed upon (≥ NO_REG)
for this parameter. The name of this array is defined as a parameter. If the array is defined too
small, then only the amount of data is transmitted that is present in the array.
The parameter must be defined as a located variable.
Chapter 11
DATA_EXCH: Exchanging Data between Applications
Description
Function Description
The DATA_EXCH function is used to perform data transfers from one device to another with M340,
M580 and Premium CPU:
data transmission
data reception
data transmission then reception
NOTE:
The type of request that can be sent is dependent on the type of CPU:
On Modicon M340 and M580 CPU, this function can be used to send Modbus requests to
another device. Modbus Application Protocol, is described in the http://www.modbus.org web
site.
On Premium CPU, this function can be used to send UNI-TE requests to another device. For
this, it is necessary to make sure the data sent constitutes the entire frame required by the
protocol being used.
The additional parameters EN and ENO can be configured.
FBD Representation
Representation:
LD Representation
Representation:
IL Representation
Representation:
LD Address
DATA_EXCH Action, Data_to_Send, Management_Param,
Received_Data
ST Representation
Representation:
DATA_EXCH(Address, Action, Data_to_Send, Management_Param,
Received_Data);
Parameter Description
The following table describes the input parameters:
For Modicon M340 and M580 CPU, the possible value is:
1: transmission followed by await reception
EMIS ARRAY [n..m] OF Integer table to be sent to the destination device of the request.
INT
NOTE: Verify that a minimum length of 1 element exists, even if there is
no data to send (code 3 for action, for example).
NOTE: Verify that the length of the data to be sent (in bytes) is assigned
to the fourth word of the management table before launching the function,
in order for this to be correctly executed.
Port Length
Ethernet (NOE or Embedded port) 1 Kb
Modbus 256 bytes
The length of the message to be sent or received is indicated in the fourth word of the management
table (see page 48).
The ADDM conversion block is used to indicate the destination of the request.
See the ADDM (see page 73) function.
NOTE: Specfify TCP.MBS keyword when the DATA_EXCH EF is used for Modbus commands over
Ethernet.
All other Ethernet entities are not supported. The DATA_EXCH EF does not manage directly a
connection over TCP.
For open user protocol over Modbus, the following syntax is accepted:
rack.module - Module server
rack.module.channel.device.MBS - Modbus protocol
rack.module.channel.device - User protocol
At a Glance
For this communication function, you can call up the assisted entry screen. Please note that the
assisted entry screen is not available for Modicon M340.
NOTE: The variable symbols are accepted in the different fields of the screen.
Illustration
The following screen shows an assisted entry screen of the function:
Address
For Premium PLCs, the types of object possible are:
ADDR(STRING)
ARRAY [0..5] OF INT
NOTE: If you enter a value directly in the field, the assisted address entry button turns gray.
Mode
Possible choices:
1 :Exchange
2 : Transmission
3 : Reception
NOTE: If you use the entry field instead of the menu, you can enter a variable of the INT type,
either located or not.
Data to Send
The variable for transmission is an integer array. This array can be located or not.
Data to be Received
The reception zone is an array of integers, that can be located or not. The size of this array
depends on the number of objects to be received.
Report
The report is an array of 4 integers, that can be located or not.
NOTE: Do not use several identical memory areas for report tables; otherwise, the variable read
function may not work.
At a Glance
Let us suppose we want two PLC stations to communicate on a Fipway network. Station 1 must
send the data (20 bytes located in %MW70:10) to station 2, which receives it in a table located in
%MW80:10. Each PLC has a management table starting with the address %MW90.
For station 1, the word %MW93 must contain the length of the data to be sent, or 20 (10 words to be
sent).
For station 2, the word %MW93 is set to 0 before the exchange, in order to see the number of
characters received at the end of the exchange.
The DATA_EXCH function requires both PLCs to be programmed, one to send, the other to receive.
Illustration
The two stations are connected via a Fipway network:
Parameters Description
ADDR('{20.2}APP') 20 : network
2 : station
APP: application of station 2
Parameters Description
ADDR('{20.1}APP') 20 : network
1 : station
APP: application of station 1
Description
An Enable Disable HTTP or FTP/TFTP Services operation changes the enabled state of
the module’s HTTP or FTP/TFTP services.
Network Implementation
An Enable Disable HTTP or FTP/TFTP Services operation can be performed on TCP/IP
Ethernet networks.
For M340:
Use the ADDM function.
The destination entity of the exchange is an array of
8 words.
Example: ADDM( '0.4.0' )
Chapter 12
ETH_PORT_CTRL: Activating or Deactivating a Protocol
Function Description
Use the ETH_PORT_CTRL function block to control the FTP TFTP, HTTP, and DHCP / BOOTP
protocols when they are enabled in the Control Expert Security screen (see Modicon M580,
BMENOC0301/0311 Ethernet Communications Module, Installation and Configuration Guide). (By
default, these protocols are disabled.) For cyber security reasons (to help protect data against
requests to modify in the monitoring mode), map the inputs on variables and on unlocated
variables in which the HMI property is disabled (the variable is not in the data dictionary).
The additional parameters EN and ENO may also be configured.
FBD Representation
Representation:
LD Representation
Representation:
IL Representation
CAL ETH_PORT_CTRL_Instance (ENABLE := EnableSecurityChange, ABORT :=
AbortSecurityChange, ADDR := ModuleAddress, ETH_SCE := ServiceToChange,
DONE => BlockExecutionDone, ACTIVE => BlockExecutionInProgress, ERROR
=> BlockExecutionError, STATUS => BlockErrorStatus, ETH_SCE_STATUS =>
ChangeServiceStatus)
ST Representation
ETH_PORT_CTRL_Instance (ENABLE := EnableSecurityChange, ABORT :=
AbortSecurityChange, ADDR := ModuleAddress, ETH_SCE := ServiceToChange,
DONE => BlockExecutionDone, ACTIVE => BlockExecutionInProgress, ERROR
=> BlockExecutionError, STATUS => BlockErrorStatus, ETH_SCE_STATUS =>
ChangeServiceStatus);
Description of Parameters
This table describes the input parameters:
(1) To address a module in the local rack, enter 0.0.10 (CPU main server address).
Execution Type
Synchronous:
When used on the following M580 CPU modules, the ETH_PORT_CTRL function block is
executed synchronously. As a result, the DONE output turns ON as soon as the ENABLE input is
set to ON. In this case, the ACTIVE output remains OFF.
BMEP581020
BMEP582020
BMEP582040
BMEP583020
BMEP583040
BMEP584020
BMEP584040
BMEP585040
BMEP586040
BMEH582040*
BMEH584040*
BMEH586040*
*
In BMEH58•040 Hot Standby CPUs, verify that the ETH_PORT_CTRL function block is
executed equally on both primary and standby CPUs.
Asynchronous:
When used on the following modules, the ETH_PORT_CTRL function block is executed asynchro-
nously and may take several cycles until the DONE output turns ON. Therefore, the ACTIVE output
is set to ON until the completion of the ETH_PORT_CTRL function block.
M340 modules:
BMXNOC0401
BMXNOE0100
BMXNOE0110
M580 modules:
BMENOC0301/11
Step Action
1 Set the bits of the services you want to activate in ETH_SCE.
2 Set ENABLE input to activate the EFB.
3 ENABLE input should be an OR between a pulse command and the ACTIVE output of the EFB.
4 Check STATUS output value:
STATUS<>0: There is a communication issue.
STATUS = 0: Check ETH_SCE_STATUS. The services for which the bits are set haven’t been
modified as they should be.
Chapter 13
EthPort_Control_MX: Activating or Deactivating a Protocol
Function Description
The EthPort_Control_MX function is used in a Unity Pro V8.0 version, for a Modicon M580
CPU embedded Ethernet, to deactivate or activate the following protocols:
FTP
TFTP
HTTP
Enable the protocol in the configuration before the EthPort_Control_MX function is used to
deactivate or re-activate the protocol.
If a protocol is not enabled in the configuration, the EthPort_Control_MX function does not
apply any change and an error is reported.
The additional parameters EN and ENO can be configured.
FBD Representation
Representation:
LD Representation
Representation:
IL Representation
Representation:
EthPort_Control_MX (ENABLE:=EnableControl, ADR:=EntityToControl,
ETHERNET_SERVICE:=ServicesControl)
ST ControlStatus
ST Representation
Representation:
ControlStatus:=EthPort_Control_MX (ENABLE:=EnableControl,
ADR:=EntityToControl, ETHERNET_SERVICE:=ServicesControl);
Parameter Description
The following table describes the input parameters:
Chapter 14
EXCH_QX: Exchanging Data between Applications on EIO Bus
Description
Function Description
The EXCH_QX function is used to perform data transfers (Modbus) to and from Modbus slaves
connected to a Modicon X80 serial communication module (BMX NOM) located in an EIO drop.
NOTE: Modbus Application Protocol, is described in the http://www.modbus.org web site.
The additional parameters EN and ENO can be configured.
The communication function blocks use one data transaction path and require multiple cycles to
complete an operation. The number of transaction paths available by module and by MAST cycle
depends on the communication port used:
Modbus Plus embedded port or NOM modules support up to 4 blocks at the same time.
TCP/IP Ethernet embedded port support up to 4 blocks at the same time.
TCP/IP Ethernet NOE, NOC, and 140 CRP 312 00 modules support up to 16 blocks at the same
time.
More communication function blocks may be programmed on the same communication port.
However, a communication block exceeding the maximum number on that port is not serviced until
one of the transaction paths is available. Then, the next block on the same port becomes active
and begins using an available path.
FBD Representation
Representation:
LD Representation
Representation:
IL Representation
Representation:
CAL EXCH_QX_Instance (ENABLE:=ExchQxEnable, ABORT:=ExchQxAbort,
ADDR:=ModuleAddress, SEND_BYTE:=NbBytesToSend, SEND_BUFFER:=ExchQxData-
Source, DONE=>ExchQxSuccessfull, ACTIVE=>ExchQxActive,
ERROR=>ExchQxFaulty, STATUS=>ErrorCode, REC_BYTE=>NbBytesReceived,
REC_BUFFER=>ReceivedBuffer)
ST Representation
Representation:
EXCH_QX_Instance (ENABLE:=ExchQxEnable, ABORT:=ExchQxAbort,
ADDR:=ModuleAddress, SEND_BYTE:=NbBytesToSend, SEND_BUFFER:=ExchQxData-
Source, DONE=>ExchQxSuccessfull, ACTIVE=>ExchQxActive,
ERROR=>ExchQxFaulty, STATUS=>ErrorCode, REC_BYTE=>NbBytesReceived,
REC_BUFFER=>ReceivedBuffer)
Parameter Description
The following table describes the input parameters:
ST Example
(* Example:
we want to read the %MW1000 on slave number 5 (a M340 PLC for instance)
wired to channel 0 of the NOM in slot 2 of which IP address is
192.168.10.17,
the Quantum CRP is in slot 5 for instance.
First of all you should declare in the data editor the following
variables:
data_to_send as an ARRAY [0..4] OF BYTE (or more if you want to send more
bytes)
bytes_to_send as a WORD
slave_addres as a STRING[40]
received_data as an ARRAY [0..3] OF BYTE (or more if you need)
enable_sending as a BOOL
and you should create an instance of EXCH_QX EFB named for instance
EXCH_QX_6 *)
(* initialize the data to send *)
data_to_send[0]:=16#03; (* Modbus function code read Holding register *)
data_to_send[1]:=16#03; (* MSB of the first register address *)
data_to_send[2]:=16#E8; (* LSB of the first register address, 16#03E8 =
1000*)
data_to_send[3]:=16#00; (* MSB of the quantity of registers to read *)
Chapter 15
INPUT_BYTE: Receiving Character Strings
Description
Function Description
INPUT_BYTE is used to send an array of bytes read request to a character mode communication
module. The message received is stored in an array of bytes.
NOTE: In general, INPUT_BYTE provides same feature like INPUT_CHAR but it allows to pass a
table off bytes instead of a string as output parameter. Because of this, it is possible to read a 0
(NULL) byte value in a byte stream from a serial port.
For Premium PLCs, this function is used to receive up to 4 Kbytes (120 bytes for the terminal port).
For Modicon M340 and M580 CPU, this function is used to receive up to 1024 bytes.
2 exclusive possibilities are available:
Read a number of bytes: No condition should be configured.
Read a message: A stop condition should be configured in the configuration screen.
FBD Representation
Representation:
LD Representation
Representation:
IL Representation
Representation:
LD Address
INPUT_BYTE Raz, Buffer_Length, Management_Param, Received_Data
ST Representation
Representation:
INPUT_BYTE(Address, Raz, Buffer_Length, Management_Param, Received_Data
);
Parameter Description
The following table describes the input parameters:
Programming rules
When several INPUT_BYTE are launched simultaneously, the RAZ parameter must be set to 0
(module's receive memory not reset).
A request may be made to reset the module's memory for the next message in order to avoid
receiving old data.
When the RAZ parameter is set to 1, the INPUT_BYTE function must be launched before sending
the data.
On Premium PLCs, it takes several PLC cycles to receive a byte string of more than 240 bytes (the
string is fragmented). It is therefore important to make sure that the management data is not
modified during the processing of the function. The system receives the string consistently over
several fragments.
On Modicon M340 and M580 CPU, it takes only one CPU cycle to receive a byte string of a
maximum length of 1024 bytes. It is important to make sure that the management data is not
modified during the processing of the function.
The Modicon M340 PLC's serial port is full duplex, so a PRINT_CHAR function can be sent even
when an INPUT_BYTE function has been sent and is still pending.
Chapter 16
INPUT_CHAR: Receiving Character Strings
Description
Function Description
The INPUT_CHAR function is used to send a character string read request to a character mode
communication module (await reception of character strings). The message received is stored in
a character string.
For Premium PLCs, this function is used to receive up to 4 Kbytes (120 bytes for the terminal port).
For Modicon M340 and M580 CPU, this function is used to receive up to 1,024 bytes.
2 exclusive possibilities are available:
Read a number of characters: No condition should be configured.
Read a message: A stop condition should be configured in the configuration screen.
FBD Representation
Representation:
LD Representation
Representation:
IL Representation
Representation:
LD Address
INPUT_CHAR Raz, String_Length, Management_Param, Received_Data
ST Representation
Representation:
INPUT_CHAR(Address, Raz, String_Length, Management_Param, Received_Data
);
Parameter Description
The following table describes the input parameters:
Programming Rules
When several INPUT_CHAR are launched simultaneously, the RAZ parameter must be set to 0
(module's receive memory not reset).
A request may be made to reset the module's memory for the next message in order to avoid
receiving old data.
When the RAZ parameter is set to 1, the INPUT_CHAR function must be launched before sending
the data.
On Premium PLCs, it takes several PLC cycles to receive a character string of more than 240 bytes
(the string is fragmented). It is therefore important to make sure that the management data is not
modified during the processing of the function. The system receives the string consistently over
several fragments.
On Modicon M340 and M580 CPU, it takes only one CPU cycle to receive a character string of a
maximum length of 1,024 bytes. It is important to make sure that the management data is not
modified during the processing of the function.
The Modicon M340 PLC's serial port is full duplex, so a PRINT_CHAR function can be sent even
when an INPUT_CHAR function has been sent and is still pending.
It is possible to launch the INPUT_CHAR function before ending the characters to the PLC.
If the ending characters are used, if in the buffer there are many ending characters and the buffer
hasn't been reset, each INPUT_CHAR function receives the beginning string of the buffer until it
reaches the first ending character and then the buffer is removed from the read characters.
It works in the same way for reading a number of characters.
If ending characters are configured it could be possible to use the number of characters function.
NOTE: RTS/CTS management: In Character mode communication, when using EF INPUT_CHAR,
the characters received on serial link are stored in a ring buffer. The size of this buffer is 1024.
When the buffer is full the other characters are lost. To prevent this loss of characters it is possible
to select the RTS/CTS management. In this case when the ring buffer is almost full, the CPU resets
its RTS signal to stop the sending of the characters.
WARNING
LOSS OF DATA
When using RTS/CTS management the maximum number of characters of a string that are
allowed to be sent by the remote equipment is 1000 (including ending character). If a string of
more than 1000 characters is sent (for example 1013), the RTS will allow to receive only the first
1000 characters, while the INPUT_CHAR function will wait for the ending character indefinitely (if
no timeout has been defined with the function).
Failure to follow these instructions can result in death, serious injury, or equipment damage.
NOTE: If you want to send string of more than 1000 characters (1013 for example) you have to
send the string twice, one sending of the first 1000 characters and the other for the remaining 13
for example.
At a Glance
For this communication function, you can call up the assisted entry screen. Please note that the
assisted entry screen is not available for the Modicon M340.
NOTE: The variable symbols are accepted in the different fields of the screen.
Illustration
The following screen shows an example of the assisted entry screen of the function:
Address
For Premium PLCs, the possible type of object is:
ADDR(STRING)
ARRAY [0..5] OF INT
NOTE: If you enter a value directly in the field, the assisted address entry button turns gray.
Type of Read
The two radio buttons select the mode of operation and this choice must be made according to the
configuration of the channel used.
Number of Characters
You can enter an integer, in the form of a variable or an immediate value.
String to be Received
The reception zone is a variable of theSTRING type. The size of this variable is a function of the
number of characters to be received. This variable must be declared before being used in this
screen.
Report
The report is an array of 4 integers.
NOTE: Do not use several identical memory areas for report tables; otherwise, the variable read
function may not work.
At a Glance
From a station with an address of 1 on Fipway network 20, we would like to read a character string
sent by a video terminal (screen and keyboard) connected to the TER port of the PLC with a
network address of 20, station 5.
This character string is stored in the Str_1 variable, the management table of the communication
function being %MW110:4.
Illustration
The two stations are connected via a Fipway network.
Programming
Programming in ST:
Request parameters:
Parameters Description
ADDR(‘{20.5}0.0.0.SYS’) {20.5} : network 20, station 5
0 : rack
0 : module
0 : channel 0
SYS: system address (terminal port)
1 Reset
0 Read the entire character string
%MW110:4 Management table
Str_1 Variable of type STRING that is to receive the message
Example of Reading Character Strings via Serial Link of Modicon M340 Processors
At a Glance
We would like to read a character string sent by a data entry/display terminal connected to a
Modicon M340 processor’s serial port.
This character string is stored in the Str variable, the management table of the communication
function being gestion.
Illustration
A Modicon M340 PLC is linked to a data entry/display terminal TM8501:
Programming
Programming in ST:
IF (%M15) THEN
INPUT_CHAR(ADDM('0.0.0'), 1, 0, gestion, Str);
END_IF;
Request parameters:
Parameters Description
ADDM(‘0.0.0’) 0 : rack
0 : module
0 : channel 0
SYS: system address (optional on Modicon M340 PLCs)
1 Reset
0 Read the entire character string
gestion Management table
Str Variable of type STRING that is to receive the message
Chapter 17
INPUT_CHAR_QX: Receiving Character Strings on EIO Bus
Description
Function Description
The INPUT_CHAR_QX function is used to receive a character string from a serial device connected
to a Modicon X80 serial communication module (BMX NOM) located in an EIO drop.
The message received is stored in a character string.
The additional parameters EN and ENO can be configured.
NOTE: The INPUT_CHAR_QX function works with a Modicon M340 BMX NOM 0200 module with
a firmware version SV: 1.4 or later. With an earlier firmware version, an error (STATUS = 16#3301)
is raised.
The communication function blocks use one data transaction path and require multiple cycles to
complete an operation. The number of transaction paths available by module and by MAST cycle
depends on the communication port used:
Modbus Plus embedded port or NOM modules support up to 4 blocks at the same time.
TCP/IP Ethernet embedded port support up to 4 blocks at the same time.
TCP/IP Ethernet NOE, NOC, and 140 CRP 312 00 modules support up to 16 blocks at the same
time.
More communication function blocks may be programmed on the same communication port.
However, a communication block exceeding the maximum number on that port is not serviced until
one of the transaction paths is available. Then, the next block on the same port becomes active
and begins using an available path.
FBD Representation
Representation:
LD Representation
Representation:
IL Representation
Representation:
CAL INPUT_CHAR_QX_Instance (ENABLE:=InputCharEnable,
ABORT:=InputCharAbort, ADDR:=ModuleAddress, RESET_BUF:=ResetInput-
Buffer, INPUT_LEN:=NbCharToRead, DONE=>InputCharSuccessfull,
ACTIVE=>InputCharActive, ERROR=>InputCharFaulty, STATUS=>ErrorCode,
REC_LEN=>NbCharReceived, REC_BUF=>ReceivedBuffer)
ST Representation
Representation:
INPUT_CHAR_QX_Instance (ENABLE:=InputCharEnable, ABORT:=InputCharAbort,
ADDR:=ModuleAddress, RESET_BUF:=ResetInputBuffer,
INPUT_LEN:=NbCharToRead, DONE=>InputCharSuccessfull, ACTIVE=>InputChar-
Active, ERROR=>InputCharFaulty, STATUS=>ErrorCode,
REC_LEN=>NbCharReceived, REC_BUF=>ReceivedBuffer)
Parameter Description
The following table describes the input parameters:
Programming Rules
When several INPUT_CHAR_QX are launched simultaneously, the RESET_BUF parameter must be
set to 0 (module's receive memory not reset).
A reset request (RESET_BUF=1) may be made to reset the module's memory for the next message
in order to avoid receiving old data. When the RESET_BUF parameter is set to 1, the
INPUT_CHAR_QX function must be launched before sending the data otherwise the characters
already received are flushed.
It is possible to launch the INPUT_CHAR_QX function before the ending characters to the PLC.
If the ending characters are used, if in the buffer there are many ending characters and the buffer
hasn't been reset, each INPUT_CHAR_QX function receives the beginning string of the buffer until
it reaches the first ending character and then the buffer is removed from the read characters.
It works in the same way for reading a number of characters.
If ending characters are configured it could be possible to use the number of characters function.
WARNING
LOSS OF DATA
When using RTS/CTS management the maximum number of characters of a string that are
allowed to be sent by the remote equipment is 1000 (including ending character). If a string of
more than 1000 characters is sent (for example 1013), the RTS will allow to receive only the first
1000 characters, while the INPUT_CHAR_QX function will wait for the ending character
indefinitely.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
NOTE: If you want to send a string of more than 1000 characters (1013 for example) you have to
send 2 strings. First send 1000 characters and then the remaining 13 characters for example.
Chapter 18
MBP_MSTR: Modbus Plus Master
Introduction
This chapter describes the MBP_MSTR block.
Block Description
Function Description
You can select one of 14 available network communication operations (see page 169) using the
MBP_MSTR function block.
The MBP_MSTR block is supported on various hardware platforms (see page 31).
EN and ENO can be configured as additional parameters.
NOTE: Verify that the programmer is familiar with the routing procedures of your network when
programming an MBP_MSTR function block. Modbus Plus routing path structures are described in
detail in the communication architectures manual (see Communication Services and
Architectures, Reference Manual) and the Modbus Plus Network Planning and Installation Guide.
If TCP/IP or SY/MAX Ethernet routing is implemented (see Quantum using EcoStruxure™Control
Expert, TCP/IP Configuration, User Manual), use standard EtherNet IP router products.
CREAD_REG, CWRITE_REG, READ_REG, WRITE_REG, and MBP_MSTR function blocks use one data
transaction path and require multiple cycles to complete an operation. The number of transaction
paths available by module and by MAST cycle depends on the communication port used:
Modbus Plus embedded port or NOM modules support up to 4 blocks at the same time.
TCP/IP Ethernet embedded port support up to 4 blocks at the same time.
TCP/IP Ethernet NOE, NOC, and 140 CRP 312 00 modules support up to 16 blocks at the same
time.
More communication function blocks may be programmed on the same communication port.
However, a communication block exceeding the maximum number on that port is not serviced until
one of the transaction paths is available. Then, the next block on the same port becomes active
and begins using an available path.
NOTE: In FBD and LD sections, this function block can be used on the program level and with
derived function blocks (DFBs). When using DFBs, verify that the parameters CONTROL and
DATABUF are directly connected to the I/O pins of the DFB.
NOTE: A TCP/IP communication between a Quantum PLC and a Momentum PLC is only possible
when one read or write job is carried out in every cycle. If several jobs are sent per PLC cycle, the
communication stops without generating a detected error message in the status register of the
function block.
NOTE: In Quantum or Premium Hot Standby, to help prevent the former standby CPU from
executing communication functions (now in RUN offline state), add a condition on the status bits
to disable the function if the CPU is offline.
Example:
You can send MBP_MSTR.Enable:=(HSBY_NOEPLCMSTR_ON) AND (%SW61.1) AND NOT
(%SW61.0)
or
You can create a boolean variable, primary_state:=(%SW61.1) AND NOT (%SW61.0), and
insert it for executing the section
NOTE: In M580 Hot Standby, to help prevent the former standby CPU from executing
communication functions (now in RUN offline state), add a condition on the status bits to disable
the function if the CPU is offline.
Example:
You can set MBP_MSTR.Enable:=(HSBY_NOEPLCMSTR_ON AND
ECPU_HSBY_1.LOCAL_HSBY_STS.RUN_PRIMARY)
or
Use the boolean variable ECPU_HSBY_1.LOCAL_HSBY_STS.RUN_PRIMARY as condition
for executing the section
NOTE: Several copies of this function block can be used in the program. However, multiple
instancing of these copies is not possible.
Representation in FBD
Representation in LD
Input Parameters
Output Parameters
Runtime Error
In the event of a detected error occurring during an MBP_MSTR operation, a hexadecimal error code
is displayed in the CONTROL[2] register of the control block for one cycle.
NOTE: Function error codes (see page 520) are network-specific.
NOTE: For a list of all block error codes and values, refer to the tables of error codes for the
communication library (see page 518).
where:
X indicates Yes
- indicates No
Summary
The structure of the MBP_MSTR control block varies according to the type of network you are using.
Structures for Modbus Plus, TCP/IP Ethernet, and SyMax Ethernet are described below.
Register Contents
CONTROL[1] Indicates an operation that is valid for Modbus Plus
CONTROL[2] Indicates the error status
CONTROL[3] Indicates the length, i.e., the number of data units transferred (max. 100)
CONTROL[4] Indicates MSTR operation-dependent information
CONTROL[5] Routing register 1: used to specify a destination node during network transfer (routing path
addresses one of five)
Most significant byte: source node address, i.e., the slot for the Modbus Plus Network
Options Module (NOM)
When using the Modbus Plus Port on the CPU, this byte must be set to 0 (regardless of
the CPU slot).
Least significant byte: destination node address, i.e., a value that represents a direct or a
bridge address. If there is no bridge, this value contains the destination node address. If
there is a bridge, this value contains the address of the bridge.
If the NOM is inserted in slot 7 on the module rack, the most significant byte of routing
register 1 looks as follows (value 0x0706):
Register Contents
CONTROL[1] Indicates an operation that is valid for TCP/IP
CONTROL[2] Indicates the error status
CONTROL[3] Indicates the length, i.e., the number of data units transferred (max. 100)
CONTROL[4] Indicates MSTR operation-dependent information
CONTROL[5] Routing register: used to specify a destination node during network transfer
Most significant byte: source node address, i.e., the NOE slot for the NOE module
When using an integrated Ethernet on the CPU, this byte must be set to 254 (FE hex)
regardless of the CPU slot.
Least significant byte: destination node address, i.e, a value that represents a direct or
bridge address. If there is no bridge the value in the least significant byte is set to 0. If
there is a bridge, this value contains the MBP for the Ethernet mapping index (MET).
If the NOE is inserted in slot 7 on the module rack and the Ethernet mapping index (MET)
is 6, the routing register looks as follows (value 0x0706):
NOTE: CONTROL[10] and CONTROL[11] are used when configuring the MBP_MSTR block for a
Read/Write Data operation (function code 23).
Register Contents
CONTROL[1] Indicates an operation that is valid for SY/MAX
CONTROL[2] Indicates the error status
CONTROL[3] Indicates the length, i.e., the number of registers transferred (max. 100)
CONTROL[4] Indicates MSTR operation-dependent information
CONTROL[5] Routing register: used to specify a destination node during network transfer
Most significant byte: source node address, ie.e, the slot for the NOE module
Least significant byte: destination node address, i.e, a value that represents a direct or
bridge address. If there is no bridge the value in the least significant byte is set to 0. If there
is a bridge, this value contains the MBP for the Ethernet mapping index (MET).
If NOM is inserted in slot 7 on the module rack and the Ethernet mapping index (MET) is
6, the routing register looks as follows (value 0x0706):
Read Data
Description
A read operation transfers data from a specified slave source device to a master destination device
on the network. The operation uses a master transaction path, and may require several cycles to
complete. To program an MBP_MSTR block to perform a write operation, use function code 2
(see page 169).
NOTE: Do not attempt to program an MBP_MSTR to read to its own station address. This action
causes the function block to generate an error in the CONTROL[2] register of the control block
(see page 170).
You can perform a read operation on a nonexistent slave register. The slave detects and logs the
status, which can last for several cycles.
NOTE: For Quantum PLC communication with a Premium/Atrium PLC, confirm that the addressing
is made with an offset of 1. In order to access an address object n of a Premium PLC, confirm that
the communication function of the Quantum PLC uses the n+1 address. IEC addressing starts at
0, and Modbus addressing starts at 1.
Network Implementation
The read operation can be performed on Modbus Plus, TCP/IP Ethernet, and SY/MAX Ethernet
networks.
Register Meaning
CONTROL[1] 2 = read data
CONTROL[2] Indicates the error status.
CONTROL[3] Number of registers to be read from the slave.
CONTROL[4] Determines the %MW starting register in the slave from which the data is read, e.g.,
1 = %MW1, 49 = %MW49.
CONTROL[5] Routing register 1 is used to specify the address (routing path address 1 of 5) of the
... node during a network transfer.
CONTROL[9] The last byte in the routing path that is not 0 is the destination node.
Register Meaning
CONTROL[1] 2 = read data
CONTROL[2] Indicates the error status.
CONTROL[3] Number of addresses to be read from the slave.
CONTROL[4] Determines the %MW starting register in the slave from which the data is read, e.g.,
1 = %MW1, 49 = %MW49.
CONTROL[5] Routing register
most significant byte: network adapter module slot
least significant byte: MBP on Ethernet Transporter (MET) mapping index
CONTROL[6] Each address contains 1 byte of the 32-bit IP address, where the MSB is in
... CONTROL[6] and the LSB is in CONTROL[9].
CONTROL[9]
Register Meaning
CONTROL[1] 2 = read data
CONTROL[2] Indicates the error status.
CONTROL[3] Number of addresses to be read from the slave.
CONTROL[4] Determines the %MW starting register in the slave to which the data is written, e.g.,
1 = %MW1, 49 = %MW49.
CONTROL[5] Routing register:
most significant byte: network adapter module slot
least significant byte: destination drop number
Write Data
Description
A write operation transfers data from a master source device to a specified slave destination device
on the network. The operation uses a master transaction path, and may require several cycles to
complete. To program an MBP_MSTR block to perform a write operation, use function code 1
(see page 169).
NOTE: Do not attempt to program an MBP_MSTR to write to its own drop address. This action
causes the function block to generate an error in the CONTROL[2] register of the control block
(see page 170).
You can perform a write operation to a nonexistent slave register. The slave detects and logs the
status, which can last for several cycles.
NOTE: For Quantum PLC communication with a Premium/Atrium PLC, confirm that the addressing
is made with an offset of 1. In order to access an address object n of a Premium PLC, confirm that
the communication function of the Quantum PLC uses the n+1 address. IEC addressing starts at
0, and Modbus addressing starts at 1.
Network Implementation
The write operation can be performed on Modbus Plus, TCP/IP Ethernet, and SY/MAX Ethernet
networks.
Register Meaning
CONTROL[1] 1 = write data
CONTROL[2] Indicates the error status.
CONTROL[3] Number of addresses sent to the slave.
CONTROL[4] Determines the %MW starting register in the slave to which the data is written, e.g.
1 = %MW1, 49 = %MW49.
CONTROL[5] Routing register 1 is used to specify the address (routing path address 1 of 5) of the node
... during a network transfer.
CONTROL[9] The last byte in the routing path that is not 0 is the destination node.
Register Meaning
CONTROL[1] 1 = write data
CONTROL[2] Indicates the error status.
CONTROL[3] Number of addresses sent to the slave.
CONTROL[4] Determines the %MW start address of the slave to which the data is written.
CONTROL[5] Routing register:
most significant byte: network adapter module slot
least significant byte: MBP on Ethernet transporter (MET) mapping index
Register Meaning
CONTROL[1] 1 = write data
CONTROL[2] Indicates the error status.
CONTROL[3] Number of addresses sent to the slave.
CONTROL[4] Determines the %MW starting register in the slave to which the data is written, e.g.,
1 = %MW1, 49 = %MW49.
CONTROL[5] Routing register:
most significant byte: network adapter module slot
least significant byte: destination drop number
Description
A Get Local Statistics operation reads the data from the local node in one cycle and does
not require a master transaction path.To program an MBP_MSTR block to
Get Local Statistics, use function code 3 (see page 169).
Network Implementation
A Get Local Statistics operation can be performed on Modbus Plus and TCP/IP Ethernet
networks (see page 209).
Register Meaning
CONTROL[1] 3 = get local statistics
CONTROL[2] Indicates the error status
CONTROL[3] Number of addresses to be read from local statistics (1 ... 54)
Note: The size of databuf must be at least the size of this entry.
CONTROL[4] First address from which the statistics table must be read (Reg1=0)
CONTROL[5] Routing register 1 is used to specify the address (routing path address 1 of 5) of the node
during a network transfer.
The last byte in the routing path that is not 0 is the destination mode.
Register Meaning
CONTROL[1] 3 = get local statistics
CONTROL[2] Indicates the error status
CONTROL[3] Number of addresses to be read from local statistics (1 ... 38)
Note: The size of databuf must be the size of this entry.
CONTROL[4] First address from which the statistics table must be read (Reg1=0)
CONTROL[5] Routing register
Most significant byte: Network adapter module slot
CONTROL[6] Not used
...
CONTROL[9]
Description
A clear local statistics operation clears the values from words 13 ... 22 in the statistics table of the
local node. The operation is carried out in one cycle and does not require a master transaction
path. To program an MBP_MSTR block to clear local statistics, use function code 4 (see page 169).
Network Implementation
A clear local statistics operation can be performed on Modbus Plus and TCP/IP Ethernet networks
(see page 209).
Register Meaning
CONTROL[1] 4 = clear local statistics
CONTROL[2] Indicates the error status
CONTROL[3] Reserved
CONTROL[4] Reserved
CONTROL[5] Routing register 1 is used to specify the address (routing path address 1 of 5) of the node
during a network transfer.
The last byte in the routing path that is not 0 is the destination mode.
Register Meaning
CONTROL[1] 4 = clear local statistics
CONTROL[2] Indicates the error status
CONTROL[3] Reserved
CONTROL[4] Reserved
CONTROL[5] Routing register
Most significant byte: network adapter module slot
CONTROL[6] Reserved
...
CONTROL[9]
Description
A write global data operation transfers data to the communication processor of the current node;
the data can be transmitted on the network as soon as the node receives the token and then read
by all nodes connected to the local network (see page 180) .
A write global data operation is carried out in one cycle and does not require a master transaction
path. To program an MBP_MSTR block to write global data, use function code 5 (see page 169).
Network Implementation
A write global data operation can be performed only on Modbus Plus networks. The read and write
global data operations comprise a Modbus Plus capability known as Peer Cop.
Register Meaning
CONTROL[1] 5 = write global data
CONTROL[2] Indicates the error status
CONTROL[3] Number of addresses to be written from state RAM into global data
memory (comm processor) (1...32)
CONTROL[4] Reserved
CONTROL[5] If global data is sent via a NOM, enter the NOM module slot in the most
significant byte of this register.
Description
A read global data operation reads data from the communications processor of a node on the
network that has written global data (see page 179). A master transaction path is not required.
A read global data operation can take several cycles if the global data is not currently available with
the nodes called. If global data is available, the operation is executed in one cycle. To program an
MBP_MSTR block to write global data, use function code 6 (see page 169).
Network Implementation
A read global data operation can be performed only on Modbus Plus networks. The read and write
global data operations comprise a Modbus Plus capability known as Peer Cop.
Register Meaning
CONTROL[1] 6 = read global data
CONTROL[2] Indicates the error status
CONTROL[3] Number of addresses to be sent from global data memory (comm
processor) (1...32)
CONTROL[4] Displays the addresses available in the scanned node. (This register Is
automatically updated.)
CONTROL[5] The least significant byte contains the address of the node whose global
data is to be read. It can be a value in the range 1 ... 64.
If global data is received via a NOM, enter the NOM module slot in the most
significant byte of this address.
Description
A get remote statistics operation can be used to read data from remote nodes on the network. With
each query, the remote communications processor supplies a complete table of statistics even if
the query does not refer to the entire table. It then copies only the words that you queried into
identified $MW addresses.
An operation can take several cycles to complete; it does not require a master data transaction
path. To program an MBP_MSTR block to get remote statistics, use function code 7 (see page 169).
Network Implementation
A get remote statistics operation can be performed on Modbus Plus and TCP/IP Ethernet
networks.
Register Meaning
CONTROL[1] 7 = get remote statistics
CONTROL[2] Indicates the error status
CONTROL[3] Number of addresses to be read from the statistics data field (1 ... 54).
Note: The size of databuf must be at least the size of this entry.
CONTROL[4] First address from which the node statistics must be read. The number of
available statistics registers cannot be exceeded.
CONTROL[5] Routing address 1 ... 5 of the node.
... The last byte in the routing path that is not 0 is the destination node.
CONTROL[9]
Register Meaning
CONTROL[1] 7 = get remote statistics
CONTROL[2] Indicates the error status
CONTROL[3] Number of addresses to be read from the statistics data field (1 ... 38).
Note: The size of databuf must be at least the size of this entry.
CONTROL[4] First address from which the node statistics must be read. The number of
available statistics registers cannot be exceeded.
CONTROL[5] Routing register
Most significant byte: network adapter module slot
CONTROL[6] Each address contains 1 byte of the 32-bit IP address, where the value in
... CONTROL[6] is the MSB and the value in CONTROL[9] is the LSB.
CONTROL[9]
Description
A clear remote statistics operation clears remote-node values from words 13 ... 22 in the statistics
table of the local node. It uses a master transaction path and may require several cycles to
complete. To program an MBP_MSTR block to perform a clear remote statistics operation, use
function code 8 (see page 169).
Network Implementation
A clear remote statistics operation can be performed on Modbus Plus and TCP/IP Ethernet
networks (see page 209).
Register Meaning
CONTROL[1] 8 = clear remote statistics
CONTROL[2] Indicates the error status
CONTROL[3] Reserved
CONTROL[4] Reserved
CONTROL[5] Routing register 1 is used to specify the address (routing path address 1 of 5) of the
... destination node during a network transfer.
CONTROL[9] The last byte in the routing path that is not 0 is the destination mode.
Register Meaning
CONTROL[1] 8 = clear remote statistics
CONTROL[2] Indicates the error status
CONTROL[3] Reserved
CONTROL[4] Reserved
CONTROL[5] Routing Register
Most significant byte: network adapter module slot
CONTROL[6] Each address contains one byte of the 32-bit IP address, where the MSB is in
... CONTROL[6] and the LSB is in CONTROL[9].
CONTROL[9]
Description
A peer cop health operation reads selected data from the peer cop communications health table
and downloads the data to the specified %MW addresses in state RAM. To program an
MBP_MSTR block to perform a clear remote statistics operation, use function code 9
(see page 169).
NOTE: Peer cop health is operational only when a peer cop-based I/O scanner has been
configured.
The peer cop communications health table is 12 words long; MBP_MSTR indexes these words with
the numbers 0 ... 11.
Network Implementation
A peer cop health operation can be performed only on Modbus Plus networks.
Register Meaning
CONTROL[1] 9 = peer cop health
CONTROL[2] indicates the error status.
CONTROL[3] Number of words wanted by the peer cop table (1...12)
CONTROL[4] First word to be read from the peer cop table, where 0 = the first word and 11 = the last
word)
CONTROL[5] Routing address 1
If this is the second of two local nodes, set the value in the high byte to 1.
Description
A reset optional module operation causes a Quantum NOE Ethernet communications module or
the Ethernet port on a 140CPU65150/60 CPU module to enter a cycle that resets its working
environment. To program an MBP_MSTR block to perform a reset option module operation, use
function code 10 (see page 169).
Network Implementation
A reset optional module operation can be performed on TCP/IP Ethernet (see page 209) and
SY/MAX Ethernet networks.
Register Meaning
CONTROL[1] 10 = reset optional module
CONTROL[2] Indicates the error status
CONTROL[3] No significance
CONTROL[4] No significance
CONTROL[5] Routing register (see page 171)
CONTROL[6] No significance
...
CONTROL[9]
Register Meaning
CONTROL[1] 10 = reset optional module
CONTROL[2] Indicates the error status
CONTROL[3] No significance
CONTROL[4] No significance
CONTROL[5] Routing register (see page 172)
CONTROL[6] No significance
...
CONTROL[9]
Read CTE
Description
A read CTE operation reads a specified number of bytes from the Ethernet configuration extension
table in the specified buffer of PLC memory. These bytes start with a byte offset at the CTE table
start. The CTE table contents are displayed in the DATABUF output parameter (see page 168). To
program an MBP_MSTR block to perform a clear remote statistics operation, use function code 11
(see page 169).
Network Implementation
A read CTE operation can be performed on TCP/IP Ethernet and SY/MAX Ethernet networks.
Register Meaning
CONTROL[1] 11 = read CTE
CONTROL[2] Indicates the error status
CONTROL[3] The length setting: a value from 12 to 37
CONTROL[4] No significance
CONTROL[5] Routing register
Least significant byte = mapping index
Either a value displayed in the byte of the register or is not used.
or Most significant byte = network adapter module slot
CONTROL[6]... No significance
CONTROL[9]
Register Meaning
CONTROL[1] 11 = read CTE
CONTROL[2] Indicates the error status
CONTROL[3] Number of words transferred
CONTROL[4] Byte offset in the PLC register structure, specifying from where the CTE
bytes are read
CONTROL[5] Routing register
MSB: slot of the NOE module
CONTROL[6] Terminator: FF hex
...
CONTROL[9]
Write CTE
Description
A write CTE operation writes the CTE configuration table from the specified data (DATABUF) to a
specified Ethernet configuration extension table or to a specific slot. To program an MBP_MSTR
block to perform a write CTE operation, use function code 12 (see page 169).
Network Implementation
A write CTE operation can be performed on TCP/IP Ethernet (see page 209) and SY/MAX
Ethernet networks.
Register Meaning
CONTROL[1] 12 = write CTE
CONTROL[2] Indicates the error status
CONTROL[3] The length setting: a value from 12 to 37.
CONTROL[4] No significance
CONTROL[5] Routing register
Least significant byte = mapping index
Either a value displayed in the byte of the address or is not used.
or
Most significant byte = network adapter module slot
CONTROL[6] No significance
...
CONTROL[9]
Register Meaning
CONTROL[1] 12 = Write CTE (Config extension table)
CONTROL[2] Indicates the error status
CONTROL[3] Number of words transferred
CONTROL[4] Byte offset in the PLC address structure specifying where the CTE bytes are written
CONTROL[5] Routing register
Most significant byte = NOE module slot
Least significant byte = Destination drop number
CONTROL[6] Terminator: FF hex
CONTROL[7] No significance
...
CONTROL[9]
Send Email
Description
The electronic mail notification service allows controller-based projects to report alarms or events.
The controller monitors the system and dynamically creates an electronic mail message, which
alerts local or remote users.
A user-defined event or condition triggers the MSTR block to create a message. Each message
uses one of three user-defined headers. Each message sent from the controller can contain text
and variable information (with a maximum of 238 bytes).
The project selects the appropriate header. Each header contains:
sender name
list of recipients
subject
To program an MBP_MSTR block to send email, use function code 13 (see page 169).
Network Implementation
A send email operation can be performed on a TCP/IP Ethernet network.
Register Meaning
CONTROL[1] 13 = send Email
CONTROL[2] Indicates the email-specific error codes (see page 532)
CONTROL[3] Number of words transferred
CONTROL[4] Not used
CONTROL[5] High byte: slot address of the NOE module or 0xFE for the 140 CPU 651 60
Low byte: always 0
CONTROL[6] Not used
...
CONTROL[9]
Register Contents
DATABUF 1 The mail header is the least significant byte with a value of 1, 2, or 3.
The most significant byte contains the number (n) of characters in the subject, a value
between 0 and 238.
DATABUF 2 The data (in ASCII format) that will be copied into the Email message.
... The first n characters are added to the configured Email subject. The remaining
DATABUF 119 characters (2 * N -2 - n) are part of the message body, where N is the number of words
transferred.
At a Glance
Use MSTR operation 15 to send generic Modbus requests on the network.
NOTE: This operation is not available on Modbus Plus ports (embedded port on CPU or NOM
modules) and the embedded Ethernet port on a CPU.
Block Operation
The MBP_MSTR block can send requests and receive responses up to 253 bytes long.
For the operation, refer to Block Operation (see page 166):
When the ENABLE input pin is turned ON, operation 15 begins.
If the ABORT input pin is turned ON or if the ENABLE input pin is turned OFF, the operation
ends.
The ACTIVE output pin is ON during the operation.
The ERROR output pin turns ON if the operation aborts without success.
The SUCCESS output pin turns ON if the operation completes with success.
The CONTROL and DATABUF output pins define the operation (refer to the Control Block
(see page 193) and Data Buffer (see page 194)).
EN and ENO can be configured as additional parameters.
Control Block
The format of the Control block is described in the following table:
Word Description
CONTROL[1] 15 = Send Modbus Request
CONTROL[2] Indicates detected error status
CONTROL[3] DATABUF length (WORDs)
CONTROL[4] Offset for the beginning of the response in the DATABUF (WORDs).
NOTE: To avoid overwriting the request, the Response Offset value multiplied by 2 must
be greater than the Request Length (CONTROL[10]).
CONTROL[5] Routing register:
High byte = Ethernet communication module slot
Low byte = MBP on Ethernet transporter (MET) mapping index (also known as Unit ID)
CONTROL[6] Byte 4 of the IP address (MSB)
CONTROL[7] Byte 3 of the IP address
CONTROL[8 Byte 2 of the IP address
CONTROL[9] Byte 1 of the IP address (LSB)
CONTROL[10] Length of the DATABUF Request data (bytes)
CONTROL[11] Length of the DATABUF Response received (bytes)
NOTE: This is read only, it is set by option module after operation completion.
Data Buffer
The MODBUS protocol defines a simple protocol data unit (PDU) independent of the underlying
communication layers.
The data buffer (DATABUF) consists of contiguous registers that include both the Modbus Request
PDU and the Modbus Response PDU:
CAUTION
LOSS OF DATA
Verify that the Response Offset is greater than the Data Request Length.
Failure to follow these instructions can result in injury or equipment damage.
NOTE: Both the Request and Response must be structured in little endian order. Each word of 2
bytes of data in little endian format, where the least significant byte is stored in the smallest memory
address.
Modbus Request
The Modbus Request PDU format is:
Modbus Response
The Modbus Response PDU format is:
Modbus Specification
The standard Modbus function codes are defined in the MODBUS Application Protocol
Specification, V1.1b, which can be downloaded from www.modbus-ida.org.
At a Glance
Use MBP_MSTR operation 16 to close a Modbus TCP/IP connection on the network.
NOTE: This operation is not available on Modbus Plus ports (embedded port on CPU or NOM
modules).
Block Operation
The MBP_MSTR block can send requests and receive responses up to 253 bytes long. For block
operation, refer to the block description (see page 166):
When the ENABLE input pin is turned ON, operation 15 begins.
If the ABORT input pin is turned ON or if the ENABLE input pin is turned OFF, the operation
ends.
The ACTIVE output pin is ON during the operation.
The ERROR output pin turns ON if the operation aborts without success.
The SUCCESS output pin turns ON if the operation completes with success.
The CONTROL and DATABUF output pins (see page 168) define the operation.
EN and ENO can be configured as additional parameters.
Control Block
The format of the CONTROL block is described below:
Read/Write Data
Introduction
In a single transaction, the MSTR read and write operations can transfer data from a master source
device to a specified slave destination device, then transfer data from this specified slave source
to the master. It uses a master transaction path and may require several cycles to complete. To
program an MBP_MSTR block to perform a combined read/write operation, use function code 23
(see page 169).
The combined read/write operation can be used only with these models:
Quantum: NOE 771 01 (3.0 or later) or NOE 771 11 (3.0 or later)
Momentum: M1E CPU (1.0 or later)
Register Content
CONTROL[1] 23 = read/write data.
CONTROL[2] Indicates the error status.
CONTROL[3] Number of registers to be sent to the slave.
CONTROL[4] Specifies the %MW starting register in the slave to which the data will be
written, e.g. 1 = %MW1, 49 = %MW49.
CONTROL[5] Routing register:
Most significant byte: network adapter module slot.
Least significant byte: MBP on Ethernet Transporter (MET) mapping
index.
CONTROL[6] Each address contains 1 byte of the 32-bit IP address, where the MSB is
... in CONTROL[6] and the LSB is in CONTROL[9].
CONTROL[9]
CONTROL[10] Number of registers to be read from slave.
CONTROL[11] Specifies the %MW starting register in the slave from which the data is
read, e.g. 1 = %MW1, 49 = %MW49.
NOTE:
When configuring the MBP_MSTR block for a read/write data operation, note that
The DATABUF output parameter is used to store, in the following sequence, both:
1 the data to be written
2 the data to be read
The size of the DATABUF output parameter must equal the combined size of the data to be
written and the data to be read; if the size is smaller, data will be overwritten and may be lost.
Both the CONTROL and DATABUF parameters must be stored at located addresses, for example
%MW addresses.
Description
An Enable Disable HTTP or FTP/TFTP Services operation changes the enabled state of
the module’s HTTP or FTP/TFTP services.
Network Implementation
An Enable Disable HTTP or FTP/TFTP Services operation can be performed on TCP/IP
Ethernet networks (see page 209).
Register Meaning
CONTROL[1] 65520 (dec) FFF0 (hex) = enable / disable HTTP or FTP/TFTP
CONTROL[2] Indicates the error status. Possible return codes include:
0x000 (Success): MSTR block with operational code 65520 was called and the enabled
state of HTTP or FTP/TFTP was changed.
0x5068 (Busy): MSTR block with operational code 65520 was called within 2 seconds of
the previous call (regardless of return code from previous call).
0x4001 (Same state): MSTR block with operational code 65520 was called to change the
enabled state of HTTP and FTP/TFTP to the states they were already in.
0x2004 (Invalid data): MSTR block with operational code 65520 was called and the data in
the control block did not match the specifications.
0x5069 (Disabled): If the HTTP or FTP/TFTP service was already disabled via the
Control Expert interface when the MSTR block with operational code 65520 was called to
change the state of the disabled service.
CONTROL[3] Set this register to 1
CONTROL[4]
CONTROL[5] Module slot number and destination ID
High byte = Module slot number communication module slot
Low byte = Destination ID
CONTROL[6] Request mode
Bit 0 (LSB) = 1: Enable FTP/TFTP
Bit 0 (LSB) = 0: Disable FTP/TFTP
Bit 1 = 1: Enable HTTP
Bit 1 = 0: Disable HTTP
Register Meaning
CONTROL[7] Set this register to 0
CONTROL[8]
CONTROL[9]
HTTP, FTP, and TFTP service state changes made by MSTR with operation code 65520 (dec) are
overridden by the configured value when the module is power-cycled or reset and when a new
application is downloaded to the module.
Here are some examples:
Network Implementation
A Peer Cop communications health status operation can be performed only on Modbus Plus
networks.
Send direct 4
Receive direct 8
10
11
Word Meaning
00 to 02 MAC address Word Contents
e.g. MAC address 00 00 54 00 12 34 is 00 00 00
displayed as follows: 01 54 00
02 12 34
03 Board status (refer to the following table)
04 and 05 Number of receiver interrupts
06 and 07 Number of transfer interrupts
08 and 09 Transfer timeout error count
10 and 11 Collision detection error count
12 and 13 Omitted packets
14 and 15 Memory error count
16 and 17 Number of restarts performed by the driver
18 and 19 Receive framing error count
20 and 21 Overflow error count receiver
22 and 23 Receive CRC error counter
24 and 25 Receive buffer error counter
26 and 27 Transfer buffer error counter
28 and 29 Transfer bin underflow counter
30 and 31 Late collision counter
32 and 33 Lost carrier counter
34 and 35 Number of retries
36 and 37 IP address Word Contents
e.g. the IP address 198.202.137.113 (or 36 89 71
C6 CA 89 71) is represented as follows: 37 C6 CA
Bit # Definition
15 0 = Link LED off 1 = Link LED on
14 0 = Appl LED off 1 = Appl LED on
13 0 = twisted pair 1 = fiber
12 0 = 10 Mbit 1 = 100 Mbit
11 ... 8 (Reserved)
7 ... 4 Module type (see table, below)
3 (Reserved)
2 0 = half duplex 1 = full duplex
1 0 = not configured 1 = configured
0 0 = not running 1 = running
NOTE: Bits are numbered from right to left, starting with bit 0 (low bit). For example, PLC running
= 0000 0000 0000 0001 and LED connection = 1000 0000 0000 0000.
The following table describes the word bit definitions for board status for the:
140 NOE 771 x1, version 3.5
140 NOE 771 x0, versions 1.02 and 2.0
140 CPU 651 x0
Bit # Definition
15 ... 12 Module type (see table below)
11 (Reserved)
10 0 = half duplex 1 = full duplex
9 0 = not configured 1 = configured
8 0 = PLC not running 1 = PLC/NOE running
7 0 = Link LED off 1 = Link LED on
6 0 = Appl LED off 1 = Appl LED on
5 0 = twisted pair 1 = fiber
4 0 = 10 Mbit 1 = 100 Mbit
3 ... 0 (Reserved)
NOTE: Bits are counted from right to left, starting with bit 0 (low bit). For example, PLC running =
0x0100, Application LED = 0x0040, and LED Connection = 0x0080.
Chapter 19
ModbusP_ADDR: Modbus Plus Address
Introduction
This chapter describes the ModbusP_ADDR block.
Description
Function Description
This function block allows the entry of the Modbus Plus address for function blocks READ_REG,
CREAD_REG, WRITE_REG and CWRITE_REG. The address is transferred as a data structure.
EN and ENO can be configured as additional parameters.
NOTE: You must be familiar with your network when programming the ModbusP_ADDR function
block. Modbus Plus routing path structures are described in detail in the communication
architectures manual (see Communication Services and Architectures, Reference Manual) and
the Modbus Plus Network Planning and Installation Guide (Reference 31003525).
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
CAL ModbusP_ADDR_Instance (SLOT_ID:=NOMModuleSlot, ROUTING1:=BYTE_va
riable1, ROUTING2:=BYTE_variable2, ROUTING3:=BYTE_variable3, ROUTING
4:=BYTE_variable4, ROUTING5:=BYTE_variable5, ADDRFLD=>DataStructu
reModbusPlusAddress)
Representation in ST
Representation:
ModbusP_ADDR_Instance (SLOT_ID:=NOMModuleSlot, ROUTING1:=BYTE_variab
le1, ROUTING2:=BYTE_variable2, ROUTING3:=BYTE_variable3, ROUTING4:=B
YTE_variable4, ROUTING5:=BYTE_variable5, ADDRFLD=>DataStructureMo
dbusPlusAddress) ;
Parameter Description
Description of input parameters:
Detailed Description
Slot_ID
If a Modbus Plus network option module (NOM) in the rack of a Quantum controller is addressed
as the destination node, the value at the Slot_ID input represents the physical NOM slot, i.e. if
the NOM is plugged in at Slot 7 of the rack, the value appears as follows:
Routing x
The Routing x input is used for address specification (routing path addresses one of five) of the
destination node during network transfer. The last byte in the routing path that is not zero is the
destination node.
Routing Tab 1
If a Modbus Plus Network Options Module (NOM) is addressed as the destination node in a
Quantum control module rack, the most significant byte represents the physical slot of the NOM. If
the destination node is a CPU, the most significant byte (regardless of the CPU slot) is set to "0".
If NOM is inserted in slot 7 on the module rack, the most significant byte of routing tab 1 looks as
follows:
Chapter 20
OUT_IN_CHAR: Sending/Receiving Character Strings
Description
Function Description
The OUT_IN_CHAR function is used to send a string of a maximum of 210 bytes (120 for the
terminal port), followed by a message receive request (send only or receive only is also possible).
The character string may be contained in a static variable (see EcoStruxure™ Control Expert,
Program Languages and Structure, Reference Manual) or stipulated in the form of an immediate
value (series of bytes between apostrophes, e.g.: 'Message to be sent').
These character strings may contain special characters, and must start with the character $
followed by the hexadecimal value of the character to be sent, for example $0D.
Certain special characters (see EcoStruxure™ Control Expert, Program Languages and Structure,
Reference Manual) may be used, such as:
$R = CR (carriage return), $L = LF (line feed), $N = CR+LF.
The additional parameters EN and ENO can be configured.
FBD Representation
Representation:
LD Representation
Representation:
IL Representation
Representation:
LD Address
OUT_IN_CHAR Mode, Data_to_Send, Management_Param, Received_Data
ST Representation
Representation:
OUT_IN_CHAR(Address, Mode, Data_to_Send, Management_Param, Received_Dat
a);
Parameter Description
The following table describes the input parameters:
NOTE: At the time of transmission or of a transmission followed by reception, the user is advised
to initialize the fourth word of the management table (length) before executing the function. Also,
the length of the character string received is stored in this same word at the end of this exchange.
However, prior to this, during configuration, it is necessary to define a stop condition (see Premium
and Atrium using EcoStruxure™ Control Expert, Asynchronous Serial Link, User Manual).
To send character strings containing end of string characters (ZERO). You must:
Use localized STRINGS.
Initialize the last word of the exchange management table with the number of characters to
send. If you initialize this word with the value 0, the string that is sent will stop at the first ZERO
character it encounters. If you initialize it will a value, the length of the character string sent will
be equal to this value.
At a Glance
For this communication function, you can call up the assisted entry screen. Please note that the
assisted entry screen is not available for Modicon M340.
NOTE: The variable symbols are accepted in the different fields of the screen.
Illustration
The following screen shows an example of the assisted entry screen of the function:
Address
For Premium PLCs, the possible type of object is:
ADDR(STRING)
ARRAY [0..5] OF INT
NOTE: If you enter a value directly in the field, the assisted address entry button turns gray.
Mode
The selection from the drop-down list:
Exchange
Transmission
Reception
String to be Sent
The string to be send is a variable of the STRING type. This variable must be declared before being
used.
If the choice of string is a variable (example String_0), the immediate value entry field
disappears.
String to be Received
The reception zone is a variable of theSTRING type. The size of this variable is a function of the
number of characters to be received. This variable must be declared before being used in this
screen.
Report
The report is an array of 4 integers.
NOTE: Do not use several identical memory areas for report tables; otherwise, the variable read
function may not work.
At a Glance
Let us assume we want to send a character string Str_1 from station 1 of network 20 to the
terminal port of station 5, then receive a character string Str_2 from the terminal port of station 5
of the same network.
Here, a video terminal is connected to the terminal port of station 5 of network 20.
The string to be sent contains 10 characters.
The function's management table is made up of the table of words %MW170:4.
Illustration
The two stations are connected via a Fipway network.
Programming
Programming in ST:
Request parameters:
Parameters Description
ADDR(‘{20.5}0.0.0.SYS’) {20.5}: network 20, station 5
0: rack
0: module
0: channel 0
SYS: system address
NOTE: Before the function is launched, initialize the length parameter (in the example:
%MW173 ) with the value corresponding to the number of characters (in bytes) to send to Str_1).
At the end of the exchange, %MW173 will contain the length of the data received (in bytes).
Chapter 21
OUT_IN_MBUS: Modbus Communication Function
Section 21.1
General Presentation of the OUT_IN_MBUS Communication Block
Function Description
Introduction
The OUT_IN_MBUS function is used to emulate a Modbus master communication from a serial link
configured in character mode.
Combined with the possibility of passing a Modbus slave configuration on the fly to a configuration
in character mode via the function WRITE_CMD, this function allows the PLC to operate either as
master or as Modbus slave on the same link.
NOTE: This function is only useful when the two modes Modbus master and slave are operating
concurrently. If this is not the case, the EF standards READ_VAR and WRITE_VAR are
recommended for managing the Modbus master function (Modbus slave is implicitly managed by
the system). In this case see the Modbus documentation.
NOTE: Be careful that two masters (on the same bus) do not send requests simultaneously
otherwise the requests are lost and each report will have a bad result which could be 16#0100
(request could not be processed) or 16#ODFF (slave is not present).
WARNING
UNEXPECTED APPLICATION BEHAVIOR - WRITING VARIABLES TO SLAVES
Before writing variables from a master to a slave ensure that the resulting application behavior
remains acceptable.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
Sample Use
Nominal Mode
Most applications are comprised of a PC used for supervision applications. The supervisor is a
Modbus master that communicates with different slaves. This operating mode is called the nominal
mode.
The figure below illustrates the nominal mode (supervisor to slave):
Functionalities
At a Glance
The OUT_IN_MBUS function supports:
The Modbus codes 1, 2, 3, 4, 5, 6, 15, 16 (see page 237)
The ASCII and RTU modes (see page 240)
The complete addressing (see page 237)
The OUT_IN_MBUS function is present as a DFB and it must be restarted at each PLC cycle as
long as the activity bit is set to 1.
The function is available on Premium PLCs using a TSXSCP111 or TSXSCP114 communication
card installed in the processor or a host module (TSXSCY21601 or TSXSCY11601).
Restrictions
On each of the ports, you must not simultaneously activate more than one OUT_IN_MBUS DFB.
Similarly, you must not simultaneously use the PRINT_CHAR, INPUT_CHAR or OUT_IN_CHAR
blocks.
Section 21.2
Description of the OUT_IN_MBUS Communication Block
FBD Representation
Representation:
LD Representation
Representation:
IL Representation
Representation:
LD Address
OUT_IN_MBUS AD, MC, RL, DB, AB, MDA, RT, AC, DO, ERR, ST
ST Representation
Representation:
OUT_IN_MBUS(AD, MC, RL, DB, AB, MDA, RT, AC, DO, ERR, ST);
Parameter Description
The following array describes the input parameters:
NOTE: In order to read one of the last 8 bits of the memory it is necessary to read all the last 8,
otherwise the function sends back an error status report. Then it possible to extract the bit needed.
NOTE: The input/output parameter uses a dynamic array, you must in this case check in
Control Expert Allow dynamic arrays [ANY_ARRAY_XXX] under tool → project option → language
extension.
Note: When the slave PLC is of Premium type, all bits become %Ms and the registers
become %MWs.
MbusCmd[3] Data area of For a read command, the data area of the slave PLC is the source of data. For a write
the slave command, the data area of the slave PLC is the destination of data.
PLC For example:
To read the output bits 300 to 500 of a slave PLC, enter 300 in this field.
To write the data of a master PLC in register 100 of type 4x of a slave PLC, enter
100 in this field.
According to the type of Modbus command (read or write), the source and target data
areas must match those in the array below (see page 238).
MbusCmd[4] Quantity This register contains the quantity of data to write or to read in the slave PLC.
For example, enter 100 to read 100 output registers in the slave PLC or enter 32 to
write 32 output bits in the slave PLC.
There is a size limit, that depends on the Modbus function code used and the
transmission mode (RTU or ASCII). These MbusCmd[4] limit values are detailed in
the array below (see page 238). This size is not significant for function codes 5 and 6.
Note: The memory area is limited depending on the device and the slave parameters.
MbusCmd[3]
The array below presents the slave PLC data area for MbusCmd[3]. This data area depends on
the Modbus function code used and the type of slave PLC:
MbusCmd[4]
The array below presents the limit value of MbusCmd[4]. This value depends on the Modbus
function code used and the transmission mode:
Definition
This parameter corresponds to the number of attempts to send a message made by the
OUT_IN_MBUS block prior to receiving a correct response from a slave device (PLC, modem, etc.).
When the response is not completely structured in the assigned time, the block generates an error
and an error code.
The number of new attempts should be between 0 and 32767.
This field is used in conjunction with RespTout.
Definition
The Modbus messages may be sent in ASCII or RTU mode.
The ASCII mode uses 7 data bits whereas the RTU modes uses 8. To send a message in RTU
characters, Databits should be set to 1.
The value must match the configuration of the communication card.
NOTE: To avoid any problem in the event of configuration changes, use the system constants of
type %KWr.m.c.1.8 to initialize the parameter.
Definition
This parameter corresponds to the wait time delay of the OUT_IN_MBUS block prior to receiving a
correct response from a slave device (PLC, modem, etc.).
When the response is not completely structured in the assigned time, the block generates an error.
This system allows no response after this delay.
The base time is 100 ms. The valid values are between 0 (infinite wait) and 32767.
The timeout begins after the last character of the message is sent.
Definition
For a read command, the data area of the master PLC is the destination of the data sent by the
slave.
For a write command, the data area of the master PLC is the source of data.
For Modbus command codes 1, 2, 5 and 15, coding of bits is performed as follows:
Bits 1 to 16 are stored in the first item of the INT array set as argument, the first bit being in the
least significant bit of the item.
Bits 17 to 32 are stored in the second item of the array, bit 17 corresponding to the least
significant bit of the item.
Etc.
Thus, to exchange 1,000 bits, you must declare an array of 63 INT (1,000/16 + 8).
NOTE: A data area of integer type %MW may be used directly in the MasterDataArea parameter
(for example: %MW100:50 designates an array of 50 integers starting at address 100).
A series of array items of type %M must first be converted and recopied in an array of integers (INT)
according to the above-described coding.
Definition
This parameter displays a status code generated by the OUT_IN_MBUS block.
The array below shows the different status codes.
Section 21.3
Installing the OUT_IN_MBUS Communication Block
Introduction
Use of the OUT_IN_MBUS block requires prior correct configuration of the serial link.
The following parameters are used:
linked to transmission and configured from Control Expert
linked to the application and passed as function arguments
To allow exchange of data between all equipment connected on the bus, configuration of the serial
link should be identical for all.
The configuration screen used to enter the parameters depends on the configuration selected in
nominal mode.
NOTE: The value of the Databit (see page 240) input parameter of the OUT_IN_MBUS block should
match the value checked in the Data window of the configuration screen.
Use of OUT_IN_MBUS requires dynamic switching to character mode. In this mode, the conditions
for stopping (on characters or silence) are disabled and not modifiable by the application. The
OUT_IN_CHAR function is thus no longer usable in receive mode (stop on timeout), and only the
INPUT_CHAR and INPUT_BYTES functions may be used for receiving by specifying the number of
characters to receive.
NOTE: The value of the Databit (see page 240) input parameter of the OUT_IN_MBUS block should
match the value checked in the Data window of the configuration screen.
When the card configuration is the character mode:
The conditions for stopping (on characters or silence) configurable in this mode must be
disabled for proper operation of OUT_IN_MBUS. The function OUT_IN_CHAR is thus no longer
usable in receive mode (stop on timeout), and only the functions INPUT_CHAR and
INPUT_BYTES may be used for receiving by specifying a number of characters to receive.
The delay between characters cannot be configured. It is thus necessary to make sure that the
value of this parameter in the remote Modbus devices is compatible with the character mode
configuration.
Procedure to Follow
The array below shows the procedure to follow for programming the OUT_IN_MBUS block.
Step Action
1 Test to determine whether any command is pending.
Before executing a WRITE_CMD, test whether an exchange is currently in progress using the
%MWr.m.c.0 language object. To refresh this word, use the READ_STS block.
2 Assign the command word.
You must next modify the value of the command language object in order to perform the
required command. For a Modbus link, the object language is the internal word
%MWr.m.c.15. For example, to switch from Modbus mode to character mode,
%MWr.m.c.15 is set to 16#4000 (%MWr.m.c.15.14=1).
Note: A single command bit must then be switched from 0 to 1 before transmitting the
WRITE_CMD.
3 Send the command.
Finally, a WRITE_CMD must be executed to acknowledge the command.
In the example (see page 252) that follows, we use the corresponding IODDT interface to
communicate with the serial port channel.
Using a Modem
Description
It is necessary to know three commands to interface telephonic modems to PLCs. These
commands are the following:
Initialize modem
Renumerate
Disconnect modem
It is imperative to send an initialization message followed by a dial message to the modem before
sending it an ASCII or Modbus message.
When the connection is successful between the two modems, you may send an unlimited number
of ASCII or Modbus messages.
When all the messages have been sent, you must send the disconnection string to the modem.
Section 21.4
Sample Use of a OUT_IN_MBUS Communication Block
Example Description
At a Glance
The example selected is a Modbus communication application via modems.
The figure below illustrates the example:
The devices communicate with each other using modems. The supervisor is Modbus master
whereas the X and Y PLCs are slaves.
The goal of the example is to write the data area values of PLC X to PLC Y.
PLC X must write a data area of 41 integers starting with the %MW100 address in PLC Y from
%MW100.
To do this, PLC X must become Modbus master. The Modbus address of PLC X is 9, Y is 10.
To simplify programming, the modems have been initialized with the correct parameters via a
programming terminal. These parameters are stored in non-volatile memory by the AT&W
commands.
Programming Structure
Step Comments
The array below summarizes the programming steps in the example:
Declaration of Variables
At a Glance
The following array shows details on the variables used:
Programming
Programming in ST Language
The example is programmed in ST structured litteral language. The dedicated section is under the
same master task (MAST).
(* Function to write %MW100 to %MW140 in slave Y *)
(* --------------------------------------------- *)
CASE Step_4 OF
0:
(* Initialization *)
IF (Start_4) THEN (* trigger flag *)
Error_4 := 0;
Step_4 := 5; (* next step *)
END_IF;
5:
(* Send command to switch serial port from Modbus to character
mode *)
10:
(* Test result of switch command *)
READ_STS(Ioddt_Pcmcia_0_3_1); (* read serial port status *)
IF (Ioddt_Pcmcia_0_3_1.EXCH_STS = 0) THEN (* command completed *)
RESET(Ioddt_Pcmcia_0_3_1.MB_TO_CHAR); (* reset MB_TO_CHAR comma
nd bit *)
IF (Ioddt_Pcmcia_0_3_1.EXCH_RPT = 0) THEN (* no error *)
IF (AND(Ioddt_Pcmcia_0_3_1.PROTOCOL, 16#0F) = 03) THEN (* c
haracter mode OK *)
Step_4 := 15; (* next step *)
ELSE
i := i + 1;
IF (i > 1000) THEN
Error_4 := -1; (* error *)
Step_4 := 65; (* next step = end *)
END_IF;
END_IF;
ELSE (* error in sending command to port *)
Error_4 := -2; (* error *)
Step_4 := 65; (* next step = end *)
END_IF;
END_IF;
15:
(* Send dial command to modem *)
20:
(* Test PRINT_CHAR function result *)
IF (NOT MngtPrint_4[1].1) THEN
IF (MngtPrint_4[2] = 0) THEN
Step_4 := 25; (* success : next step *)
ELSE
Error_4 := -3; (* error *)
Step_4 := 65; (* next step = end *)
END_IF;
END_IF;
25:
(* Test INPUT_CHAR function result *)
IF (NOT MngtInput_4[1].1) THEN
IF (MngtInput_4[2] = 0) THEN
Step_4 := 30; (* success : next step *)
ELSE
Error_4 := -4; (* error *)
Step_4 := 65; (* next step = end *)
END_IF;
END_IF;
30:
(* Test Modem reply *)
IF (AnsString_4 = 'CONNECT 9600') THEN
Step_4 := 35; (* success : next step *)
ELSE
35:
(* Initialize OUT_IN_MBUS parameters *)
MbusCmd_4[1] := 10; (* slave PLC address *)
MbusCmd_4[2] := 16#06; (* Modbus function 16#06 *)
MbusCmd_4[3] := 100; (* slave PLC area = %MW100 *)
MbusCmd_4[4] := 41; (* quantity of data *)
RetryLmt_4 := 2; (* number of retry *)
DataBits_4 := %KW0.3.1.1.8; (* 1 = 8 bits -> RTU mode, 0 = 7 bits -
> ASCII mode *)
RespTout_4 := 300; (* timeout = 30s *)
Flag_Error_4 := 0;
Step_4 := 40; (* next step *)
40:
(* Call OUT_IN_MBUS *)
Out_In_Mbus_4 (Adr_4, MbusCmd_4, RetryLmt_4, DataBits_4, RespTout_4
, Abort_4,
%MW100:41, Retry_4, Active_4, Done_4, Flag_Error_4,
Status_4);
45:
(* Hangup modem *)
MngtPrint_4[3] := 50; (* timeout *)
MngtPrint_4[4] := 9; (* number of bytes to send *)
ReqString_4 := '+++ATH0$N'; (* hangup message *)
PRINT_CHAR(Adr_4, ReqString_4, MngtPrint_4);
Step_4 := 50; (* next step *)
50:
(* Test PRINT_CHAR function result *)
IF (NOT MngtPrint_4[1].1) THEN
IF (MngtPrint_4[2] = 0) THEN
(* Success : next step *)
Step_4 := 55;
ELSE
(* End on error *)
Error_4 := 1;
Step_4 := 65;
END_IF;
END_IF;
55:
(* Send command to switch serial port from Modbus to character mode
*)
READ_STS(Ioddt_Pcmcia_0_3_1); (* read serial port status *)
IF (Ioddt_Pcmcia_0_3_1.EXCH_STS = 0) THEN (* no active command *)
Ioddt_Pcmcia_0_3_1.CONTROL := 16#00; (* reset control word *)
SET(Ioddt_Pcmcia_0_3_1.CHAR_TO_MB); (* set MB_TO_CHAR command b
it *)
WRITE_CMD (Ioddt_Pcmcia_0_3_1); (* send command *)
60:
(* Test result of switch command *)
READ_STS(Ioddt_Pcmcia_0_3_1); (* read serial port status *)
IF (Ioddt_Pcmcia_0_3_1.EXCH_STS = 0) THEN (* command completed *)
RESET(Ioddt_Pcmcia_0_3_1.CHAR_TO_MB); (* reset CHAR_TO_MB comma
nd bit *)
IF (Ioddt_Pcmcia_0_3_1.EXCH_RPT = 0) THEN (* no error *)
IF (AND(Ioddt_Pcmcia_0_3_1.PROTOCOL, 16#0F) = 07) THEN (* M
odbus mode OK *)
Step_4 := 65; (* next step *)
ELSE
i := i + 1;
IF (i > 1000) THEN
Error_4 := 2; (* error *)
Step_4 := 65; (* next step *)
END_IF;
END_IF;
ELSE (* error in sending command to port *)
Error_4 := 3; (* error *)
Step_4 := 65; (* next step *)
END_IF;
END_IF;
65:
(* End *)
Start_4 := 0; (* allow new demand *)
Step_4 := 0; (* goto waiting state *)
END_CASE;
Chapter 22
PRINT_CHAR: Sending character strings
Description
Function Description
For Premium PLCs, the PRINT_CHAR function is used to send a character string of a maximum of
4 Kbytes, 120 bytes at the terminal port, to be transmitted on a character mode link.
For Modicon M340 and M580 CPU, the PRINT_CHAR function is used to send a character string
of a maximum of 1,024 bytes.
The character string may be contained in a static variable (see EcoStruxure™ Control Expert,
Program Languages and Structure, Reference Manual) or stipulated in the form of an immediate
value (series of bytes between apostrophes, e.g.: 'Message to be sent').
These character strings may contain special characters, and must start with the character $
followed by the hexadecimal value of the character to be sent, for example $0D.
Certain special characters (see EcoStruxure™ Control Expert, Program Languages and Structure,
Reference Manual) may be used, such as:
$R = CR (carriage return), $L = LF (line feed), $N = CR+LF.
The additional parameters EN and ENO can be configured.
WARNING
UNINTENDED EQUIPMENT OPERATION
Implement a request coordination between P-HSBY and Target in a 2-wires application to abort
simultaneous PRINT_CHAR during a swap.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
FBD Representation
Representation:
LD Representation
Representation:
IL Representation
Representation:
LD Address
PRINT_CHAR String_to_Send, Management_Param
ST Representation
Representation:
PRINT_CHAR(Address, String_to_Send, Management_Param);
Parameter Description
The following table describes the input parameters:
Programming Rules
Special characters are preceded by the character $ in the string to be transmitted. The $ characters
are not transmitted by the sender, and must therefore not be counted during the initialization of the
length parameter.
The spaces between two characters are counted in a byte.
Therefore, for the example PRINTING IN PROGRESS$L$R, the length of the data to be sent is 22
bytes.
On Premium PLCs, it takes several PLC cycles to send a character string of more than 240 bytes
(the string is fragmented). It is therefore important to make sure that the management data is not
modified during the processing of the function. The system transmits the string consistently over
several fragments, but does not prohibit the transmission of another character string between two
fragments.
On Modicon M340 and M580 CPU, it takes one CPU cycle to send a character string of a maximum
length of 1,024 bytes. It is important to make sure that the management data is not modified during
the processing of the function.
The Modicon M340 PLC's serial port is full duplex, so a PRINT_CHAR function can be sent even
when an INPUT_CHAR function has been sent and is still pending.
NOTE:
To send character strings containing end of string characters (ZERO). You must:
use localized STRINGS,
initialize the last word of the exchange management table with the number of characters to
send. If you initialize this word with the value 0, the string that is sent will stop at the first ZERO
character it encounters. If you initialize it with a value, the length of the character string sent will
be equal to this value.
At a Glance
For this communication function, you can call up the assisted entry screen. Please note that the
assisted entry screen is not available for the Modicon M340/M580.
NOTE: The variable symbols are accepted in the different fields of the screen.
Illustration
The following screen shows an example of the assisted entry screen of the function:
Address
For Premium PLCs, the possible type of object is:
ADDR(STRING).
ARRAY [0..5] OF INT.
NOTE: if you enter a value directly in the field, the assisted address entry button turns gray.
String to be sent
The string to be sent is a variable of the STRING type or an immediate value. If a STRING type
variable is selected, the value field disappears.
Report
The report is an array of 4 integers, that can be located or not.
NOTE: be careful not to use several identical memory areas for report tables, otherwise the
variable read function may not work.
At a Glance
Let us assume we want to send a character string to a video terminal connected to the built-in link
of the TSX SCY 21601 module of a PLC with a network address of 20, station 3. The
TSX SCY 21601 module is located in slot 2 of the base rack.
The management table is located in %MW110:4 and the string to be sent is located in the variable
Str_1.
Illustration
The two stations are connected via a Fipway network.
Transmission
Programming in ST:
Request parameters:
Parameters Description
ADDR('{20.3}0.2.0.SYS') {20.3}: network 20, station 3
0: rack
2: module
0: channel 0
SYS: system address
NOTE: Each time the function is launched, initialize the length parameter (in the example:
%MW113) with the value corresponding to the number of characters (in bytes) to send to Str_1).
Example of Sending Character Strings via Serial Link of Modicon M340 Processors
At a Glance
Let us assume we want to send a character string to a compact data entry/display terminal
connected to a Modicon M340 processor’s serial port.
The management table is located in %MW110:4 and the string to be sent is located in the variable
caract.
Illustration
A Modicon M340 PLC is linked to a data entry/display terminal TM8501:
Transmission
Programming in ST:
IF (%M16) THEN
PRINT_CHAR(ADDM('0.0.0'),caract,gestion);
END_IF;
Request parameters:
Parameters Description
ADDM('0.0.0') 0: rack
0: module
0: channel 0
SYS: system address (optional on Modicon M340 PLCs)
NOTE: Each time the function is launched, initialize the length parameter (For example: %MW113
if the management table is located from %MW110 to %MW113) with the value corresponding to the
number of characters (in bytes) to send to caract).
Chapter 23
PRINT_CHAR_QX: Sending Character Strings on EIO Bus
Description
Function Description
The PRINT_CHAR_QX function is used to send a character string of 1000 bytes maximum to a
serial device connected to a Modicon X80 serial communication module (BMXNOM0200) located
in an EIO drop.
The character string may be contained in a static variable (see EcoStruxure™ Control Expert,
Program Languages and Structure, Reference Manual) or stipulated in the form of an immediate
value (series of bytes between apostrophes, for example: 'Message to be sent').
These character strings may contain special characters, and must start with the character $
followed by the hexadecimal value of the character to be sent, for example $0D.
Certain special characters (see EcoStruxure™ Control Expert, Program Languages and Structure,
Reference Manual) may be used, such as:
$R = CR (carriage return), $L = LF (line feed), $N = CR+LF.
The additional parameters EN and ENO can be configured.
The communication function blocks use one data transaction path and require multiple cycles to
complete an operation. The number of transaction paths available by module and by MAST cycle
depends on the communication port used:
Modbus Plus embedded port or NOM modules support up to 4 blocks at the same time.
TCP/IP Ethernet embedded port support up to 4 blocks at the same time.
TCP/IP Ethernet NOE, NOC, and 140 CRP 312 00 modules support up to 16 blocks at the same
time.
More communication function blocks may be programmed on the same communication port.
However, a communication block exceeding the maximum number on that port is not serviced until
one of the transaction paths is available. Then, the next block on the same port becomes active
and begins using an available path.
FBD Representation
Representation:
LD Representation
Representation:
IL Representation
Representation:
CAL PRINT_CHAR_QX_Instance (ENABLE:=PrintCharEnable,
ABORT:=PrintCharAbort, ADDR:=ModuleAddress, SEND_LEN:=NbCharToSend,
SEND_BUF:=SendBuffer, DONE=>PrintCharSuccessfull, ACTIVE=>PrintChar-
Active, ERROR=>PrintCharFaulty, STATUS=>ErrorCode)
ST Representation
Representation:
PRINT_CHAR_QX_Instance (ENABLE:=PrintCharEnable, ABORT:=PrintCharAbort,
ADDR:=ModuleAddress, SEND_LEN:=NbCharToSend, SEND_BUF:=SendBuffer,
DONE=>PrintCharSuccessfull, ACTIVE=>PrintCharActive, ERROR=>PrintChar-
Faulty, STATUS=>ErrorCode);
Parameter Description
The following table describes the input parameters:
Programming Rules
Special characters are preceded by the character $ in the string to be transmitted. The $ characters
are not transmitted by the sender, and must therefore not be counted during the initialization of the
length parameter.
The spaces between two characters are counted in a byte.
Therefore, for the example PRINTING IN PROGRESS$L$R, the length of the data to be sent is 22
bytes.
NOTE:
To send character strings containing end of string characters (ZERO), you must:
use localized STRINGS
initialize SEND_LEN with the number of characters to send.
Chapter 24
RCV_TLG: Receiving telegrams
Description
Function Description
The RCV_TLG function is used to read telegram-type data from a remote application.
The data received must be a maximum of 16 bytes in length. Unlike the other communication
functions, this function is processed immediately (synchronous): there are therefore no activity bit
and timeout parameters.
The integer table assigned to the management parameters therefore only uses two words instead
of four (the exchange and timeout numbers being unnecessary).
NOTE: this function can be used on Fipway in the processor only, and for stations 0 to 15.
The additional parameters EN and ENO can be configured.
FBD representation
Representation:
LD representation
Representation:
IL representation
Representation:
LD Management_Param
RCV_TLG Address, Received_Data
ST representation
Representation:
RCV_TLG(Management_Param, Address, Received_Data);
Parameter Description
The following table describes the input/output parameters:
At a Glance
Let us assume we want to receive an 8-word (16 byte) telegram from a remote application on a
Fipway network.
Illustration
The two stations are connected via a Fipway network.
Programming
Programming in ST:
IF RE(%I0.3.11) THEN
RCV_TLG(%MW200:2, %MW300,%MW310:8);
END_IF;
Request parameters:
Parameters Description
%MW200:2 Management table
%MW300 Contains the address of the sender at the end of the exchange.
%MW310:8 Contents of the telegram received
NOTE: When a RCV_TLG function is programmed in an event task, it cannot be used in the MAST
or FAST task.
To execute this function synchronously, it is necessary to test the operation report immediately
after the program line that activates the execution of this function.
Chapter 25
READ_ASYN: Reading data asynchronously
Description
Function Description
The READ_ASYN function is used to read 1 Kbyte of data via the asynchronous messaging channel
of TSX ETY modules in TCP/IP mode.
The following data can be read-accessed:
internal bits,
internal words.
Asynchronous reading can only take place between two stations on the same Ethernet TCP/IP
network segment.
The READ_ASYN function is sent at the end of the MAST task only if this is configured in periodic
mode. It is possible to activate 8 functions simultaneously.
The operating principle is identical to that of the WRITE_ASYN (see page 380) function.
The size of the send and receive buffers is expressed in words. It is 512 words, or 1024 bytes.
NOTE: The asynchronous server function supports UNI-TE V1 or V2.0 protocols. The READ_ASYN
function uses the UNI-TE V2.0 protocol.
The additional parameters EN and ENO can be configured.
FBD representation
Representation:
LD representation
Representation:
IL representation
Representation:
LD Address
READ_ASYN Object_Type, First_Object, Object_Number, Management_Param,
Receiving_Array
ST representation
Representation:
READ_ASYN(Address, Object_Type, First_Object, Object_Number,
Management_Param, Receiving_Array);
Parameter Description
The following table describes the input parameters:
Chapter 26
READ_DDT: Reading DDT
Overview
Use the READ_DDT function block to configure read messages for the BMENUA0100
communication module.
The ADR, the DDT_NAME, and the GEST parameters define the operation.
EN and ENO can be configured as additional parameters.
FBD Representation
Input Parameters
Input/Output Parameters
The GEST array is local:
Output Parameters
In case of operation report 16#01 (Request not processed) or 16#02 (Incorrect response) in the
GEST[1] word of the management table, an additional status code may be reported in the length
parameter (GEST[3]). Status codes returned in this field correspond to a subrange of the
possible STATUS parameter codes of communication EFBs. Possible values for the
READ_DDT are 0x30ss and 0x4001. Refer to the Control Expert help topic Error Codes of EFBs
with STATUS parameter (see page 520) for an description of these additional status code
values.
Depending on the DDT specified in the DDT_NAME parameter, some consistency checks will
be performed on the data received. If a mismatch is detected, code 16#02 (Incorrect response)
is set in the operation report byte (the most significant byte of GEST[1]). Note that the block does
not check the data type validity of the variable configured as the reception buffer (RECP_DDT).
Verify that the data type of the variable linked to the RECP_DDT parameter matches the type
of data received.
CAUTION
UNEXPECTED BEHAVIOR OF APPLICATION
Verify that the DDT-type variable associated to the RECP_DDT output parameter corresponds
to the type of data written in the reception buffer.
Verify that the address set in the ADR parameter corresponds to the correct module,
especially when several identical modules are configured on the same network.
Failure to follow these instructions can result in injury or equipment damage.
Step Action
1 Set the address of the destination device in ADR (use an ADDM block to specify this address
in an explicit string format).
2 Set DDT_NAME parameter with the name of the DDT to read.
3 Call the READ_DDT function to launch the communication (with EN input pin set to 1 if
configured).
4 Monitor the activity bit (in the least significant byte of the GEST[0] parameter) until the
communication is completed (the activity bit is set to 0 by the system when the communication
has ended). Execute this function only once to avoid erasing the status values. For example,
setting the EN pin to 0 during operation would cause the function to be called again.
5 View the report parameters in GEST[1]. If the report reads 16#0000, then RECP_DDT buffer
has been filled with received data. Size of the data received (in bytes) is written in the fourth
word (GEST[3]) of the management table.
READ_DDT EF Example
Chapter 27
READ_GDATA: Reading Modbus Plus Global Data
Description
Function Description
The READ_GDATA function is used to read shared data, or Global Data, on a Modbus Plus network.
Global Data is shared between a maximum of 64 stations on the same Modbus Plus network. Each
station may write up to 32 integers, which can then be used by all stations on the network.
Conversely, each station can read the 32 integers (maximum) of all the other network stations.
The additional parameters EN and ENO can be configured.
FBD representation
Representation:
LD representation
Representation:
IL representation
Representation:
LD Address
READ_GDATA Management_Param, Receiving_Array
ST representation
Representation:
READ_GDATA(Address, Management_Param, Receiving_Array);
Parameter Description
The following table describes the input parameters:
Chapter 28
READ_REG: Read Register
Introduction
This chapter describes the READ_REG block.
Description
Function description
With a rising edge at the REQ input, this function block reads a register area from an addressed
slave via Modbus Plus, TCP/IP-Ethernet or SY/MAX-Ethernet.
CREAD_REG, CWRITE_REG, READ_REG, WRITE_REG, and MBP_MSTR function blocks use one data
transaction path and require multiple cycles to complete an operation. The number of transaction
paths available by module and by MAST cycle depends on the communication port used:
Modbus Plus embedded port or NOM modules support up to 4 blocks at the same time.
TCP/IP Ethernet embedded port support up to 4 blocks at the same time.
TCP/IP Ethernet NOE, NOC, and 140 CRP 312 00 modules support up to 16 blocks at the same
time.
More communication function blocks may be programmed on the same communication port.
However, a communication block exceeding the maximum number on that port is not serviced until
one of the transaction paths is available. Then, the next block on the same port becomes active
and begins using an available path.
NOTE: When programming a READ_REG function, you must be familiar with the routing procedures
used by your network. Modbus Plus routing path structures are described in detail in the
communication architectures manual (see Communication Services and Architectures, Reference
Manual) and the Modbus Plus Network Planning and Installation Guide (Reference 31003525). If
TCP/IP or SY/MAX Ethernet routing is implemented (see Quantum using EcoStruxure™Control
Expert, TCP/IP Configuration, User Manual), standard Ethernet IP router products must be used.
NOTE: Several copies of this function block can be used in the program. However, multiple
instancing of these copies is not possible.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
CAL READ_REG_Instance (REQ:=StartReadOnce,
SLAVEREG:=OffsetAddress, NO_REG:=NumberOfRegisters,
ADDRFLD:=DataStructure, NDR=>SetAfterReadingNewData,
ERROR=>SetInCaseOfError, REG_READ=>RegisterToRead,
STATUS=>ErrorCode)
Representation in ST
Representation:
READ_REG_Instance (REQ:=StartReadOnce,
SLAVEREG:=OffsetAddress, NO_REG:=NumberOfRegisters,
ADDRFLD:=DataStructure, NDR=>SetAfterReadingNewData,
ERROR=>SetInCaseOfError, REG_READ=>RegisterToRead,
STATUS=>ErrorCode) ;
Parameter description
Description of input parameters:
Runtime error
For a list of all block error codes and values, see the table of error codes (see page 518).
Function mode
NOTE: The WordArr5 data structure can also be used with constants.
Parameter description
REQ
A rising edge triggers the read transaction.
The parameter can be entered as a direct address, located variable, unlocated variable or literal.
SLAVEREG
Start of the area in the addressed slave from which the source data is read. The source area
always resides within the %MW register area.
NOTE: For slaves for a non-Control Expert PLC:
The source area always resides within the 4x register area. SLAVEREG expects the source
reference as offset within the 4x area. The leading "4" must be omitted (e.g. 59 (contents of the
variables or value of the literal) = 40059).
The parameter can be entered as a direct address, located variable, unlocated variable or literal.
NO_REG
Number of addresses to be read from the addressed slave (1 ... 100).
The parameter can be entered as a direct address, located variable, unlocated variable or literal.
NDR
Transition to ON state for one program cycle signifies receipt of new data ready to be processed.
The parameter can be entered as a direct address, located variable or unlocated variable.
ERROR
Transition to ON state for one program cycle signifies the detection of a new error.
The parameter can be entered as a direct address, located variable or unlocated variable.
REG_READ
An ARRAY that is the same size as the requested transmission must be agreed upon (≥ NO_REG)
for this parameter. The name of this array is defined as a parameter. If the array is defined too
small, then only the amount of data is transmitted that is present in the array.
The parameter must be defined as a located variable.
STATUS
If an error occurs while the function is being executed, an error code (see page 520) remains at
this output for one cycle.
The parameter can be entered as an address, located variable or unlocated variable.
Chapter 29
READ_REG_QX: Read Register on EIO Bus
Description
Function description
The READ_REG_QX function is used to read registers in a Modbus slave connected to a
Modicon X80 serial communication module located in an EIO drop.
When programming a READ_REG_QX function, you must be familiar with the routing procedures
used by your network. Modbus Plus routing path structures are described in detail in chapter
Addressing for a Modbus Plus Communication Entity (see Communication Services and
Architectures, Reference Manual) and in the Modicon Modbus Plus Network Planning and
Installation Guide (see page 15).
NOTE: Several copies of this function block can be used in the program. However, multiple
instancing of these copies is not possible.
The additional parameters EN and ENO can be configured.
The communication function blocks use one data transaction path and require multiple cycles to
complete an operation. The number of transaction paths available by module and by MAST cycle
depends on the communication port used:
Modbus Plus embedded port or NOM modules support up to 4 blocks at the same time.
TCP/IP Ethernet embedded port support up to 4 blocks at the same time.
TCP/IP Ethernet NOE, NOC, and 140 CRP 312 00 modules support up to 16 blocks at the same
time.
More communication function blocks may be programmed on the same communication port.
However, a communication block exceeding the maximum number on that port is not serviced until
one of the transaction paths is available. Then, the next block on the same port becomes active
and begins using an available path.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
CAL READ_REG_QX_Instance (ENABLE:=ReadRegQxEnable, ABORT:=ReadRegQ-
xAbort, ADDR:=ModuleAddress, NO_REG:=NbRegistersToRead,
SLAVEREG:=SlaveAddress, IEC:=IndexAdjust, DONE=>ReadRegQxSuccessfull,
ACTIVE=>ReadRegQxActive, ERROR=>ReadRegQxFaulty, STATUS=>ErrorCode,
REG_READ=>ReadData)
Representation in ST
Representation:
READ_REG_QX_Instance (ENABLE:=ReadRegQxEnable, ABORT:=ReadRegQxAbort,
ADDR:=ModuleAddress, NO_REG:=NbRegistersToRead, SLAVEREG:=SlaveAddress,
IEC:=IndexAdjust, DONE=>ReadRegQxSuccessfull, ACTIVE=>ReadRegQxActive,
ERROR=>ReadRegQxFaulty, STATUS=>ErrorCode, REG_READ=>ReadData)
Parameter description
Description of input parameters:
Chapter 30
READ_SDO: Reading Service Data Object
Function Description
The READ_SDO function block reads (explicit exchange) from the PLC application up to the device
(SDO).
This function block provides access to the abort code when the SDO command is not successful
(only if the fieldbus is in RUN mode, and only towards the configured devices).
FBD Representation
Representation:
LD Representation
IL Representation
Representation:
CAL READ_SDO_Instance (ENABLE := EnableREAD_SDO,
ABORT := AbortREAD_SDO, ADDR := DataStructureAddress,
NODE := NodeNumber, INDEX := SDOIndex, SUBINDEX := SDOSubIndex,
OFFSET := FirstSDO, NB_IN := DataNumberIn, DONE => ReadSDOSuccessful,
ACTIVE => ReadSDOActive, ERROR => ReadSDOFaulty, STATUS => ErrorCode,
SDOABORTCODE => AbortCode, NB_OUT => DataNumberOut,
DATA => SDODataToRead)
ST Representation
Representation:
READ_SDO_Instance (ENABLE := EnableREAD_SDO, ABORT := AbortREAD_SDO,
ADDR := DataStructureAddress, NODE := NodeNumber, INDEX := SDOIndex,
SUBINDEX := SDOSubIndex, OFFSET := FirstSDO, NB_IN := DataNumberIn,
DONE => ReadSDOSuccessful, ACTIVE => ReadSDOActive,
ERROR => ReadSDOFaulty, STATUS => ErrorCode, SDOABORTCODE => AbortCode,
NB_OUT => DataNumberOut, DATA => SDODataToRead)
Parameter Description
The following table describes the input parameters:
Chapter 31
READ_VAR: Reading variables
Description
Function Description
The READ_VAR function is used to read the value of one or more language objects:
internal bits,
internal words.
Verify that the objects to be read are consecutive. They may be located in a remote CPU or in a
device connected to a communication channel.
On Modicon M340 and M580 CPU, the READ_VAR function can read up to 2,000 consecutive bits
in a remote device.
On Premium PLCs, the READ_VAR function can read up to 1,000 consecutive bits in a remote
device, whatever the device and the protocol used may be (Uni-Telway or Modbus/Jbus).
NOTE: For Premium PLCs only, reading over 1000 bits requires the use of the SEND_REQ function.
WARNING
EXCHANGED DATA INCOMPATIBILITY
Data structure alignments are not the same for Premium/Quantum and M340/M580 so verify that
the data exchanged are compatible. See DDT: Mapping rules (see EcoStruxure™ Control
Expert, Program Languages and Structure, Reference Manual) page for alignment rules.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
FBD Representation
Representation:
LD Representation
Representation:
IL Representation
Representation:
LD Address
READ_VAR Object_Type, First_Object, Object_Number, Management_Param, Re
ceiving_Array
ST Representation
Representation:
READ_VAR(Address, Object_Type, First_Object, Object_Number, Management_
Param, Receiving_Array);
Parameter Description
The following table describes the input parameters:
Rules of Use
Verify that object types are entered consistently. Write entries either all in lower case or all in upper
case; otherwise, the function sends back a report equal to 16#06 (incorrect specific parameters).
For Micro, Premium or Atrium PLCs receiving the READ_VAR function, read-only access to internal
bits has the following particularities:
The forcing value of the bits is returned in the response,
In order to read one of the last 8 bits of the memory it is necessary to read all the last 8 bits,
otherwise the function sends back a 16#01 operation report. This last particularity also applies
to Modicon M340 and M580 PLCs.
NOTE: Verify that space for the forcing indication bytes are provided for in the receive table;
otherwise, a 16#03 detected error code is sent back in the report.
NOTE: For Modicon M340/M580 PLCs, forced bits are not accessed by READ_VAR and
WRITE_VAR functions, since Modbus protocol does not support it.
Simultaneous Transactions
The following table gives the capacities of each communication channel to simultaneously process
transactions according to various configurations on Micro and Premium PLCs.
Configuration BMX P34 1000 BMX P34 2000 BMX P34 2010/ BMX P34 2020 BMX P34 2030/
20102 20302
Embedded CANopen - - 16 - 16
Embedded Ethernet - - - 16 16
Modbus master serial 8 16 16 16 -
port
Maximum number of requests as client per scan on Hot Standby M580 CPUs:
Maximum number of requests served per scan on Hot Standby M580 CPUs:
NOTE: Verify that the maximum number of simultaneous requests given in all tables takes into
account the maximum number of simultaneous requests that each CPU can manage per cycle, as
Client and as Server (see Modicon M580, Hardware, Reference Manual).
At a Glance
For this communication function, you can call up the assisted entry screen. Please note that the
assisted entry screen is not available for Modicon M340/M580.
NOTE: The variable symbols are accepted in the different fields of the screen.
Illustration
The following screen shows an example of the assisted entry screen of the function:
Address
For Premium PLCs, the possible type of object is:
ADDR(STRING).
ARRAY [0..5] OF INT.
NOTE: if you enter a value directly in the field, the assisted address entry button turns gray.
NOTE: simply choose from the solutions offered in the drop-down menu.
NOTE: if you enter a constant, an entry field appears to enter the constant. If you enter a variable,
this can be located or not.
NOTE: if you enter a constant, an entry field appears to enter the constant. If you enter a variable,
this can be located or not.
Reception zone
The reception zone is an integer array. The size of this array depends on the number of objects to
read. This integer array can be located or not.
Report
The report is an array of 4 integers.
NOTE: be careful not to use several identical memory areas for report tables, otherwise the
variable read function may not work.
At a Glance
The master PLC must read internal words %MW100 to %MW109 of address station 6 on a Uni-Telway
bus. The values of the words that are read are sorted on the basis of the internal word %MW10, and
management parameters are stored on the basis of %MW40.
Illustration
Both stations are linked by a Uni-Telway bus.
Programming
Programming in LD:
Request parameters:
Parameters Description
'0.0.0.6' 0 : rack
0 : module
0 : channel 0
6 : destination address
At a Glance
On Modicon M340 PLCs, forced bits are not accessed by READ_VAR and WRITE_VAR functions
as Modbus protocol does not support it. Therefore the following statements about forced bits
cannot be applied to Modicon M340 PLCs.
The following examples illustrate the READ_VAR communication function for reading bits. In this
case the receive table consecutively contains the value of the bits as well as the forcing indication.
Forcing can be performed for each %MW102 or %MW103 bit set to 1; the forcing value being that of
the corresponding bit read.
Example:
At a Glance
Station 2 of network 20 must read a 5-word table %MW0 to %MW4 of the Uni-Telway slave, network
address 20, station 1, communication module TSX SCM 2116 in slot 5, channel 1 in the
communication module, server address Ad0 = 3.
Illustration
The two stations are connected via a Fipway network.
Programming
Programming in LD:
Request parameters:
Parameters Description
ADDR(‘{20.1}0.5.1.3’) {20.1} : network 20, station 1
0 : rack
5 : module
1 : channel 1
3 : read destination slave address
At a Glance
That example deals with 2 Modicon M340 processors which communicate via Modbus serial link.
The Modbus master PLC must read internal words %MW100 to %MW109 of the Modbus slave PLC.
Illustration
The two Modicon 340 processors are connected via a Modbus link:
Programming
Programming in LD:
Parameters Description
ADDM(’0.0.0.7’) 0: rack number of the slave processor
0: slot number of the slave processor
0: channel number (serial port number)
7: configured slave number
At a Glance
The following example illustrates the READ_VAR function with a management parameter check.
Chapter 32
SEND_EMAIL: Sending Email
Send Email
Function Description
The SEND_EMAIL function is used for sending an email with a Modicon M340.
The SEND_EMAIL service is limited to the embedded Ethernet port and the BMX NOC 0401
modules. It is not supported through a BMX NOE module.
NOTE: For the SEND_EMAIL service to function properly, the IP address of the SMTP server and
usable email destinations must first be configured in the Control Expert software.
The additional parameters EN and ENO can be configured.
FBD representation
Representation:
LD representation
Representation:
IL representation
CAL SEND_EMAIL (ADR := Channel_Address, HEAD_KEY := Header_Number,
SUBJ_STR := Str_Email_Subject, BODY_STR := Str_Email_Body, GEST :=
Management_Param);
ST representation
SEND_EMAIL (ADR := Channel_Address, HEAD_KEY := Header_Number, SUBJ_STR
:= Str_Email_Subject, BODY_STR := Str_Email_Body, GEST :=
Management_Param);
Parameter Description
The following table describes the input parameters:
Chapter 33
SEND_REQ: Sending requests
Description
Function Description
The SEND_REQ function is used to code and send all UNI-TE and Modbus/Jbus requests, as well
as receive the associated responses.
Coding details for UNI-TE requests are provided in the reference manual: Communication
Reference TSX DR NET.
Details on coding the Modbus/Jbus requests are provided in the TSX DG MDB manual.
Modbus requests common to all Schneider devices are presented in Architecture and
Communication Services (see Communication Services and Architectures, Reference Manual).
NOTE: this function could not be used to send Modbus/Jbus requests through a Premium ETY
module.
The additional parameters EN and ENO can be configured.
FBD Representation
LD Representation
IL Representation
LD Address
SEND_REQ Request_Code, Data_to_Send, Management_Param, Received_Data
ST Representation
SEND_REQ(Address, Request_Code, Data_to_Send, Management_Param,
Received_Data);
Parameter Description
The following table describes the input parameters:
Simultaneous Transactions
The following table gives the capacities of each communication channel to simultaneously process
transactions according to various configurations on Micro and Premium PLCs. (SEND_REQ is not
available for Modicon M340/M580 and for Modicon Quantum PLCs.)
At a Glance
The UNI-TE protocol is used to:
identify and diagnose all the devices that have a UNI-TE server
provide a set of services giving read/write access to type data
download data from device to device
protect a server against concurrent connections during a critical period
These different services can be obtained using the SEND_REQ function, with coding of the UNI-TE
request to be sent.
NOTE: To find out details and the list of requests recognized by each device, refer to the TSX DR
NET reference manual.
The following tables provide a non-exhaustive list of the requests recognized by Premium devices.
To ensure that the ETY module is ready for operation, allow the PLC to run (in run mode) for 15
seconds after the last stop mode before issuing the SEND_REQ function. After the user issues the
CHANGE IP PARAMETERS command and the ETY module accepts the new parameters, the ETY
module resets and begins operations with the new parameters.
NOTE: FDR clients that use the ETY module for a server must be rebooted after the ETY's IP
address change is completed. Otherwise, these FDR clients can not update their parameter files
on the FDR server (the ETY module).
NOTE: Constant words contain the original configuration parameters, not those that were updated
after the IP address change.
NOTE: You can see the new configuration (IP parameters, subnet mask, and gateway address) in
the Control Expert ETY debug screen (see Premium and Atrium Using EcoStruxure™ Control
Expert, Ethernet Network Modules, User Manual). You can also see the newly assigned IP address
in the Ethernet Module Statistics web page (see Premium and Atrium Using EcoStruxure™ Control
Expert, Ethernet Network Modules, User Manual); however, you must be aware that the IP
Address, Subnetwork mask, and Gateway data on this page reflect the old configuration.
Refer to the example for Changing IP Parameters with SEND_REQ (see page 352).
Accessing Objects
These requests provide a set of services that give read/write access to internal bit and word-type
data, system bit and word-type data, floating point data, constant data and SFC data.
Reservation Management
These requests provide a reservation mechanism that is used to protect a server against
concurrent connections during a critical period.
NOTE: to reserve the PLC, write %SW110 to 1 and use the SEND_REQ function with Request Code
16#1D.
If NOT Management_Table[0].0 then (*reservation 1D*)
Management_Table[2]:=4; (* time out *)
SEND_REQ (ADR :=ADDR('sys'),
CODE := 16#001D,
EMIS := Emis_table,
GEST := Management_Table,
RECP => Receive_buffer);
END_IF;
With variables created in de the Data Editor as:
Management_Table: ARRAY [0..3] OF INT
Emis_table: ARRAY [0..0] OF INT
Receive_buffer: ARRAY [0..0] OF INT
NOTE: create the variables without any value inside, only the timeout value has to be set in
Management_Table[2].
At a Glance
For this communication function, you can call up the assisted entry screen.
NOTE: The variable symbols are accepted in the different fields of the screen.
Illustration
The following screen shows an example of the assisted entry screen of the function:
Address
For Premium PLCs, the possible type of object is:
ADDR(STRING).
ARRAY [0..5] OF INT.
NOTE: if you enter a value directly in the field, the assisted address entry button turns gray.
Request Code
The possible objects are of the INT type:
variables,
constants,
immediate value.
NOTE: if you enter a constant, an entry field appears to enter the constant. If you enter a variable,
it can be located or not.
Data to Send
These data to be sent are stored in the form of an integer array. This array can be located or not.
Reception Zone
The reception zone is an array of integers. This array can be located or not, and its size depends
on the request code used.
Report
The report is an array of 4 integers.
NOTE: be careful not to use several identical memory areas for report tables, otherwise the
variable read function may not work.
At a Glance
Station 2 of network 20 must send an identification request to the device with address Ad0=3 on
the Uni-Telway bus of station 1 of the same network. The identification request has the decimal
code 15 (or 16#0F).
The management table is located at %MW10:4.
Illustration
The two stations are connected via a Fipway network:
Programming
Programming in ST:
Request parameters:
Parameters Description
ADDR(‘{20.1}0.5.1.3’) {20.1}: network 20, station 1
0: rack
5: module
1: channel 1
3: destination address
NOTE: Each time the function is launched, initialize the length parameter (in the example:
%MW13 = 0).
Illustration
The graphic shows you how to set IP parameters for the ETY module in slot 2 with the SEND_REQ
block:
Note:
ADR: reflects the ETY’s position in slot 2.
CODE: reflects the value of the REQUEST_CODE.
EMIS: contains the IP parameters in Data_to_Send:
address (139.158.10.7)
subnet mask (255.255.248.0)
gateway (139.158.8.1)
At a Glance
The SEND_REQ function is used to code and send all UNI-TE and Modbus/Jbus requests, as well
as receive the associated responses.
In certain cases (reading of word tables for example) it is necessary to resequence the objects
received by using the ROR1_ARB function (shift of a byte in a table). .
Example
Objects to read:
16#0201
16#0403
16#0605
16#0807
16#0A09
Reception table after execution of a SEND_REQ (read object):
%MW100=16#0107
%MW101=16#0302
%MW102=16#0504
%MW103=16#0706
%MW104=16#0908
%MW105=16#000A
Reception table after a ROR1_ARB(%MW100:6):
%MW100=16#0201
%MW101=16#0403
%MW102=16#0605
%MW103=16#0807
%MW104=16#0A09
%MW105=16#0700
Chapter 34
SEND_TLG: Sending telegrams
Description
Function Description
The SEND_TLG function is used to send telegram-type data to a remote application.
The data to be sent must be a maximum of 16 bytes in length. Unlike the other communication
functions, this function is processed immediately (synchronous): there are therefore no activity bit
and timeout parameters.
The integer table assigned to the management parameters therefore only uses two words instead
of four (the exchange and timeout numbers being unnecessary).
WARNING
INOPERABLE FUNCTION - INVALID CONFIGURATION
Use the SEND_TLG function on a Fipway network only after installing a TSX FPP 20 card:
on channel 1 of the processor
for stations 0 to 15
Failure to follow these instructions can result in death, serious injury, or equipment damage.
FBD Representation
Representation:
LD Representation
Representation:
IL Representation
Representation:
LD Address
SEND_TLG Data_to_Send, Management_Param
ST Representation
Representation:
SEND_TLG(Address, Data_to_Send, Management_Param);
At a Glance
Let us suppose we want to send an 8-word telegram from station 1 to the remote station 3 on
Fipway network 20.
We will use table %MW190:8 to contain these words to be sent, and table %MW200:2 will contain
the management table of the exchange.
Illustration
The two stations are connected via a Fipway network.
Programming
Programming in ST:
IF RE(%I0.3.10) THEN
SEND_TLG(ADDR('{20.3}APP'), %MW190:8, %MW200:2);
END_IF;
Request parameters:
Parameters Description
ADDR(’{20.3}APP’) {20.2}: network 20, station 3
APP: application
NOTE: The word %MW 201 must be initialized to 16 (8 words) before the request is sent.
To execute this function synchronously, it is necessary to test the operation report immediately
after the program line that activates the execution of this function.
Chapter 35
SYMAX_IP_ADDR: SY/MAX IP Address
Introduction
This chapter describes the SYMAX_IP_ADDR block.
Description
Function Description
This function block allows the entry of the SY/MAX IP address for function blocks REAG_REG,
CREAD_REG, WRITE_REG and CWRITE_REG. The address is transferred as a data structure.
EN and ENO can be configured as additional parameters.
NOTE: You must be familiar with your network when programming the SYMAX_IP_ADDR function
block.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
CAL SYMAX_IP_ADDR_Instance (DROP_NO:=MappingIndex,
SLOT_ID:=NOEModuleSlot, DESTDROP:=DestinationDropNumber,
TERMINAT:=Terminator, ADDRFLD=>DataStructureSYMAX_IP)
Representation in ST
Representation:
SYMAX_IP_ADDR_Instance (DROP_NO:=MappingIndex,
SLOT_ID:=NOEModuleSlot, DESTDROP:=DestinationDropNumber,
TERMINAT:=Terminator, ADDRFLD=>DataStructureSYMAX_IP) ;
Parameter description
Description of input parameters:
Detailed Description
DROP_NR
The MBP to Ethernet Transporter (MET) mapping index is given at the DROP_NR input, i.e. if MET
is 6, the value appears as follows:
Slot_ID
If a NOE in the rack of a Quantum controller is addressed as destination node, the value at the
SLOT_ID input represents the physical NOE slot, i.e. if the NOE is plugged in at Slot 7 of the rack,
the value appears as follows:
ADDRFLD
If a NOE in the rack of a Quantum controller is addressed as a destination node, the value in the
most significant byte represents the physical slot of the NOE and the least significant byte
represents the MBP on Ethernet Transporter (MET) mapping index, i.e. if the NOE is inserted in
slot 7 of the rack and the MET mapping index is 6, the first element of the data structure looks as
follows:
Chapter 36
TCP_IP_ADDR: TCP/IP Address
Introduction
This chapter describes the TCP_IP_ADDR block.
Description
Function description
This function block allows the entry of the TCP/ IP address for function blocks READ_REG,
CREAD_REG, WRITE_REG and CWRITE_REG. The address is transferred as a data structure.
EN and ENO can be configured as additional parameters.
NOTE: You must be familiar with your network when programming the TCP_IP_ADDR function
block. A complete description of the TCP/IP routing is provided in the Quantum using
EcoStruxure™ Control Expert, TCP/IP Configuration, User Manual.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
CAL TCP_IP_ADDR_Instance (MAP_IDX:=MapIndex,
SLOT_ID:=NOEModuleSlot, IP_B4:=Byte4OfIPAddress,
IP_B3:=Byte3OfIPAddress, IP_B2:=Byte2OfIPAddress,
IP_B1:=Byte1OfIPAddress,
ADDRFLD=>DataStructureTCP_IPAddress)
Representation in ST
Representation:
TCP_IP_ADDR_Instance (MAP_IDX:=MapIndex,
SLOT_ID:=NOEModuleSlot, IP_B4:=Byte4OfIPAddress,
IP_B3:=Byte3OfIPAddress, IP_B2:=Byte2OfIPAddress,
IP_B1:=Byte1OfIPAddress,
ADDRFLD=>DataStructureTCP_IPAddress) ;
Parameter description
Description of input parameters:
NOTE: For the Slot_ID parameter: when using an integrated Ethernet CPU module such as the
140 CPU 651 •0, the slot ID must be 254 (FE hex) regardless of the CPU slot.
Description of output parameters:
Detailed Description
MAP_IDX
The MBP to Ethernet Transporter (MET) mapping index is given at the Map_Idx+ input, i.e. if MET
is 6, the value appears as follows:
Slot_ID
If a NOE in the rack of a Quantum controller is addressed as destination node, the value at the
SLOT_ID input represents the physical NOE slot. Example : if the NOE is plugged in at Slot 7 of
the rack, the value appears as follows:
NOTE: When using an integrated Ethernet CPU module such as the 140 CPU 651 x0, the slot ID
must be 254 (FE hex) regardless of the CPU slot.
ADDRFLD
If a NOE in the rack of a Quantum controller is addressed as a destination node, the value in the
most significant byte represents the physical slot of the NOE and the least significant byte
represents the MBP on Ethernet Transporter (MET) mapping index, i.e. if the NOE is inserted in
slot 7 of the rack and the MET mapping index is 6, the first element of the data structure looks as
follows:
Chapter 37
UNITE_SERVER: Immediate server
Description
Function Description
The UNITE_SERVER function is used to process UNI-TE requests immediately from the application
program.
This function can be activated in the MAST task or the FAST task.
NOTE: At any given time, only one UNITE_SERVER function can be activated by the application.
NOTE: The UNITE_SERVER function is used to process requests from a Modbus link
(TSX SCP 114 PCMCIA card in a TSX SCY 21601 module configured as a Modbus slave with
immediate server (see Premium and Atrium using EcoStruxure™ Control Expert, Asynchronous
Serial Link, User Manual)).
The additional parameters EN and ENO can be configured.
Exchange principle
The following diagram illustrates the exchanges made during the use of the UNITE_SERVER
communication function.
FBD representation
Representation:
LD representation
Representation:
IL representation
Representation:
LD Management_Param
UNITE_SERVER Address, Received_Codes
ST representation
Representation:
UNITE_SERVER(Management_Param, Address, Received_Codes);
Parameter Description
The following table describes the input/output parameters:
At a Glance
This example covers implementation of a UNITE_SERVER function as an immediate server for a
READ_VAR communication function. The Modbus link concerned is connected to the PCMCIA card
of a TSX SCY 21601 module located in slot 2 of the base rack.
Programming
Programming in ST:
Request parameters:
Parameters Description
%MW100:2 Management table
%MW110:3 Example: the immediate server is SCP114 configured as slave 49
in a SCY21601 (slot 4, rack 0).
Word 1: 16#FE00 corresponds to rack,
Word 2: 16#0405 corresponds to slot,
Word 3: 16#0095 correspond to channel.
Chapter 38
WRITE_ASYN: Writing data asynchronously
Description
Function Description
The WRITE_ASYN function is used to write 1 Kbyte of data via the asynchronous messaging
channel of TSX ETY modules in TCP/IP mode.
The following data can be write-accessed:
internal bits,
internal words.
Asynchronous writing can only take place between two stations on the same Ethernet TCP/IP
network segment.
The WRITE_ASYN function is sent at the end of the MAST task only if this is configured in periodic
mode. It is possible to activate 8 functions simultaneously.
The size of the send and receive buffers is expressed in words. It is 512 words, or 1024 bytes.
NOTE: The asynchronous server function supports UNI-TE V1 or V2.0 protocols. The
WRITE_ASYN function uses the UNI-TE V2.0 protocol.
The additional parameters EN and ENO can be configured.
Exchange principle
The following diagram illustrates the exchanges between two stations for a WRITE_ASYN function:
FBD representation
Representation:
LD representation
Representation:
IL representation
Representation:
LD Address
WRITE_ASYN Object_Type, First_Object, Object_Number, Data_to_Write,
Management_Param
ST representation
Representation:
WRITE_ASYN(Address, Object_Type, First_Object, Object_Number,
Data_to_Write, Management_Param);
Parameter Description
The following table describes the input parameters:
Chapter 39
WRITE_GDATA: Writing the Global Data Modbus Plus
Description
Function Description
The WRITE_GDATA function is used to write shared data, or Global Data, on a Modbus Plus
network.
Global Data is shared between a maximum of 64 stations on the same Modbus Plus network. Each
station may write up to 32 integers, which can then be used by all stations on the network.
Conversely, each station can read the 32 integers (maximum) of all the other network stations.
The additional parameters EN and ENO can be configured.
FBD representation
Representation:
LD representation
Representation:
IL representation
Representation:
LD Address
WRITE_GDATA Data_to_Write, Management_Param
ST representation
Representation:
WRITE_GDATA(Address, Data_to_Write, Management_Param);
Parameter Description
The following table describes the input parameters:
Chapter 40
WRITE_REG: Write Register
Introduction
This chapter describes the WRITE_REG block.
Description
Function description
On a rising edge at the REQ input, this function block writes a register area from a register area of
a device connected via Modbus Plus, TCP/IP Ethernet or SY/MAX-Ethernet, with the content of a
register area of the PLC.
EN and ENO can be configured as additional parameters.
CREAD_REG, CWRITE_REG, READ_REG, WRITE_REG, and MBP_MSTR function blocks use one data
transaction path and require multiple cycles to complete an operation. The number of transaction
paths available by module and by MAST cycle depends on the communication port used:
Modbus Plus embedded port or NOM modules support up to 4 blocks at the same time.
TCP/IP Ethernet embedded port support up to 4 blocks at the same time.
TCP/IP Ethernet NOE, NOC, and 140 CRP 312 00 modules support up to 16 blocks at the same
time.
More communication function blocks may be programmed on the same communication port.
However, a communication block exceeding the maximum number on that port is not serviced until
one of the transaction paths is available. Then, the next block on the same port becomes active
and begins using an available path.
NOTE: When programming a WRITE_REG function, you must be familiar with the routing
procedures used by your network. Modbus Plus routing path structures are described in detail in
the communication architectures manual (see Communication Services and Architectures,
Reference Manual) and the Modbus Plus Network Planning and Installation Guide (Reference
31003525). If TCP/IP or SY/MAX Ethernet routing is implemented (see Quantum using
EcoStruxure™Control Expert, TCP/IP Configuration, User Manual), standard Ethernet IP router
products must be used.
NOTE: Several copies of this function block can be used in the program. However, multiple
instancing of these copies is not possible.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
CAL WRITE_REG_Instance (REQ:=StartWriteOnce,
SLAVEREG:=OffsetAddress, NO_REG:=NumberOfRegisters,
REG_WRIT:=SourceDataArea,
ADDRFLD:=DataStructureForTransfer,
DONE=>SetAfterWritingData, ERROR=>SetInCaseOfError,
STATUS=>ErrorCode)
Representation in ST
Representation:
WRITE_REG_Instance (REQ:=StartWriteOnce,
SLAVEREG:=OffsetAddress, NO_REG:=NumberOfRegisters,
REG_WRIT:=SourceDataArea,
ADDRFLD:=DataStructureForTransfer,
DONE=>SetAfterWritingData, ERROR=>SetInCaseOfError,
STATUS=>ErrorCode) ;
Parameter description
Description of input parameters:
Runtime error
For a list of all block error codes and values, see the table of error codes (see page 518).
Function mode
NOTE: The WordArr5 data structure can also be used with constants.
Parameter description
REQ
A rising edge triggers the write transaction.
The parameter can be entered as an address, located variable, unlocated variable or literal.
SLAVEREG
Start of the area in the addressed slave to which the source data is written. The source area always
resides within the %MW address area.
NOTE: For slaves for a non-Control Expert PLC:
The destination area always resides within the 4x register area. SLAVEREG expects the target
address as an offset within the 4x area. The leading "4" must be omitted (e.g. 59 (contents of the
variables or value of the literal) = 40059).
The parameter can be entered as an address, located variable, unlocated variable or literal.
NO_REG
Number of addresses to be written to slave processor (1 ... 100).
The parameter can be entered as an address, located variable, unlocated variable or literal.
REG_WRIT
An ARRAY that is the same size as the planned transmission must be agreed upon (≥ NO_REG)
for this parameter. The name of this array is defined as a parameter. If the array is defined too
small, then only the amount of data is transmitted that is present in the array.
The parameter must be defined as a located variable.
DONE
Transition to ON state for one program scan signifies that the data has been transferred.
The parameter can be entered as an address, located variable or unlocated variable.
ERROR
Transition to ON state for one program cycle signifies the detection of a new error.
The parameter can be entered as an address, located variable or unlocated variable.
STATUS
If an error occurs while the function is being executed, an error code (see page 520) remains at
this output for one cycle.
The parameter can be entered as an address, located variable or unlocated variable.
Chapter 41
WRITE_REG_QX: Write Register on EIO Bus
Description
Function description
The WRITE_REG_QX function is used to write registers in a Modbus slave connected to a
Modicon M340 Modbus communication module (BMX NOM) located in an EIO drop.
When programming a WRITE_REG_QX function, you must be familiar with the routing procedures
used by your network.
NOTE: Several copies of this function block can be used in the program. However, multiple
instancing of these copies is not possible.
The additional parameters EN and ENO can be configured.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
CAL WRITE_REG_QX_Instance (ENABLE:=WriteRegQxEnable, ABORT:=WriteRegQ-
xAbort, ADDR:=ModuleAddress, NO_REG:=NbRegistersToWrite,
REG_WRITE:=WriteData, SLAVEREG:=SlaveAddress, IEC:=IndexAdjust,
DONE=>WriteRegQxSuccessfull, ACTIVE=>WriteRegQxActive,
ERROR=>WriteRegQxFaulty, STATUS=>ErrorCode)
Representation in ST
Representation:
WRITE_REG_QX_Instance (ENABLE:=WriteRegQxEnable, ABORT:=WriteRegQ-
xAbort, ADDR:=ModuleAddress, NO_REG:=NbRegistersToWrite,
REG_WRITE:=WriteData, SLAVEREG:=SlaveAddress, IEC:=IndexAdjust,
DONE=>WriteRegQxSuccessfull, ACTIVE=>WriteRegQxActive,
ERROR=>WriteRegQxFaulty, STATUS=>ErrorCode)
Parameter description
Description of input parameters:
Chapter 42
WRITE_SDO: Writing Service Data Object
Function Description
The WRITE_SDO function block writes (explicit exchanges) from the PLC application up to the
device (SDO).
This function block provides access to the abort code when the SDO command is not successful
(only if the fieldbus is in RUN mode, and only towards the configured devices).
FBD Representation
Representation:
LD Representation
IL Representation
Representation:
CAL WRITE_SDO_Instance (ENABLE := EnableWRITE_SDO,
ABORT := AbortWRITE_SDO, ADDR := DataStructureAddress,
NODE := NodeNumber, INDEX := SDOIndex, SUBINDEX := SDOSubIndex,
OFFSET := FirstSDO, NB_IN := DataNumberIn, DATA_IN := SDODataToWrite,
DONE => WriteSDOSuccessful, ACTIVE => WriteSDOActive,
ERROR => WriteSDOFaulty, STATUS => ErrorCode,
SDOABORTCODE => AbortCode)
ST Representation
Representation:
WRITE_SDO_Instance (ENABLE := EnableWRITE_SDO, ABORT := AbortWRITE_SDO,
ADDR := DataStructureAddress, NODE := NodeNumber, INDEX := SDOIndex,
SUBINDEX := SDOSubIndex, OFFSET := FirstSDO, NB_IN := DataNumberIn,
DATA_IN := SDODataToWrite, DONE => WriteSDOSuccessful,
ACTIVE => WriteSDOActive, ERROR => WriteSDOFaulty, STATUS => ErrorCode,
SDOABORTCODE => AbortCode)
Parameter Description
The following table describes the input parameters:
Chapter 43
WRITE_VAR: Writing variables
Description
Function Description
The WRITE_VAR function is used to write one or more language objects of the same type:
internal bits
internal words
Verify that he objects to be written are consecutive. They may be located in a remote CPU or in a
device connected to a communication channel.
WARNING
EXCHANGED DATA INCOMPATIBILITY
Data structure alignments are not the same for Premium/Quantum and M340/M580 so verify that
the data exchanged are compatible. See DDT: Mapping rules (see EcoStruxure™ Control
Expert, Program Languages and Structure, Reference Manual) for alignment rules.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
FBD Representation
Representation:
LD Representation
Representation:
IL Representation
Representation:
LD Address
WRITE_VAR Object_Type, First_Object, Object_Number, Data_to_Write,
Management_Param
ST Representation
Representation:
WRITE_VAR(Address, Object_Type, First_Object, Object_Number,
Data_to_Write, Management_Param);
Parameter Description
The following table describes the input parameters:
NOTE: Verify that the length parameter is not initialized before launching the function.
NOTE: Premium CPU embedded Ethernet of TSX P574xxx, TSX P575xxx and TSX P576xxx used
as client, can only write 100 words instead of 123 words for other Ethernet modules and Premium
CPUs with ETY PORT.
Simultaneous Transactions
The following table gives the capacities of each communication channel to simultaneously process
transactions according to various configurations on Micro and Premium PLCs.
The following table gives the capacities of each communication channel to simultaneously process
transactions according to various configurations on Modicon M340 PLCs.
Configuration BMX P34 1000 BMX P34 2000 BMX P34 2010/ BMX P34 2020 BMX P34 2030/
20102 20302
Embedded CANopen - - 16 - 16
Embedded Ethernet - - - 16 16
Modbus master serial 8 16 16 16 -
port
Maximum number of requests as client per scan on Hot Standby Modicon M580 CPUs:
Maximum number of requests served per scan on Hot Standby Modicon M580 CPUs:
NOTE: Verify that the maximum number of simultaneous requests given in all tables takes into
account the maximum number of simultaneous requests that each CPU can manage per cycle, as
Client and as Server (see Modicon M580, Hardware, Reference Manual).
At a Glance
For this communication function, you can call up the assisted entry screen. Please note that the
assisted entry screen is not available for Modicon M340/M580.
NOTE: The variable symbols are accepted in the different fields of the screen.
Illustration
The following screen shows an example of the assisted entry screen of the function:
Address
For Premium PLCs, the types of object possible are:
ADDR(STRING),
ARRAY [0..5] OF INT.
NOTE: if you enter a value directly in the field, the assisted address entry button turns gray.
NOTE: simply choose from the solutions offered in the drop-down menu.
NOTE: if you enter a constant, an entry field appears to enter the constant. If you enter a variable,
it can be localised or not. On the other hand the objects to be written are mandatory located
variables.
NOTE: if you enter a constant, an entry field appears to enter the constant. If you enter a variable,
it can be localised or not.
Data to write
The data to write zone is an integer array. The size of this array depends on the number of objects
to write. This integer array can be located or not.
Report
The report is an array of 4 integers.
NOTE: be careful not to use several identical memory areas for report tables, otherwise the
variable read function may not work.
At a Glance
Until now, the examples have been written using direct addressing (use of %MWi), but it is also
possible to create these same examples using unlocated variables.
The following example uses unlocated variables, and covers the writing of a 50-word table named
Tab_1 (declared as an ARRAY [0..49] OF INT) in the Uni-Telway slave, with the address:
Network 20
Station 1
SCM2116 module in a TSX 87 in slot 5 of the base rack
Channel 1
Server address of slave Ad0 = 3.
The values to write are in the variable Tab_1 of the sender.
The management parameters are located in a table of 4 integers called Management_Parameter
(declared as ARRAY [0..3] OF INT).
Illustration
The two stations are connected via a Fipway network.
Programming
Programming in ST:
WRITE_VAR(ADDR('{20.1}0.5.1.3'),'%MW',0,50,Tab_1,Management_Parameter);
END_IF;
Request parameters:
Parameters Description
ADDR(’{20.1}5.1.3’) {20.1}: network 20, station 1
0: rack
5: module
1: channel 1
3: destination address
At a Glance
That example deals with 2 Modicon M340 processors which communicate via Modbus serial link.
Illustration
The two Modicon 340 processors are connected via a Modbus link:
Programming
Programming in ST:
END_IF;
The request parameters are as follows:
Parameters Description
ADDM(’0.0.0.7’) 0: rack number of the slave processor
0: slot number of the slave processor
0: channel number (serial port number)
7: configured slave number
At a Glance
The following example illustrates the WRITE_VAR function with a management parameter check.
Chapter 44
XMIT: Transmit
XMIT: Transmit
Introduction
This chapter describes the XMIT block. It differs from the XXMIT block only in the interface.
Therefore for the functional descriptions, see the latter block.
Brief Description
Function Description
The XMIT (Transmit) function block sends Modbus messages from a master PLC to multiple slave
PLCs or sends ASCII character strings from the PLC's Modbus slave port #1 or port #2 to ASCII
printers and terminals.
XMIT sends these messages through telephone dialup modems, radio modems, or direct
connection.
XMIT performs general ASCII input functions in the communication mode including simple ASCII
and terminated ASCII. You may import ASCII or binary data into your PLC and convert it into
various ASCII or binary data to send to DCE devices (Data Communication Equipment) based
upon the needs of your application.
NOTE: XMIT block differs from the XXMIT block only in the interface. Therefore for the functional
descriptions, see XXMIT (see page 439).
EN and ENO can be configured as additional parameters.
Diagnostics
The block has built-in diagnostics that check that no other XMIT block is active in the PLC on the
same port. In the block a control table allows you to control the communication link between the
PLC and the DCE devices attached to Modbus port #1 or port #2 of the PLC. The block does NOT
activate the port LED when it is transmitting data.
Restrictions
The block controls Modbus port #1 and #2 of the Momentum CPUs. It can be used with the stripped
exec only. It works just as its LL984 counterpart, but without ASCII string conversion, copy and
compare functions and without the Port Status functions.
Representation
FBD Representation
LD Representation
IL representation
CAL XMIT_instance(START:=Start_param, ABORT:=Abort_param,
MSG_OUT:=MsgOut_param, SET:=Set_param, PORT:=Port_param,
MSG_IN=>MsgIn_param, CFG=>Configuration_param,
OP_ACT=>Active_param, NO_SUC=>Error_param,
EXT=>Status_param)
ST representation
XMIT_instance (START:=Start_param, ABORT:=Abort_param,
MSG_OUT:=MsgOut_param, SET:=Set_param, PORT:=Port_param,
MSG_IN=>MsgIn_param, CFG=>Configuration_param,
OP_ACT=>Active_param, NO_SUC=>Error_param,
EXT=>Status_param);
Parameter Description
Description of the block parameter
Parameter Description
MSG_OUT
MSG_OUT contains the message data to be transferred, for example, ASCII characters for an
ASCII transfer, definition of termination characters for terminated ASCII input or Modbus templates
for Modbus master messages.
The data type that must be assigned to the parameter has to be a data type WORD array. This
array has to be assigned to a 4x register range. The field length must equal the length of the
MSG_IN field. If the field is assigned to the range for Unlocated variables, a runtime error message
will be generated.
SET
SET contains the configuration of the XMIT function block in form of the XMIT_SET data structure.
This parameter may be assigned to an Unlocated variable.The data structure components have
the same function as the components of the LL984 XMIT configuration. There is only one
difference, the variables are set automatically by the system and the unused variables are not
shown in this data structure. This means, a complete configuration requires that all components in
this data structure have to be defined.
PORT
PORT specifies the communications interface. The only authorized values are 0 and 1.
NOTE: When using XMIT, L9_XMIT, or XXMIT EF blocks on the two serial ports of the Momentum
171 CBU 78090 CPU, create an EF block instance for each port. Do not dynamically change the
port number. Set the port number as an initial value for each instance because the block stores
one single port configuration.
START
A 1-signal at START initiates the XMIT operation. The 1-signal must be applied until the operation
has finished or until an error has occurred.
ABORT
A 1-signal terminates the current XMIT operation and writes the abort code 121 to the FaultStatus
component of the XMIT_CFG data structure at the CFG output.
MSG_IN
MSG_IN contains the incoming message data, for example, terminated ASCII input or responses
of a Modbus master command which was previously sent by the XMIT function block.The data type
that must be assigned to the parameter has to be a data type WORD array. This array has to be
assigned to a 4x register range. The field length must equal the length of the MSG_OUT field. If
the field is assigned to the range for Unlocated variables, a runtime error message will be
generated.
CFG
CFG contains an XMIT function block copy of the configuration defined on SET which has the form
of data structure XMIT_CFG, it includes the automatically set and not used variables.The data
structure components have the same function as the components of the LL984 XMIT
configuration.This data structure has to be assigned to a 4x register range. If the data structure is
assigned to the range for Unlocated variables, a runtime error message will be generated. CFG is
used to verify the actually applied configuration.
OP_ACT
A 1-signal indicates that an XMIT operation is in progress.
NO_SUC
A 1-signal indicates that an error has occurred or that the current XMIT operation is terminated.
OP_SUC
A 1-signal indicates that the XMIT operation has been completed successfully.
EXT
Displays an error code (except in hot standby)
XMIT_SET
This data structure contains the particular configuration for the XMIT operation. This variable may
be stored in the unlocated memory. The elements of this structure have the same meaning as the
corresponding elements of the XMIT_CFG (see page 427) structure. XMIT_SET is used to
configure the XMIT block. The values of this data structure are transfered to XMIT_CFG.
NOTE: XMIT_SET does not contain the MessagePtr element. This is automatically set to the
adress of the MSG_IN array and placed into XMIT_CFG.
At a Glance
This data structure contains the actual configuration data the XMIT block uses. Do not write directly
to this array, as the content is automatically generated or copied from XMIT_SET. The following is
a detailed description of each of the (16) XMIT communication control table registers.
XMIT_CFG.UserAvail_1
The XMIT block does not use this register. However, it may be used in the user logic as a pointer.
XMIT_CFG.DataBits
XMIT supports the following data bits: 7 and 8. To configure a data bit size, enter its decimal
number into this element. Modbus messages may be sent in ASCII mode (7 or 8 data bits) or RTU
mode (8 data bits). When an invalid data bit is entered, the block displays an illegal configuration
error (error code 127) in the XMIT_CFG.FaultStatus element. For more details on Modbus
message formats refer to Modicon Modbus Protocol Reference Guide (PI MBUS 300).
XMIT_CFG.Parity
XMIT supports the following parity: none, odd and even. Enter a decimal of either: 0 = no parity,
1 = odd parity, or 2 = even parity. When an invalid parity is entered, the block displays an illegal
configuration error (error code 127) in the XMIT_CFG.FaultStatus element.
XMIT_CFG.StopBits
XMIT supports one or two stop bits. Enter a decimal of either: 1 = one stop bit, or 2 = two stop bits.
When an invalid stop bit is entered, the block displays an illegal configuration error (error code 127)
in the XMIT_CFG.FaultStatus element.
XMIT_CFG.UserAvail_2
The XMIT block does not use this element. However, it may be used in the user logic as a pointer.
XMIT_CFG.CommandWord
The XMIT interprets each bit of the command word as a function to perform. If bit 7 and 8 are on
simultaneously or if any two or more of bits 13, 14, 15 or 16 are on simultaneously or if bit 7 is not
on when bits 13, 14, 15, or 16 are on error 129 will be generated. Other restrictions apply. For more
details refer to XXMIT Communication Functions (see page 455) . The individual bit definitions are
shown in the table below.
Bit Definition
Bit 1 (msb) Reserved
Bit 2 Enable RTS/CTS modem control Set to 1 when a DCE connected to the PLC requires hardware
handshaking using RTS/CTS control. This bit may be used in
conjunction with values contained in XMIT_CFG.XmStartDelay
and XMIT_CFG.XmEndDelay. Start of transmission delay keeps
RTS asserted for (X mS) before XMIT sends message out of PLC
port. Likewise, end of transmission delay keeps RTS asserted for
(X mS) after XMIT has finished sending a message out of the PLC
port. Once the end of transmission delay expires XMIT de-assert
RTS.
Bit 3 Enable RS485 mode Set to 1 when the selected port should operate in RS485 mode.
Otherwise it defaults to 0, which is RS232 mode.
Bit 4 Reserved
Bit 5 Terminated ASCII input Set to 1 to remove and discard all characters from FIFO until the
starting string is matched, then these starting characters and
subsequent characters are written into the MSG_IN array until the
terminator sequence is matched. The terminator string is also
written into the MSG_IN array. Refer to Terminated ASCII Input
Function (see page 457) for more details.
Bit Definition
Bit 6 Simple ASCII input Set to 1 to remove the ASCII characters from FIFO for writing into
the MSG_IN array. The Message pointer (XMIT_CFG.MessagePtr)
is automatically set to the register address specified for the
MSG_IN array. Refer to Simple ASCII Input Function
(see page 459) for more details.
Bit 7 Enable ASCII string messaging Set to 1 when you want to send ASCII messages out of the PLC.
XMIT sends ASCII strings up to 1024 characters in length. You
program the ASCII message into the MSG_OUT array. Two
characters allowed per register. Only use Bit 7 OR Bit 8, do not try
to use both. Refer to ASCII String Messaging (see page 459) for
more details.
Bit 8 Enable Modbus messaging Set to 1 when you want to send Modbus messages out of the PLC.
Modbus messages may be in either RTU or ASCII formats. When
data bits=8, XMIT uses Modbus RTU format. When data bits=7,
XMIT uses Modbus ASCII format. Only use Bit 7 OR Bit 8, do not
try to use both.
Bit 9 Enable ASCII receive FIFO Set to 1 to allow the XMIT block to take control over the selected
port (1 or 2) from the PLC. The block begins to receive ASCII
characters into an empty 512 byte circular FIFO. Refer to ASCII
Receive FIFO (see page 469) for more details.
Bit 10 Enable back space Set to 1 to allow special handling of ASCII back space character
(BS, 8Hex). When using either Simple ASCII Input (Bit 6) or
Terminated ASCII Input (Bit 5) each back space character is
removed from FIFO and may or may NOT be stored into the
MSG_IN array. Refer to Enable Back space (see page 469) for
more details.
Bit 11 Enable RTS/CTS flow control Set to 1 to allow full duplex hardware flow control using the RTS
and CTS handshaking signals for ASCII massaging. The RTS/CTS
operates in both the input and output modes. Refer to Enable
RTS/CTS Flow Control (see page 470) for more details.
Bit 12 Enable Xon/Xoff flow control Set to 1 to allow full duplex software flow control using the ASCII
Xon character (DC1, 11 Hex) and the ASCII Xoff character
(DC3, 13 Hex). The Xon/Xoff operates in both the input and output
modes. Refer to Enable Xon/Xoff Flow Control (see page 471) for
more details.
Bit 13 Pulse dial modem Set to 1 when using a Hayes compatible dial-up modem and you
wish to pulse dial a telephone number. You program the phone
number into the MSG_IN array. The length of the message must be
in XMIT_SET.MessageLen. Pulse dialed numbers are sent to the
modem automatically preceded by ATDP and with carriage return
<CR> and line feed <LF> appended. Since the dial message is an
ASCII string, bit 7 must be ON prior to sending the number to be
dialed.
Bit Definition
Bit 14 hangup modem Set to 1 when using a Hayes compatible dial-up modem and you
want to hangup the modem. You must use ladder logic to turn this
bit ON. Since the hangup message is an ASCII string, bit 7 must be
ON prior to sending the message. Hang up messages are sent to
the modem automatically preceded by +++AT and with carriage
return <CR> and line feed <LF> appended. XMIT looks for a
correct disconnect response from the modem before it turns ON
the OP_SUC output signal, noting a successful completion.
Bit 15 Tone dial modem Set to 1 when using a Hayes compatible dial-up modem and you
wish to tone dial a telephone number. The the dial message must
be placed in MSG_OUT array and the length of the message in
XMIT_SET.MessageLen. Tone dial numbers are sent to the
modem automatically preceded by ATDT and with carriage return
<CR> and line feed <LF> appended. Since the dial message is an
ASCII string, bit 7 must be ON prior to sending the number to be
dialed.
Bit 16 Initialize modem Set to 1 when using a Hayes compatible dial-up modem and you
want to initialize the modem. You program the initialization
message into the MSG_OUT array and the length of the message
XMIT_SET.MessageLen. All messages are sent to the modem
automatically preceded by AT and with a carriage return <CR> and
line feed <LF> appended. Since the initialization message is an
ASCII string, bit 7 must be ON prior to sending the message.
XMIT_CFG.MessagePtr
This pointer is automatically handled by the XMIT block. It points to the beginning of the message
table which is either the MSG_IN (see page 424) array or the MSG_OUT (see page 424) array
depending on the chosen XMIT function. Each array element (4x register) holds up to two ASCII
characters. Each ASCII string may be up to 1024 characters in length. For example, when you
want to send 10 ASCII messages out of the PLC, you must transfer the10 ASCII characters strings
into the MSG_OUT array one after another after each successful operation of XMIT.
XMIT_CFG.MessageLen
You enter the length of the current message. When XMIT is sending Modbus messages for
function codes 01, 02, 03, 04, 05, 06, 08, 15 and 16, the length of the message is automatically set
to five. When XMIT is receving Terminated ASCII input the length of the message must be set to
five or an error results. When XMIT is sending Modbus messages for function codes twenty and
twenty-one, the length of the message is automatically set to six. When XMIT is sending ASCII
messages, the length may be 1 ... 1024 ASCII characters per message.
XMIT_CFG.RespTimeOut
You enter the time value in milliseconds (mS) to determine how long XMIT waits for a valid
response message from a slave device (PLC, modem, etc.). In addition, the time applies to ASCII
transmissions and flow control operations. When the response message is not completely formed
within this specified time, XMIT issues a fault. The valid range is 0 ... 65535 mS. The timeout is
initiated after the last character in the message is sent.
XMIT_CFG.RetryLimit
You enter the quantity of retries to determine how many times XMIT sends a message to get a valid
response from a slave device (PLC, modem, etc.). When the response message is not completely
formed within this specified time, XMIT issues a fault and a fault code. The valid range is 0 ...
65535 # of retries. This field is used in conjunction with response time-out (4x + 11).
XMIT_CFG.StartDelay
You enter the time value in milliseconds (mS) when RTS/CTS control is enabled, to determine how
long XMIT waits after CTS is received before it transmits a message out of the PLC port #1. Also,
you may use this register even when RTS/CTS is NOT in control. In this situation, the entered time
value determines how long XMIT waits before it sends a message out of the PLC port #1. You may
use this as a pre message delay timer. The valid range is 0 ... 65535 mS.
XMIT_CFG.XmEndDelay
You enter the time value in milliseconds (mS) when RTS/CTS control is enabled, to determine how
long XMIT keeps RTS asserted once the message is sent out of the PLC port #1. After the time
expires, XMIT deassert RTS. Also, you may use this register even when RTS/CTS is NOT in
control. In this situation, the entered time value determines how long XMIT waits after it sends a
message out of the PLC port #1. You may use this as a post message delay timer. The valid range
is 0 ... 65535 mS.
XMIT_CFG.XmCurrentRetry
The value displayed here indicates the current number of retry attempts made by the XMIT block.
This register is read only.
Application Example
Description
The following program is a short demo application which allows to easily switch between the four
main functions of the XMIT block:
ASCII Message Out (0)
Simple ASCII In (1)
Terminated ASCII In (2)
Modbus Master (3)
To select the function enter the appropriate number into the ModeSelection variable. A rising signal
on X_Trigger activates the XMIT block by setting the Start variable 1. Start remains 1 until the
function has been performed or an error occured
IEC Section
Selection of configuration data
Variable Declarations
The following tables show the variables used in this example
Variable table
Înitial Values
The following tables show the initial values for the different arrays used:
Content of XmitSetForAaciiOut Data Structure
Chapter 45
XXMIT: Transmit
XXMIT: Transmit
Introduction
This chapter describes the XXMIT block.
Section 45.1
Introduction to XXMIT
Introduction to XXMIT
XXMIT Functionality
Function Overview
The XXMIT function block enables the use of the PLCs serial port for communication under the
control of the application program.
The following communication types are supported:
Modbus as Master
Simple ASCII Input/Output
ASCII Input with one or two termination characters
Modem Communication
Function Description
The XXMIT function block sends Modbus messages from a master PLC to multiple slave PLCs or
sends ASCII character strings from the PLCs Modbus slave port number 1 to ASCII printers and
terminals. XXMIT sends these messages over telephone dialup modems, radio modems,
CAUTION
INVALID DATA
In the case of ASCII messages, there is no control (similar to a CRC or checksum) that
guarantees the validity of the received data.
To prevent reception of invalid data due to electrical perturbations, it is advised to use Modbus
Messages that include a Cyclical Redundancy Checking (CRC).
Failure to follow these instructions can result in injury or equipment damage.
Section 45.2
XXMIT:Functions
XXMIT:Functions
Overview
This section describes XXMIT.
Brief Description
Function Description
The XXMIT function block sends Modbus messages from a master PLC to multiple slave PLCs or
sends ASCII character strings from the PLC's Modbus slave port number 1 to ASCII printers and
terminals. XXMIT sends these messages over telephone dialup modems, radio modems, or simply
direct connections.
NOTE: The XXMIT function block can only be used in MAST task. There is an immediate fault code
(127) if it is started in the FAST / AUX or EVENT tasks (there is no control performed by
Control Expert at build time).
NOTE: EN and ENO should NOT be used with the XXMIT, otherwise the output parameters may
freeze.
NOTE: Modbus communication through radio modems with Quantum PLC is only possible with the
XXMIT function block configured as Modbus Master.
NOTE: Be careful that two masters (on the same bus) do not send requests simultaneously
otherwise the requests are lost and each report will have a bad result which could be 16#0100
(request could not be processed) or 16#ODFF (slave is not present).
Refer to Block availability on various hardware platforms (see page 31) for a list of supported
hardware on the XXMIT function block.
Representation
FBD representation
Representation:
LD representation
Representation:
IL representation
Representation:
CAL XXMIT_instance(Start:=Start_param,
Command:=Command_param, MsgOut:=MsgOut_param,
MsgLen:=Msglen_param, Port:=Port_param,
Baudrate:=Baudrate_param, Databits:=Databits_param,
Stopbits:=Stopbits_param, Parity:=Parity_param,
RespTout:=RespTout_param, RetryLmt:=RetryLmt_param,
StartDly:=StartDly_param, EndDly:=EndDly_param,
Error=>Error_param, MsgIn=>MsgIn_param,
RecCount=>RecCount_param, Status=>Status_param,
Retry=>Retry_param)
ST representation
Representation:
XXMIT_instance (Start:=Start_param, Command:=Command_param,
MsgOut:=MsgOut_param, MsgLen:=Msglen_param,
Port:=Port_param, Baudrate:=Baudrate_param,
Databits:=Databits_param, Stopbits:=Stopbits_param,
Parity:=Parity_param, RespTout:=RespTout_param,
RetryLmt:=RetryLmt_param, StartDly:=StartDly_param,
EndDly:=EndDly_param, Error=>Error_param,
MsgIn=>MsgIn_param, RecCount=>RecCount_param,
Status=>Status_param, Retry=>Retry_param);
Parameter Description
Description of the block parameter
Start
A value of 1 on the Start signal triggers the XXMIT operation. The value of 1 must be applied until
the operation has finished or until an error has occurred.
NOTE: The XXMIT input parameters must be initialized before setting the START input. They must
not be changed during the function block activity.
Command
The XXMIT interprets each bit of the command word as a function to perform. If bit 9 and 8 are on
simultaneously or if any two or more of bits 3, 2, 1 or 0 are on simultaneously or if bit 9 is not on
when bits 3, 2, 1, or 0 are on error 129 will be generated. For more details refer to XXMIT
Communication Functions, page 455. The individual bit definitions are shown in the following table.
Command Word Layout
Bit Definition
Bit 15 (msb) With Momentum processors, once XMIT (see page 419), XXMIT (see page 439) or
L9_XMIT (see EcoStruxure™ Control Expert, UnityLL984, Block Library) block becomes
active, the serial port will not revert back to a Slave mode. This command bit has been
created to set the Momentum serial port to its initial configuration.
Set to 1 will set the port configuration as it was in application configuration. The DONE bit
is set to 1 when the action is done.
Bit 14 Enable Set to 1 when a DCE connected to the PLC requires hardware handshaking using
RTS/CTS modem RTS/CTS control. This bit may be used in conjunction with values contained in StartDly
control and EndDly. Start of transmission delay keeps RTS asserted for the time in StartDly (ms)
before XXMIT sends a message out of PLC port. Likewise, end of transmission delay
keeps RTS asserted for the time in EndDly (ms) after XXMIT has finished sending a
message out of the PLC port. Once the end of transmission delay expires XXMIT de-
assert RTS.
Bit 13 Enable Set to 1 when the selected port should operate in RS485 mode. Otherwise it defaults to
RS485 mode 0, which is RS232 mode.
When using the Modbus port in RS485 mode with Modbus Messaging, make sure to use
exactly the same parameters (baudrate, databits, stopbits, parity) for the XXMIT function
block as configured for that port.
Bit Definition
Bit 12 ASCII word Set to 1 to use with the ASCII_IN, ASCII_OUT, and TERM_ASCII_IN communication
inversion commands to change the byte order of the MSGIN array in the Concept format. When not
set (0), these commands retain the current MSGIN byte format.
Bit 11 Terminated Set to 1 to remove and discard all characters from FIFO until the starting string is
ASCII input matched, then these starting characters and subsequent characters are written into
MsgIn until the terminator sequence is matched. The terminator string is also written into
the MsgIn. Refer to Terminated ASCII Input Function, page 457 for more details.
Bit 10 Simple Set to 1 to remove the ASCII characters from FIFO for writing into MsgIn array. Refer to
ASCII input Simple ASCII Input Function, page 459 for more details.
Bit 9 Enable Set to 1 when you want to send ASCII messages out of the PLC. XXMIT sends ASCII
ASCII string strings up to 1024 characters in length. You program the ASCII message into the MsgOut.
messaging Only use Bit 9 OR Bit 8, do not try to use both.
Bit 8 Enable Set to 1 when you want to send Modbus messages out of the PLC. Modbus messages
Modbus may be in either RTU or ASCII formats. When data bits=8, XXMIT uses Modbus RTU
messaging format. When data bits=7, XXMIT uses Modbus ASCII format. Only use Bit 9 OR Bit 8, do
not try to use both.
Bit 7 Enable Set to 1 to allow the XXMIT function block to take control over the selected port (1) from
ASCII receive the PLC. The block begins to receive ASCII characters into an empty 512 byte circular
FIFO FIFO. Refer to ASCII Receive FIFO, page 469 for more details.
Bit 6 Enable back Set to 1 to allow special handling of ASCII back space character (BS, 8Hex) when using
space either Simple ASCII Input (Bit 10) or Terminated ASCII Input (Bit 11). If Bit 6 is set, each
back space character will NOT be stored into MsgIn. Refer to Enable Back space,
page 469 for more details.
Bit 5 Enable Set to 1 to allow full duplex hardware flow control using the RTS and CTS handshaking
RTS/CTS flow signals for ASCII massaging. The RTS/CTS operates in both the input and output modes.
control Refer to Enable RTS/CTS Flow Control, page 470 for more details.
Bit 4 Enable Set to 1 to allow full duplex software flow control using the ASCII Xon character
Xon/Xoff flow (DC1, 11 Hex) and the ASCII Xoff character (DC3, 13 Hex). The Xon/Xoff operates in both
control the input and output modes. Refer to Enable Xon/Xoff Flow Control, page 471 for more
details.
Bit 3 Pulse dial Set to 1 when using a Hayes compatible dial-up modem and you wish to pulse dial a
modem telephone number. You program the phone number into the MsgOut. The length of the
message must be in MsgLen. Pulse dialed numbers are sent to the modem automatically
preceded by ATDT and with carriage return <CR> and line feed <LF> appended. Since
the dial message is an ASCII string, bit 9 must be ON prior to sending the number to be
dialed.
Bit 2 hangup Set to 1 when using a Hayes compatible dial-up modem and you want to hangup the
modem modem. You must use user logic to turn this bit ON. Since the hangup message is an
ASCII string, bit 9 must be ON prior to sending the message. Hang up messages are sent
to the modem automatically preceded by +++AT and with carriage return <CR> and line
feed <LF> appended. XXMIT looks for a correct disconnect response from the modem
before it turns ON the Done output signal, noting a successful completion.
Bit Definition
Bit 1 Tone dial Set to 1 when using a Hayes compatible dial-up modem and you wish to tone dial a
modem telephone number. You program the phone number into the MsgOut. The length of the
message must be in MsgLen. Tone dial numbers are sent to the modem automatically
preceded by ATDT and with carriage return <CR> and line feed <LF> appended. Since
the dial message is an ASCII string, bit 9 must be ON prior to sending the number to be
dialed.
Bit 0 Initialize Set to 1 when using a Hayes compatible dial-up modem and you want to initialize the
modem modem. You program the initialization message into MsgOut and the length of the
message into MsgLen. All messages are sent to the modem automatically preceded by
AT and with a carriage return <CR> and line feed <LF> appended. Since the initialization
message is an ASCII string, bit 9 must be ON prior to sending the message.
NOTE: In comparison with the Concept XXMIT Command word, the bits numeration of the
Control Expert Command word has changed:
Command word conversion
In case of application from Concept to Control Expert, the new bit numeration has to be taken into
account when the Command word is accessed by bits. This does NOT apply when communication
word is accessed by word.
MsgOut
MsgOut contains the message data to be transferred, for example, ASCII characters for an ASCII
transfer, definition of termination characters for terminated ASCII input or Modbus templates for
Modbus master messages.
The data type that must be assigned to the parameter has to match the requirements of the
function to be performed. In the case of Modbus operation, the Data Type of MsgOut and MsgIn
must be equal.
NOTE: For all communication types (Modbus Master, ASCII Input / Output), MsgOut and MsgIn
parameters must be assigned to a variable. The two variables must be either of Data Type Byte
Array or Word Array. Other type may produce unpredictable results.
NOTE: For Modbus Messaging MsgOut must be a field of words. The minimum size of the array
is WordArr9
MsgLen
You must enter the length of the current message according to the selected XXMIT function.
The following table gives an overview for Modbus and ASCII functions:
NOTE: For Modbus function codes, the value of MsgLen can be higher than five words but, only
the first five words of the Modbus definition table are taken into account at RUN time.
Port
Port specifies the communications interface. The authorized values are 0 or 1.
Baudrate
XXMIT supports the following data rates: 50, 75, 110, 134, 150, 300, 600, 1200, 1800, 2000, 2400,
3600, 4800, 7200, 9600, 19200. To configure a data rate, enter its decimal number. When an
invalid data rate is entered, the block displays an illegal configuration error (error code 127) in the
XXMIT Status element.
Databits
XXMIT supports the following data bits: 7 and 8. To configure a data bit size, enter its decimal
number into this element. Modbus messages may be sent in ASCII mode or RTU mode. ASCII
mode requires 7 data bits, while RTU mode requires 8 data bits. When sending ASCII character
message you may use either 7 or 8 data bits. When an invalid data bit is entered, the block displays
an illegal configuration error (error code 127) in the XXMIT Status element. For more details on
Modbus message formats refer to Modicon Modbus Protocol Reference Guide (www.modbus.org).
Stopbits
XXMIT supports one or two stop bits. Enter a decimal of either: 1 = one stop bit, or 2 = two stop
bits. When an invalid stop bit is entered, the block displays an illegal configuration error (error code
127) in the XXMIT Status element.
Parity
XXMIT supports the following parity: none, odd and even. Enter a decimal of either: 0 = no parity,
1 = odd parity, or 2 = even parity. When an invalid parity is entered, the block displays an illegal
configuration error (error code 127) in the XXMIT Status element.
RespTout
You enter the time value in milliseconds (ms) to determine how long XXMIT waits for a valid
response message from a slave device (PLC, modem, etc.). In addition, the time applies to ASCII
transmissions and flow control operations. When the response message is not completely formed
within this specified time, XXMIT issues a fault. The valid range is 0... 32767 ms. The timeout is
initiated after the last character in the message is sent.
RetryLmt
You enter the quantity of retries to determine how many times XXMIT sends a message to get a
valid response from a slave device (PLC, modem, etc.). When the response message is not
completely formed within this specified time, XXMIT issues a fault and a fault code. The valid range
is 0... 32767 number of retries. This field is used in conjunction with RespTout.
StartDly
You enter the time value in milliseconds (ms) when RTS/CTS control is enabled, to determine how
long XXMIT waits after CTS is received before it transmits a message out of the PLC port. Also,
you may use this register even when RTS/CTS is NOT in control. In this situation, the entered time
value determines how long XXMIT waits before it sends a message out of the PLC port. You may
use this as a pre message delay timer. The valid range is 0... 32767 ms.
EndDly
You enter the time value in milliseconds (ms) when RTS/CTS control is enabled, to determine how
long XXMIT keeps RTS asserted once the message is sent out of the PLC port. After the time
expires, XXMIT dessert RTS. Also, you may use this register even when RTS/CTS is NOT in
control. In this situation, the entered time value determines how long XXMIT waits after it sends a
message out of the PLC port. You may use this as a post message delay timer. The valid range is
0... 32767 ms.
NOTE: On RS 485 communication the transmit signal is held to ‘1’ during the EndDly time. On 2-
wire connections any characters coming from the communication partner will be lost. Therefore set
EndDly to 0 ms if the function is not needed.
Active
A value of 1 indicates that an XXMIT operation is in progress.
Done
A value of 1 indicates that the XXMIT operation has been completed successfully.
Error
A value of 1 indicates that an error has occurred or that the current XXMIT operation is terminated.
MsgIn
MsgIn contains the incoming message data, for terminated ASCII input or simple ASCII input.
In case of Modbus operation, the data type must be equal to the type of the MsgOut field.
RecCount
This element displays the number of received characters.
NOTE: When too many characters are received with no terminal character detected, an error is
reported in the Status parameter (131) and the RecCount parameter is set to MsgLen-1.
Status
This element displays a fault code generated by the XXMIT.
A complete list is shown in the table below.
Fault Status
RespTout, StartDly, EndDly, RecCount, MsgLen, RetryLmt values are less than 0.
NOTE: 1) This fault code does happen if the Modbus slave responds too fast.
In case the used Modbus slave is a Modicon PLC, please check the Modbus Port Setup of that
PLC’s configuration.
2) For the XXMIT function block in Modbus master mode, if error 116 persists after performing
correct configuration using keypad or online modifications, rebuild and transfer application to the
PLC.
Step Action
1 Connect the PC to Control Expert
2 Put the PLC in STOP
3 Change Modbus port settings (RS232 or RS 485)
4 Change command word according to the requested mode
5 Rebuild application
6 Download application
7 Put the PLC in RUN
Retry
The value displayed here indicates the number of retry attempts made by XXMIT. This element is
read only.
This Output is updated one time only when the operation is complete.
For Modicon Quantum the Retry output is updated each time there is a new retry.
For Modicon Momentum the Retry output is updated once the operation is complete, with or
without success.
NOTE: When using either of these functions you MUST set Enable ASCII receive FIFO ( Bit 7) to
1. Bit 15 (MSB) and Bits 13 and 12 are reserved. (See Table Command, page 446)
At a Glance
XXMIT supports the following ASCII communication functions
Terminated ASCII Input
Simple ASCII Input
ASCII String Messaging
The 3 graphics above show different values for XXMIT function. Regardless of what is set or
displayed in the CPU configuration screen or on the LCD display, the actual values used for
transmission are the one from the XXMIT Function Block:
Baudrate: 2400
Parity: Even
Data Bits: 7
Stop Bits: 2
Byte Function
MsgOut[1] length of start string (0 or 1 or 2)
MsgOut[2] length of termination string (1 or 2)
MsgOut[3] 1st start character
MsgOut[4] 2nd start character
MsgOut[5] 1st termination character
MsgOut[6] 2nd termination character
During the process, RecCount holds a running count of characters written into the MsgIn array.
Once the terminated string is received the Done output on XXMIT goes ON and RecCount holds
the total length of the received string including the starting and terminator strings. At this point
XXMIT still owns the port and continues to save newly received characters into the ASCII receive
FIFO, because the enable ASCII receive FIFO Command Word, Bit 7 is ON.
Using program logic, you can clear the simple ASCII input Bit before the next scan, while leaving
the enable ASCII receive FIFO Bit ON. Thus, MsgIn is NOT over written by newer FIFO data, which
is still collected in the FIFO.Using program logic, you can clear both bits for enable ASCII receive
FIFO (Bit 7), and terminated ASCII input (Bit 11) to return port control back to the PLC.
When too many characters are written into the MsgIn array with NO terminator detected, or the
MsgIn array is outside the allowed range for the configured PLC an error is reported in Status and
the RecCount parameter is not significant. The character limit is the smaller of 1024 or two times
the sizes of the MsgIn array.
Byte Content
MsgOut[1] Number of starting characters (0x01)
MsgOut[2] Number of terminator characters (0x02)
MsgOut[3] First starting character ('$')
MsgOut[4] Second starting character (Not Used)
MsgOut[5] First terminator character ('cr')
MsgOut[6] Second terminator character ('lf'')
Terminated ASCII Input Definition Table Example (content for Datatype Word Array)
XXMIT becomes ACTIVE and then discards from the input FIFO the initial five characters,
"AMScrlf", because they do not match the first starting character set to '$'. On the logic scan after
the '$' is received, XXMIT remains ACTIVE and it copies the '$' and subsequent characters into the
MsgIn array, updating RecCount with the count done so far, as the characters come in.
After the final termination character is received the output Done is activated and MsgLen contains
the total length equal to 22 characters (0x0016). The MsgIn array contains: "$weight = 1245
GRAMScrlf" as Byte Array (or: "$w", "ei", "gh", "t ", "= ", "12", "45", " G", "RA", "MS", "crlf" if using
a Word Array).
On the scan that the output Done is activated, the already received characters from the next
message, "$wei", that came in after the termination string, remains in the ASCII input FIFO. This
gives the program logic the opportunity to turn off the Terminated ASCII input before the next scan
solve of XXMIT for this port, keeping those characters in the FIFO until the PLC completes
processing the current message, that might take several scans.
From the above figure (not to scale) you can estimate the influence of the three different times
Requester Scan-time, Transmission-time and Partner Scan-time on the required Partner Delay-
time. As the requester’s and partner’s scans are asynchronous, the Partner Scan-time should not
be taken into account. The transmission-time depends on telegram length and baud rate. A
message with 18 characters at 9600 baud takes 14 ms. The main contribution obviously comes
from the Requester Scan-time. So even the minimum Partner Delay-time could be less than the
Requester Scan-time, we recommend to use the Requester Scan-time as the minimum Partner
Delay-time to ensure a sound communication..
At a glance
XXMIT allows you to communicate to a Hayes compatible modem using the functions listed in the
following table:
Modem Functions
Hangup Modem
Set Bit 2 of the command word to 1 when using a Hayes compatible dial-up modem if you want to
hangup the modem. You must use program logic to turn this bit ON. Since the hangup message is
an ASCII string, bit 9 must be ON prior to sending the message. Hang up messages are sent to
the modem automatically preceded by +++AT and with carriage return <CR> and line feed <LF>
appended. XXMIT looks for a correct disconnect response from the modem before it turns ON the
Done output signal, noting a successful completion.
Initialize Modem
Set Bit 0 of the command word to 1 when using a Hayes compatible dial-up modem and you want
to initialize the modem. You program the initialization message into the MsgOut array and the
length of the message into MsgLen. All messages are sent to the modem automatically preceded
by AT and with a carriage return <CR> and line feed <LF> appended. Since the initialization
message is an ASCII string, bit 9 must be ON prior to sending the message.
At a Glance
XXMIT supports the following Modbus function codes:
01 ... 06 and 15 ... 16
08
The 3 graphics above show different values for XXMIT function. Regardless of what is set or
displayed in the CPU configuration screen or on the LCD display, the actual values used for
transmission are the one from the XXMIT Function Block:
Baudrate: 19200
Parity: Even
Data Bits: 8
Stop Bits: 1
From the above figure (not to scale) you can estimate the influence of the three different times
Master Scan-time, Transmission-time and Slave Scan-time on the required Slave Delay-time. As
the master and slave scans are asynchronous, the Slave Scan-time should not be taken into
account. The transmission-time depends on telegram type, baud rate and protocol. A standard
Read request at 9600 baud using ASCII protocol for example takes 14 ms. The main contribution
obviously comes from the Master Scan-time. So even the minimum Slave Delay-time could be less
than the Master Scan-time, we recommend to use the Master Scan-time as the minimum Slave
Delay-time to ensure a sound communication..
NOTE: For Quantum PLCs you can specify the delay time in the Modbus Port Settings dialog. The
delay time can be specified between 10 and 1000 ms, which will automatically be rounded up to
be divisible by 10.
You must enter the required delay-time plus 10 ms. For example to have a 110 ms delay you must
enter 120 in this field.
NOTE: For 171 CBU 78090 Momentum PLCs, create an EF block instance for each port when
using XMIT, L9_XMIT, or XXMIT EF blocks on the two serial ports of the PLC. Do not dynamically
change the port number. Set the port number as an initial value for each instance because the
block stores one single port configuration
Content Description
Modbus function XXMIT supports the following function codes:
code (MsgOut[1]) 01 = Read multiple bits (%Q)
02 = Read multiple discrete bits (%I)
03 = Read multiple words (%MW)
04= Read multiple input words (%IW)
05 = Write single bit (%Q)
06 = Write single words (%MW)
15 = Write multiple bits (%Q)
16 = Write multiple words (%MW)
Quantity (MsgOut[2]) Enter the amount of data you want written to the slave PLC or read from the slave
PLC. For example, enter 100 to read 100 words from the slave PLC or enter 32 to
write 32 bits to a slave PLC. There is a size limitation on quantity that is dependent
on the PLC model. Refer to Appendix A for complete details on limits.
Slave PLC address Enter the slave Modbus PLC address. Typically the Modbus address range is
(MsgOut[3]) 1 ... 247. To send a Modbus message to multiple PLCs, enter 0 for the slave PLC
address. This is referred to as Broadcast Mode. Broadcast Mode only supports
Modbus function codes that writes data from the master PLC to slave PLCs.
Broadcast Mode does NOT support Modbus function codes that read data from slave
PLCs.
Slave PLC data area For a read command, the slave PLC data area is the source of the data. For a write
(MsgOut[4]) command, the slave PLC data area is the destination for the data. For example, when
you want to read bits (%I300 ... %I500) from a slave PLC, enter 300 in this field.
When you want to write data from a master PLC and place it into words (%MW100)
of a slave PLC, enter 100 in this field. Depending on the type of Modbus command
(write or read), the source and destination data areas must be as defined in the
Source and Destination Data Areas table below.
Master PLC data For a read command, the master PLC data area is the destination for the data
area (MsgOut[5]) returned by the slave. For a write command, the master PLC data area is the source
of the data. For example, when you want to write bits (%M16 ... %M32) located in the
master PLC to a slave PLC, enter 16 in the field. When you want to read words
(%IW1 ... %IW100) from a slave PLC and place the data into the master PLC data
area (%MW100 ... %MW199), enter 100 in this field. Depending on the type of
Modbus command (write or read), the source and destination data areas must be as
defined in the Source and Destination Data Areas table below.
Source and Destination Data Areas for Function Codes (01 ... 06, 15 and 16)
Function Code Master PLC Data Area Slave PLC Data Area
03 (Read multiple 4x) %MW (destination) %MW (source)
04 (Read multiple 3x) %MW (destination) %IW (source)
01 (Read multiple 0x) %M (destination) %Q (source)
02 (Read multiple 1x) %M (destination) %I (source)
16 (Write multiple 4x) %MW (source) %MW (destination)
15 (Write multiple 0x) %M (source) %Q (destination)
05 (Write single 0x) %M (source) %Q (destination)
06 (Write single 4x) %MW (source) %MW (destination)
When you want to send 20 Modbus messages out of the PLC, you must transfer 20 Modbus
definition tables one after another into MsgOut after each successful operation of XXMIT, or you
may program 20 separate XXMITs and then activate them one at a time through user logic.
Content Description
Modbus function XXMIT supports the following function code:
code (MsgOut[1]) 08 = Diagnostics
Content Description
Diagnostics Enter the diagnostics subfunction code decimal value in this field to perform the specific
(MsgOut[2]) diagnostics function desired. The following diagnostic subfunctions are supported:
Subfonction Code Description
00 Return query data
01 Restart comm option
02 Return diagnostic word
03 Change ASCII input delimiter
04 Force listen only mode
05 ... 09 Reserved
10 Clear counters
11 (& diagnostics words in 384, 484)
12 Return bus messages count
13 Return bus comm error count
14 ... 15 Return bus exception error count
16 Not supported
17 Return slave NAK count
18 Return slave busy count
19 ... 21 Return bus Char overrun count
Slave PLC Enter the slave Modbus PLC address. Typically the Modbus address range is 1 ... 247.
address Function code 8 does NOT support Broadcast Mode (Address 0).
(MsgOut[3])
Diagnostics You must enter the decimal value needed for the data area of the specific diagnostic
function data field subfunction:
content
Subfonction Code Description
(MsgOut[4])
02, 04, 10, 11, 12, 13, This value is automatically set to zero in the Modbus message
16, 17 and 18 sent to slave (this value is not reflected in the MsgOut buffer).
00, 01, and 03 You must enter the desired data field value. For more details,
refer to Modicon Modbus Protocol Reference Guide
(www.modbus.org).
Master PLC data For all subfunctions, the master PLC data area is the destination for the data returned
area (MsgOut[5]) by the slave.
You must specify a memory word %MW that marks the beginning of the data area
where the returned data is placed.
For example, to place the data into the master PLC data area starting at (%MW100),
enter 100 in this field. Subfunction 04 does NOT return a response. For more details,
refer to Modicon Modbus Protocol Reference Guide (www.modbus.org).
At a glance
XXMIT allows the user to define the use of a receive FIFO buffer, flow control and the function of
received back spaces.
CAUTION
TRANSMISSION LOCK-UP
If the CTS signal is forced indefinitely to OFF by the receiving device (or if there is a cable problem
that forces the CTS signal to OFF), the XXMIT block never completes the transmission and the
receiving device never receives the command. To prevent this kind of lock-up, it is advised to start
a Timer when the XXMIT block is started and warn the application program when the Timer
internal time is reached. It is also advised to reset the XXMIT Start bit.
Failure to follow these instructions can result in injury or equipment damage.
NOTE: The RTS/CTS Flow Control algorithm is different from RTS/CTS Modem Control. The
former is related to full duplex receive buffer overflow. The latter deals with the transmit process
gaining access to a shared transmission medium. Therefore, it is illegal to simultaneously request
both of these RTS/CTS algorithms.
NOTE: You CANNOT select any type of RTS/CTS Flow Control (bit 5) handshaking when the port
is in RS 485 mode (bit 13) because these signals do NOT exist in RS 485 mode.
Application Examples
Description
The following program is a short demo application with four instances of XXMIT showing the four
main functions:
Modbus Master
Simple ASCII In
ASCII Message Out
Terminated ASCII In
Modbus Master
The following Modbus Master operation is a read request to a slave (address 4 for example) device
connected to port 1 of the master:
Read slave's %MW1 to %MW10
into local %MW11 to %MW20
The Slave (address 4) must be set up with the following port parameters:
9600 baud
8 data bits
1 stop bit
even parity (2)
Declare stringname for Array by clicking on next to type (in this case bool) This will then open
a variable type selection window.
Define Element Type 1
Definition ByteArr36
Section 45.3
XXMIT: Programming Rules
The start signal is written by the application. Active, Done and Error signals are read by the
application.
CAUTION
MULTIPLE TRANSMISSION
If the Start signal is maintained to 1 after the completion, the XXMIT block is restarted. This will
generate multiple transmission of the same Modbus or ASCII message to the receiving device.
To prevent this multiple transmission, it is advised to reset the Start bit as soon as the Done bit
is seen at 1.
Failure to follow these instructions can result in injury or equipment damage.
The XXMIT function block can only be used in MAST task. There is an immediate fault code (127)
if it is started in the FAST / AUX or EVENT tasks (there is no control performed by Control Expert
at build time).
NOTE: The XXMIT input parameter must be initialized before setting the START input. They must
not be changed during the function block activity. If the START bit is reset to 0 before completion,
the function block is stopped (active bit to 0). To have a complete block execution, the value of 1
must be applied on the START bit until the operation has finished or until an error has occured.
Section 45.4
Technical References for XXMIT
Overview
This section describes the Technical References for XXMIT.
Description
There are three commands that you need to become familiar with when interfacing dial-up modems
to XXMIT.
These commands are:
Initialize modem
Dial modem
Hangup modem.
Before an ASCII message or a Modbus message goes through the modem, you must first send
an initialization string and then a dial string to the modem. Once the modem has dialed the
telephone number and made a connection to the remote modem, you may send an unlimited
number of ASCII messages or Modbus messages through the modem. To send multiple
messages, you increment the message pointer to the next message after each successful XXMIT
operation. When all messages are sent, you may then send the hangup string to the modem.
Initialization Message
The initialization message is just like any other ASCII message and may be a maximum of 512
characters long, although 50 characters is usually more than enough to initialize a modem. You
may implement any Hayes AT command as part of the initialization string. We recommend the
following commands when initializing a modem for use with XXMIT.
Initialization Message for Dial-Up Modem
NOTE: While some modem manufacturers state full compatibility with Hayes, they may still be
slightly different. Therefore, we recommend using only those commands that have the same
definition as those stated above.
The initialization message must always start with Hayes standard AT command. XXMIT
automatically precedes modem command messages with AT and appends the message with
carriage return (0x0D) and line feed (0x0A) characters since these are required by all modem
control messages. Other (non controlling) ASCII messages do not have to end with a carriage
return and line feed.
For example, a typical initialization message that XXMIT sends to the modem.
Message Length
(AT)&F&K0&Q0&D0V1X0Q0 (<CR><LF>) 1 17 characters
1 Characters within parentheses are automatically sent.
For example, the initialization message may also be used to set S-registers of the modem.
Message Length
(AT)S0=1 (<CR><LF>) 1 4 characters
1 Characters within parentheses are automatically sent.
To have XXMIT send an initialization message to the modem, bit 9 and bit 0 of the command word
must be ON. When bit 0 is ON, bits 1 and 2 must not be ON or XXMIT will not complete the
operation successfully. To actually send the message, Start input of XXMIT must come ON and
stays ON until the operation is complete or an error occurs. When XXMIT determines the message
was successfully sent to the modem, it turns ON the Done output. When an error occurs, the Error
output comes ON. The Active output is ON while the message is being sent to the modem.
NOTE: To eliminate some user logic programming, you may initialize the modem with parameters
via a terminal program and not use XXMIT. Once the parameters are in the modem memory they
may be saved to non-volatile memory with an AT command, usually &W.
Dial Message
The dial message is used to send a telephone number to the modem. Only AT commands related
to dialing a number should be included with the message. Examples of typical dial messages used
with XXMIT are shown below.
For example, dial telephone number using tone dialing.
Message Length
(AT)DT)6800326 (<CR><LF>)1 7 characters
1 Characters within parentheses are automatically sent.
Message Length
(AT)DP)6800326 (<CR><LF>) 1 7 characters
1 Characters within parentheses are automatically sent.
For example, dial telephone number using tone dialing, wait to hear dial tone before dialing
number, and pause before dialing the rest of the number.
Message Length
(AT)DT)W,6800326 (<CR><LF>) 1 9 characters
1 Characters within parentheses are automatically sent.
To have XXMIT send a tone dial message to the modem, bit 9 and bit 1 of the command word must
be ON. When bit 1 is ON, bits 0 and 2 must not be ON or XXMIT will not complete the operation
successfully. To actually send the message, the Start input of XXMIT must come ON and stays ON
until the operation is complete or an error occurs. When XXMIT determines the message was
successfully sent to the modem, it turns ON the Done output. When an error occurs, the Error
output comes ON. The Active output is ON while the message is being sent to the modem.
NOTE: Because it takes so long for a local modem to make a connection to a remote modem, the
timeout value, in RespTout should be quite long when sending a dial message to a modem. For
example, set the timeout for 30,000 mS when sending a dial message. When the timeout value is
too short, XXMIT issues a message timeout. You may have to try several settings before finding
the optimal time.
Hangup Message
The hangup message is used to hangup the modem. Only AT commands related to hanging up
the modem should be used in this message. An example of a typical hangup message is shown
below.
For example, hangup modem message.
Message Length
(+++AT)H0 (<CR><LF>)1 2 characters
1 Characters within parentheses are automatically sent.
When the hangup message is sent to a modem that is already connected to a remote modem,
XXMIT must first set the local modem in command mode. XXMIT does this by sending a escape
sequence +++ to the modem. XXMIT assumes that +++ sets the modem in command mode. Some
modem manufactures let the owner change this default escape sequence. For XXMIT to function
properly the modem should be set to accept the +++ escape sequence.
To have XXMIT send a hangup message to the modem, bit 9 and bit 2 of the command word must
be ON. When bit 2 is ON, bits 0 and 1 must not be ON or XXMIT will not complete the operation
successfully. To actually send the message, the Start input of XXMIT must come ON and stays ON
until the operation is complete or an error occurs. When XXMIT determines the message was
successfully sent to the modem, it turns ON the Done output. When an error occurs, the Error
output comes ON. The Done output is ON while the message is being sent to the modem.
NOTE: Expert: Because it takes so long for a local modem to hangup once it receives the hangup
command, the timeout value, in RespTout should be quite long when sending a dial message to a
modem. For example, set the timeout for 30,000 mS when sending a dial message. When the
timeout value is too short, XXMIT issues a message timeout. You may have to try several settings
before finding the optimal time.
Description
The following program is a short demo application to send the "Hello World" message through a
Hayes compatible Modem (Com One, Deskline 56K).
To start the application, the "stage" variable has to be set to 1 in a Control Expert animation table.
start_xxmit_block BOOL
command WORD
msgout ARRAY[0.40] OF BYTE
Msg_Size INT
xmit_DONE BOOL
xmit_ERROR BOOL
xmit_ACTIVE BOOL
xxmit_RESPTOUT INT
xxmit_STARTDLY INT
xxmit_ENDDLY INT
xmit_STATUS_mem INT
counter INT
stage WORD
msgout[4] := 16#30;(*0->30*)
msgout[5] := 16#26;(*&->26*)
msgout[6] := 16#44;(*D->44*)
msgout[7] := 16#30;(*0->30*)
msgout[8] := 16#56;(*V->56*)
msgout[9] := 16#31;(*1->31*)
msgout[10] := 16#51;(*Q->51*)
msgout[11] := 16#30;(*0->30*)
msgout[12] := 16#58;(*X->58*)
msgout[13] := 16#30;(*0->30*)
msgout[14] := 16#45;(*E->45*)
msgout[15] := 16#31;(*1->31*)
Msg_Size := 16;
start_xxmit_block:=1;
stage := 2; end_if;
if stage = 3 then
(* Dial message *)
xxmit_STARTDLY := 100;
xxmit_ENDDLY := 100;
xxmit_RESPTOUT := 32000;
(* Command word init *)
command:=2#0000001000000010;
(* Extension number *)
msgout[0] := 16#32;(*2*)
msgout[1] := 16#35;(*5*)
msgout[2] := 16#37;(*7*)
msgout[3] := 16#34;(*4*)
start_xxmit_block:=1;
Msg_Size := 4;
stage := 4; end_if;
if (stage = 5)then
if RE(%m6) then
counter := counter + 1;
end_if;
if stage = 7 then
(* ASCII message to be send *)
xxmit_STARTDLY := 300;
xxmit_ENDDLY := 400;
xxmit_RESPTOUT := 32000;
(* Command word init *)
command:2=#0100001000000000;
msgout[0] := 16#48; (*H*)
msgout[1] := 16#65; (*e*)
msgout[2] := 16#6C; (*l*)
msgout[3] := 16#6C; (*l*)
msgout[4] := 16#6F; (*o*)
msgout[5] := 16#20; (* *)
msgout[6] := 16#57; (*W*)
msgout[7] := 16#6F; (*o*)
msgout[8] := 16#72; (*r*)
msgout[9] := 16#6C; (*l*)
msgout[10] := 16#64; (*d*)
msgout[11] := 16#20; (* *)
msgout[12] := 16#21; (*!*)
msgout[13] := 16#21; (*!*)
Msg_Size := 14;
start_xxmit_block:=1;
stage := 8; end_if;
if stage = 100 then
(* Hangup message *)
command:=2#0000001000000100;
xxmit_STARTDLY := 300;
xxmit_ENDDLY := 400;
xxmit_RESPTOUT := 500;
msgout[0] := 16#48;(* *)
msgout[1] := 16#30;(*CR*)
Msg_Size := 2;
start_xxmit_block:=1; end_if;
(* Change of state after each XXMIT operation *) if xmit_DONE = 1 then
start_xxmit_block:=0;
if stage = 2 then
stage := 3;
end_if;
if stage = 4 then
ounter := 0;
stage := 5;
end_if;
if stage = 8 then
stage := 99;
end_if;
if stage = 99 then
stage :=100;
end_if; end_if;
Section 45.5
Cabling Information
Cabling Information
Overview
This section describes cables and pinouts for the hardware components used with XXMIT.
Cable Pinouts
Connector Pinouts
9-Pin Connector 25-Pin D-shell
Signal Name Pinout Pinout Pinout Signal Name
Connected To
...
RXD 2 Yes 3 RXD
TXD 3 Yes 2 TXD
RTS 7 Jumpered 4 Jumpered RTS
CTS 8 Jumpered 5 Jumpered CTS
DSR 4 Jumpered 6 Jumpered DSR
6 Jumpered 20 Jumpered
DTR DTR
GND 5 Yes 7 GND
Connector Pinouts
9-Pin Connector 25-Pin D-shell
Signal Name Pinout Pinout Pinout Signal Name
Connected To
...
RXD 2 Yes 3 RXD
TXD 3 Yes 2 TXD
RTS 7 Yes 4 RTS
CTS 8 Yes 5 CTS
DSR 4 Jumpered 6 Jumpered DSR
6 Jumpered 20 Jumpered
DTR DTR
GND 5 Yes 7 GND
Connector Pinouts
9-Pin Connector 9-Pin Connector
Signal Name Pinout Pinout Pinout Signal Name
Connected To
...
RXD 2 Yes 3 TXD
TXD 3 Yes 2 RXD
RTS 7 Jumpered 7 Jumpered RTS
8 Jumpered 8 Jumpered
CTS CTS
DSR 4 Jumpered 4 Jumpered DSR
6 Jumpered 6 Jumpered
DTR DTR
GND 5 Yes 5 GND
Connector Pinouts
9-Pin Connector 9-Pin Connector
Signal Name Pinout Pinout Pinout Signal Name
Connected To
...
TXD 2 Yes 2 TXD
RXD 3 Yes 3 RXD
RTS 7 Yes 7 RTS
CTS 8 Yes 8 CTS
DSR 4 Jumpered 4 Jumpered DSR
6 Jumpered 6 Jumpered
DTR DTR
GND 5 Yes 5 GND
Connector Pinouts
9-Pin Connector 25-Pin D-shell
Signal Name Pinout Pinout Pinout Siignal Name
Connected To
...
RXD 2 Yes 2 TXD
TXD 3 Yes 3 RXD
RTS 7 Jumpered 4 Jumpered RTS
CTS 8 Jumpered 5 Jumpered CTS
DSR 4 Jumpered 6 Jumpered DSR
6 Jumpered 20 Jumpered
DTR DTR
GND 5 Yes 7 GND
Connector Pinouts
RJ45 Connector 25-Pin D-shell
Signal Name Pinout Pinout Pinout Signal Name
Connected To
...
RXD 4 Yes 2 TXD
TXD 3 Yes 3 RXD
RTS 6 Jumpered 4 Jumpered RTS
7 Jumpered 5 Jumpered
CTS CTS
GND 5 Yes 7 GND
DSR 2 Yes 6 DSR
20
DTR
Chassis 8 Yes 1 Chassis
Ground Ground
CAUTION
RISK OF 5V SHORT CIRCUIT
Pin1 of the RJ45 receives 5V from the PLC.
Failure to follow these instructions can result in injury or equipment damage.
Connector Pinouts
RJ45 Connector 9-Pin D-shell
Signal Name Pinout Pinout Pinout Signal Name
Connected
To ...
RXD 4 Yes 3 TXD
TXD 3 Yes 2 RXD
RTS 6 Jumpered 7 Jumpered RTS
7 Jumpered 8 Jumpered
CTS CTS
GND 5 Yes 5 GND
DSR 2 Yes 4 DTR
6 DSR
Chassis 8 Yes Case of the
Ground Connector
CAUTION
RISK OF 5V SHORT CIRCUIT
Pin1 of the RJ45 receives 5V from the PLC.
Failure to follow these instructions can result in injury or equipment damage.
Connector Pinouts
RJ45 Connector 25-Pin D-shell
Signal Name Pinout Pinout Pinout Signal Name
Connected To
...
RXD 4 Yes 3 RXD
TXD 3 Yes 2 TXD
RTS 6 Jumpered 4 Jumpered RTS
7 Jumpered 5 Jumpered
CTS CTS
GND 5 Yes 7 GND
DSR 2 Yes 6 DSR
20
DTR
Chassis 8 Yes 1 Chassis
Ground Ground
CAUTION
RISK OF 5V SHORT CIRCUIT
Pin1 of the RJ45 receives 5V from the PLC.
Failure to follow these instructions can result in injury or equipment damage.
Connector Pinouts
RJ45 Connector 25-Pin D-shell
Signal Name Pinout Pinout Pinout Signal Name
Connected
To ...
RXD 4 Yes 3 RXD
TXD 3 Yes 2 TXD
RTS 6 Yes 4 RTS
CTS 7 Yes 5 CTS
GND 5 Yes 7 GND
6 Jumpered DSR
20 Jumpered
DTR
Chassis 8 Yes 1 Chassis
Ground Ground
CAUTION
RISK OF 5V SHORT CIRCUIT
Pin1 of the RJ45 receives 5V from the PLC.
Failure to follow these instructions can result in injury or equipment damage.
Connector Pinouts
RJ45 Connector RJ45 Connector
Signal Name Pinout Pinout Pinout Signal Name
Connected
To ...
RXD 4 Yes 4 RXD
TXD 3 Yes 3 TXD
RTS 6 Yes 6 RTS
CTS 7 Yes 7 CTS
GND 5 Yes 5 GND
DSR 2 Yes 2 DSR
Chassis 8 Yes 8 Chassis
Ground Ground
CAUTION
RISK OF 5V SHORT CIRCUIT
Pin1 of the RJ45 receives 5V from the PLC.
Failure to follow these instructions can result in injury or equipment damage.
Connector Pinouts
RJ45 Connector 9-Pin Connector
Signal Name Pinout Pinout Pinout Signal Name
Connected
To ...
RXD 4 Yes 2 RXD
TXD 3 Yes 3 TXD
RTS 6 Jumpered 7 Jumpered RTS
7 Jumpered 8 Jumpered
CTS CTS
GND 5 Yes 5 GND
DSR 2 Yes 6 DSR
4 DTR
Chassis 8 Yes Case of the Connector
Ground
CAUTION
RISK OF 5V SHORT CIRCUIT
Pin1 of the RJ45 receives 5V from the PLC.
Failure to follow these instructions can result in injury or equipment damage.
Connector Pinouts
RJ45 Connector 9-Pin Connector
Signal Name Pinout Pinout Pinout Signal Name
Connected To
...
RXD 4 Yes 2 RXD
TXD 3 Yes 3 TXD
RTS 6 Yes 7 RTS
CTS 7 Yes 8 CTS
GND 5 Yes 5 GND
6 Jumpered DSR
4 Jumpered DTR
Chassis 8 Yes Case of the Connector
Ground
CAUTION
RISK OF 5V SHORT CIRCUIT
Pin1 of the RJ45 receives 5V from the PLC.
Failure to follow these instructions can result in injury or equipment damage.
Pinouts table for the RJ 45 High end Quantum RS 422/RS 485 connector.
NOTE: For RS-485 protocol pins 1 and 6 must be short circuited as well as pins 2 and 3.
Connection Example 2
RJ45 to DB25
33002527 10/2019
Appendices
Appendix A
EFB Error Codes and Values
Introduction
The following tables show the error codes and error values created for the EFBs of the Library.
Introduction
When an error occurs, the FFBs of the Communication Library generate and error code in the
STATUS parameter (see page 520) (for EFBs with a STATUS output parameter), an error
information in the diag buffer (if the system diagnostic is enabled) and an error code in %SW125
(see EcoStruxure™ Control Expert, System Bits and Words, Reference Manual). The error codes
list is given in the following table.
Extended
Table of error codes and errors values created for EFBs of the Extended family.
NOTE: To know the meaning of STATUS output parameter codes, see error codes (see page 520).
Introduction
The following table shows the common error codes and error values created for floating point
errors. These error information are displayed in the Diagnostic Viewer and the error code values
are written in %SW125 (see EcoStruxure™ Control Expert, System Bits and Words, Reference
Manual).
The ss value corresponds to the Modbus Exception code returned by the Modbus slave device in
case of error (second byte of the Modbus exception PDU):
exception-function_code = request function code + 0x80: 1 byte
exception_code: 1 byte (returned as ss in 16#30ss error code
The ss value corresponds to the Communication Report code (see page 45) returned by existing
communications EFs on Premium/Atrium/Mxxx platforms.
NOTE: Taken by permission from The CIP Networks Library, Volume 1, Common Industrial
Protocol (CIP™), Edition 3.6, April 2009.
NOTE:
Error code 5055 (hex) can occur before an error code 503C (hex).
No remote device takes precedence over a timeout.
Overview
The SDO abort code is used when the SDO command is not successful.
Glossary
A
ADDM_TYPE
This predefined type is used as an output for the ADDM function. This is an ARRAY[0..8] OF Int.
You can find it in the library, in the same family as the EFs that use it.
ADDR_TYPE
This predefined type is used as an output for the ADDR function. This is an ARRAY[0..5] OF Int.
You can find it in the library, in the same family as the EFs that use it.
ANY
There is a hierarchy among the various data types. In the DFBs, it is sometimes possible to declare
variables that can contain several types of values. In that case we use ANY_xxx types.
The figure below describes this hierarchical structure:
ARRAY
An ARRAY is a table containing elements of a single type.
The syntax is as follows: ARRAY [<limits>] OF <Type>
Example:
ARRAY [1..2] OF BOOL is a one-dimensional table with two elements of type BOOL.
ARRAY [1..10, 1..20] OF INT is a two-dimensional table with 10x20 elements of type INT.
Assigned variables
A variable whose position in the PLC memory can be known. For example, the Water_pressure
variable is associated with %MW102. Water_pressure is said to be assigned.
B
BOOL
BOOL is the abbreviation for the Boolean type. This is the basic data type in computing. A BOOL
variable can have either of the following two values: 0 (FALSE) or 1 (TRUE).
A bit extracted from a word is of type BOOL, for example: %MW10.4.
BYTE
When 8 bits are grouped together, they are called a BYTE. You can enter a BYTE either in binary
mode or in base 8.
The BYTE type is encoded in an 8 bit format which, in hexadecimal format, ranges from 16#00 to
16#FF.
D
DINT
DINT is the abbreviation of Double INTeger (encoded in 32 bits).
The upper/lower limits are as follows: -(2 to the power of 31) to (2 to the power of 31) - 1.
Example:
-2147483648, 2147483647, 16#FFFFFFFF.
E
EFB
EFB is the abbreviation of Elementary Function Block.
This is a block used in a program which performs a predefined logical function.
EFBs have states and internal parameters. Even if the inputs are identical, the output values may
differ. For example, a counter has an output indicating that the preselection value has been
reached. This output is set to 1 when the current value is equal to the preselection value.
EN
EN stands for ENable; it is an optional block input. When the EN input is enabled, an ENO output is
set automatically.
If EN = 0, the block is not enabled; its internal program is not executed, and ENO is set to 0.
If EN = 1, the block's internal program is run and ENO is set to 1. If an error occurs, ENO is set to 0.
If the EN input is not connected, it is set automatically to 1.
ENO
ENO stands for Error NOtification; this is the output associated with the optional input EN.
If ENO is set to 0 (because EN = 0 or in case of an execution error):
the status of the function block outputs remains the same as it was during the previous scanning
cycle that executed correctly;
the output(s) of the function, as well as the procedures, are set to "0".
F
Function
See EF.
I
INT
INT is the abbreviation of single INTeger (encoded in 16 bits).
The upper/lower limits are as follows: -(2 to the power of 15) to (2 to the power of 15) - 1.
Example:
-32768, 32767, 2#1111110001001001, 16#9FA4.
S
STRING
A STRING variable is a series of ASCII characters. The maximum length of a string is 65,534
characters.
W
WORD
The type WORD is encoded in a 16 bit format and is used to perform processing on series of bits.
This table shows the upper/lower limits of each of the bases that can be used:
Examples of representation
Index
A um, 50
INPUT_BYTE, 141
ADDM, 73
INPUT_CHAR, 147
ADDM_TYPE, 73, 79
INPUT_CHAR_QX, 159
ADDMX, 79
MBP_MSTR, 165
ADDR, 87
ModbusP_ADDR, 213
ADDR_TYPE, 87
OUT_IN_CHAR, 219
asynchronous execution
OUT_IN_MBUS, 227
ETH_PORT_CTRL, 129
PRINT_CHAR, 265
availability of the instructions, 31
PRINT_CHAR_QX, 277
RCV_TLG, 281
READ_ASYN, 287
C READ_DDT, 291
CANCEL, 89 READ_GDATA, 295
CLOSE_TCP_CNX, 93 READ_REG, 297
communication - instructions READ_REG_QX, 305
ADDM, 73 READ_SDO, 309
ADDMX, 79 READ_VAR, 313
ADDR, 87 SEND_EMAIL, 333
CANCEL, 89 SEND_REQ, 337
CLOSE_TCP_CNX, 93 SEND_TLG, 355
CREAD_REG, 97 SYMAX_IP_ADDR, 361
CWRITE_REG, 105 TCP_IP_ADDR, 367
DATA_EXCH, 113 UNITE_SERVER, 373
ETH_PORT_CTRL, 129 WRITE_ASYN, 379
EthPort_Control_MX, 133 WRITE_GDATA, 385
EXCH_QX, 135 WRITE_REG, 387
general information for Premium and Atri- WRITE_REG_QX, 395
WRITE_SDO, 399
WRITE_VAR, 403
XXMIT, 439
CREAD_REG, 97
CWRITE_REG, 105
D
Data Structure
XMIT_CFG, 427
XMIT_SET, 426
DATA_EXCH, 113
E INPUT_CHAR, 147
INPUT_CHAR_QX, 159
error codes, 517
instructions
CREAD_REG, 520
availability, 31
CWRITE_REG, 520
EXCH_QX, 520
GET_TS_EVT_M, 520
GET_TS_EVT_Q, 520
M
MBP_MSTR, 165
INPUT_CHAR_QX, 520
ModbusP_ADDR, 213
PRINT_CHAR_QX, 520
PWS_CMD, 520
PWS_DIAG, 520
READ_PARAM_MX, 520
O
READ_REG, 520 OUT_IN_CHAR, 219
READ_REG_QX, 520 OUT_IN_MBUS, 227
READ_SDO, 520
READ_STS_MX, 520
READ_STS_QX, 520
P
RESTORE_PARAM_MX, 520 Parameter Description, 424
SAVE_PARAM_MX, 520 PRINT_CHAR, 265
WRITE_PARAM_MX, 520 PRINT_CHAR_QX, 277
WRITE_REG, 520
WRITE_REG_QX, 520
WRITE_SDO, 520 R
ETH_PORT_CTRL, 129, 129 RCV_TLG, 281
EthPort_Control_MX, 133 READ_ASYN, 287
EXCH_QX, 135 READ_DDT, 291, 291
execution type READ_GDATA, 295
ETH_PORT_CTRL, 129 READ_REG, 297
READ_REG_QX, 305
READ_SDO, 309
F READ_VAR, 313
FTP/TFTP services
enable/disable, 125, 200
function block S
ETH_PORT_CTRL, 129 security
ETH_PORT_CTRL, 129
SEND_EMAIL, 333
H SEND_REQ, 337
HTTP services SEND_TLG, 355
enable/disable, 125, 200 string management - instructions
INPUT_CHAR, 147
OUT_IN_CHAR, 219
I PRINT_CHAR, 265
INPUT_BYTE, 141 SYMAX_IP_ADDR, 361
synchronous execution
ETH_PORT_CTRL, 129
T
TCP_IP_ADDR, 367
U
UNITE_SERVER, 373
W
WRITE_ASYN, 379
WRITE_GDATA, 385
WRITE_REG, 387
WRITE_REG_QX, 395
WRITE_SDO, 399
WRITE_VAR, 403
X
XMIT, 419
XMIT_CFG, 427
XMIT_SET, 426
XXMIT, 439