Adding Second Com Port Screws Up Data From First Port


Recommended Posts

Here's my setup:

com3serial 19200 8/0/1 connected to weather station using ModbusRTU

com4serial 115200 8/0/1 connected to PV Inverters using ModbusRTU

 

Here's my problem:

I originally setup the com3serial and was able to poll the registers and display current weather but as soon as I added a channel to poll com4serial the values showing up for the com3serial channels values are screwed up.  I added an offset to the com4serial channel but that didn't help

Link to comment
Share on other sites

Modbus is a digital protocol.  Noise or interference gets caught by the CRC.  If you are getting errant values, there is probably crosstalk in your devices, or possibly a setup issue.  To determine if its a setup issue on the DAQFactory side, I'd need to see your document.

Link to comment
Share on other sites

OK to update everyone, the issue here was due to modbus addressing.  The modbus specification calls for addressing such as 40,001 for the first holding register.  However, in the Modbus serial frame, 40,001 corresponds to function 3, tag #0.  So over the years there have formed two camps among hardware manufacturers: those that use the old 40,001 notation, and those that use the zero-indexed notation in the actual Modbus frame.  Since DAQFactory is designed to work with a wide variety of devices, and we want to make it easier for users, DAQFactory will try and automatically determine which notation you are using.  Basically it assumes you are using zero-indexed notation until you read a channel in the 30,000-50,000 range, at which point it assumes you are using the 40,001 type notation.  You can read a channel in the 50,000 range and it will lock it into zero indexed mode for those devices that have zero-indexed tags in the 30,000-50,000 range (which is valid because the modbus frame supports 65536 tags per function, even though the original 40,001 notation only supports 9,999.)

 

In this case, the first device used zero indexed notation and the system worked fine.  The second device used 40,001 notation, so once the channels for the second device were added, the Modbus driver switched all devices over to 40,001 notation and thus the first device was now reading the wrong tags (off by one).  The fix is to simply use one notation form.  In this case it was easiest to simply convert the 40,001 notation by stripping the 4 and subtracting 1.  So, 40108 became channel #107.

Link to comment
Share on other sites

Archived

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