LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

pause while loop and resume at last iteration

Hi,
 
For the ease i have attached a VI containing the essence of the problem i'm having in my program.
When starting the program, case false is executed. When paused, this stops and the true structure is executed. this one finishes after a while and then there is jumped back to the false case. The problem is, the iterations start from zero again. How can i resume at the last iteration executed?
The purpose is of running through a frequency range. When paused a new frequency range can be entered, e.g. when a problem has occurred and you want to review. Afterwards, the program should continue at the last frequency in the false structure. How...?
I don't seem to be able to figure it out.
 
Gr Filip
0 Kudos
Message 1 of 8
(3,943 Views)
Hi Filip,

I'm not sure I get your point.. I modified a bit you code to try to do what I understood you were asking for.

Maybe you should concider a different architecture, a while loop with a case structure inside, and when you switch the boolean to "true", just do the next 100 execution of the loop in the true case. Tell me if I'm not clear..

Hope this helps you

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 2 of 8
(3,931 Views)
Hi,
 
Thanks for the answer, you are totally right, on the other hand i was totally wrong with my questionSmiley Sad, must have had my mind somewhere far away
 
I attached the subVI of the program in which the problem takes place. Normally you should see the structure of my previous posted VI in this one too. Now the real problem is: when i get out of the true case (ie after being paused), the program jumps back to the start frequency instead of where it stops. I know why but i don't see how to solve this. It's about Y1 coming from the formula node in the false structure. The formula node takes the entered start frequency again instead of resuming at the last frequency (which i already said i guess...).
 
The program can't be rund stand-alone, but maybe you can see the problem and probably maybe even a solution...
 
Filip
0 Kudos
Message 3 of 8
(3,924 Views)
well... I suggest you should create some sub-VIs to make your code clearer and smaller, a well-spread guideline is not to exceed the size of the screen for the diagram.
My LabVIEW teacher use to say that a well-set problem is half-solved, in your case, I'm pretty sure that if you make your code clearer the solution will come up from itself.
I think you should dig a little bit more the idea of the shift register in the while loop to "remember" the last frequency computed in the false case.

Keep it simple, keep it silly, I'm sure you'll find your own solution 😉



We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 4 of 8
(3,920 Views)

I'm indeed still quite unexperienced in LabVIEW and never had it thaugt to me, so I try to figure it out myself as much as possible, but I'll keep your advice in mind and start with creating some more subVI's then. Anyways, thanks for the trouble.

Filip

0 Kudos
Message 5 of 8
(3,916 Views)
Your welcome 😉

If you don't come up with a solution in the afternoon, post your VIs and I'll try to play with them on the week-end.
And if (like I hope) you find your solution, please post it, I am always interested in "how problems can be solved".

Learn what you can, share what you know, that's one on my favorite catch phrase !

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 6 of 8
(3,915 Views)
Despite your wise advice, I left everything as it was, but found a very simple (maybe only temporarily) solution. I used your method of counting the iterations, compared the number with 0 (first iteration). When the first iteration, I wired the external frequency through the true case structure, when not I connected the input to the shift register, if you can still follow :). Anyhow, not very innovating, but it works for now so I'll see
Message 7 of 8
(3,905 Views)
Well I'm glad I helped you find a solution.

Keep in mind for your next application to make subVIs from the start. Separate the different parts of your code 😉

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 8 of 8
(3,900 Views)