Sir ,
I have a problems using interrupt in MicroC for PIC. Am using PIC 16F877A
Sir e.g I have two square waves , when first wave rise interrupt 1 start and timer also start , after some time 2nd square wave rise at that time timer should be off , and the value of timer should be stored in a variable , this is the part of my project , please Help
Regards Usman Ghani
Use INT0 interrupt. When first rising edge is detected start timer and clear INT0IF bit. On 2nd rising interrupt stop timer. Use a counter inside isr which increments on every timerx interrupt. If timer interrupt you used was for say 20 us then counter will have number of timerx interrupts and the remaining time after the last timerx interrupt is got from TMRx register. If 1000 timerx interrupts had occured then counter value will be 1000. 1000 * 20 us + remaining time in TMRx register gives total time.