Set Modbus mode, slaveAddress, returnInterval
|slaveAddress||Slave address (1 to 254)|
|returnInterval||Return interval (1 to 255)|
Cubloc supports the Modbus protocol in combination with Ladder Logic functions. Modbus can be used on RS-232 channel 1 only.
To enable Modbus slave mode, use the
Set Modbus command. This
command will enable the Modbus slave. It must come after an OpenCom
command to set up RS-232 communication on serial channel 1. The baud
rate, stop bit, and parity settings can be set with OpenCom.
OpenCom 1,115200,3,80,80 ' Please set receive buffer to at least 50. Set Modbus 1,1,100 ' RTU mode, Slave address = 1 Set Ladder On ' Program should run forever without exiting Do Loop
After this command, the Cubloc will respond to any incoming Modbus queries automatically. The Cubloc supports Modbus function codes 1, 2, 3, 4, 5, 6, 15, and 16.
|01, 02||Bit Read|
|03, 04||Word Write|
|05||1 Bit Write|
|06||1 Word Write|
|15||Multiple Bit Write|
|16||Multiple Word Write|
The return interval is Cubloc's delay time for responding to the master Modbus device. If the return interval is set to be too fast, the master device might not be able to receive all data. The default setting is 1, which is about 200 micro-seconds. A value of 100 is about 4.5ms and a value of 255 is about 11ms.