You can configure a counter to measure the frequency of a signal connected to the channel. The counter counts the number of rising or falling signal edges during the length of the Frequency Timebase, divides that number by the Frequency Timebase in µs, and returns the frequency in kHz.

You can configure the following options for a frequency measurement counter.

Input Filter

You can add an input filter to all input channels of the module. A filter removes noise, glitches, and spikes on inputs by rejecting signals with periods shorter than the specified length. You can select one of the following options.

  • Disabled—The hardware synchronizes the digital inputs using a 4 MHz timebase. Pulses longer than 250 ns are always detected. Pulses shorter than 250 ns may be rejected.
  • 1 µs—Pulses shorter than 1 µs are rejected. Pulses between 1 µs and 2 µs are sometimes detected. Pulses longer than 2 µs are always detected.
  • 16 µs—Pulses shorter than 16 µs are rejected. Pulses between 16 µs and 32 µs are sometimes detected. Pulses longer than 32 µs are always detected.
  • 256 µs—Pulses shorter than 256 µs are rejected. Pulses between 256 µs and 512 µs are sometimes detected. Pulses longer than 512 µs are always detected.
  • 4096 µs—Pulses shorter than 4096 µs are rejected. Pulses between 4096 µs and 8192 µs are sometimes detected. Pulses longer than 8192 µs are always detected.
  • Measurement Edge

  • Rising—The counter counts rising edges.
  • Falling—The counter counts falling edges.
  • Frequency Timebase

    Selecting a Frequency Timebase is a tradeoff between resolution and response speed. A shorter timebase provides lower resolution but the data it returns is more up to date. A longer timebase provides higher resolution but may lag behind or miss changes in signal frequency. The guidelines below for selecting a timebase for different frequency ranges will result in a maximum error of approximately 1%. If you require higher resolution and can tolerate less frequent updates, use a longer timebase than indicated.

  • 256 µs—The counter counts the edges of the selected type that occur in 256 µs and returns the frequency of the signal. Use this setting for frequencies of 500 kHz or higher.
  • 512 µs—The counter counts the edges of the selected type that occur in 512 µs and returns the frequency of the signal. Use this setting for frequencies of 250 kHz or higher.
  • 1024 µs—The counter counts the edges of the selected type that occur in 1024 µs and returns the frequency of the signal. Use this setting for frequencies of 125 kHz or higher.
  • 2048 µs—The counter counts the edges of the selected type that occur in 2048 µs and returns the frequency of the signal. Use this setting for frequencies of 62.5 kHz or higher.
  • 4096 µs—The counter counts the edges of the selected type that occur in 4096 µs and returns the frequency of the signal. Use this setting for frequencies of 31.3 kHz or higher.
  • 8192 µs—The counter counts the edges of the selected type that occur in 8192 µs and returns the frequency of the signal. Use this setting for frequencies of 15.6 kHz or higher.
  • 16384 µs—The counter counts the edges of the selected type that occur in 16384 µs and returns the frequency of the signal. Use this setting for frequencies of 7.8 kHz or higher.
  • 32768 µs—The counter counts the edges of the selected type that occur in 32768 µs and returns the frequency of the signal. Use this setting for frequencies of 3.9 kHz or higher.
  • Note   For frequencies lower than 3.9 kHz, configure a counter to measure period and calculate the frequency using the inverse of the measurement.

    Frequency Measurement Example

    Refer to the Frequency Measurement (Host) VI in the labview\examples\CompactRIO\NI Scan Engine\Advanced\Specialty Digital Configuration - Counter Mode\Specialty Digital Configuration - Counter Mode.lvproj for an example of frequency measurement. The example uses an NI 9401, but you can modify it to use a different digital input module.