I have this little project that requires exact clock so I'm using 32768 Hz quartz on RB6 & RB7 on my PIC16F628. Both pins are grounded using 33 pF capacitors.
My code that configures the timer1 is as follows (HI-TECH C compiler):
TRISA = 0b11100011; //x3F; // bit=0 - output; bit=1 - input
TRISB = 0b11110000; //x3F; // bit=0 - output; bit=1 - input
nRBPU = 1; //affects inputs only
TMR1ON = 0; // Disable Timer 1
T1CKPS1 = T1CKPS0 = 0; // 1:1 Prescale value
T1OSCEN = 1; //start tmr1 oscillator
TMR1CS = 1; //0: internal clock; 1: wait external clock
nT1SYNC = 0; //sync by external clock
TMR1 = 0x8000;
PEIE = 1;
TMR1IE = 1;
ei(); //sets GIE
//T1CON = 0b00001111;
TMR1ON = 1; // Enable Timer 1
The config bits:
__CONFIG(WDTE_OFF & MCLRE_ON & PWRTE_ON & BOREN_OFF & LVP_ON & FOSC_INTOSCIO & CP_OFF & CPD_OFF);
The problem - it never runs. I have an LED in the ISR that should be lighted up. Also I used an oscilloscope to investigate. Changed the capacitors. Tried another crystal. Tried all possible approaches. Nothing helped.