From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
10-21-2021 08:31 AM
Hi, I am new to Labview, I am writing a program to generate a voltage in USB6002. I am attaching an example program. I also need 'enable' using digital High, and am able to do this, using a boolean (Run button). When I click off (?) the run button, the digital signal becomes low, as expected.
The problem is, when I close the VI without remembering to click off the run button, then the digital high continues to be on. I want the VI to essentially 'click off' the run button (make the digital pin low) and then exit. But I am not sure how to do that. The trial version is attached here. My attempts to use event structure with 'Application Instanced Closed?' is not successful. Any help will be appreciated. Thank you.
Best Regards
S. Ramanathan
10-21-2021 08:56 AM
@Ramanathan_S wrote:
Hi, I am new to Labview, I am writing a program to generate a voltage in USB6002. I am attaching an example program. I also need 'enable' using digital High, and am able to do this, using a boolean (Run button). When I click off (?) the run button, the digital signal becomes low, as expected.
The problem is, when I close the VI without remembering to click off the run button, then the digital high continues to be on. I want the VI to essentially 'click off' the run button (make the digital pin low) and then exit. But I am not sure how to do that. The trial version is attached here. My attempts to use event structure with 'Application Instanced Closed?' is not successful. Any help will be appreciated. Thank you.
Best Regards
S. Ramanathan
You can detect when someone clicks the [x] button, prevent the app from closing and instead execute code to shut down gracefully (e.g., send the signal low, etc.), then let the app close gracefully.
See this link.
10-21-2021 08:56 AM
You forgot to attach the vi. When you say "when I close the VI without remembering to click off the run button" what do you mean? Are you using the Panel Close (the X at the top right of the screen) or the Abort button (the Stop sign on the tool bar)?
10-21-2021 09:36 AM - edited 10-21-2021 09:36 AM
An Event Structure can detect these Events that might be helpful to you
Use them to perform a "safe shutdown" or warn the user if they just close the program.
10-21-2021 12:25 PM
Sorry, I forgot to attach the VI. As a backup, here is a dropbox link of the file. https://www.dropbox.com/s/0toq0nt9bi6cr0s/Example01.vi?dl=0
Will go through the suggested solutions and test and update. Thank you all for the help.
Best Regards
S. Ramanathan
10-21-2021 01:25 PM
There are a lot of things wrong with this code. First, if you have a STOP button to end the program then you should use that in your Event structure, and put the button in the Stop case. Also, you have a race condition. You could very well be turning the digital high OFF and then immediately back ON. Put your other code in the Timeout case and add a reasonable timeout in order to eliminate this. You really should consider a state machine.
Finally, I would recommend reading through the training materials at the top of this board.
10-22-2021 12:01 PM
Thanks, looks like I have to pick up quite a few things to sort it out. Thanks for the pointers
Best Regards
S. Ramanathan
10-22-2021 03:34 PM
@Ramanathan_S wrote:
Thanks, looks like I have to pick up quite a few things to sort it out. Thanks for the pointers
Best Regards
S. Ramanathan
Feel free to come back with specific questions as you develop your code.