02-08-2008 08:20 AM
02-11-2008 01:08 PM
02-11-2008 01:57 PM
02-11-2008 02:17 PM
Hi jbrohan,
in which way do you cancel your vi? If you close it with the "RED" CANCEL Button it could be that there are some tasks open after stoping the vi. Or do you use the "X" Button of the window? You have to ensure that your program close all created tasks before it stops ruinning.
Mike
02-11-2008 04:13 PM
02-11-2008 07:16 PM - edited 02-11-2008 07:17 PM
Hello jbrohan,
I believe that aeastet, Mike S81, and johnsold have provided excellent suggestions and I just wanted to elaborate a little bit on what they’ve said. It sounds to me like you are using the Abort button to exit your VIs as opposed to a stop button on a while loop. As aeastet said, you need to clear all of the tasks you create at the end of your VI’s execution so that the program will run correctly the next time you run it. Below is a screenshot of a typical data acquisition (DAQ) program. If you use the abort button (top left in the screenshot) then program execution will stop immediately in the middle of the while loop and the clear task VI will not run. However, if you use the stop button on the while loop that will stop the while loop and then the Clear Task VI will execute before it stops—thus properly closing the tasks. In general is it not recommended to use the Abort button primarily because it causes the affects you have been seeing.
If for some reason you have extenuating circumstances that require the use of the abort button you should be able to call the DAQmxBase Reset Device VI at the start of your program. This will clear all tasks associated with the device and reset it to an initialized state. I want to stress that this is not a very good programming practice because it will leave the tasks active between subsequent executions of the code. For instance if you have a digital output task and you use the abort button sometime during execution when the digital output is high then it will stay in this state until you run the program again and the Reset Device VI runs. On the other hand if you use the stop button and the Clear Task VI the task will be closed at the end of the VI’s execution and the output states will be reset to their defaults immediately.
I hope that this explains a little bit of what is going on. If I’ve misunderstood what it is that you are asking please reply back with more information so we can offer further suggestions.
Have a good night!
02-12-2008 07:21 AM