Jyothi@Pic
New Member
hi
can some one tell me how to use watch dog timer in PIC16F877A
can some one tell me how to use watch dog timer in PIC16F877A
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Ony 42 posts and you are already a cynicOK, sorry, I just did, happy?
Hi,
I want to know that when watch dog timer is used in PIC16F877A on reset the control goes to 0000th location and starts executing from that location reseting all the variables. If the code gets hang up then I want the control to get back to previous location executed without damaging the variables stroed in RAM location. I dont want the control to start from 0000th location.
I want to know if this is possible, kindly reply.
#chip 16f690,8
#config Osc=INTRC_OSC_NOCLKOUT
#define LED1 PortC.0
dir LED1 out
;Set max prescaler 1:65536 WDTCON = b'10110'
;Set shared TMR0 Prescaler to 128 and assign
;to the wdt here OPTION_REG = b'xxxx1111'
;This gives a wdt of 268 sec
OPTION_REG = OPTION_REG OR b'00001111'
WDTCON = b'10010' ;try for 67 sec
Main:
Set LED1 ON
wait 1 s
Set LED1 Off
SWDTEN = 1 ;turn on WDTCON,0 bit on
asm sleep
nop ;sleep executes the next instruction
SWDTEN = 0
goto main
reply immediately
Haven't seen that one before, have to give that person credit for originality... hehe, it's usually 'someone help me plzzzzzz'. It's YAMA time again (yet another missed assignment).reply immediately
LOL really
In the way Nigel suggests, the WDT can be used as a crude timer, and not resort back to ORG 0. Like put Pic to sleep wait for X period of time, then do something, and go back to sleep. You could keep track of much longer periods of time by inserting a counter where the NOP is, and keeping track of that.
Well now, there is something practical, very nice.My particular application was intended to wake up and transmit an IR code at specific intervals - with no great accuracy required. I used a DIL switch on one of the ports, and that was used to set the number of WDT wakeups required before the code was transmitted. I think maximum time is about 2.5 seconds, so I could set it from 2.5 seconds to 40 seconds with a 4 pin switch.
Hehehe. "You have 30 seconds to comply."reply immediately