38.7.13 Comparator Control

Table 38-20. Register Bit Attribute Legend
SymbolDescriptionSymbolDescriptionSymbolDescription
RReadable bitHCCleared by Hardware(Grey cell)Unimplemented
WWritable bitHSSet by HardwareXBit is unknown at Reset
KWrite to clearSSoftware settable bit
Name: CMPCTRL
Offset: 0x0B0
Reset: 0x00000000
Property: RW

Bit 3130292827262524 
   IEHIHIIEHILOADCMPHI[11:8] 
Access R/WR/WR/WR/WR/WR/W 
Reset 000000 
Bit 2322212019181716 
 ADCMPHI[7:0] 
Access R/WR/WR/WR/WR/WR/WR/WR/W 
Reset 00000000 
Bit 15141312111098 
 IEBTWNIELOHIIELOLOCMPENADCMPLO[11:8] 
Access R/WR/WR/WR/WR/WR/WR/WR/W 
Reset 00000000 
Bit 76543210 
 ADCMPLO[7:0] 
Access R/WR/WR/WR/WR/WR/WR/WR/W 
Reset 00000000 

Bit 29 – IEHIHI Enable VAL >= CMPHI

Setting this bit enables comparison events ADCMPHI≤ ADC value.

Note:
  1. This bit is Enabled Protected : (Writes are ignored when CTRLA.ENABLE = 1) returns a bus error.
  2. The Digital Comparator works on the final value of the filter data.
  3. When using channel using FRACT (16bits left justified) the lower 4 bits are ‘0, therefore in this mode 15:4 will be in 11:0 and user must account for the lower 4 bits of 0’s.
  4. In any case where the results value is of greater resolution than 12 bits, the comparison is only performed on upper 12 bits of the results value according to the settings of register CMPCTRL.

Bit 28 – IEHILO Enable VAL < CMPHI

Setting this bit enables comparison events ADC value < ADCMPHI.

Note:
  1. This bit is Enabled Protected : (Writes are ignored when CTRLA.ENABLE = 1) returns a bus error.
  2. The Digital Comparator works on the final value of the filter data.
  3. When using channel using FRACT (16bits left justified) the lower 4 bits are ‘0, therefor in this mode 15:4 will be in 11:0 and user must account for the lower 4 bits of 0’s.
  4. In any case where the results value is of greater resolution than 12 bits, the comparison is only performed on upper 12 bits of the results value according to the settings of register CMPCTRL.

Bits 27:16 – ADCMPHI[11:0] High Limit of Digital Comparator

This register stores the limit value which is used for comparisons with the ADC Module output data when

IEHIHI = 1, IEHILO = 1, or IEBTWN = 1.

The user is responsible for formatting the data in ADCMPHI[11:0] as signed or unsigned to match the data format as specified by the CHNCFG3.SIGNk and CHNCFG2.FRACTk bits for all the analog input channels k which are enabled by CHNCFG1.CHNCMPENk .

Note: In Filter accumulation mode, the comparison is done on the upper 12 of the 16 bits of filter data.
Note:
  1. This bit is Enabled Protected : (Writes are ignored when CTRLA.ENABLE = 1) returns a bus error.
  2. The Digital Comparator works on the final value of the filter data.
  3. When using channel using FRACT (16bits left justified) the lower 4 bits are ‘0, therefor in this mode 15:4 will be in 11:0 and user must account for the lower 4 bits of 0’s.
  4. In any case where the results value is of greater resolution than 12 bits, the comparison is only performed on upper 12 bits of the results value according to the settings of register CMPCTRL.

Bit 15 – IEBTWN Enable CMPLO <= VAL < CMPHI

Setting this bit enables comparison events ADCMPLO ≤ ADC Value < ADCMPHI.

Note:
  1. This bit is Enabled Protected : (Writes are ignored when CTRLA.ENABLE = 1) returns a bus error.
  2. The Digital Comparator works on the final value of the filter data.
  3. When using channel using FRACT (16bits left justified) the lower 4 bits are ‘0, therefor in this mode 15:4 will be in 11:0 and user must account for the lower 4 bits of 0’s.
  4. In any case where the results value is of greater resolution than 12 bits, the comparison is only performed on upper 12 bits of the results value according to the settings of register CMPCTRL.

Bit 14 – IELOHI Enable VAL >= CMPLO

Setting this bit enables comparison events ADCMPLO≤ ADC Value.

Note:
  1. This bit is Enabled Protected : (Writes are ignored when CTRLA.ENABLE = 1) returns a bus error.
  2. The Digital Comparator works on the final value of the filter data.
  3. When using channel using FRACT (16bits left justified) the lower 4 bits are ‘0, therefor in this mode 15:4 will be in 11:0 and user must account for the lower 4 bits of 0’s.
  4. In any case where the results value is of greater resolution than 12 bits, the comparison is only performed on upper 12 bits of the results value according to the settings of register CMPCTRL.
ValueDescription
0Use normal interrupts
1use early interrupts

Bit 13 – IELOLO Enable VAL < CMPLO

Setting this bit enables comparison events ADC Value < ADCMPLO.

Note:
  1. This bit is Enabled Protected : (Writes are ignored when CTRLA.ENABLE = 1) returns a bus error.
  2. The Digital Comparator works on the final value of the filter data.
  3. When using channel using FRACT (16bits left justified) the lower 4 bits are ‘0, therefor in this mode 15:4 will be in 11:0 and user must account for the lower 4 bits of 0’s.
  4. In any case where the results value is of greater resolution than 12 bits, the comparison is only performed on upper 12 bits of the results value according to the settings of register CMPCTRL.

Bit 12 – CMPEN Comparator Enable

Setting this bit enables digital comparisons for the inputs to the ADC.

For each channel input channel k to be compared the corresponding bit CHNCFG1.CHNCMPENk must be set for the channel to be monitored.

Note:
  1. This bit is Enabled Protected : (Writes are ignored when CTRLA.ENABLE = 1) returns a bus error.
  2. The Digital Comparator works on the final value of the filter data.
  3. When using channel using FRACT (16bits left justified) the lower 4 bits are ‘0, therefor in this mode 15:4 will be in 11:0 and user must account for the lower 4 bits of 0’s.
  4. In any case where the results value is of greater resolution than 12 bits, the comparison is only performed on upper 12 bits of the results value according to the settings of register CMPCTRL.

Bits 11:0 – ADCMPLO[11:0] Low Limit of Digital Comparator

This register stores the limit value which is used for comparisons with the ADC Module output data when

IELOHI = 1, IELOLO = 1, or IEBTWN = 1.

The user is responsible for formatting the data in ADCMPLO[11:0] as signed or unsigned to match the data format as specified by the CHNCFG3.SIGNk and CHNCFG2.FRACTk bits for all the analog input channels k which are enabled by CHNCFG1.CHNCMPENk .

Note: In Filter accumulation mode, the comparison is done on the upper 12 of the 16 bits of filter data.
Note:
  1. This bit is Enabled Protected : (Writes are ignored when CTRLA.ENABLE = 1) returns a bus error.
  2. The Digital Comparator works on the final value of the filter data.
  3. When using channel using FRACT (16bits left justified) the lower 4 bits are ‘0, therefor in this mode 15:4 will be in 11:0 and user must account for the lower 4 bits of 0’s.
  4. In any case where the results value is of greater resolution than 12 bits, the comparison is only performed on upper 12 bits of the results value according to the settings of register CMPCTRL.