Mehmet Fide

HCS08C: Software watchdog and detecting last routine

Discussion created by Mehmet Fide on Mar 24, 2008
Latest reply on Mar 28, 2008 by CompilerGuru
Hi,
 
I'm using software watchdog method and internal COP unit.
I want to detect when the reset was occured (which line of my main routine) without using BDM.
I'm not sure this is possible for COP but I thing it is possible for software watchdog.
 
 
Code:
void main(void){  ..  ..  while(1) // main loop  {    SOFTWARE_WATCHDOG = 0; // clear soft watchdog    func1();    func2();    func3();    func4();    func5();  }}interrupt VectorNumber_Vtpm1ovf void intTPM1OVF(void){  TPM1SC_TOF = 0;   // software watchdog for 5sec  if(++SOFTWARE_WATCHDOG > 200) asm("dcb 0x8D"); // illegal opcode  ...}

Can I save interrupt return address to a register before executing illegal opcode? How can I obtain this address in interrupt routine?
 
Is there any way to detect similar address that COP reset was occured?
 
Thanks,
BP.
 

Outcomes