Skip to main content
Skip table of contents

13.2.13 Conditional Reset [T-Series Datasheet]


T4 Capable DIO: DIO4, DIO5, DIO6, DIO7, DIO8, DIO9 (aka FIO4, FIO5, FIO6, FIO7, EIO0, EIO1)

T7 Capable DIO: DIO0, DIO1, DIO2, DIO3, DIO6, DIO7 (aka FIO0, FIO1, FIO2, FIO3, FIO6, FIO7)

T8 Capable DIO: DIO0, DIO1, DIO2, DIO3, DIO4, DIO5, DIO6, DIO7, DIO8, DIO9, DIO10, DIO11, DIO12, DIO13, DIO14, DIO15 (aka FIO0, FIO1, FIO2, FIO3, FIO4, FIO5, FIO6, FIO7, EIO0, EIO1, EIO2, EIO3, EIO4, EIO5, EIO6, EIO7)

Requires Clock Source: No

Index: 12

Streamable: No

DIO-EF Conditional Reset will reset a specified DIO-EF after a specified number of edges have been detected.


To set up a DIO-EF Conditional Reset is simple. Just set the DIO number of the DIO-EF you would like to reset and then set the other options.

DIO#_EF_ENABLE: 0 = Disable, 1 = Enable
DIO#_EF_CONFIG_A: Reset Options bit field:

  • bit 0: Edge select. 1 = rising, 0 = falling
  • bit 1: Disable. 1 = disable the selected DIO_EF on reset. 0 = don't disable.
  • bit 2: One-Shot. 1 = only reset once. 0 = reset every n edges.

DIO#_EF_CONFIG_B: Number of edges per reset.
DIO#_EF_CONFIG_C: IO number of DIO-EF to be reset.
DIO#_EF_CONFIG_D: Not used.

Disable vs. One-Shot

To disable a DIO_EF mode instead of resetting the count, set the DIO#_EF_CONFIG_A "Disable" bit to 1. This is similar behavior to a One-Shot reset, but instead of resetting the count only once, it disables the set DIO_EF mode on reset.

There is conflicting behavior between Disable and One-Shot so it is recommended to use either Disable or One-Shot (or neither), but not both. In the case where both Disable and One-Shot are used, Disable has a higher priority so the selected DIO_EF will be disabled instead of being reset.

CONFIG_A Value Map

To configure the DIO_EF reset options, refer to the table below for the mapping between the Reset Options bit field, and the corresponding integer value which should be written to DIO#_EF_CONFIG_A.

Reset OptionsBit FieldInt Value
Continuous Falling0b0000
Continuous Rising0b0011
Disable Falling0b0102
Disable Rising0b0113
One-Shot Falling0b1004
One-Shot Rising0b1015

* Reset Options utilizing both One-Shot and Disable bits are omitted from the table as there is conflicting behavior between these modes. See above for additional info.


No update operations can be performed on Conditional Reset.


Results are read from the following registers.

DIO#_EF_READ_A – Returns the current count.


This example assumes that DIO0 has a running extended feature such as quadrature or a counter. Now we will set up DIO2 as a falling edge trigger that will reset the count of DIO0_EF.

DIO2_EF_ENABLE = 0    // Ensure that the DIO-EF is not running so that it can be configured.
DIO2_EF_INDEX = 12    // Set to Conditional Reset
DIO2_EF_CONFIG_A = 0  // Falling edges
DIO2_EF_CONFIG_B = 1  // Reset every edges
DIO2_EF_CONFIG_C = 0  // Reset events clear the count of DIO0_EF
DIO2_EF_ENABLE = 1    // Turn on the DIO-EF

Now falling edges on DIO2 will set the count of DIO0_EF to zero.

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

Edge Rate Limits

This interrupt-based digital I/O extended feature (DIO-EF) is not purely implemented in hardware, but rather firmware must service each edge. This makes it substantially slower than other DIO-EF that are purely hardware-based.  To avoid missed edges, the aggregate limit for edges seen by all interrupt-based DIO-EF is 70k edges/second.  If stream mode is active, the limit is reduced to 20k edges/second.  Excessive processor loading (e.g. a busy Lua script) can also reduce these limits.  Note that interrupt features must process all edges, rising & falling, even if a given feature is configured to only look at one or the other. Additionally, note that intensive interrupt based features may limit the maximum streaming rates due to processor loading.

The more proper way to think of the edge limit, and understand error that could be introduced when using multiple interrupt-based DIO-EF, is to consider that the interrupt that processes an edge can take up to 14 μs to complete.  When a particular channel sees an applicable edge, an IF (interrupt flag) is set for that channel that tells the processor it needs to run an ISR (interrupt service routine) for that channel.  Once an ISR is started, it runs to completion and no other ISR can run until it is done (except that stream interrupts are higher priority and will preempt other interrupts).  When an ISR completes, it clears the IF for that channel.  So it is okay to have edges on multiple channels at the same time, as long as there is not another edge on any of those channels before enough time to process all the initial edges.

Say that channel A & B have an edge occur at the same time and an ISR starts to process the edge on channel A.  If channel A has another edge during the first 14 μs, that edge will be lost.  If channel B has another edge during the first 14 μs, the initial edge will be lost.  If channel B has another edge during the second 14 μs (during the ISR for channel B), the new edge will be lost.

JavaScript errors detected

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

If this problem persists, please contact our support.