LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read register storaged in IEEE 754

Solved!
Go to solution

Hi!

I need to build an application to read registers from my gauge. Application is almost finished but values i get on from holding register are different than values on my gauge (ex. i have voltage 230V on gauge, and values about 20k in application). Gauge stores values in IEEE 754 32-bit format and I have no idea how to read it to get correct value. I saw it's possible with using "Type cast", but i don't know how to configure it, I am totally newbie in LabVIEW. I will be much grateful if someone could show me a VI with reading from IEEE 754 option, or just tell me how to do it in detail (what to click, what to write, etc :)) 

Sorry for my english, I hope I didn't make many mistakes 🙂 

Greets 🙂

0 Kudos
Message 1 of 9
(3,501 Views)

Hi CLRSB,

 

you should note the data representation of your input values. I assume you receive a string:

check.png

The upper solution is using TypeCast, while the lower one uses DeserializeString. The second solution is more versatile as you can adapt the byte ordering easily…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 9
(3,497 Views)

Thanks for reply 🙂 I'm trying to do something like You just showed me, bu i can't wire it (still getting errors). Could You take a look on my app?

0 Kudos
Message 3 of 9
(3,483 Views)

Hi clrsb,

 

you did not use any of the shown solutions! Why don't you?

 

check.png

You may need to change byte ordering...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 9
(3,475 Views)

Oh sorry, wrong file. I made somthing like this

0 Kudos
Message 5 of 9
(3,465 Views)
Solution
Accepted by topic author CLRSB

Notice your red dots, they indicate a data type mismatch. Remove the byte array to string, because it truncates your U16 array elements to U8. Typecast and unflatten accepts U16 arrays directly. (corrected, see answer below)

 

Also change your "holding registers" to a diagram constant (righ-click terminal...change to constant). Only the type matters, the data is irrelevant here. (Shouldn't it be a scalar SGL instead?)

 

Sorry, I don't have the toolkit so I am missing your subVI.

0 Kudos
Message 6 of 9
(3,460 Views)

Unflatten dont accept this array 😕

0 Kudos
Message 7 of 9
(3,442 Views)

@CLRSB wrote:

Unflatten dont accept this array 😕


Yes, of course. Sorry about that. Insert a typecast (with type disconnected, producing a string) before wiring to the unflatten function.

0 Kudos
Message 8 of 9
(3,424 Views)

Thank You very much for Your help. Greets 🙂

0 Kudos
Message 9 of 9
(3,415 Views)