ChriX
Member
I am having problems when trying to get the Timer1 module to interrupt on overflow.
I know the timer is actually running as I have tested it by polling TMR1IF and it overflows accordingly.
I had it all working using Timer0 but could not make this overflow slow enough for my needs, basically I have just changed the init section to timer1 and the bit which is reset in the ISR, but now I get nothing.
Thought I had something when searching and found the PEIE bit needs to be set, so I did that and still nothing.
Any ideas?
I know the timer is actually running as I have tested it by polling TMR1IF and it overflows accordingly.
Code:
; Timer1 module setup
clrf TMR1L
clrf TMR1H
BANKSEL PIE1
bsf PIE1,TMR1IE
bcf PIR1,TMR1IF
BANKSEL T1CON
movlw b'00010000'
movwf T1CON
bsf T1CON,TMR1ON ; Start the timer
bsf INTCON,GIE ; Enable interrupts
bsf INTCON,PEIE
Code:
ISR
<my rubbish here>
BANKSEL PIR1
bcf PIR1,TMR1IF ; Clear the interrupt bit so it can happen again
retfie
I had it all working using Timer0 but could not make this overflow slow enough for my needs, basically I have just changed the init section to timer1 and the bit which is reset in the ISR, but now I get nothing.
Thought I had something when searching and found the PEIE bit needs to be set, so I did that and still nothing.
Any ideas?