10-14-2014 09:33 AM
I am Trying to read values for a prolinx Hart to Modbus controller i have talked to Prolinx and established that my Pressure values are coming from 40031-40032 and my flow values are coming from 40131-40132 each are standard U16 values using LabVIEW code:
I get a rather nonsensical number. I have tried reversing arrays and byte and word swapping. all to no avail. for register 31-32 LabVIEW reads 61919 and 16811 respectively which need to combine to get something close to 82 + some change and for registers 131-132 i read 17054 and 61858 respectively which needs to combine to 79 and change.
I Have Tried most of what i can find out there but please ask question about the holes in this question it might pop something out.
Thanks,
Mark
Solved! Go to Solution.
10-14-2014 09:59 AM
What is the datatype of the constant going into the typecast?
Make sure it is SGL and not DBL.
10-14-2014 10:03 AM - edited 10-14-2014 10:03 AM
Yes it is a single I have tried it both way meanin both of them are doubles then again as both of them are singles. either way I get a number in the billions
10-14-2014 10:05 AM
10-14-2014 10:09 AM
You're right. Your constant must be SGL, otherwise you'd have a coercion dot for the wire going into the SGL indicator.
Gerd's image shows exactly what I got for your 2nd example.
For your first example of 61919 and 16811, I get -2.21e30, but if I swap the values, I get a more reasonable 21.4931 (though not the 82+) you are expecting.
Are you sure about the values coming from the Modbus Read? Can you put an indicator on the array wire going to the typecast to double check those values?
10-14-2014 10:20 AM
Ok So.... you're right about me do something wrong but is wasn't really LabView code it turns out that when I went back to look at how my Prolinx profile was set up it turns out that for the flow register I was word and byte swapping in the controller and for pressure I was only byte swapping
Thanks for the hlep guys.