07-08-2016 08:05 AM
I recently posted a timeout question here, that was solved, but now I am running into another minor concern.
In the attached VI, in the Inner Loop, I get that my Input is SAV, which then causes the case to be true, and stops the VI. My issue is that once that happens, for some reason, the Loop runs once more, the inner loop stays at 0 and I get something that is not what my scope sees.
When I highlight execution, I do not get this issue, I thought because of the timing, so I increased TimeDelay to 10 seconds, just to see, and it did the problem where Loop=Loop+1 and InnerLoop=0.
Any suggestions?
07-08-2016 08:09 AM
I am not sure if i understand your issue.
However, the stop button in the outer loop is read *somewhen* during execution of the loops content. That means: the stop button is likely to be one of the first thing to be read/addressed in the loop iteration. That means that pressing stop most likely will be read in the NEXT iteration.
Is it possible that you are seeing this?
Norbert
07-08-2016 08:13 AM
Is it possible that this idea is true for the inner loop, where it reads True, but then does not execute until the next loop?
I haven't been hitting the stop button, so I do not see how that could cause the extra loop.
07-08-2016 08:22 AM
Norbert answered your question, but I'm going to state it another way (and demonstrate how you can get the behavior you seem to be expecting).
LabVIEW's principle of Data Flow means that in an "execution context" (and here, think of "everything inside the While loop"), anything not tied together by data flow (in particular, anything not on the Error line in your code) are candidates for "simultaneous execution". Your loop has everything tied to the Error line (and hence strictly sequential) except the Stop button. Hence the "main sequence" and the reading of the Stop button probably happen together.
Suppose you press the Stop button -- you are probably somewhere in the middle of the loop, but the Stop button has already been read, and the "false" value put on its output line, so when you reach the end of the loop, you do not stop. Now you enter the loop, read True for the Stop, execute "one more time", and stop.
If you want the Stop to be read at the end of the loop (instead of at the beginning), put it inside a Sequence frame and run the Error line through it. Until the Error line enters the Sequence, the Stop button will not be read.
Bob Schor
07-08-2016 08:57 AM
Thanks, that makes sesne.
Total beginner question: I am adding the flat sequence, but when I do, the stop hides behind it on the block diagram. Is there a way to change that?
07-08-2016 09:01 AM
07-08-2016 09:03 AM
It just hides behind the sequence when I drop it in.
07-08-2016 09:11 AM
The stop terminal itself cannot be placed into a sub diagram.
Hint: The content of a sequence structure (each frame) is (each) called sub diagram (relative to the loop).
Norbert
07-08-2016 09:44 AM
Now I am a little lost. @Bob_Schor mentioned that I need it inside a sequence with the error line, but if it cannot go inside one, how can I tell it to stop at the end of the loop?
07-08-2016 10:13 AM
Additionally, this doesn't happen if I highlight execution.