Log in

View Full Version : DT inst. interrupt & Timer0 with pic 16F88



aratti
- 24th October 2009, 10:53
I am anable to compile without ERROR[113] Symbol not previously defined (T0IF) using timer0 interrupt.

Here the code:



INCLUDE "DT_INTS-14.bas" ; Base Interrupt System
INCLUDE "ReEnterPBP.bas" ; Include if using PBP interrupts

.
.
.
.

ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler RX_INT, _Getbytes, PBP, yes
INT_Handler TMR0_INT, _TM0Label, PBP, yes
;INT_Handler TMR1_INT, _TM1Label, PBP, yes

endm
INT_CREATE ; Creates the interrupt processor
ENDASM


@ INT_ENABLE RX_INT ; enable RX_INT interrupts
@ INT_ENABLE TMR0_INT
;@ INT_ENABLE TMR1_INT

.
.
.
.



If I comment out TMR0 interrupt then the code compiles correctly, this is the case also with TMR1 interrupt (good compiling) but not with TMR0.

Since, I cannot find out the reason for this error, I need help please.


Al.

Bruce
- 24th October 2009, 15:37
Open P16F88.INC in your MPLAB directory and look under the INTCON Bits section.



;----- INTCON Bits --------------------------------------------------------
GIE EQU H'0007'
PEIE EQU H'0006'
TMR0IE EQU H'0005'
INTE EQU H'0004'
RBIE EQU H'0003'
TMR0IF EQU H'0002'
INTF EQU H'0001'
RBIF EQU H'0000'

It's defined as TMR0IF. You can fix this with;


;----- INTCON Bits --------------------------------------------------------
GIE EQU H'0007'
PEIE EQU H'0006'
TMR0IE EQU H'0005'
INTE EQU H'0004'
RBIE EQU H'0003'
TMR0IF EQU H'0002'
T0IF EQU H'0002'
INTF EQU H'0001'
RBIF EQU H'0000'

Several of the newer 16F header files have it listed both ways.

aratti
- 24th October 2009, 15:46
Thank you Bruce, very kind of you. Simple thing if you know it!

Al.

aratti
- 24th October 2009, 16:29
Now my pic16F88.inc INTCON Bits section is as below, but not success in compiling. Still the same error# but changed definition. Now: "Symbol not priously defined (T0IE)"




;----- INTCON Bits --------------------------------------------------------
GIE EQU H'0007'
PEIE EQU H'0006'
TMR0IE EQU H'0005'
INTE EQU H'0004'
RBIE EQU H'0003'
TMR0IF EQU H'0002'
T0IF EQU H'0002'
INTF EQU H'0001'
RBIF EQU H'0000'


Still, commenting out TMR0_INT error disappear.

Al.

Bruce
- 25th October 2009, 15:32
Just add it & save it.


;----- INTCON Bits --------------------------------------------------------

GIE EQU H'0007'
PEIE EQU H'0006'
T0IE EQU H'0005' ; <---- same as below without the MR
TMR0IE EQU H'0005'
INTE EQU H'0004'
RBIE EQU H'0003'
T0IF EQU H'0002'
TMR0IF EQU H'0002'
INTF EQU H'0001'
RBIF EQU H'0000'

aratti
- 25th October 2009, 16:13
Thank you again Bruce, this additional line fixed the problem!

Al.

ronbowalker
- 17th December 2009, 21:23
Sorry for the late entry, but I have the same issue and I am not familiar with where the .inc file you guys are editing is located. Can you assist me?

I scanned my PC and found it. Made the change as recommended above, all errors were fixed. Thanks guys...