LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help parsing a string

OK, I have a program that I think is working so far. I'm sending instructions to polhemus, then getting a string of 1s and 0s back. 

Now in that string, there are 4 16 bit segments that I need with every itteration. These are my 4 data points in quarternians. Does that make sense?

So say I'm getting

0101000101010101010100101101010101010101101010011010101010110100

I need these 4 pieces:

0101000101010101

0101001011010101

0101010110101001

1010101010110100

And that will make up 1 measurement. 

So then I want it to loop again and give me 4 measurements again from this continuous string of 1s and 0s. 

 

Then I need each of these segments converted into a usable number (aka not binary). 

 

This is the acquesition section of my program with what I have so far... I don't think it's doing the right thing yet, I just pasted in a part of another file I found in the examples to see if I could modify that and get it working. 

 

If any of y'all can help it would seriously make my day! 

0 Kudos
Message 1 of 7
(3,187 Views)

Is this what you want? There are also different ways to do this besides string subset

 

 

0 Kudos
Message 2 of 7
(3,180 Views)

DOH! easier way.

 

0 Kudos
Message 3 of 7
(3,175 Views)

That looks very  promising! I can't really tell what some of those functions are, so it's hard to tell... Any chance you could upload a .vi or tell me where some of those functions are located or what they're called? I'm fairly new to this so I don't have a lot of these in my head just yet.

0 Kudos
Message 4 of 7
(3,174 Views)

Look at my second example. It's a better way. The first function is Scan Value, and the numeric constant is an I64. The next is a type cast to an array of I16 numerics. I don't know if you need I16 or U16, but that is something that's easily changed.

0 Kudos
Message 5 of 7
(3,169 Views)

I feel bad, you're being so helpful and I'm still pretty lost. I have everything except for the type and the output of the type cast. Where do you find the things  you're using? 

And if I have this all right, where is this output going? I've never used that type of output before. Is it like a variable I can call on or what?

 

Edit: I figured out how to set things as I16 and I64, so that part is a little more clear. I just don't know what the number with the arrows beside it on top of the type cast or the output of the type cast are. I can't seem to find those things anywhere. Here's my version of what you uploaded all by itself. 

Download All
0 Kudos
Message 6 of 7
(3,160 Views)

It's an array constant. Just drop one on your block diagram and drag the numeric constant into it. Then right-click the output of the type cast function and choose create indicator.

0 Kudos
Message 7 of 7
(3,142 Views)