10-11-2010 02:53 PM
Hello, I am trying to measure a 4MHz frequency accurately without much luck, can anybody help in doing this, ideally the measurement would want to be accurate to within 10Hz, any help would be much appreciated.
10-12-2010 08:55 AM
Hi Dave
I am sorry to hear you are having a few issues with your PCI system, I understand that you are trying to measure a 4MHz frequency with a PCI 6601.
I have had a look at your product specifications and the accuracy, would it be possible for you to give me some information so I can continue with the right idea of your application? Could you let me know what rate you are sampling your data at currently? What are you doing with your data when the measurements have been taken?
I will continue to look into this for you in the meantime.
Thank you
10-12-2010 09:09 AM
Hello Dave_123,
The base clock accuracy of the PCI-6601 is 100ppm. Thus, on a 4MHz signal, the best accuracy you'll be able to get is about ±400 Hz. Are you seeing results outside that value? Also, can you post the code you are using to do the frequency measurement?
Regards,
10-12-2010 09:12 AM
I created a task in MAX and in there I can only get a measurement to within around 500Hz, in Max the sampling rate is 20KHz, once I have got the frequency I will perform a calculation with it to calibrate a real time clock on a control panel.
10-12-2010 09:25 AM
Hi again
When you are taking measurements of data the sampling rate determines how accurate the acquisition will be.
If you are just looking to recreate the frequency of your signal you will need to sample at 2x the signal frequency to ensure you get an accurate portrayal of the frequency of the signal.
If you want to recreate the shape of the signal accurately as well you will need to sample at 5-10 times the measurant frequency.
The hardware you have should allow for this.
There is a piece of literature which may assist you; sampling basics
Thanks
10-12-2010 09:52 AM
The code below was created from Max, All I am after is a frequency value. This returns 4000400Hz
DAQmxCreateTask("DAQTaskInProject2", &MeasFreq);
DAQmxCreateCIFreqChan (MeasFreq, "Dev3/ctr0", "Frequency", 30000,
4900000, DAQmx_Val_Hz, DAQmx_Val_Rising,
DAQmx_Val_HighFreq2Ctr, 0.005, 40, "");
double MeasureFreq(void)
{
uInt32 ReadArray[100];
int32 samples;
float64 data[100];
int status;
DAQmxStartTask(MeasFreq);
ProcessSystemEvents();
status = DAQmxReadCounterF64 (MeasFreq, DAQmx_Val_Auto, 1, data, 3, &samples, 0);
DAQmxStopTask(MeasFreq);
return data[0];
}
10-12-2010 10:14 AM - edited 10-12-2010 10:14 AM
You are also going to see additional error due to "quantization". Quantization error is basically error due the fact that your clock and your signal are not synchronized, so when calculating the frequency the measurement may or may not catch the first rising and last rising edges during the measurement period. More information can be found in the NI-DAQmx Help (Start » Programs » National Instruments » NI-DAQ, search on "Quantization Error")
DAQmxCreateCIFreqChan (MeasFreq, "Dev3/ctr0", "Frequency", 30000, 4900000, DAQmx_Val_Hz, DAQmx_Val_Rising, DAQmx_Val_HighFreq2Ctr, 0.005, 40, "");
When you are defining your Counter Input Frequency Measurement channel, you are choosing to use the High Frequency, 2 Counter method (which is correct for your application) and a measurement period of 5ms (which is probably too small).
From the Quantization Error article in the NI-DAQmx help, this chart shows the potential error relation with regards to input signal and measurement period:
10-29-2010 02:47 AM
Hi
Sorry about getting off on the wrong foot with your idea, I hope you now have the information you need.
Staphnaie L