New modbus channel works but stops communication on ALL other channels


MattWebb

Recommended Posts

Hi,

I am new to DAQFactory and Modbus so please bear with me.

I extended a 485 network and added 5 Energy monitoring instruments to it, these instruments use ModbusRTU protocol. This network connects to the LAN via a Netbiter.

There are dozens of other networks and instruments which are working okay and DAQFactory is displaying and logging the data without issue.

I created a new channel to communicate to one of the new instrument and when I set the timing to say 5s then Apply, the data starts to flow in from the new device - Great.

The problem is that at the moment the new device start communicating, ALL other channels stop?

To remedy this, I set the timing to 0 on the new channel and have to shutdown and restart DAQFactory.

Due to the devastating affect that this new channel has to the communications on all the other channels, most of which do not share this rather small physical network in the compressor house, I have to imagine that what I have done must be obviously wrong? but.... on the flipside, the new instruments are passing their new data as expected?

Any pointers would be appreciated.

 

Link to comment
Share on other sites

OK, so the issue is almost certainly modbus addressing.   I can give you a long winded explanation, but the short is that Modbus addresses are specified in one of two ways: 

1) 40,001 notation, where holding registers go from 40,001->49,999, input registers from 30,001->39,999 etc. 
2) 0 indexed notation, where holding registers go from 0->65535, input registers go from 0->65535, etc.

(there are actually other notation methods, but they all are just variations of #1 above).  The worse part about it is that the Modbus data going through the wire itself only uses 0 indexed notation (#2).  When you type specify an address of 40,001 you are actually telling the software (usually) that you want the first holding register, which is 0.  Modbus registers specified using method #1 and all its variations only exist in the documentation.  The actual Modbus comms does not use it.  This makes for a tremendous amount of confusion, even from manufacturers, who mess it up all the time.  But now I'm getting long winded...  

Anyhow, when you ask for 40,001, what the software does is strip the 10,000's place and subtract one.  So 40,001 becomes 0, 40,002 becomes 1, 30,015 becomes 14, etc.  The 10,000 place tells you what type of register you have (holding vs input), but in the Modbus protocol, this is determined by the function, NOT the address, so again, this is all just documentation trickery.

To your problem: since about 50% of device's manuals use #1 (remember, its only in documentation), and 45% use #2 (what actually goes over the wire to your device), and, say, 5% use a variation of #1 or just plain mess it up, DAQFactory tries to make this easier for you.  What it does is that if you only specify channel #'s (registers) < 30,000, it assumes that you are going to use method #2 to specify all your register addresses.  Once you specify a channel between 30,000 and 50,000 on any Modbus device, then DAQFactory assumes that ALL your channel #'s on  that particular protocol (TCP vs RTU are considered different), are using method #1. 

To further complicate it, the addresses using method #2 overlap with the numbers used for #1, so it is possible to be using 0 index notation (#2) and have registers up into the 30 and 40,000 range or even higher which would confuse DAQFactory.  To handle this, you simply have to read, once, a register > 50,000 and DAQFactory will lock into the #2 method of addressing.

So, in your case, what happened is you used 0 index notation (#2) for all your existing devices, and then you added a new device and their documentation used method #1, so you entered an address > 30,000.  At this point, DAQFactory switched all the Modbus channels to method #1 which shifted all the addresses by 1 and made it stop working (probably because you have 32 bit values).

What you need to do is decide which of the two methods you want to use and stick with it.  I personally do everything in 0 indexed notation except for the simplest of systems.  It is very easy to just translate the addresses when you enter them into DAQFactory: strip the 10,000 place and subtract one.  This is what I suggest you do with your new device.  Remember, the 40,000 numbers you are entering are just creations of the documentation and are never seen by your actual device.

 

Link to comment
Share on other sites

Thankyou very much for your detailed reply.

I have changed the new channels to use method #2. I did find that rather than subtracting 1 from the register number, I needed to add 1 to make the registers align.

Nevertheless, it is all good now - thanks.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.