Hi, I am back again with a problem. This time it looks like the interrupt is serviced but only once and code does not move forward. Can you please have a look at my code and advise me if I am doing it right ?
Code:
Define OSC 4 ' OSCCON defaults to 4MHz on reset
INCLUDE "DT_INTS-14.bas" ; Base Interrupt System
INCLUDE "ReEnterPBP.bas" ; Include if using PBP interrupts
Include "modedefs.bas"
@ __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _CP_ON & _BOD_ON & _CPD_ON & _IESO_OFF & _FCMEN_ON & _WUREN_OFF
' Pin Definations are here
ToTx var GPIO.2
ToRx var GPIO.3
Monitor var GPIO.4
T1CON=49
main:
' Initialize the processor
TRISIO = %011000
CMCON0 = 7
GPIO=0
OPTION_REG = %00000111
WDA.4=1 : WPUDA.4=1
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler TMR1_INT, _Setval, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM
start0:
gpio.0=1 ' LED1
start:
gpio.1=1 ' LED 2
@ INT_ENABLE TMR1_INT
Serin ToRx, N2400,["pp3"],code
@ INT_DISABLE TMR1_INT
if code=0 then goto start0
' ELSE CHECK OTHER VALUES FOR THE RECEIVED CODE
goto start0
Setval:
code=0
gpio.0=0 : pause 200
@ INT_RETURN
When power is applied this is what happens:
1) Both LED1 & LED2 glow
2) LED 1 (gpio.0) goes off
and system stays like this though LED should turn ON after 200mS. Please help me know what am I doing wrong?
Bookmarks