03-18-2008 03:56 AM
03-18-2008 04:42 AM
Hey Toni,
Your C++ is slightly confusing, it looks like you're making BOTH X and Y = step2, which means they would both be the same whenever they are fed into the table! Do you mean X=step1 there?
I've attched a modified VI that should mimic the C++, what you will see is that Y=0 while X increases 0,1,2 then Y=1 when X increases again 0,1,2 then Y=2 etc... See screenshot. This is what happens with nested loops like the one you have attached.
If you need something else can you check through the C++ again and post back?
Best wishes,
Mark Lee
03-18-2008 05:37 AM
03-18-2008 06:32 AM
Hi dctoni,
you should use a state mashine instead of stacked sequences. Take a while loop and a case structure. Every case in the case structure is a new sequence.
Mike
03-18-2008 06:35 AM
Hey Toni,
Thanks for the reply! Using Sequences is OK - all you need to do is pass the value from one frame to the next.
You can do this with flat sequences by just wiring to the right hand border of the previous frame, this will create a tunnel from which you can pick up the data in the next frame.
If you're using stacked sequences (which you were in your original post), you need to right click on the top bar and select 'Create Sequence Local'. This will give you a tunnel with an arrow in it. You can wire into this tunnel the data you want to pass onto the next frame (or subsequent frames) of the sequence (I have done this in the example I've attached). You can drag this tunnel around the border of the frame of the sequence structure if you like.
Please bear in mind that using sequence structures is not a recommended way to program in LabVIEW, there are several limitations to them (discussed really well in LabVIEW Basics 2 last time I checked). If you'd like to try a recommended way, look up state machines on ni.com or around the forums, they're the best way to make your code flexible, scalable and maintainable (and they're really easy to learn to use!)
Good Luck with your project!
Mark
03-18-2008 07:13 AM
03-18-2008 08:11 AM