LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Binary Data Manipulation (TCP/IP)

Solved!
Go to solution

Hello,

 

I was wondering if someone could point me in the right direction of converting streaming TCP/IP data into more meaning full information. The transmitting data contains "an array of 10 floats". For argument sake, I saved some data into a text file. I have tried to use the typecast and unflatten to string function to convert the data to ascii in real-time, but my lack of knowledge with binary data conversion is making things very difficult.

 

By luck, I got to convert saved binary data into an array of single precision numbers which is displaying correct values. However, I am still puzzled about doing this in real-time. I attached the data set and the example vi.

 

Thanks 

Sam

Download All
0 Kudos
Message 1 of 4
(3,857 Views)

Use a cluster of ten Floats as your fixed-size array, and use Unflatten from String, like this:

 

 

Message 2 of 4
(3,831 Views)

Thanks for your response. After trying out for many hours, I was able to derive a solution which is similar to yours. I used LV2013 during this troubleshoot, but when I decided to implement in the lab system which has LV 7.1, the "Unflatten from String" function is not same as the one in the LV2013. The LV 7.1 Unflatten from String was missing two important controls: "data includes array or string size (T or F)" and "bye order (big-endian, network order, native, host order, and little-endian)". 

 

Is there another way to accomplish this without using the modern Unflatten from String function? Maybe construct two subroutines to accommodate missing controls from LV 2103 Unflatten from String function?

 

 

 

0 Kudos
Message 3 of 4
(3,816 Views)
Solution
Accepted by topic author Sam2009

After spending hours of research on forms.ni.com and I was able to convert array of 10 floating point values into readable values in LV. As drjdpowell pointed out that using modern "Unflatten from String" function is much easier to accomplish this task. Since I had to deal with older version of LV (7.1), I needed to use typecast with type of I32 array, For-loop, Swap Words, Swap Bytes, and typecast with type SGL array. Please refer to attach .vi for more details.

0 Kudos
Message 4 of 4
(3,772 Views)