12-01-2011 10:45 AM
I've put some conditions in a for-loop and a conditional terminal. When my conditions are reached my for loop stops, as it should, and
i use a local variable on the conditional terminal in my for loop to stop my while loop.
My local variable linked to my stop gives a true (checked with probe), so my while loop should stop. Instead it keeps on running. Aney ideas?
already tnx for the help
12-01-2011 11:01 AM
Can you attach your code so it is easier to determine the problem?
12-02-2011 04:52 AM
I've done some remoddeling but i can't seem to get rid of the local variable.
But the problem now is my stop responds 1 cycle after he gets the true signal.
what i mean is: The conditions are met, my global stop (while loop) gets a true value and it still doesn't shut down. My for loop runs one more time completeley before my while loop shuts down. This way i've reached my goal but my output is totally wrong.
So is there a way to avoid my for loop doing the excessive loop?
12-02-2011 05:06 AM
Do remenber that loop iterations starts from 0. i,e, if you want to stop at 10 iterations and compare the ieration value to 10 then, defenitely you will be having 11 iteration 0-10 (11)....checked this..?
12-02-2011 05:11 AM
yes i've checked all of that. it's just my stop gets a true signal and still allows one more execution of my loop...
12-02-2011 05:28 AM
check the solution for your issue... only you have to specify some delay in the loop.. see vi. If u remove the delay in the loop, it will run for extra one time.. and with delay it will stop at first attempt only..... cheers....
12-02-2011 06:02 AM
The thing with your VI: you start with a true value on your boolean. So your program ends after completion of 1 for loop. In my case the for loop needs to be repeated a couple of times. So i tried to add a reset of my booleans with a case structure. When you execute this you'll see that the for loop is execute twice instead of once.
12-02-2011 06:29 AM
It sounds like it is a sequencing problem. I see that you said you have used local variable to stop the while loop. Could you create a sequence such that, in the first sequence u execute your for loop and once you come out of for loop in the next sequence, read the local variable and wire it to the conditional terminal of while loop.
Hope this solves your problem
Regards,
Prashant
12-02-2011 06:40 AM
Tnx a lot for your reply Prashant, thanks to you i tried every way possible to directly connect my conditional terminal from while and for loop. Now it works perfectly. I just had to put in a shiftregisters on my for loop that connects my two terminals. Such an easy fix for something i've been struggling bout for so long.
tnx all who replied during my search.