LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

pci-6601 accurate 4MHz frequency measurement

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.

0 Kudos
Message 1 of 8
(4,411 Views)

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

Stephanie L
Applications Engineer
National Instruments UK and Ireland
0 Kudos
Message 2 of 8
(4,384 Views)

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,

Seth B.
Principal Test Engineer | National Instruments
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 3 of 8
(4,380 Views)

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.

0 Kudos
Message 4 of 8
(4,378 Views)

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

Stephanie L
Applications Engineer
National Instruments UK and Ireland
0 Kudos
Message 5 of 8
(4,372 Views)

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];

}

0 Kudos
Message 6 of 8
(4,356 Views)

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_HighFreq2Ctr0.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:

2010-10-12_100829.png
The error for your measurement, in addition to the 100 ppm (0.01%) due to the hardware, will fall somewhere between the highlighted values.  Thus, the values are seeing make sense, based on your setup.  I would recommend increasing the measurement period, though you will still be bound by the ±0.01% accuracy limitations of the board.

 

Seth B.
Principal Test Engineer | National Instruments
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 7 of 8
(4,349 Views)

Hi

 

Sorry about getting off on the wrong foot with your idea, I hope you now have the information you need.

 

Staphnaie L

Stephanie L
Applications Engineer
National Instruments UK and Ireland
0 Kudos
Message 8 of 8
(4,240 Views)