mrcube_ns said:Watchdog reset mcu like when you put reset pin down to Vss, and up to Vdd.
1. So your registers will be reseted to default value.
2. No it is not possible.
Regards!
Mr.Cube
PaulHolland said:Hi, Registers will be the same as before the reset !!!!!. No matter what people tell you !. All RAM will remain the same too !.
You can't return to the old position but you can use a WDT reset to leave sleep mode (sleep instruction) if you want and then you always know where you were !.
PaulHolland said:Hi, Maybe I do not understand what you want or expect from the watchdog timer but the watchdog timer is used to prevent your code from ending-up in an endless loop. So normally you use a watchdog timer to reset your system if the code is hanging in an endless loop due to wrong input of a crash due to power supply or clock failure.
You can also use a watchdog timer to do something for you, wake you up, or other things when you are a sleep or want to execute some code some times a second or even a few times a minute.
What you want ?. Its not clear to me..
johnyaya said:I don't use the PIC micros, but I'm curious about the register preservation that PaulHolland mentioned. If all registers are preserved through the watchdog reset does this include the stack pointer as well? If so, then one could recover their previous location, either subroutine level or pre-planned location, from the watchdog reset by utilizing the stack pointer. Yes?
PaulHolland said:If your using a watchdog timer and timer 0 or any other interrupt source I would not clear the WDT during the interrupt (so also during TIMER0). Only call and clear your WDT during your main loop and set the WDT so that it can always clear your WDT again within the time.
Normally your code has some endless loop, performing all kind of tasks and checking all kind of things, only clear WDT during this loop !!.
PaulHolland said:Which PIC are you using ??.. What language ?. C or ASM ??.
WDT is handled automatically for you by PBP in background - you don't have to do anything. If you look at the Assembler listing of any of your compiled programs, you will see a liberal sprinkling of CLRWDT instructions throughout. PBP puts them there to keep resetting the WDT so you don't have to.
The Pause instruction compiles to have a CLRWDT within it, otherwise something like Pause 10000 would cause the WDT to restart the PIC.
You would have to try real hard to get the WDT to crash a PBP program through normal code execution...
You can add the following define to stop PBP from automatically resetting the WDT (see PICBasic Pro Manual under CLEARWDT command)...
DEFINE NO_CLRWDT 1
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?