LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I would like to strip individual bits from a frame of data

I have a 240bit frame of binary data. The frame is composed of multiple data points of varying word length. How does one decode a frame such as this in labview?
0 Kudos
Message 1 of 7
(3,210 Views)
There's an Array Subset function that allows you to extract parts of an array. You could use that to pull out the individual words, which you would then process however you need to.

Are there specific problems you're having?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 7
(3,210 Views)
what is separating the data points? If frame is a string you might be able to use match pattern function
0 Kudos
Message 3 of 7
(3,210 Views)
please give an example

"mike23303" schrieb im Newsbeitrag
news:50650000000800000008860000-1042324653000@exchange.ni.com...
> I have a 240bit frame of binary data. The frame is composed of
> multiple data points of varying word length. How does one decode a
> frame such as this in labview?
0 Kudos
Message 4 of 7
(3,210 Views)
One way is to create a cluster of the data types included in the bits. Convert the 240 bits into an array of U8 or a string and typecast it to the cluster type. See the attached picture.

If this doesn't work for you, (word lengths not multiple of 8 bits) please give more information about the bit packing format and the data you want to extract.


LabVIEW, C'est LabVIEW

0 Kudos
Message 5 of 7
(3,210 Views)
The frame is a 240bit binary string that contains some 31 data points of varying bit width. bit 1=lsb and 240 =msb. transmission begins with lsb. the frame is such that some data points can be as short as one bit wide where the longest is 25bits wide. I looked at the array functions but they want to work in bytes, not bits. I saw one suggestion to flatten the string to a cluster and then bust the frame up in that manner. Not sure if that will do it though unless i append zeros anything less than 8 bits in width and turn the 25bit words into 32bit unsigned... this make any sense?

thanks
0 Kudos
Message 6 of 7
(3,210 Views)
> The frame is a 240bit binary string that contains some 31 data points
> of varying bit width. bit 1=lsb and 240 =msb. transmission begins with
> lsb. the frame is such that some data points can be as short as one
> bit wide where the longest is 25bits wide. I looked at the array
> functions but they want to work in bytes, not bits. I saw one
> suggestion to flatten the string to a cluster and then bust the frame
> up in that manner. Not sure if that will do it though unless i append
> zeros anything less than 8 bits in width and turn the 25bit words into
> 32bit unsigned... this make any sense?
>

The array nodes work on elements. If the array is bytes, then they work
in bytes. If you truly want to work in bits, then convert to bits, the
n
use the array nodes.


I'm not sure if this is the best conversion, but wire the array of bytes
to a For loop. The loop will index the bytes automatically. Inside the
loop, wire up a conversion bullet to go from bytes to array of Booleans.
Wire this loop out to the edge of the loop, and this will make a 2D
array of Booleans. Outside the loop, you can use Array Reshape to make
a 1D array of the correct length.

With this you can index, split, or do whatever you like.

For a different but similar problem, you might want to look at the past
labviewzone challenge concerning bit twiddling.

Greg McKaskle
0 Kudos
Message 7 of 7
(3,210 Views)