using a voltage from adc channel to activate interrupt on atmega328p

Thread Starter

jackmrdoctor

Joined Apr 17, 2018
16
if i have a voltage range from 2.5 to 4.3 at sine wave. let's say i have i want to choose 3v at set point to activate interrupt then from that i want the micro
do something else
 

danadak

Joined Mar 10, 2018
4,057
The ADC has a conversion complete interrupt, a simple test in interrupt
will permit, via flag, a redirection in processor code execution.

Set a flag in the interrupt, return to main, then test if >3V was result, and
call the function/code you want executed. The reason you do this vs call
other subroutines in ISR is to avoid a lot of stack push/thrashing, which
slows down ISR active to result code execution.

Note part has a comparator interrupt, that would be even faster detection
method for 3V.

Regards, Dana.
 
Top