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 question

Status
Not open for further replies.

AtomSoft

Well-Known Member
hey guys/gals ive been wondering about ADC... i know you can setup the adc on a pic to interrupt when complete but is it possible to setup to interrupt on change?
 
hey guys/gals ive been wondering about ADC... i know you can setup the adc on a pic to interrupt when complete but is it possible to setup to interrupt on change?

No, it's not really anything to do with the ADC - but easy enough to check for a change from the completed interrupt.
 
oh yeah!!! nice one Nigel heh thanks i even forgot about that.

So i can simply have 2 global variables :

1 = oldADC
2 = isNew

On interrupt clear isNew var and check the old ADC value store in oldADC against the new one and if new set the isNew flag and set the oldADC variable to the new data. Correct?
 
oh yeah!!! nice one Nigel heh thanks i even forgot about that.

So i can simply have 2 global variables :

1 = oldADC
2 = isNew

On interrupt clear isNew var and check the old ADC value store in oldADC against the new one and if new set the isNew flag and set the oldADC variable to the new data. Correct?

Yes, as easy as that.
 
I read somewhere that you could use an interrupt from a comparator, but I don't see how that would apply if you don't know what it is changing from, but if it changes from V+ or some value you set, it could be done and the ADC would not need to be running all the time .

I like Nigels way though.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top