Seeking Tips Converting from INTERRUPT to INTERRUPT NOPRESERVE
I apologize if this is repeated in the forum (it's not coming back with any hits for INTERRUPT NOPRESERVE).
I'm needing to shave off a few cycles in my interrupt.
I'm trying to do some code optimization, but am tempted to use the NOPRESERVE feature.
·
I currently have some SX/B in the interrupt with some nested ·if..then.else statements that uses the __PARAM1 variable, like the following...
·And note that the asm code show it push and popping the parms before and after the interrupt code.
Other than code optimization, upping the clock, and doubling the interrupt period/reducing the sampling rate of my interrupt, which may not work in my application, what would the 'pro' approach be in reducing the 'stack', and the interrupt clocks using INTERRUPT NOPRESERVE?·
Would it be to introduce·different global·variables to replace _PARAM1, or would it be to only preserve the variables the interrupt really needs to reuse ? e.g.·__INTPARAMFSR,·__PARAM1 in this case?
Many thanks!
Rodney
Post Edited (Yendor) : 8/4/2008 9:07:29 PM GMT
I'm needing to shave off a few cycles in my interrupt.
I'm trying to do some code optimization, but am tempted to use the NOPRESERVE feature.
·
I currently have some SX/B in the interrupt with some nested ·if..then.else statements that uses the __PARAM1 variable, like the following...
MOV FSR,MyVal ; IF MyVal = 1 THEN MOV __PARAM1,IND BANK $00 CJNE __PARAM1,#1,@i__ELSE_2 ;...etc
·And note that the asm code show it push and popping the parms before and after the interrupt code.
; save/preserve param1 and param2 MOV FSR,#__INTPARAMFSR MOV IND,M INC FSR MOV IND,__PARAM1 INC FSR MOV IND,__PARAM2 ;...__PARAM3...etc. 'interrupt code ;pop stack
Other than code optimization, upping the clock, and doubling the interrupt period/reducing the sampling rate of my interrupt, which may not work in my application, what would the 'pro' approach be in reducing the 'stack', and the interrupt clocks using INTERRUPT NOPRESERVE?·
Would it be to introduce·different global·variables to replace _PARAM1, or would it be to only preserve the variables the interrupt really needs to reuse ? e.g.·__INTPARAMFSR,·__PARAM1 in this case?
Many thanks!
Rodney
Post Edited (Yendor) : 8/4/2008 9:07:29 PM GMT
Comments
Set your ISR to NOPRESERVE and then use this at the beginning of the ISR:
And this right before the RETURNINT: