LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Loop does not stop with Button

Hey everyone,

 

I believe this is a very simple problem, but I've been trying to figure it out, and I am in the same question.

 

I am testing parallel events for future application and eventually I understood my STOP buttons are not working. I am creating a sinusoidal wave to simulate my signal and I want to be able to stop/pause the acquisition if needed. However I can't stop it, neither I can now exit the program after starting the acquisition (and after it is finished).

 

Maybe someone can give me some tip? I attached the .vi

 

Thank you!

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

Hi Rhen,

 

did you read the "Do's and Don'ts" mentioned in the LabVIEW help for the event structure?

 

- You should avoid stacking event structures inside of event structures!

- You should avoid waiting for events when you have configured your event to process new UI action only when the current event has been handled!

- You should avoid long execution times in event cases!

- many more…

 

And: try to reduce local variable usage…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(2,835 Views)

All events should be in the same event structure. Use a

Queued Message Handler or

notifier to control parallel  loops. There are multiple examples on ni.com and your examples in labview. 

 

http://www.ni.com/video/2728/en/

0 Kudos
Message 3 of 5
(2,829 Views)

Hi GerdW,

 

Thank you for the fast answer!

I guess I did read it some time ago, but maybe I should review it again!

 

Anyway, the event structure inside the event structure is to disappear. I used it because in the first test the small while cycle was out (to test parallel behaviour).

How can I handle an acquisition otherwise without an event then? I need to choose when to start acquiring. Should I simply use a case structure out of the event case?

About your second point (" You should avoid waiting for events when you have configured your event to process new UI action only when the current event has been handled!"), I didn't really understand what it means...

 

Abour local variables, I guess I got "addicted" to use them. I'll try to reduce them! Btw, is it better to use property nodes? Or should I simply connect wire as much as possible?

 

Thank you once again!

 

 

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

Hi Rhen,

 

maybe I should review it again!

Yes…

 

I didn't really understand what it means...

Read the LabVIEW help on the event structure and all options for event cases!

 

Btw, is it better to use property nodes?

No, they are even slower…

 

Or should I simply connect wire as much as possible?

LabVIEW follows the DATAFLOW: use wires for DATAFLOW!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 5
(2,812 Views)