User Manual

Apollo3 Blue Datasheet
DS-A3-0p9p1 Page 731 of 909 2019 Ambiq Micro, Inc.
All rights reserved.
18.2.9 Window Comparator
A window comparator is provided which can generate an interrupt whenever a sample is determined to be
inside the window limits or outside the window limits. These are two separate interrupts with separate
interrupt enables. Thus one can request an interrupt any time a specified slot makes an excursion outside
the window comparator limits.
The window comparison function has an option for comparing the contents of the limits registers directly
with the FIFO data (default) or for scaling the limits register depending on the precision mode selected for
the slots.
Firmware has to participate in the determination of whether an actual excursion occurred. The window
comparator interrupts set their corresponding interrupt status bits continuously whenever the inside or
outside condition is true. Thus if one enables and receives an “excursion” interrupt then the status bit can’t
be usefully cleared while the ADC slot is sampling values outside the limits. That is, if one receives an
excursion interrupt and clears the status bit, it will immediately set again if the next ADC sample is still
outside the limits. Thus firmware should reconfigure the interrupt enables upon receiving an excursion
interrupt so that the next interrupt will occur when an ADC sample ultimately goes back inside the window
limits. Firmware may also want to change the windows comparator limit at that time to utilize a little
hysteresis in these window comparator decisions.
The determination of whether a sample is inside or outside of the window limits is made by comparing the
data format of the slot result written to the FIFO with the 20 bit window limits. An ADC sample is inside if
the following relation is true:
14.6 Lower Limit <= ADC SAMPLE <= 14.6 Upper Limit
Thus setting both limits to the same value, say 700.0 (0x2BC<<6 = 0xAF00), will only produce an inside
interrupt when the ADC sample is exactly 700.0 (0xAF00). Furthermore, note that if the lower limit is set to
zero (0x00000) and the upper limit is set to 0xFFFFF then all accumulated results from the ADC will be
inside the window limits and no excursion interrupts can ever by generated. In fact, in this case, the
incursion interrupt status bit will be set for every sample from any active slot with its window comparator bit
enabled. If the incursion interrupt is enabled then an interrupt will be generated for every such sample
written to the FIFO.
The window comparator limits are a shared resource and apply to all active slots which have their window
comparator bits enabled. If window limits are enabled for multiple enabled slots with different precision
modes, the window comparison function can be configured to automatically scale the 14.6 upper and lower
Table 1072: Window Comparator Lower Limit Register
1
9
1
8
1
7
1
6
1
5
1
4
1
3
1
2
1
1
1
0
0
9
0
8
0
7
0
6
0
5
0
4
0
3
0
2
0
1
0
0
Lower Limit
Table 1073: Window Comparator Upper Limit Register
1
9
1
8
1
7
1
6
1
5
1
4
1
3
1
2
1
1
1
0
0
9
0
8
0
7
0
6
0
5
0
4
0
3
0
2
0
1
0
0
Upper Limit