My time on 16F188777 runs to slow in this setup
Have a xtal 32,768 kHz on pin RC0 - RC1. with 2 15pf capasitor
have now been running for 11 hours and on this time the time has lost 37 min = 2220 seconds.
Around 6% lost,
So i think something must be wrong in setup ?
Here is a bit of code to it.
Have a xtal 32,768 kHz on pin RC0 - RC1. with 2 15pf capasitor
have now been running for 11 hours and on this time the time has lost 37 min = 2220 seconds.
Around 6% lost,
So i think something must be wrong in setup ?
Here is a bit of code to it.
Code:
static void interrupt isr(void) // Here is interrupt function - the name is unimportant.
{
if(TMR1IF) // Was this a timer overflow?
{
TMR1IF=0; // Clear interrupt flag, ready for next
TMR1L=0x00;
TMR1H=0x80; // If we set TMR1 to start at 0x8000 (32768), the TMR1 will overflow every 1 second
sec=1; // adds a sec. to main loop
}
}
void setup(void)
{
TRISA0=1; //set all A port in
TRISA1=1;
TRISA2=1;
TRISA3=1;
TRISA4=1;
TRISA5=1;
TRISA6=1;
TRISA7=1;
TRISB0=0; // port b0 = out
TRISB3=0; // PORT B3 = out
TRISB5=1;
TRISB6=1;
TRISB7=1;
TRISC0=1; // ALL C = IN
TRISC1=1;
TRISC2=1;
TRISC3=1;
TRISC4=1;
TRISC5=1;
TRISC6=1;
TRISC7=1;
TRISD0=0; // ALL D = out
TRISD1=0;
TRISD2=0;
TRISD3=0;
TRISD4=0;
TRISD5=0;
TRISD6=0;
TRISD7=0;
TRISE0=0; // E0 = out
TRISE1=1;
TRISE2=1;
ANSELA=0b00000000; // set alle digital.
ANSELB=0b00000000;
ANSELC=0b00000000;
ANSELD=0b00000000;
ANSELE=0b0000;
//timer 1 setup
T1CS0=0; // 0110 = SOCS
T1CS1=1;
T1CS2=1;
T1CS3=0;
T1CKPS0=0; // no prescale
T1CKPS1=0;
nT1SYNC=1; // no sync
}