Hoping some one can help. The following program is a simple program which increments a variable when a external interrupt(RB0) occurs. If a "rb change" interrupt occurs then the same variable is decremented. The main program is
checking if the variable is greater than 0. If so then PortA (0) is high. It seems the program isn't decrementing. The probelm seems to be the RB change interrupt. The increment doesn't register. The interrupt will do other things but it won't increment or decrement.
The program looks ok. There may be some practical problems with testing.
The listed program will turn RA0 on if count1 is > 0 (not > 1 as stated). So it will only be off when count1 = 0.
Interrupt responses are extremely fast so, if you are using switches or other electrically noisy signal source, the program might be counting additional pulses from switch bounce. This would corrupt the expected position of the zero count.
The INT input will respond to one edge of any input pulse, whereas the RB change interrupt will respond to both edges of an input pulse, possibly giving an asymetric count problem.
If unused RB<4:7> pins are left floating, they might be contributing additional interrupt signals due to noise.