Below is the ISR for CCP2(fall edge), the input is also tied to CPP1(rise). Only the CCP2 interrupt is enabled. I need to get Pulse Width and Pulse Rate from this interupt, and I would use the following equations;
PW = fall(n)-rise(n); PR = fall(n+1) - last_fall(n);
PW works, but I can't get PR to work, fall always seems to be equal to last_fall, equating to zero. I would also like to reset Timer1 to 0 after each interupt, how?
Any help with this code would be appreciated.
#int_ccp2 void isr_ccp2() { last_fall = fall; rise = CCP_1; fall = CCP_2; report_flag=1; } ______ ______ ______| |_____________________| |___ ^ ^ ^ ^ rise(n) fall/last_fall(n) rise(n+1) fall/last_fall(n+1)
TIA