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

How can I reset the Program counter ?

I want to restart the program counter at 0x0000 when leaving a function, I already try the following solutions, but the compiler always returns me a syntax error :
code void (*pReset) (void) = 0x00;
extern code void (*pReset) (void) = 0x00;

Parents
  • The statement

    ((int( code * )( void ) ) 0x0000 ) ();
    

    forces the compiler to generate "LCALL 0000H". Note that a call or jump to address 0000H does not reset any of the SFR's. This is different to a hardware reset. Hardware reset forces SFR's to their documented values (mostly 0x00).

    HHK

Reply
  • The statement

    ((int( code * )( void ) ) 0x0000 ) ();
    

    forces the compiler to generate "LCALL 0000H". Note that a call or jump to address 0000H does not reset any of the SFR's. This is different to a hardware reset. Hardware reset forces SFR's to their documented values (mostly 0x00).

    HHK

Children