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.
CWRITE_REG
function. Modbus
Plus routing path structures are described in detail in the communication architectures
manual and the Modbus Plus Network Planning
and Installation Guide (Reference 31003525). If TCP/IP or SY/MAX Ethernet routing is implemented, standard Ethernet IP router products must be used.Representation in FBD
Representation:

Representation in LD
Representation:

Representation in IL
Representation:
CAL CWRITE_REG_Instance (SLAVEREG:=OffsetAddress, NO_REG:=NumberOfRegisters, REG_WRIT:=SourceDataArea, ADDRFLD:=DataStructure, STATUS=>ErrorCode)
Representation in ST
Representation:
CWRITE_REG_Instance ( SLAVEREG:=OffsetAddress, NO_REG:=NumberOfRegisters, REG_WRIT:=SourceDataArea, ADDRFLD:=DataStructure, STATUS=>ErrorCode) ;
Parameter Description
Description of input parameters:
Parameter |
Data Type |
Description |
---|---|---|
|
|
Offset address of the first %MW register in the slave to be written to. |
|
|
Number of addresses to be written from slave. |
|
|
Source data (A data structure must be declared as a located variable for the source file.) |
|
|
Data structure transferring the Modbus Plus-address, TCI/IP address, or SY/MAX-IP address. |
Description of output parameters:
Parameter |
Data Type |
Description |
---|---|---|
|
|
If an error occurs while the function is being executed, an error code remains at this output for one cycle. |