In an ISR , ADC High Limit Interrupt, I am trying to read the ADC value at a specific point (please see the attached figure- I am trying to read the minimum value). I am using the attached simple code to read the ADC result when the interrupt happens (Sample 0 > 0.85 V). However, I am reading multiple values (gradually increasing between 0.85 to 1.6 V) instead of just one when the interrupt happens. Also the values are changing all the time. I am using a structure named adc0_array to save 100 values. Will anyone please let me know where is the problem?
Thanks. Rishad
Hi Rishad
It looks to me like the ISR would be triggering whenever your input is greater than the threshold when using the HighLimit ISR so it looks like it is working as programmed.
If you use it that way you would probably have to add code to find the lowest value in a set of readings.
It would be best if you could trigger the ADC only at the location desired. Not sure if you can set upt the PWM to trigger that way.
Just some thoughts.
Pete