DT_INTS-14    (kudos)


October 05, 2002 was a good day.   Because that's the day that Tim Box released his "INT_CTRL.pbp" program.   The original "Instant Interrupts"

Tim had discovered that the only reason you couldn't use Basic statements in a normal interrupt, was because the PBP system variables currently being used by the statement that got interrupted, would be overwritten by the Basic statements in the interrupt routine.   And that, all you have to do is save the state of the system vars at the start of the interrupt, and restore them back to the way they were before exiting the interrupt and you can use any Basic statements you want.

I've probably said it too many times already but ... Thanks again Tim!


ReEnterPBP.bas is an adaptation of the same concept, but it allows the Interrupt system to determine if it needs to save the variables or not.

For instance, if you have a program with both ASM and PBP interrupt handlers, and an interrupt triggers an ASM handler, there's no need to save the variables first, it would just be waisting valuable time. And if more than 1 Basic handler is triggered at the same time, it only saves the variables once, and processes all the Interrupts on the same pass, before restoring the system vars, again saving time.

However, it does still take a lot of time to save all those variables. Usually it takes around 70 instruction cycles to save the vars. Then another 70 cycles to restore them again. At 4mhz it's 140us total save and restore time, which limits the maximum interrupt frequency to just over 7khz. At 20mhz OSC, you can go up to almost 36khz. That's fast enough to receive RS232 at over 250Kbaud with the USART.   But is still considerably slower than you can get with ASM interrupts.