Hi,
It's not just get in get out, I'm afraid.
PBP has a bunch of internal system variables that it uses for its needs. If you use DT-INTS and declare the handler as an ASM type handler DT-INTS doesn't save those internal system variables before entering the ISR beacuse you told it the ISR is written in ASM. (Which doesn't use PBP's system variables). But in this case the handler IS written in PBP even though it's declared as ASM type so you need to be very careful.
It means that if that main program is in the middle of a calculation (or HSEROUT or a anything) that happens to use one or more of the system variables when the interrupt occurs AND the code in the handler ALSO need to use these variables you're pretty much screwed.
I've only looked at this briefly but this particular handler...
Code:
sine:
TMR1L = timerone.byte0
TMR1H = timerone.byte1
CCPR1L = sineval[STEPCOUNT]>>1
stepcount = stepcount -1
if stepcount = 0 then stepcount = 32
toggle PortB.4
@ INT_RETURN
...seems to use system variable T1 so IF your main code happens to use a PBP statement that also needs T1 it's going to be a mess.
Now, your main code (at least the one you posted) is a simple Pause and Goto and it does not seem to use T1 so you get away with it. Once you add code to the main routine that needs T1 it'll start acting up.
It is possible to do what is being done here by carefully examining the generated code for the interrupt handler to determine which PBP system variables it uses and then save and restore only those variables.
I hope that makes SOME sense.
/Henrik.
Bookmarks