EmbeddedRelated.com
Forums

HCS12 Watchdog...Reset

Started by folg...@yahoo.com January 14, 2009
Hello,

I need for my programm a reset-function. I want to call a function ResetApplication(). Then I want to use the watchdog to reset the application.
I do not know how to use the watchdog exactly.
After the reset the programm should start at the beginning.

If the following code complete or have I to do something else. To reset I only have to start the watchdog!?

void ResetApplicatio(void)
{
COPCTL= 0x01;
}

Best regards

That'll work though you may want to prevent further processing while
waiting:

void ResetApplication( void)
{
asm("sei");
COPCTL=0x01;
while(1);
}

-rob
f...@yahoo.com wrote:
> Hello,
>
> I need for my programm a reset-function. I want to call a function
> ResetApplication( ). Then I want to use the watchdog to reset the
> application.
> I do not know how to use the watchdog exactly.
> After the reset the programm should start at the beginning.
>
> If the following code complete or have I to do something else. To reset
> I only have to start the watchdog!?
>
> void ResetApplicatio( void)
> {
> COPCTL= 0x01;
> }
>
> Best regards