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
(696 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
(687 Views)

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

Always maintain an accurate count of deployed mousetraps.
0 Kudos
Message 3 of 15
(681 Views)

If all the users would use the stop button, my life would be easy Smiley Happy  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
(680 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
(677 Views)
Solution
Accepted by topic author ncm
08-27-2015 04:09 PM

!0.png

 

Its buried on the DAQmx palattes under "Dev Config"

Always maintain an accurate count of deployed mousetraps.
Message 6 of 15
(669 Views)

@ncm wrote:

If all the users would use the stop button, my life would be easy Smiley Happy  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
(664 Views)

@kbbersch wrote:

@ncm wrote:

If all the users would use the stop button, my life would be easy Smiley Happy  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
(659 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.

Always maintain an accurate count of deployed mousetraps.
Message 9 of 15
(651 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
(621 Views)