Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

ADC driven program -- interrupts?

Status
Not open for further replies.
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?
 
Last edited:
Thanks for the quick reply.

I was hoping that I could set it up in a "only bug me if you have something good to tell me fashion," but I suppose it's not too burdensome to do it the way you mentioned.

Thanks
 
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.

Any thoughts? Can this be done?
You need more than two comparators in a small package?

The TI MSP430G2211 can multiplex 8 comparator channels in a 14 pin package. Doesn't get you around the fact, that a timer interrupt would still be the way to go. The usage of the comparator module is explained in the **broken link removed**.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top