Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How to specify sampling rate? Must use "Measurement & Automation Explorer"?

Solved!
Go to solution

I am using NI cDAQ-9171 (USB single-slot chassis) and NI-9207 to measure analog current input. I have LabVIEW 2010 and NI-DAQmx installed.

How do I specify the sampling rate?

If I use M&A Explorer to create task, I can specify the Rate (Hz) under the Configuration tab -> Timing Settings.

For NI data acquisition, it is compulsory to use M&A Explorer?

If I do not want to use M&A Explorer, how do I specify the Rate (Hz)?

0 Kudos
Message 1 of 5
(3,191 Views)
Solution
Accepted by topic author splee

Hi,

 

You can specify sampling rate with "DAQmx Timing.vi" located on the DAQmx function palette (read the context help on how to use it properly).

 

You don't have to use M&A explorer (MAX) to create a task.

One simple and fast way is to use DAQ Assistant (same configuration as in MAX) to configure your measurement.

Another is to use DAQmx function blocks to manually build your application code.

 

From my experience DAQ Assistant is great for simple tasks (one type of measurement), as for more complex measurements (synchronized analog and digital inputs),

I tend to use function blocks as they give you more freedom regarding code execution.

 

Note: You can also build DAQmx code from a configured DAQ Assistant task.

 

Best regards

Matej

/* A smart device is only as smart (stupid) as its programmer. */
Message 2 of 5
(3,189 Views)

I just found an example from within LV2010 (attached).

I suppose the "Software Loop Time (ms)" object is used as the sampling clock? What happen if my DAQ module can only sample up to 500Hz, but I specify "Software Loop Time (ms)" = 1ms? So the real sampling rate will be 500Hz or 1KHz?

 

Also, how could I add a data logger in this vi?

0 Kudos
Message 3 of 5
(3,184 Views)

Hi,

 

The example you attached uses software timing to control acquisition.

"Software Loop Time (ms)" defines the execution rate of the while loop. Because the while loop contains "DAQmx Read.vi" this also defines the sampling rate for the DAQ module.

 

One thing you must keep in mind when using software timing is that it can be inaccurate.

For example: Lets say you set Software Loop Time to: 1ms. If your code inside the loop cannot execute within 1ms, the loop will slow down and so will the sampling rate for the DAQ module.

For your application this means if "DAQmx Read.vi" can't read samples that fast, it will either slow down or report an error.

 

If you need a fixed acquisition rate, then you need to look into Hardware timed acquisition (example: Cont Acq 0-20mA Current Samples-Int Clk.vi)

 

You can add data logging to this vi, but like before you need to be careful. Data logging can also slow down software timed acquisition loops.

 

Best regards

Matej

 

 

/* A smart device is only as smart (stupid) as its programmer. */
Message 4 of 5
(3,174 Views)

Hi again;

 

I just saw that I misread your last question, sorry about that.

Here is a link to an example that I'm using in one of my applications: http://forums.ni.com/t5/Multifunction-DAQ/Write-measurement-data-to-text-file-every-10-seconds-for/t...

Although it is designed for periodic logging you can modify it for your needs.

 

Matej

/* A smart device is only as smart (stupid) as its programmer. */
0 Kudos
Message 5 of 5
(3,155 Views)