PDA

View Full Version : ON INTERRUPT problem



juszuf
- 29th December 2005, 16:40
Hi!

I'm using PIC18F4620 controller, and i would like to ask if i can call sub-routine from basic ISR routine (the lenght of the code is 40 KB). -is it possible?-
Please advise me, if you can! Thanks.
By: Toth Jozsi

Darrel Taylor
- 29th December 2005, 19:20
Hi juszuf,

That's the only good thing about "ON INTERRUPT"'s.

You can use any Basic statements inside an ISR, including GOSUB.
<br>

juszuf
- 2nd January 2006, 21:12
Thanks for your help, but i cannot use gosub, probably because i want to call another page, page15. Every time the program restarts or freezes. Do you think that it may be the poblem?

Darrel Taylor
- 2nd January 2006, 22:05
If you're trying to gosub to something in "Page 15", then it might be a problem. &nbsp; With the 18F processors, there aren't any Pages. Program Memory is just one big block of Flash. There is a BANK 15, but that's RAM.

If things are freezing, or restarting, it could be from a "Stack Over/Underflow", or Interrupt Loop.

Some things to check ...

Use DISABLE before, and ENABLE after the ISR. AND, any subroutines that you GOSUB to from the ISR.

The ISR must "RESUME", not RETURN.

Make sure you reset the Interrupt Flag(s) before resume-ing.

Never jump out of a Subroutine using GOTO, always RETURN



Here's some more Stack information from Bruce.
http://www.picbasic.co.uk/forum/showthread.php?p=2686
<br>

juszuf
- 10th January 2006, 15:17
I was able to fix the program, i did not use disable before ISR, so thanks a LOT for your advise!!!

Bye!