In some cases, a computer may employ both types of watchdogs. Other watchdogs are automatically enabled upon system boot and cannot be disabled at all these are typically used to detect and recover from boot faults. Some watchdogs can be enabled and disabled by software, making it possible for a program to enable the watchdog only when its services are needed. If a fault condition prevents the program from kicking the timer, then the watchdog will timeout and initiate corrective action. During normal operation, the application program regularly kicks the timer to keep it from reaching zero, typically as part of a control loop. The watchdog is kicked by momentarily asserting its restart input (usually by writing to a watchdog control register). The timeout signal is connected to external circuitry so that it can initiate corrective action.Ī program can restart the timer at any time by loading the initial value into the counter this is commonly called “kicking” the watchdog. The watchdog will “timeout” when the counter reaches zero, causing it to assert its timeout signal and halt counting. Typically the counter counts down from the initial value to zero, and the initial value is programmable so that the program can configure how long it takes to count to zero. ![]() In general, a watchdog timer (or just “watchdog”) consists of a digital counter that counts from an initial value to a terminal value at a rate determined by a fixed-frequency clock. Watchdog timers consists of a digital counter that counts from an initial value to a terminal value at a rate determined by a fixed-frequency clock. Watchdog timers are widely used in embedded and remote systems, in equipment ranging from microwave ovens to Mars rovers. Also, a watchdog timer can respond to faults more quickly than a human operator, making it invaluable in cases where a human operator would be too slow to react to a fault condition. This can be as simple as restarting the computer, as if a human operator has pressed the computer’s reset pushbutton, or it may involve a sequence of actions that ultimately ends with a computer restart. After setting the outputs to safe levels, the next order of business is to restore normal system operation. This is a high priority action that must occur as soon as a fault is detected. First, it must set the computer’s control outputs to safe levels so that potentially dangerous devices such as motors and heaters will not pose threats to people or equipment. It is an essential component of systems that are difficult or impossible to physically access because it provides a way to automatically recover from transient faults.Įvery watchdog timer, however simple or sophisticated, must initiate two corrective actions. _timer.Stop() //if AutoReset was not falseĮdit: If you like to watch the timer and if the operation takes longer time then you should not use timer in the first place, instead use wrap your operation in a new thread and use MaunalResetEvent, use its WaitOne method to specify the timeout, if the timeout occurs then stop or about the operation.By Jim Lamberson, Embedded Measurement and Control, Solutions DeveloperĪ watchdog timer is an electronic circuit that initiates corrective action in response to a computer hardware malfunction or program error. Private void OnTimerElapced(object sender, e) ![]() ![]() ![]() Private volatile bool _requestStop = false Here is the pattern that I use: private _timer = new () Use the and set the its AutoReset to false, and only start it when the previous elapsed finished or at your custom condition.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |