Skip to main content
Skip table of contents

13.2.7 Line-to-Line In [T-Series Datasheet]

Overview

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

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

T8 Capable DIO: DIO0, DIO1, DIO2, DIO3, DIO4, DIO5, DIO8, DIO11, DIO13 (aka FIO0, FIO1, FIO2, FIO3, FIO4, FIO5, EIO0, EIO3, EIO5)

Requires Clock Source: Yes

Index: 6

Streamable: No

Line-to-line mode can be used to measure the time between edge transition points on two supported DIO.

T4/T7 - The measurement occurs between the lower DIO number edge and the upper DIO edge. For example, the time between a falling edge on DIO0 and the next falling edge on DIO1 when using a T7.

T8 - The measurement occurs between the combination of edges selected. Either DIO can trigger the measurement.

Operation

Clock#Frequency = CoreFrequency / DIO_EF_CLOCK#_DIVISOR
Time(s) = DIO#_EF_READ_A / Clock#Frequency
Resolution(s) = 1 / Clock#Frequency
Max Time(s) = DIO_EF_CLOCK#_ROLL_VALUE / Clock#Frequency

See the DIO-EF Clock Source section for more information about your device core frequency and DIO_EF clock source settings.

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 using a lower roll value for another feature such as PWM Out.

A couple 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

Line-to-Line In operates in a one-shot mode. Once the specified combination of edges is observed, the data is saved and measuring stops. Another measurement can be started by resetting or performing the configuration procedure again.

Configure

Configuring Line-to-Line In requires configuring two digital I/O lines (DIO0 and DIO1 only) as Line-to-Line In feature index 6. The first DIO configured should be the one expecting the first edge. Any extended features on either DIO should be disabled before beginning configuration.

DIO#_EF_ENABLE: 0 = Disable, 1 = Enable
DIO#_EF_INDEX: 6
DIO#_EF_CLOCK_SOURCE (formerly DIO#_EF_OPTIONS): Default = 0. Specify which clock source to use. 0 for Clock0, 1 for Clock1, or 2 for Clock2.
DIO#_EF_CONFIG_A: 0 = falling edge. 1 = rising edge.
DIO#_EF_CONFIG_B: Not used.
DIO#_EF_CONFIG_C: Not used.
DIO#_EF_CONFIG_D: Not used.

Update

No update operations can be performed on Line-to-Line In.

Read

Results are read from the following registers.

DIO#_EF_READ_A: Returns the one-shot measured time in clock source ticks.  If the specified combination of edges has not yet been observed this value will be zero.  Both configured DIO#s return the same value.
DIO#_EF_READ_A_F: Returns the time in seconds.

DIO#_EF_READ_B: Returns 1 for the DIO# which detected the first edge, if it was not the first edge returns 0. Both configured DIO#s will not return the same value, but a combination of 1,0 based on which line detected the edge first.

Reset

DIO#_EF_READ_A_AND_RESET: Performs the same operation as DIO#_EF_READ_A, then clears the result and starts another measurement. Also clears the READ_A values on the paired DIO#.

Example

First, configure the clock source:

DIO_EF_CLOCK0_DIVISOR = 1
DIO_EF_CLOCK0_ROLL_VALUE = 0
DIO_EF_CLOCK0_ENABLE = 1

On the T4 and T7 this clock configuration results in:

Resolution = 1 / 80 MHz = 12.5 ns

MaxPeriod = 232/ 80 MHz = 53.7 seconds

On the T8 this clock configuration results in:

Resolution = 1 / 100 MHz = 10 ns

MaxPeriod = 232/ 100 MHz = 42.9 seconds

Now configure the DIO-EF on DIO0 and DIO1 as line-to-line (use DIO4 and DIO5 on the T4):

DIO0_EF_ENABLE = 0
DIO1_EF_ENABLE = 0

DIO0_EF_INDEX = 6     // Index for line-to-line feature.
DIO0_EF_OPTIONS = 0   // Select the clock source.
DIO0_EF_CONFIG_A = 0  // Detect falling edge.
DIO0_EF_ENABLE = 1    // Turn on the DIO-EF

DIO1_EF_INDEX = 6     // Index for line-to-line feature.
DIO1_EF_OPTIONS = 0   // Select the clock source.
DIO1_EF_CONFIG_A = 0  // Detect falling edge.
DIO1_EF_ENABLE = 1    // Turn on the DIO-EF

At this point the device is watching DIO0 for a falling edge.  Once that happens it watches for a falling edge on DIO1.  Once that happens it stores the time between those 2 edges, which you can read from the READ registers described above.

To do another measurement, repeat the DIO0-EF configuration above, or read from DIO0_EF_READ_A_AND_RESET.

Rate Limits

Line-to-line can achieve high resolution while requiring very little processor time. The time between the edges can be as little as 50 ns. Once a measurement has been completed the system will not measure again until reconfigured or reset. Unless you are reading at a high rate, line-to-line will have little impact on other systems.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.