01-19-2015 09:29 AM
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 🙂
Solved! Go to Solution.
01-19-2015 09:34 AM - edited 01-19-2015 09:36 AM
Hi CLRSB,
you should note the data representation of your input values. I assume you receive a string:
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…
01-19-2015 09:55 AM
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?
01-19-2015 10:03 AM
01-19-2015 10:22 AM
Oh sorry, wrong file. I made somthing like this
01-19-2015 10:30 AM - edited 01-19-2015 12:43 PM
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.
01-19-2015 11:14 AM
Unflatten dont accept this array 😕
01-19-2015 12:42 PM
@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.
01-19-2015 12:57 PM
Thank You very much for Your help. Greets 🙂