Measuring Period
You can use the counters on your measurement device to measure period. Period measurements measure the time between consecutive rising or falling edges.
The formula for period is as follows:
Period (in seconds) = Count / Counter Timebase Rate
where Count is the number of ticks of the counter timebase that elapsed during one period of the input signal being measured.
The Counter Timebase Rate is a known frequency (20 MHz or 100 kHz) and allows you to make frequency and time measurements. To configure a measurement, specify the expected range of the input signal. Based on this range, NI-DAQmx automatically chooses the internal timebase that provides the highest resolution for your measurement and uses it as the counter timebase.
Depending on the phase of the input signal in relation to the start of the measurement, the first sample of continuous measurements is often invalid. For instance, if you are performing a continuous period measurement, and you start the measurement when the input signal is halfway through its current cycle, the measured period for the first sample is half of its expected value. Subsequent samples indicate the correct values since they are guaranteed to have seen a full period of the input signal. For this reason, the first sample of continuous period, pulse-width, and semiperiod measurements often indicates a smaller value than the actual value. For continuous frequency measurements, the first sample often indicates a higher frequency than the actual frequency.
For period measurements, you also can perform measurements with one or two counters. For most applications, setting Measurement Method to 1 Counter (Low Frequency) is sufficient and desirable because it uses fewer resources. However, if you have a high-frequency or widely varying signal, you may wish to use one of the two counter measurement methods—2 Counters (High Frequency) or 2 Counters (Large Range). Depending on the rate of your input signal and measurement method used, your measurement is subject to different quantization error. NI-DAQmx automatically internally routes as needed to perform the measurement across paired counters.