wannaBinventor
Member
Does anyone know if a PIC can be set up in a way to generate an interrupt if an ADC reading falls above or below a certain range?
Let's say it's an 8 bit reading and I wanted the program to take action (as in enter the ISR) when the reading was, say, above binary ADC values of 205 and below values of 50. Is there a way to do this purely by interrupt instead of polling? I know some PICs have comparators that can generate an interrupt, but I think that is just a test to see if it is greater or less than some individual reference. I know I could use two different comparators, but the 16F pics are short on comparators so trying to do this with a few different ADC readings won't work. I need something peicewise on one ADC channel.
I know I could set a timer interrupt that goes in and polls the ADC channels every so often, but to me that's tantamount to polling in the code. I'm hoping the ADC peripheral itself can generate the interrupt.
Any thoughts? Can this be done?
Let's say it's an 8 bit reading and I wanted the program to take action (as in enter the ISR) when the reading was, say, above binary ADC values of 205 and below values of 50. Is there a way to do this purely by interrupt instead of polling? I know some PICs have comparators that can generate an interrupt, but I think that is just a test to see if it is greater or less than some individual reference. I know I could use two different comparators, but the 16F pics are short on comparators so trying to do this with a few different ADC readings won't work. I need something peicewise on one ADC channel.
I know I could set a timer interrupt that goes in and polls the ADC channels every so often, but to me that's tantamount to polling in the code. I'm hoping the ADC peripheral itself can generate the interrupt.
Any thoughts? Can this be done?
Last edited: