LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

daqmx write

Solved!
Go to solution

Hello,

 

I am trying to simultaneously acquire a signal while generating/writing a chirp (swept sine wave) signal which varies from 0-800 Hz. Previously, I have been able to do so using a timed-loop with the 1 KHz clock and 100 msec period. The sampling rate for the DAQmx Timing for generation was 4000 Hz and the number of samples per channel was set to 400. In the timed-loop, the samples per channel for the DAQmx write VI is set to 400. I used "Creat Analog Signal" express VI within the timed-loop to generate the chirp signal using a sampling rate of 4000 Hz and number of samples of 400. The FFT of the acquired signal was clean with almost no noise in it.

 

Now, I changed the above parameters such that the VI can be used for closed-loop realtime control. Therefore, I reduced the samples per channel in all instances to 1, and used the 1 MHz clock with 200 micro-sec period, acquiring and generating at 4000 Hz. However, evaluating the FFT the acquired signal, I realized that it contains a lot of noise, while the previous code with 400 samples per channel didn't contain any noise for a frequency band of up to 1000 Hz.

 

I think the problem is coming from the high sampling rate with small number of samples per channel for the DAQmx write VI. My feeling is that the DAQmx does not have enough time to write every sample to the buffer. I tried different values of the timeout for DAQmx write (and DAQmx read) VI's in the timed-loop but it didn't work....I have given the latest VI here. Can anybody help me where the problem is arising?

 

Also, is there any way that I can monitor the actual values of the written data (i.e. output of the DAQmx write)?

 

Thanks,

 

   

0 Kudos
Message 1 of 7
(3,274 Views)

What kind of RT target are you using?

Thomas N.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 7
(3,208 Views)

Hi Thomas,

 

I am using a standard desktop PC (processor: core due) with NI RTOS as my target.

 

 

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

Is your loop finishing on time? Are you using a PCI card with DAQmx and if so, which one? Are you monitoring this noise on the Waveform Charts? If so, please attach a screenshot of the noise you are refering to.

 

 

Applications Engineer
National Instruments
0 Kudos
Message 4 of 7
(3,170 Views)

The loop is supposed to finish within 330 micro-seconds. I monitor the loop duration, and it appears to me that it is a bit different for each loop iteration. For example, it might take the loop to finish within 108 micro-seconds for one iteration while for another loop execution, it might take it 110 micro-seconds, however, it doesn't finish late over the runnig duration of the VI.

 

I am using D/A (PCI-6733) and A/D (PCI 6031) boards.

 

I have given a screenshot of the noisy data (in time-domain and frequency domain, after taking the FFT) here. 

 

As mentioned in my previous post, I didn't encounter this noise using the previous settings for the sampling rate/number of samples of the DAQmx and the period of the timed-loop so I guess the noise is related to a software issue.

 

Thanks,

 

Download All
0 Kudos
Message 5 of 7
(3,164 Views)
Solution
Accepted by topic author mhmdi

You mentioned the loop is suppose to finish within 330 micro-seconds. Isn't it designed to finish in 200 micro-seconds based on the period of your timed loop? The best way to monitor the actual loop time would be to connect an indicator to the Iteration Duration terminal on the inside of the timed loop. 

 

It looks like you configured your DAQmx Timing VI to have a sample rate of 4000. You are then writing a signal to it that is at 12000 S/s from the Create Analog Signal node. I would recommend keeping these two values consistent. If you are wanting to read/write data at 4000 Hz, that would correlate to a period of 250 micro-seconds. You may want to increase the period of your timed loop to be 250 or greater. 

 

Can you attach a screenshot of some of the data you had that had less noise for comparison purposes?

Applications Engineer
National Instruments
0 Kudos
Message 6 of 7
(3,138 Views)

Thanks for your advice! I changed the loop period to 250 micro-seconds to be in correlation with the 4000 Hz sampling rate and the noise reduced a lot.

 

Regards,

 

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