edofbrighton
Member
Hello,
I'm trying to work out how to user the timer1 module for a project, but have so far been unsuccesful. Can anybody point out where i'm going wrong. The code does go to the interupt handler, but the delay is shorter than i was expecting and it only seems to work with the internal oscillator. Ideally i need to use an external one because my application requires a reasonably accurate clock. Here's what I've got so far. My knowledge of interputs is poor so any explaination would be very helpful.
Thanks in advance.
I'm trying to work out how to user the timer1 module for a project, but have so far been unsuccesful. Can anybody point out where i'm going wrong. The code does go to the interupt handler, but the delay is shorter than i was expecting and it only seems to work with the internal oscillator. Ideally i need to use an external one because my application requires a reasonably accurate clock. Here's what I've got so far. My knowledge of interputs is poor so any explaination would be very helpful.
Thanks in advance.
Code:
ISR:
bcf INTCON,T0IF
movwf W_Save
movf STATUS,w
movwf STATUS_Save
INCF NUMBER_OF_BREATHS
BTFSC NUMBER_OF_BREATHS,7
CALL LETTER
BTFSC NUMBER_OF_BREATHS,7
clrf NUMBER_OF_BREATHS
movf STATUS_Save,w
movwf STATUS
swapf W_Save,f
swapf W_Save,w
retfie
INTERRUPTTEST:
bsf STATUS,RP0
bsf PIE1,0
bcf STATUS,RP0
bsf INTCON,7
BSF INTCON,PEIE
CLRF TMR1L
CLRF TMR1H
MOVLW B'00110001'
MOVWF T1CON
man:
nop
nop
nop
goto man
Code: