I'm pretty sure that the IF statement executes as it should. The problem is likely that the C1Out doesn't actually toggle.
According to your schematic in the first post you have one input to RA0 and the other to RA2. As far as I can see in the datasheet, section 12.1, the inputs to comparator 1 is RA0 and RA3.
/Henrik.
Bookmarks