MBB - 2011-05-15

I built a frequency counter using a 16F628 and it works from about 2 Hz to 5 MHz EXCEPT near the Timer 1 overflow points. This is the code I use to count the Timer1 interrupts and exit the BitClk loop when Timer0 overflows.  The PRINT statements are for troubleshooting.

'PROBLEM BitClk not catching IntBit2 increment near overload points!!!!!!
' IntBit  ALWAYS = 0 WHY????????
BitClk:
FreqH = TMR1H
FreqL = TMR1L
BTFSC PIR1, TMR1IF; Check T1 interrupt bit, if 0 skip next step.
IntBit = IntBit + 1
IntBit3 = IntBit; for troubleshooting
If IntBit >= 1 then
IntBit2 = IntBit + IntBit2
IntBit = 0
BCF PIR1, TMR1IF; Clear T1 interrupt bit
End If
BTFSS INTCON, T0IF ;TMR0 interrupt bit, if bit=1 then skip next  instruction. i.e. exit loop.
Goto BitClk

'
CLS
Print IntBit2
locate 1,1
Print IntBit3
Wait 1 s
CLS

I've noticed that IntBit2 increment properly at most frequencies but not near the Timer1 FFFFh point and multiples of FFFFh.  Form example:

At 130 kHz the LCD reads 130 kHz
At 131 kHz the LCD reads 65 kHz
At 132 kHz the LCD reads 131 kHz.

The 131 kHz is near the 2 x FFFF point.  The problem occurs a couple 100 Hz either side of 131 kHz.

Does anyone know why this happens?