This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
AVR ATmega168 Analog Comparator Demonstration | |
by Mike Szczys | |
I'm using a voltage divider with a photoresistor on | |
PC6 and a voltage divider with equal values on PC7 | |
to yield a 2.5V reference signal. | |
The analog comparator is set to throw an interrupt | |
whenever there is a zero crossing. I then check the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;Begin delaying | |
LDI ZH,0xFF ;Set high byte | |
LDI ZL,0xFF ;Set low byte | |
DelayLoop: | |
SBIW ZL,1 ;subtract one from word | |
BRNE DelayLoop ;Branch back to DelayLoop unless zero flag was set | |
;Go on with the rest of life |
NewerOlder