i saw 2 things
- You can't use Gosub in a interrupt handler
- I don't see that you re-enable the interrupts
And it should be only a part of your program 'cause i don't see any ON Interrupt goto statement.
i saw 2 things
- You can't use Gosub in a interrupt handler
- I don't see that you re-enable the interrupts
And it should be only a part of your program 'cause i don't see any ON Interrupt goto statement.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Thanks mister_e!
I will try to reprogram the interrupthandler without using GOSUB.
The on interrupt goto statement is written in a GOSUB init: funktion which is called befor the main: loop
'--------------------------------------------------------------------------
inter_default:
on interrupt goto inter
return
'--------------------------------------------------------------------------
The reenabeling of interrupt is done in this two funktions:
'--------------------------------------------------------------------------
int_ende: 'Interrupt Ende
z1_tmp=10
z2_tmp=10
z3_tmp=10
z4_tmp=10
resume main_ende
enable
'--------------------------------------------------------------------------
main_ende:
pause 10
goto main
No my interrupthandler is working without any GOSUB routine.
But the problem with having a variable counted up via a timer1 interrupt is still there.
???
by NVM
> You can't use Gosub in a interrupt handler
Not true.
You just got to watch how many Interrupts & Gosubs you've got pushed on the stack and not exceed the maximum allowed. The sum total in most cases must not exceed FOUR.
mmm interesting... it's different from what i already heard somewhere. I should test it one day.
Usually my interrupt handler are just short and mostely set Flag and variable wich are tested in the main program, then it react depending of them.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Try the TIMER (Buttons.bas) example I just posted under the SINGLE BUTTON FUNCTION thread or OLYMPIC TIMER, both contain a GOSUB within an ISR.
You have to treat an ISR as if it was a SUBROUTINE except you exit with a RESUME rather than a RETURN.
The only thing you have to remember is the TOTAL number of pushes made on the stack do not exceed the maximum allowed for your PIC.
Hello Melanie ,mister_e
Yes its possible to use GOSUB in the interrupt handler.
But i do not really understand the thing with "TOTAL number of pushes made on the stack" What exactly are pushes and how do they get stored on the controller?
I posted another thread because the controller is reseting every 20 to 30 interrupst i guess it could stick on overflowing stack?
by NVM
Bookmarks