ADC Magnitude Threshold Interrupts
708
SPNU503C – March 2018
Copyright © 2018, Texas Instruments Incorporated
Analog To Digital Converter (ADC) Module
19.7 ADC Magnitude Threshold Interrupts
The ADC allows up to three magnitude threshold interrupts to be generated. The comparison parameters
are programmed via the Magnitude Compare Interrupt x Control Register (ADMAGINTxCR).
19.7.1 Magnitude Threshold Interrupt Configuration
The following fields are configurable for each of the three available magnitude threshold interrupts:
1. CHN_THR_COMP: Specifies whether to compare two channels’ conversion results, or to compare a
channel’s conversion result to a programmable threshold value. A value of 0 will select the
programmable threshold to be compared, and a value of 1 will select the conversion result of the
channel identified by the COMP_CHID field to be compared.
2. MAG_CHID: Specifies the channel number from 0 to 23 whose conversion result needs to be
monitored.
3. COMP_CHID: Specifies the channel number from 0 to 23 whose last conversion result is used for the
comparison with the conversion result of the channel being monitored.
4. MAG_THR: Specifies the value for comparison with the conversion result of the channel identified by
the MAG_CHID field.
5. CMP_GE_LT: Specifies whether the conversion result of the channel identified by MAG_CHID is
compared to be “greater than or equal to”, or “less than” the reference value. The reference value can
be the conversion result of another channel identified by the COMP_CHID field, or it could be a
threshold value specified in the MAG_THR field. A value of 0 in the CMP_GE_LT field indicates a “less
than” comparison and a value of 1 indicates a “greater than or equal to” comparison.
19.7.2 Magnitude Threshold Interrupt Comparison Mask Configuration
There is also a separate comparison mask register (ADMAGINTxMASK) for each of the three magnitude
threshold interrupts. This register is used to specify the bits that are masked off for the sake of the
comparison. For example, the lower 4 bits of the conversion result can be masked off by writing 0xF to the
interrupt comparison mask register, allowing a gross comparison to be made. By default, the full 10/12-bit
conversion results are compared.
19.7.3 Magnitude Threshold Interrupt Enable / Disable Control
Each of the three magnitude interrupts also have separate interrupt enable set (ADMAGINTENASET) and
clear (ADMAGINTENACLR) registers. These are used to respectively enable and disable that particular
magnitude threshold interrupt from being generated. To enable a magnitude threshold interrupt, write a 1
to the corresponding bit of the interrupt enable set register. Conversely, to disable a magnitude threshold
interrupt, write a 1 to the corresponding bit of the interrupt enable clear register.
19.7.4 Magnitude Threshold Interrupt Flags
There is a separate Magnitude Interrupt Flag register (ADMAGINTFLG) that holds the flags for these three
interrupts. This flag gets set whenever the comparison condition for the corresponding interrupt is met. A
magnitude threshold interrupt is generated if the corresponding flag is set inside the flag register, and the
interrupt generation is enabled. This flag can be cleared by writing a 1 to the flag or by reading from the
interrupt offset register in case of this interrupt being the current highest-priority pending interrupt.
19.7.5 Magnitude Threshold Interrupt Offset Register
It is possible to have multiple magnitude threshold interrupts pending at the same time. The magnitude
threshold interrupt offset register (ADMAGINTOFF) holds the index of the currently pending highest
priority magnitude threshold interrupt. The magnitude threshold interrupt 1 has the highest priority while
the magnitude threshold interrupt 3 has the lowest priority. This is a read-only register and returns zeros if
none of the magnitude threshold interrupts are pending. Writes to this register have no effect.
A read from this register updates the register to the next highest-priority pending magnitude threshold
interrupt. This read also clears the corresponding flag from the magnitude threshold interrupt flag register.
However, a read from the magnitude threshold interrupt offset register in emulation mode does not affect
the interrupt flag register or the interrupt offset register.