Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

When I clear a buffered AO task, why does the first value appears on output?

Using a 6052E DAQ board, when I clear an onboard buffered analog output the output gets set to the first point of the waveform in memory but I want it to be zero.
 
For setup, I configure an AO Voltage task, use my waveform for Finite Sample timing, force the board to use onboard memory, configure a trigger from a clock pulse, write the waveform, and start the task. When I send a clock pulse, the waveform is triggered as desired. When I stop the task, the voltage stays at zero (which is the last point of the waveform). But when I clear the task, the voltage jumps to 3v (the first point of my waveform).
 
I have tried shifting the waveform so the first point is zero and the second point is 3v and when I clear the task, the output is zero so I'm pretty sure it's the first buffered point that is getting set. But, I don't want to delay my waveform by 1 tick so does anyone know how to clear the task and leave the voltage output where it was?
 
Also, I have tried running the DAQmx Control Task with "unreserve" before clearing the task and the voltage output jumps to the value in the first buffered point right after running this (before the clear).
 
Thanks in advance,
Dave
0 Kudos
Message 1 of 7
(3,527 Views)
Dave,

Thank you for posting to the NI Forum.  I have been unsuccessful in preliminary tests to reproduce the problem.  It will be helpful to have a few more details about your setup to be able to reproduce the issue.  First, which version of DAQmx do you currently have installed?  Second, could you post an simplified example that reproduces the issue?  For example, you could create an analog output task that only outputs 3 samples or something just to show the behavior.

I look forward to hearing back from you.

Regards,

Neil S.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 7
(3,517 Views)
Neil,
 
Thank you for your response. I am using DAQmx 8.3.0f3 and a PCI-6052E board. Attached is a simplified example of triggering a 5ms square wave from a clock source. When I press stop, AO0 = 5v. Whatever I change the first point of the waveform to will be the output when the task clears.
 
Also, I think this behavior does not happen on M-series boards. That is, the voltage level stays at zero on clear for M-series.
 
Let me know what you think.
 
Thanks!
0 Kudos
Message 3 of 7
(3,510 Views)
Dave,

I will have to track down a PCI-6052E, but I wanted to add one suggestion.  Could you add a DAQmx Wait Until Done VI after your while loop and before the stop task to see if this changes the behavior.  When the Stop VI is called the acquisition is halted even if the task is not done.  It is possible in your VI for the stop to be called on a sample other than the last sample.  Since the voltage is 5 volts for a good period of time it is possible, although unlikely, that when you stop the acquisition it is at the beginning of the buffer.  If this was the case then I would expect to see the behavior you have mentioned.

If I don't hear from you I will track down a 6052E tomorrow and try to reproduce with the VI that you provided.  Thanks for sending the simplified example.

Regards,

Neil S.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 7
(3,508 Views)

Neil,

Yes, I have tried the "wait until done" before stopping the task. The behavior is the same. Also, it's always the first waveform point that gets set so if I made the waveform: 2.5, 5, 5, 5, ... 0; the output after clear would be 2.5. Also note that the voltage stays at zero after the stop task - it only goes high after the clear.

Thanks!

0 Kudos
Message 5 of 7
(3,507 Views)
Dave,

Thanks for your patience while I tracked down an E-Series device.  I was able to reproduce the issue using an PCI-6040E.  I simplified the example even further and removed the counter from the VI.  Even doing a single finite generation using only on-board memory reproduced the issue.  This was reported to R&D (# 45INPVF) for further investigation.  Some possible workarounds include:

A) Do not use on-board regeneration.  It does not occur if on-board regeneration is not used.  Obviously there are some applications where this would not work, but for those with less time dependent operations this can work.

B) Make the desired last sample generated after the Clear Task the first sample in the buffer.

C) Update the analog channel to the desired value after clearing the task, in other words, create a new task to generate the desired value.

Let me know if none of these workarounds is possible in your specific application.  I wish you good luck with your application.  Thank you for your feedback and for contacting National Instruments.

Regards,

Neil S.
Applications Engineer
National Instruments
0 Kudos
Message 6 of 7
(3,496 Views)

Neil,

Thanks for your help. I think I'll start with option B and eventually go with:

D) Replace the card with an M-series

Thanks,

Dave

0 Kudos
Message 7 of 7
(3,478 Views)