LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Notification and synchronization issues.

Apologies for the slightly vague title - I'm not exactly sure what you'd call my problem!

 

I have attached a small library who's top level vi scans a list of visa connections to verify if the instruments are connected properly. (In my main program, this is actually a subvi.) There is also a loading bar subvi that displays whilst the visa ports are being scanned. When testing, I encountered a situation where some of the instruments were taking a long time to reply. Since then, I added a 'cancel' button to the loading bar. At the moment this works to close the loading bar, but I want to also stop some code in the calling vi from executing (*) if the button was pressed. My various attempts at that failed, so I've come here to look for some help and pointers. The vi's I've uploaded are in the state from just before I started trying to get the (*) functionality. In the main vi, there is a constant called 'loading bar cancelled' - this is where I want to wire the 'output' from the subvi if possible. There is also a 3rd vi, but this was just for debugging purposes.

 

Thank you.

 

- James

 

 

Attachment:  LabVIEW 8.5



Never say "Oops." Always say "Ah, interesting!"

0 Kudos
Message 1 of 4
(2,788 Views)

Hi James,

 

as a Quickfix you could use a global variable to hold the "Cancel?"-status of your progress bar VI. (Well, don't forget to initialize that global...)

Best regards,
GerdW


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

In the code I'm rewriting from, almost every wire led to a global. That has left me with slight mental scarring and a deeply rooted fear of global variables! I may give your suggesting a try, but is there any other option? 😛



Never say "Oops." Always say "Ah, interesting!"

0 Kudos
Message 3 of 4
(2,772 Views)

You can use a notifier. We use a common VI that can be used in subVIs to see if a stop notification has been fired.

 

Check Stop Condition.png

 

At the point you are processing your cancel have it post to the notifier to siganl a stop condition has occurred. The timeout of 0 on the get notification will not slow down your code but it will catch a new notification.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 4
(2,757 Views)