Microcontroller › PIC › How to count milliseconds with PIC18F4550? › Hi Alison,Try these algorithm
September 25, 2012 at 6:48 pm
#8615
AJISH ALFRED
Participant
Hi Alison,
Try these algorithm for your “stop when an event occurs and restart when that event stop”
1) Configure external interrupt as positive edge triggered
2) Enable external interrupt
3) When interrupt occurs do the step 4) to 7)
4) In interrupt ISR, disable the external interrupt
5) Reconfigure the external interrupt as negative edge triggerd
6) Enable external interrupt again
7) If the count is stopped already, then restart count, otherwise stop the count
There is a lot to learn about interrupts, ISR and how to implemnt them in your microcontroller.