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

Modify the return from interrupt

Hello !

I have an interrupt like this :
void int_timer_0 (void) interrupt 1
{
... instructions ...
if ( condition ) {
// power down
}
... instructions ...
}

In the interrupt, i want to execute an C function 'power_down' (this function power down the product with an infinite loop ). But the interrupt (timer 0) must be call on the next timer overflows because it is used to transmit the power down information.
So, i want to put in the stack the address of the function to call and make a return from interrupt. I want to insert a code like this :
#pragma asm
push ??? ; power_down address (high)
push ??? ; power_down address (low)

reti
#pragma endasm
but i don't know the syntax for the address of 'C' fucntion.

Thanks

Benoit.

Parents
  • In the interrupt, i want to execute an C function 'power_down' (this function power down the product with an infinite loop ).
    Do you mean "power_down" or "reset"
    I can not use a flag and let the main process to do the power down, because the main porcess can be in some action that take 1 minites and i must power down as soon as possible.
    Why not just do an infinite loop in the ISR and let the watchdog do the reset?

    Erik

Reply
  • In the interrupt, i want to execute an C function 'power_down' (this function power down the product with an infinite loop ).
    Do you mean "power_down" or "reset"
    I can not use a flag and let the main process to do the power down, because the main porcess can be in some action that take 1 minites and i must power down as soon as possible.
    Why not just do an infinite loop in the ISR and let the watchdog do the reset?

    Erik

Children