I can generate a software reset by the following code: ((void (code *) (void)) 0x0000) (); After the reset, however, my application no longer responds to my interrupts. How can I reinizialize all my interrupts in C? Any help would be appreciated. Thanks.
I can generate a software reset by the following code: ((void (code *) (void)) 0x0000) (); everybody and his brother "can generate a software reset by the following code" very few can make it work. To make it work by this method, you must meticuously restore the reset value of each and every SFR at the beginning of startup/a51. The ONE safe and easy method is to let the watchdog time out. Erik
"I can generate a software reset by the following code: ((void (code *) (void)) 0x0000) (); After the reset, however, my application no longer responds to my interrupts. How can I reinizialize all my interrupts in C?" My guess is that you are making that call from within an interrupt service routine so the interrupt hardware is never being reset by a RETI.
My guess is that you are making that call from within an interrupt service routine so the interrupt hardware is never being reset by a RETI. Excellent guess. I do belive even the right one. To recover the interrupt status, you must pad the stack and execute a reti. Somethimes you need to do it more than once. One derivative, I do not recall which, lock up if you do too many, but most can handle you doing it for, say, 3 times without locking up. Use the watchdog, it WORKS ALWAYS. Erik
Thnaks for all the help. I was using the watchdog before but thought there might be a more "elegant" way of doing it.
I was using the watchdog before but thought there might be a more "elegant" way of doing it. HUH ? what could be better than while(1); // let the puppy bite to reset the processor or jmp $ ;let the puppy bite to reset the processor both use the hardware to generate a reset which is a hardware function. Erik