Modbus Port Lock Error


Recommended Posts

I am doing an application withover 250 channels using MODBUS RTU protocol with TCP port, it will communcate fine but it gets a Port Lock error every so often and then a RTU time out error. I have tried adjusting the timing but I have been able to stop the errors. I would like to if I should be polling the RTU with a sequence or can just using the automatic polling which is the way that I am doing now.

Link to comment
Share on other sites

Are you polling a single device or multiple devices? Are those devices on different IP addresses or the same? This is how you should have it setup if using channels:

1) Single device, 250 channels: all input channels should have the same timing / offset. The timeout needs to be longer (probably at least 100 ms) than it takes to read all the channels. You can use the monitor to figure out how long it takes. You need to do this to allow a little time in your polling loop to set outputs. Otherwise, the port is locked the entire timeout period and the asynchronous setting of an output can never get the port and throws a port locked error.

2) Multiple devices daisy chained on 485 then connected to a single IP address. Same as above.

3) Multiple devices on different IPs. In this case, you don't have the bottleneck, so put all the input channels on a particular device at a single timing / offset, but then set all the inputs for each other device on its own timing/offset. This causes DAQFactory to use separate threads for each and thus makes them all independent and DF can read them simultaneously. A timeout on one won't cause a port locked on the other.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.