06-25-2014 11:22 AM - edited 06-25-2014 11:24 AM
Hello,
I need urgent help with a problem I have using DAQmx write. The "DAQmx Write VI" is located inside a while loop that repeats every 20ms. I am using queues to transfer data in between multiple asynchronous VI and the data only updates every 20ms. Because I am not going to attach the entire project I have simulated the 20ms timing with a "Wait for next ms Multiple" function. What is happening is I will send 20ms of data to the DAQmx Write VI, it will output all of the data in 4ms then sit at idle for 16ms. I have set up the task for the DAQmx to be 1000 sample per channel at a rate of 50kHz this should take the entire 20ms to output. I have also checked the input waveforms the input do have 1k samples and a dt of 2E-5. When I switched to 2D Array's of DBL there was no change. I want to point out that all of the data is sent out in the 4ms. This was confermed visulaly and with the "Samples Written" node.
I did a test where I allowed my VI to run as fast as possible. In this case the output was a smooth sine curve, however upon closer inspection I discovered that the frequency of the output was 25Hz 5 time faster than the signal I sent to the DAQmx Write VI. In addition if you limit the loop to 10ms an iteration the data is outputted for 4ms and the idle for 6ms.
I know that everything is set up correctly. I have double checked the data I am sending at the task properties. It should be outputting correctly, but it is not. I tried calling NI support and it was not particularly helpful.
The hardware I am using is a PXI 6723 AO card. I will attach a vi that anyone could run and I will attach a photo of the output on an oscilloscope. Thnak you for the help
-James
Solved! Go to Solution.
06-25-2014 02:40 PM
Helps to see code. Are you writing one sample or N Samples? If N, are they "clocked" (i.e. do you have a clock signal that makes the device write at a specific rate, or does it go "as fast as it can")? Where is the clock in your code?
BS
06-25-2014 03:26 PM
I am writing N samples. I have set up a task in NI Max that has a set number of sample per channel and a rate. I do not have an external clock signal, but I thought that the task is enough and it can regulate on it's internal clock. As for code I have attadhed the Vi, is that what you mean? Or is there something else I can add.
06-25-2014 08:59 PM
My apologies -- I didn't realize that "System Output for NI Help" was your VI.
06-27-2014 09:09 AM
I solved my own problem. I needed to add a DAQmx Timing and a DAQmx Write edit the task before it enters the while loop. I use the timing to set the Sample mode and the Trigger source, while the DAQmx Write simple sends out and array of zeros. With these added it works fine.
-James