Hello,
I working on microcontroller project. I want to use Watchdog Timer. I have a basic Question on it, which is
Independent of particular controller. If i am enabling the watchdog Timer. I have to clear the Counter of Watchdog after some instruction in order to avoid the Warm Reset by Watchdog Timer.
Q1) If the maximum count of Watchdog is 2 sec, then what should i do in the situation of below Code,
for(I=0, I<20, I++)
{
//Piece of Code which will take more than 2 Sec.
}
Q2) In multithreading, for simple example If I am having two thread, Each Thread will Switch in 500ms.
Thread 1:
while(1)
{
if(Cond)
{
instruction 1
}
//Clear WDT Counter
if(Cond)
{
instruction 1
}
while(wait for Cond);
//Clear WDT Counter
}
Thread 2:
while(1)
{
if(Cond)
{
instruction 1
}
//Clear WDT Counter
if(Cond)
{
instruction 1
}
//Clear WDT Counter
}
In thread 1, there is a while condition which will wait for some Condition. My aim to reset the Controller, if that Condition is not meeting for 2 sec. But when Context Switch is happen, other thread will Clear the Counter. How this Condition can be manage.
I working on microcontroller project. I want to use Watchdog Timer. I have a basic Question on it, which is
Independent of particular controller. If i am enabling the watchdog Timer. I have to clear the Counter of Watchdog after some instruction in order to avoid the Warm Reset by Watchdog Timer.
Q1) If the maximum count of Watchdog is 2 sec, then what should i do in the situation of below Code,
for(I=0, I<20, I++)
{
//Piece of Code which will take more than 2 Sec.
}
Q2) In multithreading, for simple example If I am having two thread, Each Thread will Switch in 500ms.
Thread 1:
while(1)
{
if(Cond)
{
instruction 1
}
//Clear WDT Counter
if(Cond)
{
instruction 1
}
while(wait for Cond);
//Clear WDT Counter
}
Thread 2:
while(1)
{
if(Cond)
{
instruction 1
}
//Clear WDT Counter
if(Cond)
{
instruction 1
}
//Clear WDT Counter
}
In thread 1, there is a while condition which will wait for some Condition. My aim to reset the Controller, if that Condition is not meeting for 2 sec. But when Context Switch is happen, other thread will Clear the Counter. How this Condition can be manage.