Searching \ for '[PIC]: Monitoring internal clock?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/time.htm?key=clock
Search entire site for: 'Monitoring internal clock?'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Monitoring internal clock?'
2002\09\12@161617 by Tony Pan

picon face
The hardware has already been built and all ports are used.

I was hoping that I can somehow compare the TMR0 and the independent WDT to
know the TMR0 is off. Is there such a technique?





{Original Message removed}

2002\09\12@162834 by Jim

flavicon
face
Oh.

Do you need to correct for changes in the frequency on
the fly - or is this a one-time check for operation
within a certain freq range during manufacture and
test operations?

RF Jim


{Original Message removed}

2002\09\12@164125 by Tony Pan

picon face
I will run the check at powerup, if the clock is off, I reset the processor.
If it keeps being off, it would always be reset. I don't need to correct the
frequency. I simply don't run the software if the clock is off.

Is that possible?


{Original Message removed}

2002\09\12@165413 by Barry Gershenfeld

face picon face
>I was hoping that I can somehow compare the TMR0 and the independent WDT to
>know the TMR0 is off. Is there such a technique?

Yes but it usually tells you more about the WDT than it does about
the processor clock.   Specifically it will tell you what
the chip temperature is!

You'd have a bit of a chance if your "off-by" spec is rather
large.  Like looking for a broken crystal,  crystal oscillating
in an overtone mode, or the wrong parts installed in an RC
clock.  But no 1% error stuff.

Barry

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spam_OUTlistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


2002\09\12@170152 by

flavicon
face
How do you run any code at all, if the "clock is off" ?

Jan-Erik.

Tony Pan wrote:
I will run the check at powerup, if the clock is off, I reset the processor.
If it keeps being off, it would always be reset. I don't need to correct the
frequency. I simply don't run the software if the clock is off.

Is that possible?

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam@spam@mitvma.mit.edu with SET PICList DIGEST in the body


2002\09\12@181142 by Bob Barr

flavicon
face
On Thu, 12 Sep 2002 22:54:55 +0200, Jan-erik Söderholm (QAC)
wrote:

>How do you run any code at all, if the "clock is off" ?
>

I think he meant off-frequency and not turned off.


Regards, Bob

<snip>

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamKILLspammitvma.mit.edu with SET PICList DIGEST in the body


2002\09\12@182437 by Robert.Rolf

picon face
The WDT and the RC osc both have temperature dependancies.
Unfortunately the "hardware is already built" so you are rather
limited in what you can do. You need some sort of stable frequency or
time reference to accomplish what you want. Can you measure the
period of an incoming serial bit or some other 'known' time?

And why do you not just compensate for the clock being in error
by changing your TMRO value? There have been several threads here
on how to get really accurate time by compensating for xtal errors
in software.

If you could read a temperature sensor (one wire, thermistor, whatever)
you could use a look up table to correct the WDT (or RC) period.

Bob Barr wrote:
{Quote hidden}

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam.....mitvma.mit.edu with SET PICList DIGEST in the body


2002\09\13@075336 by Olin Lathrop

face picon face
> I will run the check at powerup, if the clock is off, I reset the
processor.
> If it keeps being off, it would always be reset. I don't need to correct
the
> frequency. I simply don't run the software if the clock is off.
>
> Is that possible?

The firmware can not tell how fast it's own clock is running without some
other timing reference.  The watchdog timer runs from an independent
internal R/C oscillator, and can therefore be used as a reference.  Of
course the accuracy of the answer is only as good as the accuracy of the
reference.  Other possible references include a separate timer 1 oscillator,
or an external R and C used as a single one-shot event timer.

Frankly, this whole thing sounds like a kludge to work around a bad design.
What overall problem are you trying to solve?  What tolerance do you need to
know your clock is within.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: To leave the PICList
EraseMEpiclist-unsubscribe-requestspam_OUTspamTakeThisOuTmitvma.mit.edu


2002\09\13@115324 by Tony Pan

picon face
> Frankly, this whole thing sounds like a kludge to work around a bad
design.

I agree.

> What overall problem are you trying to solve?  What tolerance do you need
to know your clock is within.

I want to have an accurate timer. If it's not accurate I rather let the
operation discontinued. The tolerance is 10%.


{Original Message removed}

2002\09\13@142049 by Olin Lathrop

face picon face
> I want to have an accurate timer. If it's not accurate I rather let the
> operation discontinued. The tolerance is 10%.

Ah, now we're finally getting somewhere.  So why not just use a crystal
oscillator or even a ceramic resonator and be done with it?  That will
easily guarantee you are within 10% unless an outright electrical
malfunction has occurred.  A malfunction that allows a crystal oscillator to
keep running but be more than 10% out of spec is extremely unlikely.  At
that kind of probability you would have to worry about many other more
likely malfunctions that could also cause your system to report the wrong
value.

So, again, what is the larger system?  It seems you've gone down a rathole.
You need to step back and define the problem from an overall system point of
view.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestspamspam_OUTmitvma.mit.edu


2002\09\13@171331 by M. Adam Davis

flavicon
face
From my brief overview you are limited by no extra pins, and it uses an
RC oscillator.

Your options, to get 10%, is to replace the resister and capacitor with
1% or better parts (prefereably parts which are not affected by
temperature by more than 1% for a total of 4% maximum out of range), or
remove them entirely, cut the extra osc trace (if it goes anywhere) and
add a surface mount resonator either directly to the traces (if space
and layout permits) or with the adition of one or more wires and a dab
of epoxy to fix it to the board.

In order to get the software to detect whether it's in range or not you
must have a steady reference to compare it to.  There's nothing in the
explanations you've made which could act as such a reference.  Perhaps
if you tell us what the PIC is connected to we could come up with a
system in software.  the PIC has nothing intrinsically which could act
as a reference, but you might be surprised at what types of already
attached hardware could be made into a reference.

Lastly, can you calibrate them before putting them to use?  If you
calibrate each device before use so you know the temp coefficient of the
RC oscillator and the temp coefficient of the WDT, you may be able to
solve the three variable equation which would give you temperature and
thus the speed of the RC oscillator.  Chances are the curves will be
quite close, though, so you may not be able to obtain any useful data,
especially considereing that the RC and WDT could easily be at slightly
different temperatures.

-Adam

Tony Pan wrote:

{Quote hidden}

>{Original Message removed}

2002\09\13@203102 by Jinx

face picon face
> I want to have an accurate timer. If it's not accurate I rather
> let the operation discontinued. The tolerance is 10%.

You can use WDT for this IF you can guarantee that the PIC will
stay within a certain temperature range. Assuming the WDT (using
full pre-scaler) times out at around 2.21 seconds at 20C, +/- 10%
will work between 2.43s (~ 35C) and 1.99s (~ 2C). However, you'd
need to test this for the actual PIC(s) you want to use. Repeatability
between batches isn't too bad IME but if you're going to use WDT
to shut-down the s/w it should be characterised before application

Even a cheap ceramic resonator runs very close to marked value
and 10% is a long way off. As Olin said, if you experience that sort
of drift there could be other things to worry about

--
http://www.piclist.com hint: To leave the PICList
@spam@piclist-unsubscribe-requestKILLspamspammitvma.mit.edu


2002\09\16@115126 by Roman Black

flavicon
face
Olin Lathrop wrote:
>
> > I want to have an accurate timer. If it's not accurate I rather let the
> > operation discontinued. The tolerance is 10%.
>
> Ah, now we're finally getting somewhere.  So why not just use a crystal
> oscillator or even a ceramic resonator and be done with it?


There is no reason an RC system has to be innacurate
if designed properly. We've had heaps of posts asking
about baudrates etc on a budget, so I think this could
be worth discussing.

The primary problems with the RC osc are PIC variations,
stray capacitance, and temp drift.

Here's the start of a simple strategy for getting
accurate baudrates etc from MINIMAL cost and sized
hardware. Please critique as needed. ;o)

What about a CHEAP external time constant system
that gives a highly stable baudrate for a few
cents in parts?

Once the RC time constant gets slow there are much lower
currents and the effect of the PIC discharge transistor
reduce in comparison to the RC circuit itself. The
difference in stability between a microscopic R/C/T on
the PIC die itself doing 4MHz and an external RC circuit
doing a few kHz at uA is enormous.

Here's the idea:
* PIC using internal RC osc at 4MHz
* external R/R/C controlling baudrate;
 * charges though R1, discharge through R2 into PIC pin
 * two dedicated PIC pins (same PIN count as a crystal)
 * charge/discharge time about 20:1
 * the short discharge time is fixed
 * low charge current
 * charge time controls baudrate

The temperature issue can be addressed by having
similar temp coefficients of R1 (charge) and C,
so time constant remains fairly stable.

Using the PIC schmitt input for "charged" detection
the reference is 0.8 Vdd. The 0.8 Vdd threshold
is from internal resistor ladder which will have
2 resistors of identical temp performance (hopefully).

Stray capacitance etc is no longer an issue using 20nF
cap instead of 20pF!!

Changes in Vdd won't affect charge rate when referenced
against the internal 0.8 Vdd resistor pair. The system
is voltage compensated like a 555 timer.

I'm sure the baudrate could be held stable within a
fraction of a percent using this system, although the
initial part variances still may present a problem.

Any thoughts? :o)
-Roman

--
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 2002 , 2003 only
- Today
- New search...