Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

sampling at 512Hz

Solved!
Go to solution

I've used daqmx to acquire (and store) a waveform at a rate of 512Hz (therefore dt = 0.001953125).

When I re-open the file the sample rate is reported as 512.007Hz.

I have found dT is only stored within the waveform as 0.0019531 (missing final 2dp values)

 

dT value is stored as dbl value, so no reason why LV should need to trim the value.

 

Has the data been sampled at 512 or 512.007Hz?

 

Is there a way round this (avoiding the obvious "don't sample at 512Hz" reply)?

 

Any other thoughts?

 

cheers

 

A

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

Hi Andy,


Thanks for your reply and I hope your well today!


The sampling rate is determined by an onboard counter. A limitation of a counter is that it can only increment or decrement by integer values. The time base is divided down by the counter to create the sample clock. Consequently, there are certain “valid sampling rates” that depend on your time base and the resolution of the counter.

 

Therefore, the "valid" sampling rates are given by the following formula:

(TIME BASE) / (1 < INTEGER VALUE < 2^COUNTER RESOLUTION) = (VALID SAMPLING RATES). 

 

I specify a sample rate of 101 Hz the next closes “valid rate” is

20,000,000 Hz / 200,000 = 100 Hz

and

20,000,000 Hz / 199,999 = 100.005 Hz

Difference = 0.005 Hz

If an exact sampling rate is required you can actually provide your own time base. This is done by wiring a signal to one of the PFI lines and then specifying the source of the clock as a PFI line (from the “DAQmx timing.vi"). The maximum allowable time base is dependent on the card and can be found in the specification sheet for the DAQ card of interest.

 

Hope this explains.

 

Kind Regards,
James

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
Message 2 of 5
(3,488 Views)

Hi Hillman

 

thanks for the response, all is clear.

 

we use a wide range of cards in different applications, so it is more convenient to stick with the on-board clock rather than supplying an external one.

 

is the 20Mhz clock frequency constant across NI acquisition devices  (E series, M series etc.)?

if not, is there a device property, or similar, that reports this value?

 

For information, I am deploying a logging application where the end-user can select their required acquisition rate - so what I want to do now is put a check in my code to warn the user if the actual sample rate is going to differ from their requested one.

 

cheers

 

A

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

Hi Andy,

 

Yes the 20MHz onboard clock is consistent acreoss the E, S and M series devices. However on the M-Series devices there is also a 80 MHz clock. This then allows the onboardclock terminal to be either 20 or 80 MHz depending on the expected input / output frequency.

 

If you want 20 MHz all the time you need to use the advanced terminal /DevX/20MHzTimebase this will force DAQmx to always use the 20MHz reference.

 

Finally to find the actual rate the DAQ device is using  you can wire a DAQmx timing property node into the DAQmx Task wire after the DAQmx Timing VI.

In the property node select  Sample Clock >> Rate and make the property readable with the right click menu. This will tell you the rate the DAQ device is running at. 

 

Regards
JamesC
NIUK and Ireland

It only takes a second to rate an answer 🙂

Message Edited by JamesC on 11-17-2008 09:39 AM
Message 4 of 5
(3,459 Views)

Cheers James

 

This is all very useful information

 

A

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