LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Initiating 2 while loops independent of each other

Hi, my problem is that i am using 2 while loops independent of each other. These 2 while loops contain one chart and one xy graph behaving as a chart and both are using fieldpoint. What i need to do is leave the first while alone, leave it to run and the second while loop needs to be started when i tell it to. I have tried containing the while loop within a case structure and controling it with a boolean, but the while loop will not graph the data, when starting and stopping it which u would think it would do.

Any offers of help greatly appreciated
0 Kudos
Message 1 of 9
(2,667 Views)
You need to put the case structure inside the while loop. I've included an example in LV 6.0 of what i mean showing your 2 graphs.

I hope this helps you..

Kim
Message 2 of 9
(2,667 Views)
Try this:

Wrap the second while loop in a case structure with a stop/go button
attached and put THAT in a while loop so that you can be checking it
for being pushed.

Keep the first while loop outside of all of this and it should run
independently unless they are both trying to share the same
communications h/w or something.

Doug De Clue
ddeclue@bellsouth.net


stu22 wrote in message news:<506500000008000000C9550000-1027480788000@exchange.ni.com>...
> Hi, my problem is that i am using 2 while loops independent of each
> other. These 2 while loops contain one chart and one xy graph behaving
> as a chart and both are using fieldpoint. What i need to do is leave
> the first while alone, leave it to run and the second while loop needs
> to be
started when i tell it to. I have tried containing the while
> loop within a case structure and controling it with a boolean, but the
> while loop will not graph the data, when starting and stopping it
> which u would think it would do.
>
> Any offers of help greatly appreciated
Message 3 of 9
(2,667 Views)
Tried this, still does'nt work. I think the problem is that using data from the same source.

Thanks Stu
0 Kudos
Message 4 of 9
(2,667 Views)
What might be happening is that you are calling the same vi from 2 different places in the program at the same time. If so, you need to make this vi re-entrant which means you can open it in parallel with itself.

Another thing to try is if you are using data from the same source, why not read the data from one place in the program and save it to local or global variables to be read by the other part of the program. There should be no dependency problems then and your while loops should run smoothly.

I hope this helps. If not, maybe you could post some code in LV 6.0 to illustrate your problem.

Kim
0 Kudos
Message 5 of 9
(2,667 Views)
Hi, heres the examples, see what u make of them. Please be aware these are just development versions so may be a little messy. Also the settings may be different to your PC.

Thanks Stuart
0 Kudos
Message 6 of 9
(2,667 Views)
I have looked at your example and have added a while loop round the Boolean button and case structure (see attached example). This will allow the button to be pressed during runtime to activate the 2nd while loop - otherwise the buttons' status will always be set to OFF and the case structure will only ever run once, in the false state.

Appart from that, i could see no reason why the 2nd loop shouldn't run - i could not run it myself as the subVI's were not included.

I hope this helps you..

Kim
0 Kudos
Message 7 of 9
(2,667 Views)
Thanks for your help, the loop will start now i have just got a few niggles with the program i should be able to sort out.

Stuart
0 Kudos
Message 8 of 9
(2,667 Views)
Thanks works a treat.

Stuart
0 Kudos
Message 9 of 9
(2,667 Views)