I have a project which toggles the state of PORTB every ~0.9ms by using the CCP1 feature of the 16F87 chip.
The project was making use of the external 8Mhz oscillator (on the EasyPic 5 developement board) but recently I tried to adapt the program to use the internal oscillator.
Now PORTB toggles state every ~3.5ms.
What am I missing?
Here are the settings I used originally:
Code: Select all
Oscillator: HS 8 MHz (HS_OSC config bit set)
T1CON = 0x01;
PIE1.TMR1IE = 0;
PIR1.TMR1IF = 0;
TMR1H = 0x00; // Initialize Timer1 register
TMR1L = 0x00;
PIE1.CCP1IE = 0; // enable CCP1 interrupt
CCP1CON = 0x08;
CCPR1H = 0x06; // Times to match to
CCPR1L = 0xF2;
Code: Select all
INTRC_IO Config bit set
HS_OSC config bit NOT set
OSCCON = 0x7C; // Set to select 8MHz internal RC Oscillator
// Device running primary system clock
// Stable frequency
// Oscillator mode
T1CON = 0x25; // Set to prescale 1:4 (as clock will be FOsc / 4)
// Timer 1 oscillator shut off (as not used)
// Do not synchronise external clock input
// Internal Clock (FOsc / 4)
// Enable Timer1
PIE1.TMR1IE = 0;
PIR1.TMR1IF = 0; // clear TMR1IF
TMR1H = 0x00; // Initialize Timer1 register
TMR1L = 0x00;
CCP1CON = 0x08;
CCPR1H = 0x06; // Times to match to
CCPR1L = 0xF2;
Jimbo