Hi all,
I'm wander if there is a better way for synchronizing an external
interrupt INT0 fired by a 20mS external event with a 5mS asynchronous
event.
I need this precise delay for reading a voltage at 5mS after every
zero crossing voltage.
I'm doing like this inside the ISR:
-- _mili_second counter is incremented in the ISR every 1mS based on
the Bresenham alorithm
if INTCON_INT0IF then ; first int0 external interrupt occured
INTCON_INT0IE = low; disable INT0 external interrupt
_mili_second = 0 ; reset the counter
int0_flag = high ; interrupt has ocurred set a flag
INTCON_INT0IF = low ; clear int0 flag
end if
if (_mili_second == 5) & int0_flag then ; 5ms passed from the
previous int0 interrupt ?
; run adc here!
cda_inv2 = on ; yes see the event on the output pin
elsif (_mili_second >= 6) & int0_flag then ; keep the output on
for another 1 ms
cda_inv2 = off ; ok enough, I saw it
int0_flag = low; clear the interrupt flag
end if
thx,
Vasile
--
You received this message because you are subscribed to the Google Groups
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/jallib?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.