Technical Support

C51: SAVING EXTRA VARIABLES ON THE STACK

Information in this article applies to:

  • C51 Version 5.50

QUESTION

I want to push extra variables onto the stack in an interrupt service routine (in addition to what the compiler has already saved). How can I do that?

ANSWER

Probably the best way to save additional data on the stack in an interrupt service routine is:

  1. Include in-line assembly code in the ISR to push and pop the variables.
  2. Generate an assembly file for the C file. Use the #pragma SRC directive for that. Then, directly modife the SRC file, assemble it, and include it in the linker command line.

Last Reviewed: Saturday, July 09, 2005


Did this article provide the answer you needed?
 
Yes
No
Not Sure