LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Conversion [U16] to Float32

I would like to know, as at the output of the block, "Read Holding Register" there are data "[U16]" how to do the conversion to Float32. Because the Modbus Slave data I receive from my instrument is Float32 type.

0 Kudos
Message 1 of 6
(3,503 Views)

First you need to know how the data is stored in your device. 

 

 [U16] is not something to do with LabVIEW, it is Modbus that only can store values in 16 bit format. 
You get an array out of that function, and to be able to convert to single precision float, you need to read 2 registers. 

 

To convert, look at this document: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YHcACAW&l=da-DK

0 Kudos
Message 2 of 6
(3,479 Views)

Thanks for your reply but the images are not visible in the link

0 Kudos
Message 3 of 6
(3,469 Views)

The important images are, and there are instructions on what you need at the end.

0 Kudos
Message 4 of 6
(3,462 Views)

The quick answer is to use Type Cast.  But depending on how you did the read, you will likely have to use Reverse 1D Array before the type cast in order to put the words in the correct order.



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
0 Kudos
Message 5 of 6
(3,457 Views)

Thanks for the answer, even if I didn't understand much about type cast. I'll try with the link method that was posted to me at the top. I hope to be able to convert the data [U16] to Float32 to read it like I do on modsim32.

 

0 Kudos
Message 6 of 6
(3,423 Views)