1 Reply Latest reply on Aug 18, 2017 1:04 PM by michael_1534646

    How to change ADC limit interrupt compare mode during runtime?

    michael_1534646

      Hi.

         

      Is it possible to change ADC limit interrupt compare mode during runtime?

         

      I don't see anything in component's datasheet (BTW, the datasheet doesn't mention the ADC_IRQ_StartEx() function. I wonder if there are more things missing in it).

         

      Thanks.

        • 1. Re: How to change ADC limit interrupt compare mode during runtime?
          vsrs

          Hi Michael,

          I don't think any API's readily available for the purpose. One thing you can do is use the register ADC_SAR_RANGE_COND_REG . The bits 31:30 of the register control the range of the register. 

          Values corresponding to each mode are:
                                                                          0x0: BELOW
                                                                          result RANGE_LOW

                                                                          0x1: INSIDE
                                                                          RANGE_LOW = result RANGE_HIGH

                                                                          0x2: ABOVE
                                                                          RANGE_HIGH = result

             

                                                                          0x3: OUTSIDE
                                                                          result RANGE_LOW || RANGE_HIGH = result

             

          You may change these values dynamically to change the compare mode. It is better to stop the ADC before the register write operation and start it again. Use masking technique so that you won't disturb other bits in the register.

          Happy Designing !

          Regards,
          VSRS