MODBUS Address control?

Recommended Posts

So i have read and understand the various permutations on modbus addressing, that is, 0 based, 30-40000, and 50000+ (i am ignoring the 400001 ones).  My system has 5 or 6 modbus devices from different manufacturers, and I have had DAQFactory using some 42006 kinds of addresses, where I think it is subtracting stripping the 4 and subtracting 1 before it sends the address down the wire, and all was well.  Now, I have a device that seems intent on wanting the 0 based addressing, and fails access to any any addresses until I use the "write to a modbus address over 50000" trick to force the scheme back to a 0 index approach...then the new device works fine, but all the other addresses are now off by one.  I really don't want to have to go and find all the locations that specify modbus address constants and subtract one from them, because i will have to go back and test each and every different system to make sure it still works.  Is there an explicit control of the scheme, so that I can specify which address mode to use for a given device access?  What i see now is even for testing, if I read an address over 50000, the mode changes to 0 index, all the prior devices begin to fail, and the only way to change it back is to restart the program.

this fails, until I read an address over 50000, then this works fine, but other addresses like 42006 start failing

P-ModbusRTU 0002: Illegal Data Address

Share this post

Link to post
Share on other sites

No, there isn't an explicit way of controlling the mode.  This is something I hope will be changed.  

Probably the easiest solution for you is to make a duplicate driver.  So, let's assume you are using the ModbusTCP driver.  RTU is very similar, just different file names.  Do this:

1) copy pModbusTCP.dll and pModbusTCP.dds to, say, pModbusTCP2.dll and pModbusTCP2.dds

2) edit the new pModbusTCP2.dds file with a text editor:  change the first line from:




and save.

3) Restart DAQFactory

Now when you go to the device configuration, there will be two protocols, ModbusTCP and ModbusTCP2.  Create a new device with ModbusTCP2 for your new device and leave the old one as is.  By creating a copy, you have two completely separate drivers, which both just happen to talk ModbusTCP.  But one can be setup for 40000 mode, while the other uses 0 indexed.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now