LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting Raw Serial Data

Solved!
Go to solution

Im using LabVIEW to read data coming into a serial port and I am having trouble figuring out how to convert the bytes being read.

 

So, I am reading in 48 8-bit bytes, where every 2 8-bit bytes form a 16-bit integer, where the least significant byte is coming in first.

 

For example. The first byte is 10110110, the second is 01111011 to form 01111011 10110110.

 

From the 48 bit bytes, I need to get 24 16-bit integers?

 

Any ideas?

0 Kudos
Message 1 of 4
(3,343 Views)
Solution
Accepted by topic author sout23

Hi sout,

 

try this:

check.png

The right part shows two methods of converting the received string to meaningful data, using TypeCast or DeserializeString.

(When the byte order is different than needed you can wire a constant at DeserializeString or use SwapBytes after the TypeCast…)

Best regards,
GerdW


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

Cool thanks, i will try that.

 

From there, How would i extract each individual I16-bit integer. For example the first value would be Vin, the second Vout, etc and I want to display each value seperately?

0 Kudos
Message 3 of 4
(3,317 Views)
Solution
Accepted by topic author sout23

Hi sout,

 

you get an array of integer values. To index certain elements from your array you should use IndexArray

 

When you have a fixed set of data you could TypeCast into a cluster. This cluster needs to be defined according to your datastructure. When doing so you could use UnbundleByName instead…

Best regards,
GerdW


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