Hello,
I am facing to the strange problem. I have the following program:
'interrupt for timer
OPTION_REG = $d5
INTCON = $a0 'enable TMR0 interrupts and global interrupt
PIE1 = 0
On Interrupt Goto intManagement
enable
while 1
if (PIR1.5==1) then
HSERIN 50, main, [wait ("GET /"), STR COMMAND\96\$2F]
GOSUB waitFiveSec
HSEROUT["Hello"]
endif
WEND
end
disable
intManagement:
if (INTCON.2 == 1) then
ticks = ticks + 1 ' Count pieces of seconds
If ticks < 61 Then tiexit
toggle ACTIVITY_LED
ticks = 0 'One second elasped
second = second + 1
If second >= 60 Then
second = 0
minute = minute + 1
If minute >= 60 Then
minute = 0
hour = hour + 1
if (hour >= 24) then
hour = 0
day = day + 1
if (day >= 7) then
day = 0
endif
endif
ENDIF
endif
endif
tiexit:
INTCON.2 = 0
INTCON.7 = 1
resume
enable
waitFiveSec:
for i = 0 to 5000
pause 1
next i
return
The interrupt is working, my activity led is blinking. But if I will send to serial port this "GET /",
then the LED will stop blink for these 3 seconds. For me it seems, that if the main program will jump to sub, then, it waits for its end and then it calls the interrupt. It looks like, that the interrupt doesn't work in sub programs. Am I right?
Bookmarks