11-17-2014 12:41 PM
I would like the user to be able to abort my daqmx task by pressing a button.
I am attempting to use the method in this VI:
https://decibel.ni.com/content/docs/DOC-15815
It utilizes an event structure with the daqmx Control Task VI to abort.
The example VI above works for me, on my system with my USB-6356 device, as expected.
When I attempt to incorporate the same method into my VI it does not--despite having an identical arrangement, so far as I can tell.
I believe that my problem lies with the event structure, and the dynamic registration. I am unfamiliar with this and must be using it incorrectly.
I have attached my VI, though it is cumbersome. The code which I am struggling with is in the "Acquire" case. As far as I can tell, I am doing exactly the same this in this particular case as in the example mentioned. Yet in the example, the event structure completes, or aborts, whatever you want to call it, right after the "Wait Until Done" VI executes. In my own VI, the "Wait Until Done" and "Clear Task" VIs execute, but the event structure does not register it.
Here are my specific questions: is there anything extra or special that one must do in order for the Task to properly trigger a "Done" event and pass through the event structure? At what point is the daqmx task "Done"?
thanks,
Matt
11-17-2014 01:01 PM
I notice two things quickly.
First, the example shows the code to abort the task taking place inside the event related to the Done. In your code, that event is empty while all the code takes place in the Abort Button value change event. Why did you make this change to their software?
Additionally, I found two Event Structures in the cases I looked at briefly. You want to avoid having multiple event structures. The original example certainly didn't do this.
11-18-2014 04:28 AM
Many USB DAQs dont support all (if any) daq events, double check how yours work.
/Y
11-18-2014 09:24 AM
natasftw,
My event structure is identical to theirs; what you are seeing are the two different cases that exist in the event structure. In both the example and the VI, there is a <task out>: Done and a "Dynamic Event": Value Change. In the dynamic event case, I have my abort button and relevant code--this I believe is the code you were referring to, which you thought I was missing... Regarding my multiple event structures, they should operate completely independently as they respond to different events.
11-18-2014 09:25 AM
Yamaeda,
That might have been the answer, except that the example case works properly with the USB DAQ that I am using (which is a USB-636). thanks for the idea though
11-18-2014 02:24 PM
Okay I figured it out: the event must be registered before the task is started.
When I connected the error stream to the event registration, the error popped up and explained it to me (I should have had my error stream connected through it in the first place).
I do appreciate the help everyone, thank you.
Matt