Reading the ADC result at an ADC High Limit Interrupt service routine

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Reading the ADC result at an ADC High Limit Interrupt service routine

700件の閲覧回数
rishadahmed
Contributor II

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 

tek00005.bmp

0 件の賞賛
返信
1 返信

588件の閲覧回数
dynapb
Contributor IV

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

0 件の賞賛
返信