'(Fwd) Re: PIC16C54 RC vs. XT'
crocontroller discussion list
|Tried to post this earlier, but it didn't get through, I don't think:
Has anyone thought of using the WDT? Just check the flag bits at the
beginning of your program, and you can tell if you're starting from
scratch (better init everything) or just waking up from the WDT.
You can set the WDT prescaler to the interval you want, then do your
loop stuff, and go to sleep. The WDT will wake you up. You just have
to structure your program to branch to the loop entry from the
beginning if it's a WDT entry...
That is, if you're not already planning to use the WDT for the obvious...
Someone give me a sanity check on this... I may use it in an upcoming
John R. Haggis outside mail, please respond to:
IBM Almaden Research Center netcom.comhaggis
927-2474 / ZZHAGGIS AT ALMADEN
--------- Forwarded Message Follows ---------
"My plan is to assign the prescaler to the RTCC and spin waiting for
it to equal zero."
That works; my usual technique is to set the RTCC to a negative number
and bit-test the MSB. Remember to account for the delay between
initializing the RTCC and when it begins to increment.
Paul Milazzo <bbn.com> milazzo
BBN Systems and Technologies
crocontroller discussion list
> Has anyone thought of using the WDT? Just check the flag bits at the
> beginning of your program, and you can tell if you're starting from
> scratch (better init everything) or just waking up from the WDT.
> You can set the WDT prescaler to the interval you want, then do your
> loop stuff, and go to sleep. The WDT will wake you up. You just have
> to structure your program to branch to the loop entry from the
> beginning if it's a WDT entry...
> That is, if you're not already planning to use the WDT for the obvious...
> Someone give me a sanity check on this... I may use it in an upcoming
> - JohnR
The only problem I see here is that the WDT is a free running on-chip
RC oscillator. To quote the DataBook for the PIC16C71:
The WDT has a nominal time-out period of 18 ms, (with
no prescaler). The time-out periods vary with
temperature, VDD and process variations from part to
part (see DC specs).
So you see, if you want accurate timing, the use of the RTCC is required
since it works off of the crystal controlled oscillator. If you put the
part to sleep, the crystal oscillator stops and you cannot really get
very accurate timing.
When I built a recording accelerometer using the 16C71, I used the RTCC
with prescaler, checked for zero in the RTCC in a tight loop, On RTCC=0
I sampled, did a little averaging processing, saved the sample to memory
via serial routine to EEPROM, then entered my loop. I figured out ahead
of time that by the time I finished my routines, the RTCC was no longer
at zero so I was not worried about entering the loop and immediately
jumping out again. Also, with the prescaler set to at least 4, you will
not miss the RTCC=0 point. I chose not to use the RTCC interrupt
because I didn't need to do anything else until the time for the next
sample rolled around. Your milage may vary of course.
Jerry Ethridge Richardson, Tx. |
ERICSSON NETWORK SYSTEMS /O\
exu.ericsson.se \_______[|(.)|]_______/ exujet
o ++ O ++ o
More... (looser matching)
- Last day of these posts
- In 1994
, 1995 only
- New search...