LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

buffered analog output puts out additional sample on aborting or stopping task

I'm using DAQmx and LV 8.2
I'm doing a buffered analog output operation where the sample clock is driven by pulses from ctr0 on the same device (PXI-6070E).  When I end the analog output task, either with the DAQmx stop task or DAQmx control task (abort option selected), the AO puts out one additional point from the buffer.  (I have checked by setting breakpoints and stepping through the code that the additional point is definitely generated when the analog ouput task is aborted)
 
I need the output to remain where it was before the stop task command is issued.  How do I fix this?
 
 
Thanks,
Marc
0 Kudos
Message 1 of 4
(2,897 Views)
Hi Marc,

What condition are you using in order to stop your analog output? Is it possible that you are meeting this condition, then writing the final value, then leaving your while loop? If so, you should simply ignore the final value or set some sort of condition (case structure) over you DAQmx write.
Best regards,

Jordan D
Applications Engineering
National Instruments
0 Kudos
Message 2 of 4
(2,869 Views)
I'm watching to see if there hasn't been a sample output in a certain length of time, then terminating the task if there hasn't been.  Specifically, I have ctr0 outputting pulses to drive the task based on input from the AnalogComparisonEvent terminal.  I'm using a counter on a different PXI device to count the number of pulses and monitoring this count to determine if another sample has been output.  I'm outputting the ctr0 pulse to PFI3 as well, and I'm monitoring both the ctr0 output (which drives the ao clock) and the analog output itself on an oscilloscope.
 
Basically I'm sitting in a while loop waiting for the monitoring counter to fail to increment.  Then I terminate the while loop and stop the analog output task.  I can watch the analog output on the oscilloscope while I step through the program.  Immediately before the daqmx control task - abort (or daqmx stop if I don't abort first, or daqmx clear, if I don't abort or stop) vi runs, the analog output remains outputting the last sample.  Immediately after the abort, stop, or clear, the analog output advances one sample in the buffer. 
 
During this time, ctr0 does not output another pulse, so the scan clock should not advance.
 
Thanks,
Marc
0 Kudos
Message 3 of 4
(2,861 Views)

Hi Marc,

It sounds to me like you are stopping your task in software. This type of configuration is bound to cause a few extra samples to output before the command reaches the card and stops your clocking. What is your current sampling rate?

Best regards,

Jordan D
Applications Engineering
National Instruments
0 Kudos
Message 4 of 4
(2,841 Views)