LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Byte array to specifier Type

Solved!
Go to solution

Hello Crossrulz,

 

If this possible as a solution this would be absolutely great!

However:

How does the unflatten from string know which bytes it has to use to unflatten. As you can see in the picture (I will attach it again) this numbers are devided over several bytes per number.

Also we use little-endian.

 

How do I program this? 

 

Kind regards,

Jesse Bax

SwissDrones Operating AG

0 Kudos
Message 11 of 15
(1,189 Views)

@Feignedjesse2 wrote:

How does the unflatten from string know which bytes it has to use to unflatten. As you can see in the picture (I will attach it again) this numbers are devided over several bytes per number.

Also we use little-endian.


Your cluster should be made up of I32 and I16 values to correspond to the data type given in that table.  My previous post was a snippet which you can save to your desktop and then drag onto a block diagram and you will have the code.  You can see how I made up the cluster from there.  Note that the snippet was made with LabVIEW 2015, so you will need 2015 to open the snippet.

 

And there is an input to the Unflatten From String to state the endianness.  You just need to set that to Little Endian.


GCentral
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
Message 12 of 15
(1,170 Views)
It uses the bytes in order of the elements in the cluster, as many bytes as are needed for each data type. If the first element in the cluster is a U8, it gets the first byte from the string. Then if the second cluster element is an I32 it gets the 4 bytes that follow, etc.
Message 13 of 15
(1,155 Views)

And be sure to set the correct cluster order.  Which will work if you create the controls/indicators in the order that is in your string.  If you mess up, go to the cluster, right click on the boundary and reorder the elements to get the order that is in the byte array.  Best to save this cluster as a type def control so that it can be used in the code and in front panels.

LabVIEW ChampionLabVIEW Channel Wires

Message 14 of 15
(1,148 Views)

Thank you for the info.


It alreadyworks, I used your template as a base 🙂

 

Kind regards,

Jesse Bax

SwissDrones Operating AG

0 Kudos
Message 15 of 15
(1,131 Views)