LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting modbus hex-data from one register into float

Solved!
Go to solution

I have different settings for the range here that i can readout:

 

Solved now with your calculation:

-10V..+10V --> Range=10

-5V..+5V --> Range=5

-1V..+1V --> Range=1

-500mV..+500mV --> Range=0.5

-150mV..+150mV --> Range=0.15

 

But what to do with:

4mA..20mA

-10mA..20mA

0mA..20mA

-210°C..760°C

270°C..1372°C

...

 

can the calculation be changed to accept two values?

 

Thx again.

0 Kudos
Message 11 of 18
(1,383 Views)
Solution
Accepted by OnlyOne

Try this out:


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 12 of 18
(1,379 Views)

Hm, found a problem...the given Read- value is a U16 and not  an I16.

What do i have to change?

Thank you

0 Kudos
Message 13 of 18
(1,359 Views)

@OnlyOne wrote:

Hm, found a problem...the given Read- value is a U16 and not  an I16.

What do i have to change?

Thank you


Are you sure about that?  That would not work for the -10V to +10V range.  Possibly for the temperature one.  In that case, you just need to add by the minimum value instead of the average of the max and min.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 14 of 18
(1,349 Views)

I am sure because the open-source modbus-dll that provides the function to read out this register returns an ushort-array.

 

Here are some values that are displayed in the webinterface for +/- 10V-range:

FFFC = -0,001

F32D = -1,001

E662 = -2,001

BFF7 = -5,001

8CB8 = -9,006

8000 = -10V

-------------

0005 = 0,001

0CD3 = 1,001

199E = 2,001

4008 = 5,003

7340 = 9,006

7FFF = 10V

 

So it looks like 0V..10V is displayed as 0005x to 7FFFx

and

the negative values are 8000x to FFFFx in opposite order.

 

But how to put this in a vi including the different ranges?

 

Thanks

0 Kudos
Message 15 of 18
(1,342 Views)

@OnlyOne wrote:

I am sure because the open-source modbus-dll that provides the function to read out this register returns an ushort-array.

 

Here are some values that are displayed in the webinterface for +/- 10V-range:

FFFC = -0,001

F32D = -1,001

E662 = -2,001

BFF7 = -5,001

8CB8 = -9,006

8000 = -10V

-------------

0005 = 0,001

0CD3 = 1,001

199E = 2,001

4008 = 5,003

7340 = 9,006

7FFF = 10V

 

So it looks like 0V..10V is displayed as 0005x to 7FFFx

and

the negative values are 8000x to FFFFx in opposite order.

 

But how to put this in a vi including the different ranges?

 

Thanks


It is actually using 2's Complement.  By definition, that is an I16.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 16 of 18
(1,337 Views)

Thx - 

Now, after everything is working, i found in the module an option to set the return-value to Engeneering-format 🙂

0 Kudos
Message 17 of 18
(1,330 Views)

@OnlyOne wrote:

Thx - 

Now, after everything is working, i found in the module an option to set the return-value to Engeneering-format 🙂


Well, I hope you at least learned something through this experience.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 18 of 18
(1,325 Views)