Was just thinking about this idea some more - couldn't this be used to calibrate PBP's 'SLEEP' and 'NAP' commands?
Arch
Was just thinking about this idea some more - couldn't this be used to calibrate PBP's 'SLEEP' and 'NAP' commands?
Arch
"Data sheets? I ain't got no data sheets. I don't need no data sheets. I don't have to read any stinking data sheets!"
Also see Melanie's post on getting the WDT to timeout even without the Define set.
http://www.picbasic.co.uk/forum/show...ight=no_clrwdtCode:@ goto $
I have not read the AN (yet) and am therfore not sure if this is helpful. It sounds like you could do some stuff in your program and then sit in a tight loop and count time outs ...
Paul Borgmeier
Salt Lake City, Utah.
USA
I'm still trying to figure out how to get this to work. I think undersand the concept of the Microchip AN, but I am having a little difficulty implementing it.
This is my understanding, basically you have two timers WDT and TMR0. TMR is based on a temperature compensated crystal (in my case a temperature compensated INTOSC) and WDT is based on a non temperature compensated RC.
A prescaler in the code is setup so that timer TMR0 rolls over multiple times before the WDT rolls over. By counting the number of times TMR0 rolls over in a WDT period an inference on the temperature can be made.
The confusion I am having is how to setup the WDT correctly. How do I setup the WDT up so that it rolls over without reseting the pic, and how do I tell that the WDT rollover has occured. Since it may matter I am using a 12F675 for this project. I assume I set the pic fuse to not use the WDT to reset the pic, but I am not sure how to use it in my code.
I think I am missing one minor piece and I will be able to get this to work.
Thanks for any help
I'm not experienced in assembly, but it looks like the idea in the app note is that you WANT the WDT to cause a PIC reset. Once the PIC is reset by a WDT timeout, you then check to see if the WDT timeout caused the PIC to reset, or if some other condition caused a reset. There are several flags that will tell you whether a PIC has just powered up, or has reset due to various other conditions - one of them being a WDT timeout. See "STATUS" and "PCON" registers in the device data sheet.Originally Posted by modifyit
You'll need to set the WDT ON in the config fuse.
Arch
Last edited by Archilochus; - 20th June 2006 at 01:54.
"Data sheets? I ain't got no data sheets. I don't need no data sheets. I don't have to read any stinking data sheets!"
If I am counting the number of times the TMR0 rolls over before a WDT reset, wouldn't I have to use eeprom to save this count variable? It does not seem that this is the intent of the AN to me, so I wonder if there is a way to watch when the WDT rolls over without having it reset the pic.
Bookmarks