I don't recall ever using an external clock source for T1. I guess I am trying it for the first time and can't seem to get it to work. My chip is the pic18445k22.
I have everything hooked up as in the schematic below. It should be noted that I am in the bread board phase and that the crystal and caps are on a small board which I have designed and connected by jumpers to the breadboard. I don't expect an accurate clock, I just want it to work.
I am using the internal RC oscillator for my main oscillator. I assume the T1 oscillator will still work in this configuration?
I am configuring the timer as follows:
#define TMR1HVAL 0x80
#define TMR1LVAL 0x00
// Timer 1
TMR1H = TMR1HVAL; // Set Timer 1 Overflow Hi
TMR1L = TMR1LVAL; // Set Timer 1 Overflow Lo
T1CON = 0x3; // Set external osc and enable Timer 1
PIR1bits.TMR1IF = 0; // Clear Timer 1 interrupt flag
PIE1bits.TMR1IE = 1; // Enable Time 1 interrupt
Am I missing anything else? Is there a configuration bit I need to set? I checked the datasheet and it does not seem to mention anything else.
My interrupt routine never gets called but if I change to internal clock cycle for T1 then the interrupt routine gets called as expected.
How can I diagnose that the oscillator is running? If I place my scope on pin 2, I see no transitions. If I place it on pin 2, I see transitions while the chip is being programmed which I find kind of strange since that pin is not MCLR, PGC or PGD.
I have everything hooked up as in the schematic below. It should be noted that I am in the bread board phase and that the crystal and caps are on a small board which I have designed and connected by jumpers to the breadboard. I don't expect an accurate clock, I just want it to work.
I am using the internal RC oscillator for my main oscillator. I assume the T1 oscillator will still work in this configuration?
I am configuring the timer as follows:
#define TMR1HVAL 0x80
#define TMR1LVAL 0x00
// Timer 1
TMR1H = TMR1HVAL; // Set Timer 1 Overflow Hi
TMR1L = TMR1LVAL; // Set Timer 1 Overflow Lo
T1CON = 0x3; // Set external osc and enable Timer 1
PIR1bits.TMR1IF = 0; // Clear Timer 1 interrupt flag
PIE1bits.TMR1IE = 1; // Enable Time 1 interrupt
Am I missing anything else? Is there a configuration bit I need to set? I checked the datasheet and it does not seem to mention anything else.
My interrupt routine never gets called but if I change to internal clock cycle for T1 then the interrupt routine gets called as expected.
How can I diagnose that the oscillator is running? If I place my scope on pin 2, I see no transitions. If I place it on pin 2, I see transitions while the chip is being programmed which I find kind of strange since that pin is not MCLR, PGC or PGD.