Communication Functions on Controllers

Introduction

This topic describes management and operations of the controllers’ communication functions. The functions facilitate communications between specific devices. Most of the functions are dedicated to Modbus exchanges. One function (SEND_RECV_MSG) is used by an ASCII manager to manage the exchange of data between devices operating on other protocols than Modbus.

NOTE: Communication functions are processed asynchronously regarding the application task that called the function.

NOTE: Do not use function blocks of the PLCCommunication library on a serial line with a Modbus IOScanner configured. This disrupts the Modbus IOScanner exchange.

NOTE: Before you use the function blocks of this library for communication via an Ethernet port, make sure that the status of the Ethernet port provided by the variable ETH_R.i_wPortAIp­Status is DATA_EXCHANGE. For further information, refer to the description of the ETH_R_PORT_IP_STATUS enumeration data type in the PLCSystem Library Guide of your controller.

Available Function Blocks

This table describes the communication function blocks available to controllers:

Function

Description

ADDM

This function takes the destination address of an external device and converts its string representation to an ADDRESS structure.

READ_VAR

This function reads standard bits or registers from a Modbus device.

WRITE_VAR

This function writes standard bits or registers to a Modbus device.

WRITE_READ_VAR

This function reads and writes standard bits or registers on Modbus devices.

SINGLE_WRITE

This function writes a single register to an external device.

SEND_RECV_MSG

This function sends and receives user-defined messages on selected media, for example, a serial line.