WRITE_VAR
: Write Data to a Modbus Device
The WRITE_VAR
function block writes data to an external device in the Modbus protocol.
WRITE_VAR
- Specific Parameter Description
Input |
Type |
Comment |
---|---|---|
|
ObjectType |
|
|
DINT |
|
|
UINT |
|
|
POINTER TO BYTE |
Pointer address to the array that holds the data which shall be written to the target device. The array must be equal or greater than the data which shall be written. For example, if 4 registers shall be written an array of 4 words is required and the writing of 32 bits require an array of 2 words or 4 bytes, each bit of which is set to the corresponding value. You must use the ADR function to pass the address of the first byte of the array (see CFC chart in the example). |
WARNING | |
---|---|
This example shows the implementation of the WRITE_VAR
function block in conjunction with the ADDM
function block in order to write 10 outputs (coils) starting at address 0 of a Modbus slave. The Modbus slave is specified with address 8 and must be reachable through the serial line interface 1. A precondition is the configuration of the Modbus Manager as master under the serial line interface 1.