LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

daqmx tasks

I am trying to use Daqmx tasks to acquire data from a pxi-4472. Originally, I used the create channels vi to create the task programatically. Acquiring data this way works fine. But for other reasons I am trying to use daqmx tasks. I used  NI Max to set up the task, sample rate 1k Hz, sampling continuously and reading 100 samples. My acquisition code ran at a 10 Hz rate so it will read the 100 samples each iteration.

 

The problem is that the amplitude is not correct. At first I thought it was a scaling problem. But the amplitude changes with a change in the input frequency. Even though the signal generator is set to generate a constant frequency and a constant level.  The amplitude is worse at lower frequencies, less than 10 Hz.

 

Next I tried using the test panel within NI Max and it produced the same result. I changed the number of samples to be read to 1000, no change.

 

So, if the task is created programatically there is no problem, the amplitudes are correct for any frequency. But if I use a Daqmx task the amplitudes are incorrect.

 

The task is set up as

Scaled Units : volts

Terminal Configuration : Pseudodifferential

Custom Scaling : No Scaling

Continuous Samples

SR : 1k Hz

Sampels : 1000

0 Kudos
Message 1 of 7
(2,476 Views)

Hi dcwill,

 

If you run the Cont Acq&Graph Voltage-Int Clk.vi example included in the example finder (Help » Find Example) do you see the same thing?  What kind of amplitude and frequency are you expecting versus what are you seeing?  If you crank up the frequency does the amplitude increase to the point you would expect to see.

 

There should not be a difference between creating a task in MAX and creating a task in LV.  I would also double check that your frequency source that you are reading from has kept a consistent amplitude.  Hopefully we can narrow down what is causing the filtering effect.

Andy K.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 7
(2,443 Views)

Thanks for the reply!

The example you suggested is pretty much the same code as what I have been using for years and it has been working. No problems over the entire frquency range.  I modified the code to use a Task, instead of the "DAQmx Create Channel...vi", and the problems persists. I have attached the modified code which runs the original code in parallel with identical code that uses a Task instead. Included in the attached zip files are three screen shots. One with a sine wave input, another with a triangular wave input. And a screenshot from NI Max which shows the Task settings and a test panel with an incorrect acquisition.

 

The trianular waveform seems to demonstrate a sampling problem since the shape and the amplitude are incorrect.

 

The problem seems to go away at higher frequencies, greater than 10 Hz. 

 

There is no acquisition problem when using "DAQmx Create Channel...vi" to create the task.

 

I have three PXI-4472 cards in the system all behave the same.

 

 

 

0 Kudos
Message 3 of 7
(2,422 Views)

Hi dcwill,

 

I was able to recreate the issue on my system and did some more research on what was going on.  It turns out this effect is related to the Gibbs Phenomenon.  Why we are seeing this only in the MAX task and not the LabVIEW task I am not sure.  I am going to talk with R&D about it.

Andy K.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 7
(2,405 Views)

Hi Andy.

 

How does the Gibbs Phenomenon explain the fact the data acquisition behaves correctly when the task is created programatically as opposed to being created externally by Ni-Max.

 

Said another way.

 

 

The sampling rate is 1000 Hz and the signal under test is 5 Hz or less. The A/D cards should handle this with no problem. Which they do, if tasks are not used. So .......    How does creating the task in Ni Max effect the sampling.

 

Dave

 

0 Kudos
Message 5 of 7
(2,391 Views)

Hi Dave,

 

I think you might have AC coupling enabled in your MAX tasks. Can you click on the "Device" tab in MAX (next to "Settings" and "Calibration") and see whether the coupling is set to AC or DC?

 

Brad

---
Brad Keryan
NI R&D
0 Kudos
Message 6 of 7
(2,385 Views)

Hi Brad,

 

Setting the coupling to DC did the trick. Thanks! 

 

Dave

 

0 Kudos
Message 7 of 7
(2,373 Views)