PDA

View Full Version : Question on DT_Interrupts



financecatalyst
- 9th May 2010, 08:34
I use DT_INTERRUPT whenever I need to use interrupts. Having no knowledge of ASM, I find it much easier. I have always used it for 12F635. Recently I have tried to use DT_INT on 16F690 & 16F676 for one of my projects, but I failed to get results. I made sure I have right settings in DT_INT file and Re-Enter file.
1) FOR 16F690 I used
wsave var byte $70 ; in DT_INTS-14 file & none of the Temp (T1,T2,T3,T4) variables where commented out.
Few lines from the code are the following which are not working to begin with:



Include "modedefs.bas"
INCLUDE "DT_INTS-14.bas"
INCLUDE "ReEnterPBP.bas"
DEFINE OSC 4

@ __Config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON & _MCLRE_OFF & _BOR_ON & _CP_ON & _CPD_ON & _IESO_OFF & _FCMEN_ON
PAUSE 50
ANSEL=0
ANSELH=0
CM1CON0 = 0
CM2CON0 = 0

OPTION_REG=128
PORTB=0
PORTC = 0
PORTA = 0
TRISA = %001000
TRISC = 0
TRISB =0

ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler TMR1_INT, _CHECK, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM
T1CON=$E1
@ INT_ENABLE TMR1_INT
while 1
FOR W1=1 TO 10
TOGGLE PIN13
PAUSE 100
NEXT W1

FOR W1=1 TO 5
TOGGLE PIN13
PAUSE 1000
NEXT W1
wend

CHECK:
TOGGLE PIN11
@ INT_RETURN


PIC (690) does not responds to anything. When I use 676 then Pin11 on the PIC blinks couple of times and then stops and just glows continuesly along with pin13. Seems to me that wether DT_INTS are for selected PICs only or is there something I need to add/delete from the code to make it work on 676 & 690.
Has anyone else had issues with DT_INT for these PICs. I am looking forward to try them on 16F877A. Are there any known reliability issues with 877A?

Bruce
- 9th May 2010, 13:37
You have Timer1 configured to operate from the T1G gate input pin.

This works fine on the 690;


ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler TMR1_INT, _CHECK, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM
T1CON = %00110001

@ INT_ENABLE TMR1_INT

while 1
FOR W1=1 TO 10
TOGGLE PORTB.5
PAUSE 100
NEXT W1

FOR W1=1 TO 5
TOGGLE PORTB.5
PAUSE 1000
NEXT W1
wend

CHECK:
TOGGLE PORTB.6
@ INT_RETURN

financecatalyst
- 9th May 2010, 17:16
I will try it on 690 soon. Please answer on 16F676 as well.
Here is my code for 676:


Include "modedefs.bas"
INCLUDE "DT_INTS-14.bas"
INCLUDE "ReEnterPBP.bas"
DEFINE OCS 4
DEFINE OSC_1K 1

@ __Config _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _BODEN & _CP & _CPD

PAUSE 50
TRISA = %001000
TRISC = 0
PORTC = 0
PORTA = 0
CMCON = 7
ANSEL = 0
OPTION_REG=128

ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler TMR1_INT, _CHECK, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM
T1CON=%00010001
@ INT_ENABLE TMR1_INT

while 1
FOR code=1 TO 5
TOGGLE pin8
PAUSE 1000
NEXT code
wend

CHECK:
toggle pin7
i=i+1
if i=2 then
Portc=%000000
PORTC=0
i=0
endif
@ INT_RETURN

The led on Pin7 (in ISR) seems to be blinking at a constant rate BUT pin8 is erratic. Do I need to take care of any other setting as well? Thanks

Bruce
- 9th May 2010, 17:32
What is this? DEFINE OSC_1K 1

If you're trying to load the factory osccal value use DEFINE OSCCAL_1K 1.

Which physical pin is pin8 & where have you defined pin8?

If it's on PORTC, you're clearing this in your int handler (twice).