Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How to calculate the sampling rate based on time period

I would like to know how I can calculate the sampling rate for a given aperiodic (Arbitrary) waveform generation on a NI DAQ M6251 at run time? I use LabWindows/CVI 8.5.1 for programming the application. Scenario I have the time duration of each sample (e.g 1.92 Seconds and total samples 1000), then with this information how I will be able to calculate the sampling rate?

 

I have also two more questions

1)  what is the minimum sampling rate which i can set on this DAQ card mentioned above? Is it possible that i can set 0.52 S/s as the sampling rate?

2) I was generating a pulse with 1micro second On time and 30 micro second off time. This signal measured on the oscilloscope is attached. Please any one can tell me that the waveform shape is correct or else tell me where I can find the data sheet for this DAQ which shows the typical waveform shape with time 7 votlage duration when a pulse is generated with ON time equal to 1/maximum sampling rate (e.g if maximum sampling rate is 1MS/s then for time equal to 1micro second)

0 Kudos
Message 1 of 14
(84,661 Views)

Howdy Sreekantha,

 

Sample rate is specified in units of samples per second. If you have 1000 samples taken over 1.92 seconds, then that would give you a sampling rate of 1000/1.92 =  520.83 S/s (or 0.52083 kS/s) where S represents samples.

 

The 6251 M-Series card has no minimum sampling rate as confirmed in the 625x Specifications document available on its product page. At that link, click Resources»Manuals.

 

Are you using an analog output channel to generate the pulse? Just to clarify, sampling rate refers to analog input channels--not to be confused with update rate, which is the analog output equivalent to the sampling rate. (Both specs are also available in the specs document) In any case, I would suggest using a counter output channel instead of an AO channel to generate your pulse. DAQmx ships with a handy example that you can use to get up and going: DigPulseTrain-Cont.prj located in the NI Example Finder under Hardware I/O»DAQmx»Generating Digital Pulses. As a matter of convenience, you would probably want to replace the DAQmxCreateCOPulseChanFreq function in this example with the DAQmxCreateCOPulseChanTime function that would allow you to easily specify the high/low time of the pulse that you desire.

 

Cheers,

Warm regards,

pBerg
0 Kudos
Message 2 of 14
(84,636 Views)

Hi pBerg,

 

Thanks fo rthe information. The reason I added the sampling rate is here, I generate the waveform using the internal sample clock. So when I set the sampling rate say less than 1S/s then I get the samples generated limited to 1S/s referring to teh example, I have each sample to be generated at 1.92 Sec and total samples 1000.Then the complete cycle should take 1920Sec for generation but here I have complete cycle generated within 1Sec. Therefore I would liek to know whether I can set sampling rate less than 1S/s?

 

Also incase of pulse generation, the pulse amplitude would range any value need not be 5V.If i use counter then the amplitude value would be limited to 5V. So i use the same technique using internal sample clock to generate the signal. I have pulse sequence with on time 1 micro second and off time 30 micro second with 5000 samples which is fed to the output buffer. Later these samples are generated with trigger generated by internal sample clock. So i would like to know the practical waveform shape for 1 microsecond pulse to verify whether the pulse I observed on the oscilloscope matched with it.

 

thanks  & regards

Sreekantha S

Message Edited by Sreekantha on 09-11-2008 11:30 PM
0 Kudos
Message 3 of 14
(84,619 Views)

Hi Sreekantha,

 

The 6251 can run at sampling rates below 1S/s (I just verified this on my machine). You set the timing and then when your code is running, can see what the exact sampling rate is by using the DAQmxGetSampClkRate() function.

 

I'm not quite sure about what's being asked in your second question. Is your goal to create a pulse train that is something different than 5V pulses? If so, I would recommend using some external IC's or one of our HSDIO products. If you're fine with the 5V TTL output, you don't need to create an analog waveform and generate it on the analog output channel. Instead, use the DAQmx counter functions. Here you can create a pulse train very simply with the high and low ticks you request. Look at the DAQmx C Reference help, specifically the DAQmxCreateCOPulseChanTicks() function.

 

Also, if you're trying to monitor the internal sample clock, you can export this to an external PFI line. This can be done with DAQmxExportSignal or DAQmxConnectTerms

PBear
NI RF
0 Kudos
Message 4 of 14
(84,602 Views)

Hello PBear,

 

Thanks, I could solve the problem related to sampling rate less than 1S/s, but one difference I could see, when I try toset sampling rate less than 1S/s using the function DAQmxCfgSampClkTiming I could easily set and the waveform generated correctly but when I used  DAQmxSetTimingAttribute to individually set sampling rate then it did not work. Can I know the reason behind it. No other code was changed except the calling function mentioned above.

 

With respect to my second question, the need for me to generate such a curve on analog output is, I have a requirement like

Voltage(Volts)                      Time(sec)

----------------------------------------------------

0.000                                    0.000001

13.500                                  0.000010

0.000                                    0.000000

----------------------------------------------------

Can you let me know how I should generate this curve on this DAQ analog output. the number of cycles to repeat this curve is 5.

 

Best regards

Sreekantha S

 

0 Kudos
Message 5 of 14
(84,588 Views)
Hi Sreekantha,

In order to define the Update Rate with the DAQmxSetTiming Attribute, you need to specify DAQmx_SampClk_Src as the attribute.  However, if you can use DAQmxCfgSampClkTiming to set the Update Rate then this is fine.  If you take a look at the MultVoltUpdates-IntClk.c example, you can see that it uses DAQmxCfgSampClkTiming and uses the internal clock of the device.  You will also set the Update Rate using this function. 

If you do a search on www.ni.com for the keywords "ansi c daq examples", you will find the following article.  This article will shows where the DAQmx C examples are located on your computer.  Take a look at the MultVoltUpdates-IntClk.c example, as it shows how to generate a finite number of voltage samples at a user-specified rate. 
Rod T.
0 Kudos
Message 6 of 14
(84,558 Views)

Dear sir !

i want to interface ADC (ADS8688) with DSPIC microcontroller.The ADS8688 has a sampling  rate of  500KSPS.

But my requirement is to get 1000SPS.How can i achieve that much of sampling rate ?

Please tell me.

 

Thank you.

0 Kudos
Message 7 of 14
(65,880 Views)

If you want to increase the sample rate, why would you post in an 8 year old thread that is about reducing the sample rate?

Is any of this related to any NI products (After all, this is a National Instruments forum)?

0 Kudos
Message 8 of 14
(65,875 Views)

Hi sir !

As i explained above ,i wnat to decrease my sampling rate.

So please guide me to do that.

Thank you sir !

0 Kudos
Message 9 of 14
(65,872 Views)

Maybe you should find a forum that focuses on the hardware you have.

0 Kudos
Message 10 of 14
(65,865 Views)