WRITEMODBUS ch, DeviceID, address, data |
Purpose | Automatically write the 16-bit data to a MODBUS device using the MODBUS RTU/ASCII protocol. The communication baud rate is the default baud rate of that COMM port unless it has been changed by the SETBAUD command.
|
Comments: | The command automatically checks the response string received from the slave device for the correct LRC and the slave address. The status of the operation can be checked by the user program by testing the STATUS(2) function, which will return a ‘1’ for successful command and a ‘0’ if there is any error or if the slave device is not present. |
Examples | WRITEMODBUS 3, 8, 1000, 1234 |
The data 1234 will be written to the MODBUS device with ID=08 at the holding register offset address 1000 (in MODBUS convention this refer to holding register #41001). | |
See Also | READMODBUS( ), STATUS(2), NETCMD$( ) |