We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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.
Ok, but why not just a reset? I fail to see why you would want to power down. Let us know. Erik
In the interrrupt, i detect that the power must be stopped (in fact i detect that the 'on/off' button had been activated). So the microcontroleur must send a message to the board of the system that control the power. And this board will disconnect the batterie and the whole system will be powered off.(power off is the good expression, power down is not). A reset will just restart the microcontroleur, it is not what i want.
if the interrupt(s) required to execute the power off function are of a higher priority than the interrupt you are in, you can call power off from inside the interrupt you are in. If power off is called from the main as well you will need two copies or a NOAREG. Erik