This is actually a somewhat tricky problem. Without spending a couple hours going through this for you, I'm going to take a shot in the dark. Your description of the problem suggests the value of CCP1 is getting changed at an inopportune time, or the output is being switched to C2 temporarily or there's a bad TRISC or ADCON statement. The most likely cause is that you have a lot of code in your interrupt routine, and you go to it often. It's possible that CCP1 getting set / reset occasionally at unfortunate times because you are off servicing the interrupt. I'd recommend that the interrupt routine set a flag only, or simply increment Tick_Tmr and do the value comparisons (IF..THEN) as part of your main loop.
Just a guess, and maybe a new direction for you to poke.
Bookmarks