Difficulties reading T7 registers from Foglamp Modbus-C plugin | LabJack
 

Difficulties reading T7 registers from Foglamp Modbus-C plugin

4 posts / 0 new
Last post
Thom
Thom's picture
Difficulties reading T7 registers from Foglamp Modbus-C plugin

Hello,

I'm attempting to use Foglamp's Modbus-C plugin (https://github.com/foglamp/foglamp-south-modbus-c) to read registers from a T7.  The plugin successfully connects to the T7, but I'm getting errors when attempting to read certain registers.  I'm able to successfully read a register at location 2000.  I can read the read-only test register at 55100, but it returns 17 which oddly is the default value for 55110.  Reading 55110 yields 17, but I'm also seeing an Illegal Data Address error in the console from the Modbus-C plugin.  Attempting to read 55120 yields an error with Illegal Data Value.  Any insight into what may be causing this?

Thank you,

Thom Shulok

LabJack Support
labjack support's picture
There are a couple things to

There are a couple things to look for. We need to start by making sure we are reading from the address which we think we are. Then we can look at the data formatting.

First is the Modbus address. Many Modbus programs will add an offset to the address. Usually there is an option to disable the offset, but occasionally we just have to compensate when asking for an address. This is easiest to diagnose if there is a debugging mode that will show you the actual Modbus requests or packets. Keep in mind that the offset can be different for different ranges within the modbus map.

Second, not all Modbus programs define the bytes in the registers the same way. The interpretation of data bytes can be flipped, such that the first byte in a word can be most or least significant. This significane swap can also occur between 16-bit registers when reading 32-bit data types. Most Modbus programs have options to change the byte interpretation.

 

Also, our LJM library is cross-platform and will handle all of these details for you. LJM also has a log of functionality built in to make more advanced features easier to use. I strongly recommend using LJM if at all possible. 

 

Thom
Thom's picture
Thank you for the response. 

Thank you for the response.  We do use the LJM library as well, but we were hoping to integrate our Labjacks with the Foglamp (nka Fledge) platform.  I would think that many others have already done this using the existing Foglamp plugins, but perhaps not.  And you're right, though, we're discovering client programs have a host of peculiar offsets they apply to the input address.

Thanks,

Thom

LabJack Support
labjack support's picture
We have not heard of anyone

We have not heard of anyone using Foglamp / Fledge before.

In case you need it, more protocol details are here:

https://labjack.com/support/software/api/modbus/protocol-details