LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Broken Output for DAQmx Write

Solved!
Go to solution

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

 

0 Kudos
Message 1 of 5
(4,337 Views)

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

0 Kudos
Message 2 of 5
(4,303 Views)

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.  

0 Kudos
Message 3 of 5
(4,291 Views)

My apologies -- I didn't realize that "System Output for NI Help" was your VI.

0 Kudos
Message 4 of 5
(4,265 Views)
Solution
Accepted by topic author mully006

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

0 Kudos
Message 5 of 5
(4,219 Views)