13.2.5 Frequency In [T-Series Datasheet] | LabJack
« Close

Datasheets and User Guides

App Notes

Software & Driver


13.2.5 Frequency In [T-Series Datasheet]



T4 Capable DIO: DIO4, DIO5 (aka FIO4, FIO5)


T7 Capable DIO: DIO0, DIO1 (aka FIO0, FIO1)

Requires Clock Source: Yes

Index: 3 (positive edges) or 4 (negative edges)

Streamable: Yes—integer READ registers only.


Frequency In will measure the period/frequency of a digital input signal by counting the number of clock source ticks between two edges: rising-to-rising (index=3) or falling-to-falling (index=4).  The number of ticks can be read from DIO#_EF_READ_A.

Clock#Frequency = CoreFrequency / DIO_EF_CLOCK#_DIVISOR    //typically 80M/Divisor
Period (s) = DIO#_EF_READ_A / Clock#Frequency
Frequency (Hz) = Clock#Frequency / DIO#_EF_READ_A
Resolution(s) = 1 / Clock#Frequency
Max Period(s) = DIO_EF_CLOCK#_ROLL_VALUE / Clock#Frequency

Frequency In works best with periodic signals. Due to a hardware constraint, the first edge is often missed. That can cause confusing results when the signal is not periodic. For measuring non-perioidic singles we recommend L2L.

CoreFrequency is always 80 MHz at this time, but in the future some low-power operational modes might result in different core frequencies.  The valid values for DIO_EF_CLOCK#_DIVISOR are 1, 2, 4, 8, 16, 32, 64, or 256, and a value of 0 (default) equates to a divisor of 1.  For more details about Clock#Frequency and DIO_EF_CLOCK#_DIVISOR, see the DIO-EF Clock Source section.

Roll value for this feature would typically be left at the default of 0, which is the max value (2^32 for the 32-bit Clock0), but you might be forced to use a lower roll value due to another needed feature such as PWM Out.

A couple of typical scenarios with roll value = 0 and using the 32-bit clock (Clock0):

  • Divisor = 1, Resolution = 12.5 nanoseconds, MaxPeriod = 53.7 seconds
  • Divisor = 256, Resolution = 3.2 microseconds, MaxPeriod = 229 minutes

By default, Frequency In operates in one-shot mode where it will measure the frequency once after being enabled and a new measurement only once after each read of a READ_A register. The other option is continuous mode, where the frequency is constantly measured (every edge is processed) and READ registers return the most recent result. Running in continuous mode puts a greater load on the processor.

If you do another read before a new edge has occurred, you will get the same value as before.  Some applications will want to use the read-and-reset option so that a value is only returned once and extra reads will return 0. (See Reset below.)


DIO#_EF_ENABLE: 0 = Disable, 1 = Enable
DIO#_EF_INDEX: 3 or 4
DIO#_EF_OPTIONS: Default = 0.  Bits 0-2 specify which clock source to use ... 000 for Clock0, 001 for Clock1, and 010 for Clock2. All other bits reserved and should be set to 0.
DIO#_EF_CONFIG_A: Default = 0.  Bit 1:  0 = one-shot, 1 = continuous. All other bits reserved.
DIO#_EF_CONFIG_B: Not used.
DIO#_EF_CONFIG_C: Not used.
DIO#_EF_CONFIG_D: Not used.


No update operations can be performed on Frequency In.


Results are read from the following registers.

DIO#_EF_READ_A: Returns the period in ticks. If a full period has not yet been observed this value will be zero.
DIO#_EF_READ_B: Returns the same value as READ_A.
DIO#_EF_READ_A_F: Returns the period in seconds. If a full period has not yet been observed this value will be zero.
DIO#_EF_READ_B_F: Returns the frequency in Hz. If a full period has not yet been observed this value will be zero.

Note that all "READ_B" registers are capture registers.  All "READ_B" registers are only updated when any "READ_A" register is read.  Thus it would be unusual to read any B registers without first reading at least one A register.

Stream Read

All operations discussed in this section are supported in command-response mode.  In stream mode, you can read from the integer READ registers (A, B, A_AND_RESET), but as mentioned in the Stream Section those reads only return the lower 16 bits so you need to also use STREAM_DATA_CAPTURE_16 in the scan list to get the upper 16 bits.


DIO#_EF_READ_A_AND_RESET: Returns the same data as DIO#_EF_READ_A and then clears the result so that zero is returned by subsequent reads until another full period is measured (2 new edges).

Note that even in continuous mode, with reads happening faster than the signal frequency using a _RESET read will result in measurements of every other cycle not every cycle.


Most applications can use default clock settings, so to configure frequency input on DIO0 you can simply write to 3 registers:


Now you can read the period in seconds from a 4th register DIO0_EF_READ_A_F.

Roll value considerations:

Sometimes, other DIO-EF might interact with this feature.  For example, roll value would usually be set to 0 to provide the maximum measurable period, but assume that we have to use 10000 because it is set to that for PWM output on another channel:

DIO_EF_CLOCK0_DIVISOR = 8          // Clock0Frequency = 80M/8 = 10 MHz.
DIO_EF_CLOCK0_ROLL_VALUE = 10000   // Roll value needed for PWM output on another channel.

This clock configuration results in:

Resolution = 1 / 10M = 0.1 us


MaxPeriod = 10000 / 10M = 1 ms

For a more detailed walkthrough, see Configuring & Reading Frequency.

Rate Limits

T-Series IC Rate Limits

The maximum measurable frequency varies based on the one-shot setting, concurrent stream rate, and other DIO-EFs set to an input mode. 

One-shot or Continuous: When one-shot is enabled, the T-series devices will take a single measurement, then wait for a READ_A register to be read before taking another measurement. This means that with one-shot, only a small fraction of the total periods of a signal are measured. One-shot allows for higher maximum measurable frequency than continuous does.

Stream: The stream process is the highest priority process on T-series devices. When stream needs the processor, all other operations are put on hold. That hold occurs more frequently at higher stream speeds. When a DIO-EF process has to wait, the max frequency that can be measured is reduced.

Multiple DIO-EFs: DIO-EFs on other different lines also require processor time. The amount of processor time required depends on the signal being processed and the DIO-EF's settings. The maximum frequencies in the below table give the total max frequency for all running DIO-EFs—divide the max frequencies below by the number of enabled DIO-EFs to get the max frequency for each individual DIO-EF.

Refer to the following table for maximum measurable frequencies in various combinations of stream and one-shot.

Index One-shot or Continuous Stream Rate Max Frequency
3 or 4 Continuous Stream not running 200 kHz
3 or 4 One-shot Stream not running 750 kHz
3 or 4 Continuous 10 kHz 75 kHz
3 or 4 One-shot 10 kHz 750 kHz
3 or 4 Continuous 100 kHz 20 kHz
3 or 4 One-shot 100 kHz 250 kHz
5 Continuous Stream not running 200 kHz
5 One-shot Stream not running 750 kHz
5 Continuous 10 kHz 75 kHz
5 One-shot 10 kHz 750 kHz
5 Continuous 100 kHz 20 kHz
5 One-shot 100 kHz 250 kHz