Measuring Semiperiod
You can use the counters on your measurement device to measure semiperiod. Semiperiod measurements measure the time between consecutive edges, alternating between high time and low time.
The formula for semiperiod is as follows:
Semiperiod(in seconds) = Count / Counter Timebase Rate (in Hz)
where Count is the number of ticks of the counter timebase that elapsed during the high or low time of the signal to measure.
The Counter Timebase is a clock with 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.