How to change ADC limit interrupt compare mode during runtime?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

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.

0 Likes
1 Reply
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

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

0 Likes