07-21-2014 03:51 PM
I'm having an issue with ready any floating point number correctly off of a Shark 100 Power Meter.
I can sucessifully read a block of registers containing the meter name and serial number as 16 bit characters.
For example when I read registers 1-16 on the map and flattening them to a string, I get a fully working string returned.
When I try and read holding registers 1012-1013 (Amps A) I get really funny numbers when I convert to a float.
Here is my code so far
With my front pannel settings:
Expected Value I'm looking to have returned: 11.11 Amps
but
When I use an indicator to read the registers: 19265, 0
Same value when I do a conversion
When I do a type casting to a float: 1.26484E+7
I've tried some different combinations such as reading only one register and joining the numbers, both in big-endian and little-endian order, still no luck.
Please Help!
Here is the modbus float definition as defined the owners manual:
Solved! Go to Solution.
07-22-2014 12:32 AM
07-22-2014 01:29 AM
Also, I've seen that the Modbus toolkit sometimes has a weird off-by-one-register behavior (so you actually have to ask for a different address to get the data you want) and that some devices have an even weirder off-by-one-byte behavior, so that now you're off by half a register and you have to ask for more registers and then rearrange the bytes by taking one byte off the preceding or trailing register.
07-23-2014 08:18 AM
Thank you tst!
You were right about the registers being off by one. I ended up subtracting one off the leading register and it fixed things immediately.
07-08-2023 01:11 AM
This is a long shot this many years later. Could you share the VI. I am new to labview . I have a shark 100 and cant get any data. TY in advance
07-08-2023 09:17 PM - edited 07-08-2023 09:20 PM
There are a bunch of Modbus libraries floating around. This is the one I personally use.
https://www.vipm.io/package/ni_lib_modbus_library/
If you look at the documentation for the starting address it talks about the 0 index or 1 index. This is the one off behavior. I have been burned by this multiple times.