10-23-2015 09:43 AM - edited 10-23-2015 09:56 AM
Hello,
I use the AO to produce a sinusoidal array of values sent out multiple times using Allow Regeneration, with Finite Samples, which is initiated by a trigger. Call this one group.
A single test involves hundreds of groups. But, there are gaps between them where other devices are doing things. In that gap, I also change the sinusoidal array values and then restart (waiting for trigger). I would like to use just the Stop Task and Start Task vis for this.
The complication is I want the AO to be a specific value in the gap between groups, which might not be the last value of the array. I want a way to say: after the task is done, make the AO sit at X until you hit the next start trigger. Since I'm using regeneration, I can't just put the value on the end of the normal output array.
Is there a way to do this without clearing the triggered task, creating a new untriggered task, setting the value, then clearing again, creating a new triggered task, ect., hundreds of times as it goes around the loop?
thanks,
Isaac
Solved! Go to Solution.
10-23-2015 12:13 PM
can you post a sample of the code where you are doing this (image would be ok)?
10-23-2015 12:34 PM
10-23-2015 01:11 PM
@iBrow1000 wrote:
Hello,
Is there a way to do this without clearing the triggered task, creating a new untriggered task, setting the value, then clearing again, creating a new triggered task, ect., hundreds of times as it goes around the loop?
thanks,
Isaac
Your approach is just a bit off--- but the question is a nice little headwarmer. It sounds like you need 1 Task outputting a waveform streamed to the device. Luckilly I went into the Example finder:
That is "C:\Program Files (x86)\National Instruments\LabVIEW 2014\examples\DAQmx\Analog Output\Voltage (non-regeneration) - Continuous Output.vi
Some mods would need to be made:
The tricky part will be adjusting the granularity of the wafeform length to meet your trigger timing constraints but, you can easilly generate DC wafeforms at very short lengths (Oh, Say 1 sample long) and longer wafeforms while in the "Triggered" mode.
Have fun!
10-23-2015 01:32 PM
Thanks for the answers all.
hmarcano: I'm not going to post code right now, since I'd need to unpick the relevant parts, and I already have some suggestions to work with.
Michael78: I was under the impression that you could not send in a different task to Start without Clearing the old one. But, if you're right that than this is what I want to do. Using Stop Task each time doesn't bother me, I just didn't want to re-create the task each time.
Jeff: thanks for the different approach idea, but it sounds more complicated than having two alternating tasks and start and stop, assuming I can get that to work.
10-26-2015 02:30 PM - edited 10-26-2015 02:35 PM
In case anyone else wants to try something similar, you cannot actually transition between two tasks using the same resources (lines) just by using the DAQmx Stop Task VI, because the resources are still reserved.
Instead, I replaced Stop Task with the DAQmx Control Task VI, with the action set as 'unreserve'. I can unreserve one task, then start a different one, and in that way go back and forth without needing to Clear or Create the tasks each time (same idea could be used for any number of tasks on the same lines, though I have just two).
I tested this by meassuring the analog output and it seems to work, no errors reported in the code.