From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scan Rate in DAQ Mx

I just aquired an s-series DAQ card and now I'm learning to  write labview programs in DAQ mx. Is there anyway to set the scan rate for the "DAQ mx read" vi? I can specify the number of samples but the scan rate itself seems to drift in time and sometimes even cause weird aliasing when it reads my signal. Thanks!
0 Kudos
Message 1 of 7
(2,859 Views)

Look at example vi's shipped with LabVIEW.

Find Examples>>hardware input output>>DAQmx>>Analog measurement >>Voltage and look at availible continuous acquisition program to start off.

Ther are 2 factors

1.Set sampling rate in DAQmx Timing.vi ( will select number of scans / sec)

2. Set samples to read in DAQmx read .vi ( will select number of acquired samples to read/give at output of this function, per iteration of the loop)

setting these two optimally will see to it that your scan rate will remain fixed

Any doubts, do ask

Regards,

Dev

0 Kudos
Message 2 of 7
(2,849 Views)
Hi Devchander. I tried using DAQ mx timing, with limited success. Changing the number of samples does influence my scan rate, but changing the number of samples per second does not. I've included a couple screenshots- in the first the sample's/second is 1000 and I am taking 100 samples, and this gives me the expected run-time of 100ms. But in the second, when I increase my spls/s by 10, nothing changes! I need to be able to take a lot of data very quickly so I am aiming for a large number of samples and at the same time a very small smpl:smpls/s ratio. I've attached the VI: am I doing anything wrong?
Download All
0 Kudos
Message 3 of 7
(2,817 Views)
Hi Ayam,

you should connect the error-outputs, and better use the daqmx-timing VI instead of the porperty nodes!.

Maybe you used a too big samplerate?

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 4 of 7
(2,801 Views)
I'm not sure why either of those would have any effect, since if you open up the daqmx-timing vi, the block diagram is just property nodes, and if I connect the error inputs, any errors I have would just show up in the output instead of popping up on screen like they do now. The card should be able to go up to 300k. I should mention also that when I run the MAX test panels I can indeed go up to these sample rates; this is purely a labview problem.
0 Kudos
Message 5 of 7
(2,797 Views)

Ayam,

Property nodes change the levels or properties of what has already been explicitly stated.  In your instance, by creating a task dynamically, there is no timing explicitly stated and therefore will produce uncertain behavoir.  I think labview defaults all unexplicitly stated timing to 1000hz and 100 samples, which explains your graphs.  Essentially the property nodes on your block diagram are decorations that will do nothing for you, (except, interestingly enough, is change number of samples).  Get used to using timing nodes and wiring error clusters, this will eliminate avoidable errors.  Also in the labview help, there is mountains of resources, one of which being the fundamentals section that I find myself occasionally refering to for specific questions.  However, I do think you have stumbled on to a problem that is not mentioned in the help files.

Chris

0 Kudos
Message 6 of 7
(2,787 Views)
Ayam,

After playing with the code for a while I discovered that if you are going to set the timing characteristics with a property node, you must first include the property "SampTimingType" with the rest of the properties.  I attached a modified version of your code that demonstrates what I'm talking about.

I would recommend though that you use the "DAQmx Timing.VI" to configure your timing characteristics.  I would also recommend using a "DAQmx Clear Task.VI" at the end of your code to release the resources allocated by the task.

I agree with you though that your original code should throw an error or at least a warning.  I will talk to our DAQmx developers, I'm sure they would be interested to see this behavior.  Thank you for posting it to the forums.

Best Regards,

Jeff Tipps
Applications Engineer
National Instruments
0 Kudos
Message 7 of 7
(2,748 Views)