LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

stopping while loop while in Event case

I've made several posts in the past months and found this to be the most helpful resource. Ive written a program to keep the load constant by moving an indentor towards or away the test subject at various step sizes depending on the differences in load(dp).  For the time being I dont know how long I want to data collect so I simply have a stop for the while loop in the creep test event.  However when I went to test if I could export my data I cannot exit the loop.  I do not understand why.  I tried writing a simpler program - and realized as soon as I put the while inside an event case the problem arises- the stop button becomes ineffective.  I just want to know why the stop button is ignored in the event instance and how I can fix this.  Also I want to export my collected data- am I doing it correctly ?

 

Im using labview 8.5 with a pzt actuator and PI controller.

 

Thanks for all the help, again 

0 Kudos
Message 1 of 5
(2,853 Views)

Right-click on the event structure and click 'Edit Events Handled by this Case' and uncheck the Lock Front Panel option.

 

I would recommend that you use the Producer/Consumer architecture. You can check out a template by navigating to File -> New.. and look for Producer/Consumer Design Pattern (Events).

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 2 of 5
(2,846 Views)

kingsgambit1943 wrote:

... I do not understand why.  I tried writing a simpler program - and realized as soon as I put the while inside an event case the problem arises- the stop button becomes ineffective.  I just want to know why the stop button is ignored in the event instance and how I can fix this.  Also I want to export my collected data- am I doing it correctly ?

 

Im using labview 8.5 with a pzt actuator and PI controller.

 

Thanks for all the help, again 


If you watch your code execute in execution-highlighting mode (turn on the light-bulb) you will see the "data-flow" prardigm at work. The stop button will only be read if it is inside your while loop (sorry can't look at you code, old machine).

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 5
(2,840 Views)

The real problem is that you have time consuming code inside an event case.  Look at the Producer/Consumer (events) design pattern which ships with LV.  Your code cannot respond to the stop button because it has not completed executing all the code inside the Creep Test case.

 

In general you do not want anything with loops inside an event case just to prevent the situation you are seeing.

 

Learn about state machines and the Producer/consumer architecture.  They are ideal for jobs like yours.

 

Lynn 

0 Kudos
Message 4 of 5
(2,830 Views)

Thanks for the replies.  I will look into the mentioned structures this weekend.  Thanks again. 

0 Kudos
Message 5 of 5
(2,815 Views)