This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Interrupt entry and exit routines

I would like to change the order that some of the registers are stored on the stack when an interrupt occurs. Ideally I would like to store the IE register first.
Does anyone know if it is possible to stop the C51 compiler from pushing and poping registers from the stack automatically in an interrupt routine, so that I can do this manually, in the order I would like?

Parents
  • Why would you want to push/pop IE anyway?
    Well, since I do it I'll tell you why

    OLD
    local U8 saveIE;
    
    SaveIE = IE;
    EA = FALSE;
    ....
    IE = save IE;
    
    NEW:
    Push(IE);
    EA = FALSE;
    ....
    Pop(IE);
    

    Old requires one byte of storeage per ISR, New require one byte per priority level.

    In addition, you have the same problem with things like Cygnal F12x SFRPAGE and other stuff.

    Erik

Reply
  • Why would you want to push/pop IE anyway?
    Well, since I do it I'll tell you why

    OLD
    local U8 saveIE;
    
    SaveIE = IE;
    EA = FALSE;
    ....
    IE = save IE;
    
    NEW:
    Push(IE);
    EA = FALSE;
    ....
    Pop(IE);
    

    Old requires one byte of storeage per ISR, New require one byte per priority level.

    In addition, you have the same problem with things like Cygnal F12x SFRPAGE and other stuff.

    Erik

Children
No data