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

Software reset C51 from interrupt routines

You can use the void pointer function sample in simple programs but if you want to use software reset in interrupt routines you can act like this:
by calling the int. routine and coming up your condition it will jump to 0x0000
Also the "addr" is unsigned char and SP set as compiler defaults.

void t0_service(void) interrupt 1 using 3 {
addr=SP;

/*        Your Code */

PSW=0;
if( /*your condition to jump 0x0000*/ ){
*(unsigned char *)(addr)=0;
*(unsigned char *)(addr-1)=0;
*(unsigned char *)(addr-2)=0;
*(unsigned char *)(addr-3)=0;
*(unsigned char *)(addr-4)=0;
*(unsigned char *)(addr-5)=0;
*(unsigned char *)(addr-6)=0;
*(unsigned char *)(addr-7)=0;
return;
}
}

0