我找到很好的软件复位办法了,而且调试通过,这个办法对于S12,S08都适用。
采用看门狗的方法:
interrupt 2 void COP(void){
PORTB = 0x01;
asm jmp _Startup;
}
//=============================================================================
#pragma CODE_SEG DEFAULT
//======================== Force to Reset =====================================
void ForceReset(void){
COPCTL = 0x07; // Turn on watchdog
ARMCOP = 0x00; // Write Incorrect value => Force Reset
}
我实验过了没问题的,很好用。 |