I have configured ADC interrupt and also written ISR for respective interrupt. My interrupt is getting triggered on every ADC value change. Can anyone help me in following :
How to use Hardware compare function?
Which values should we compare?
please refer to chapter 44.5.5 Automatic compare function of the RM.
As mentioned there the compare mode is determined by SC2[ACFGT], SC2[ACREN] bits, and the values in the Compare Value registers (CV1 and CV2). After the input is sampled and converted, the compare values in CV1 and CV2 are used as described in the table 44-5. If the condition selected evaluates true, SC1n[COCO] is set.
Upon completion of a conversion while the compare function is enabled, if the compare condition is not true, SC1n[COCO] is not set and the conversion result data will not be transferred to the result register, Rn.