No exact or substring matches. trying for part
PICList
Thread
'[PICLIST] [pic] need help about WDT and TMR0'
2001\02\23@121001
by
Kim, Jinhong
|
Hello, everyone.
I am confusing about using WDT with TMR0 under the 4MHz OSC in PIC16F877
I set the TMR0 as like followings
PSA=0( assign prescaler to TMR0)
PS0=1, PS1=1,PS2=0 ( set prescaler 1:128) => so increment TMR0 every 64th
instruction cycle
TOCS=0
TMR0=0 (Clear TMR0 initially)
By this setting I get the interrupt by TMR0 every 32.768ms <===
{(256*prescaler)/Frequency/4)}=(256*128)/(4MHz/4)
but there were some conflict because I also need to add WDT for any
unexpected crash... WDT should be bigger than my Interrupt service time so
that It can't reset PIC during the interrupt service routine.
but from my setting, I will get WDT time-out every 256us which is not what I
want. How can I get bigger WDT time-out period value (like 1min or bigger)?
I saw a sample assembly code at the Microchip website( DS33023: Mid-range
MCU Family Reference Manual) about changing prescaler between TMR0 and WDT.
but not sure this is what I need and if it is how can I apply this to my
code.
I need this TMR0 as a time critical interrupt handling. my interrupt routine
needs to get values from 4 channel(RA5,RE0,RE1,RE2) through ADC and send
those values to SPI bus less than every 40ms.( isn't this quite heavy to be
exercuted in 32.768ms?)
any advice?
thanks for your time regarding this.....
from Kim
--
http://www.piclist.com hint: The PICList is archived three different
ways. See http://www.piclist.com/#archives for details.
2001\02\23@123703
by
Fred Bailey
While you are waiting for the TMR0 to time-out your code is doing something
else. Usually there is a repeating loop of some sort. In this loop you should
place a CLRWDT. This instruction resets the WDT so it never times out.
Best regards,
Fred
--
http://www.piclist.com hint: The PICList is archived three different
ways. See http://www.piclist.com/#archives for details.
2001\02\23@125408
by
Alan B. Pearce
>I need this TMR0 as a time critical interrupt handling. my interrupt routine
>needs to get values from 4 channel(RA5,RE0,RE1,RE2) through ADC and send
I have not used the WDT, but this is my recollection of posts on this list.
If you are really time critical in getting these values you will not be wanting
to use the WDT, as it takes time for the PIC to wake up, as in several thousand
oscillator cycles.
Hence you should disable the WDT in the configuration fuses.
--
http://www.piclist.com hint: The PICList is archived three different
ways. See http://www.piclist.com/#archives for details.
2001\02\23@130837
by
Kim, Jinhong
Well, that is really what I want. just making WDT disable...but what if my
PIC has a unepected crash?
all that I need from Watch dog is just preventing unexpected crash.
I just thought every micro has to have something like WDT for the case of
crash...
thank you for your advice..
{Original Message removed}
2001\02\23@131520
by
Alan B. Pearce
>Well, that is really what I want. just making WDT disable...but what if my
>PIC has a unepected crash?
>all that I need from Watch dog is just preventing unexpected crash.
>I just thought every micro has to have something like WDT for the case of
>crash...
You could have a CMOS 555 timer that you periodically reset from a pin. This
could then pull the reset line when it timed out.
--
http://www.piclist.com hint: The PICList is archived three different
ways. See http://www.piclist.com/#archives for details.
More... (looser matching)
- Last day of these posts
- In 2001
, 2002 only
- Today
- New search...