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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

clearing tasks automatically at start of program

Solved!
Go to solution

When running a LabVIEW program, periodically the program is stopped in the middle and the Clear Task function was not able to execute.  Of course when the next LabVIEW program is run, I get an error.  Is there a way to clear all tasks on a DAQ or CAN in the beginning of a LabVIEW program in order to make sure that the program you are running doesn't run into an issue since the previous task wasn't cleared properly?  I was hoping for a simple drop into my program.  Any help would be appreciated!

-ncm
0 Kudos
Message 1 of 15
(3,144 Views)

The best practice is to make sure all task are cleared properly when a program exits.  Don't ever stop a program with the abort button on the tool bar as that will gaurantee that you will have tasks left in limbo.  Make sure you use a stop button on the front panel so you can close all tasks properly.  Other than that, can you give a specific example of what kind of tasks you're trying to clear?

 

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
0 Kudos
Message 2 of 15
(3,135 Views)

You should be able to issue device resets.  This will abort any running tasks and establish a known state.


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 15
(3,129 Views)

If all the users would use the stop button, my life would be easy 🙂  The most common is using the DAQ to read a voltage, for example, in my attachment I am reading a voltage from a PCB.  I was just hoping there was a way to ensure the next program runs when another user messes it up. 

 

-ncm
0 Kudos
Message 4 of 15
(3,128 Views)

//You should be able to issue device resets.  This will abort any running tasks and establish a known state.//

 

How do I do this?

-ncm
0 Kudos
Message 5 of 15
(3,125 Views)
Solution
Accepted by ncm

!0.png

 

Its buried on the DAQmx palattes under "Dev Config"


"Should be" isn't "Is" -Jay
Message 6 of 15
(3,117 Views)

@ncm wrote:

If all the users would use the stop button, my life would be easy 🙂  The most common is using the DAQ to read a voltage, for example, in my attachment I am reading a voltage from a PCB.  I was just hoping there was a way to ensure the next program runs when another user messes it up. 

 


Users should have no way to exit except the stop button or the window close button.  You can handle the window close event so things actually get cleaned up and the window doesn't close.  The abort button should not be visible to users.

 

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
Message 7 of 15
(3,112 Views)

@kbbersch wrote:

@ncm wrote:

If all the users would use the stop button, my life would be easy 🙂  The most common is using the DAQ to read a voltage, for example, in my attachment I am reading a voltage from a PCB.  I was just hoping there was a way to ensure the next program runs when another user messes it up. 

 


Users should have no way to exit except the stop button or the window close button.  You can handle the window close event so things actually get cleaned up and the window doesn't close.  The abort button should not be visible to users.

 


Agree 100%. The application should not allow the user to exit in a manner that will leave things in an unknown state.



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
Message 8 of 15
(3,107 Views)

Sounds like yet another case of "Everythings fine as long as the users don't use it."

 

Managing users in a lab enviornment can get really fun.  Good luck.


"Should be" isn't "Is" -Jay
Message 9 of 15
(3,099 Views)

I've spent most of my career managing users in a lab environment.  That's WHY I never let a user exit in an uncontrolled manner.

 

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
Message 10 of 15
(3,069 Views)