* WRITEMODBUS ch, DeviceID, address, data {* Applicable only to M+ PLC models}

Purpose Automatically write the 16-bit data to a MODBUS ASCII device using the MODBUS ASCII protocol. The communication baud rate is the default baud rate of that COMM port unless it has been changed by the SETBAUD command.

ch - PLC COMM port number (1-8)
DeviceID - Device ID of the MODBUS device (1 to 255)
address - Zero-offset address of the holding register in the MODBUS device.
data - the 16-bit data to be written to the MODBUS device

Examples WRITEMODBUS 3, 8, 1000, 1234
Comments: 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). 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 in the user program by executing the STATUS(2) function, which will return a ‘0’ if there is any error or if the slave device is not present.
See Also READMODBUS( ), STATUS(2), NETCMD$( )

backbutton.gif (507 bytes)  Basic to TBASIC Reference Manual