Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

watchdog timer

Status
Not open for further replies.

amindzo

Member
Hi, in my program i have some loops that the program should stock in these loops until something happens, sometimes we have some errors from sensors and the program stock in these loops for a long time. can i use the watchdog timer to reset the program after a certain time? i use picbasic pro and pic16f873a.
 
Just enable WDT in the config reg and then set a pre-scale to suit your application... remember, to put a "clear watchdog" in your program somewhere when its working good to stop it resetting when there is no error.
 
should i enable WDT in that loop and then clear it? because i have a main loop that the program should work in it for a long time. i have two other loops that the program should work in them for maximum two minutes and if it stock in it the program should reset.
 
The problem we have here is the WDT times out much quicker than two minutes even with the largest prescale.. What you'll have to do is set up a local varable and count cycles with each increase of the cycle, kick the dog if you had to kick the dog "X" number of times then a reset is needed... That way you can monitor all loops independently.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top