Hello everybody!
I'm currently working on a project which is about regulation. To assure that, I am using a timer to control the stats of my sensors every five minutes.
The problem is, that all timers (except TMR0 which is already in use) start immediately after releasing/starting the program.
I'm using MPLAB IDE v8.92 with C18 Compiler and the PIC18F14K22.
At first scan I'm clearing the IF but it seems to turn back high immediately.
First scan Code:
OpenTimer1( TIMER_INT_ON & // enable timerinterrupt
T1_16BIT_RW & // registersize = 16Bit
T1_SOURCE_INT & // internal Osz.
T1_PS_1_8 & // prescaler 1/8
T1_OSC1EN_ON & // Enable Timer1 oscillator
T1_SYNC_EXT_OFF); // Don’t sync external clock input
RCONbits.IPEN = 1; // Prioritätslevel aktivieren
RCONbits.BOR = 0; // brown -Reset off
INTCONbits.PEIE = 1; // Enable peripheral interrupts
INTCONbits.GIEH = 1; // Enable all Interrupts
PIR1bits.TMR1IF = 0;
I hope somebody can help me.
Thank you up front!
I'm currently working on a project which is about regulation. To assure that, I am using a timer to control the stats of my sensors every five minutes.
The problem is, that all timers (except TMR0 which is already in use) start immediately after releasing/starting the program.
I'm using MPLAB IDE v8.92 with C18 Compiler and the PIC18F14K22.
At first scan I'm clearing the IF but it seems to turn back high immediately.
First scan Code:
OpenTimer1( TIMER_INT_ON & // enable timerinterrupt
T1_16BIT_RW & // registersize = 16Bit
T1_SOURCE_INT & // internal Osz.
T1_PS_1_8 & // prescaler 1/8
T1_OSC1EN_ON & // Enable Timer1 oscillator
T1_SYNC_EXT_OFF); // Don’t sync external clock input
RCONbits.IPEN = 1; // Prioritätslevel aktivieren
RCONbits.BOR = 0; // brown -Reset off
INTCONbits.PEIE = 1; // Enable peripheral interrupts
INTCONbits.GIEH = 1; // Enable all Interrupts
PIR1bits.TMR1IF = 0;
I hope somebody can help me.
Thank you up front!