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

Truncated match.
PICList Thread
'PIC TIMER'
1998\04\23@140816 by Jawed Mateen

flavicon
face
Dear fellows,
               I  have just started learning PIC Controllers.I want to
make a Timer Circuit  0 to 60 minute adjustable.Can anybody help me?

Jawed Mateen

<spam_OUTjawedmTakeThisOuTspampaknet3.ptc.pk>

1998\04\24@102450 by Aurangzeb Haque

flavicon
face
Dear Jawed,

You can impliment a timer by simply writing a couple of nested counting
routines, to "spend" the CPU's time. The general format would be as
follows:

       set initial variable1

       ww:     set initial variable2
       qq:     subtract 1 from variable2
               is it zero?
               if not go to qq

       subtract 1 from variable1
       is it zero?
       if not go to ww


You could add sufficent number of such routines to get a desired basic unit
of measurement , say 1second. You can then multiply by nesting more
routines.

Another possibility is to slow down the clock to absolute low. However that
will effect the other processes that way.

However because of the limited resources of the PICS, please don't expect
to make a timer which is able to span a large period (from seconds to
hours). For that you would need to add external hardware.

Regards
Aurangzeb Haque

----------
{Quote hidden}

1998\04\27@201153 by paulb

flavicon
face
Aurangzeb Haque wrote:

> You can implement a timer by simply writing a couple of nested
> counting routines, to "spend" the CPU's time.

...

> You could add sufficent number of such routines to get a desired basic
> unit of measurement , say 1 second.  You can then multiply by nesting
> more routines.

> However because of the limited resources of the PICS, please don't
> expect to make a timer which is able to span a large period (from
> seconds to hours). For that you would need to add external hardware.

 Can you explain that please?  One singularly popular PIC application,
if only as an exercise since there are plenty of clock chips purpose-
manufactured already, is a common LED clock such as the following:
http://hydromail.supelec-rennes.fr/rennes/se/equipe/jweiss/pic/pic.htm

 .. while the rather *uncommon* version is the "propellor" clock in
either "digital": http://www.bobblick.com/bob/projects/mclock.html or
"analog" www.geocities.com/siliconvalley/lab/3685/analog.htm
versions.

 Cheers,
       Paul B.

1998\04\28@005723 by -Dossary %166.87.109.11%

flavicon
face
Paul B. Webster VK2BZC wrote:
{Quote hidden}

paul, i believe as c programmer you can use for next loop to count for
one second, once its done increment the secound counter by one untill
seconds reaches to 60, then you increment minutes counter by one untill
minutes counter reaches 60, then increment hours counter by one untill
hours counter reaches 12 then you can change pm or am variable or
continue to increment hours to 24 then you reset the whole thing back to
zero for another day.

you need to have seperate pic to do this job.



abdulla aldossary

EraseMEdossam1espam_OUTspamTakeThisOuTaramco.com.sa

1998\04\28@181639 by Tom Handley

picon face
  Abdulla (and Aurangzeb), I'm as confused as Paul over your replies to
this. You can easily generate delays of years with any PIC. Given a crystal
oscillator, you don't even need a timer. The common method is to generate a
timer interrupt at a convenient interval and use that `tick' to increment
software counters as you described but you don't need external hardware.

  - Tom

At 07:50 AM 4/28/98 +0300, Abdulla Aldossary wrote:
{Quote hidden}

1998\04\29@112924 by Aurangzeb Haque

flavicon
face
Tom, Abdulla & Paul.


I couldn't agree more with you guys. Of-course there must be umpteen other
methods to implement a TIMER using PICs. I had however tried to give the
very basic solution to the problem considering that the orignal posting was
from a person just starting out with microcontrollers.

This is all the more true for Pakistan, where even basic components for
electronic hobbyists are unavailable. Just to give you a flavour, the PIC
series microcontrollers ARE NOT AVAILABLE in Pakistan. These would need to
be specially imported where the customs duty and postage and handling may
EXCEED the cost of the PIC.

Regards and Good wishes

Aurangzeb Haque
----------
> From: Tom Handley <@spam@thandleyKILLspamspamTELEPORT.COM>
> To: KILLspamPICLISTKILLspamspamMITVMA.MIT.EDU
> Subject: Re: PIC TIMER
> Date: Wednesday, April 29, 1998 3:10 AM
>
>    Abdulla (and Aurangzeb), I'm as confused as Paul over your replies to
> this. You can easily generate delays of years with any PIC. Given a
crystal
{Quote hidden}

basic
> >> > unit of measurement , say 1 second.  You can then multiply by
nesting
> >> > more routines.
> >>
> >> > However because of the limited resources of the PICS, please don't
> >> > expect to make a timer which is able to span a large period (from
> >> > seconds to hours). For that you would need to add external hardware.
> >>
> >>   Can you explain that please?  One singularly popular PIC
application,
{Quote hidden}

1998\04\29@125450 by Mike Keitz

picon face
On Wed, 29 Apr 1998 19:54:11 +0500 Aurangzeb Haque
<spamBeGoneexpacospamBeGonespamKHI.COMSATS.NET.PK> writes:
These would
>need to
>be specially imported where the customs duty and postage and handling
>may
>EXCEED the cost of the PIC.

Still a good deal.  You'd certainly want to fit the whole project in one
PIC.

PIC software can easily create a time delay longer than a person's
lifetime.  It just depends on the number of bytes of RAM available.  If
you make the PIC count in binary at 1000 Hz, here's how long it takes for
various sizes of counter to overflow:

1 byte  : 256 ms (0.256 seconds)
2 bytes : 65.536 seconds = 1.0922 minutes
3 bytes : 279.6 minutes = 4.66 hours
4 bytes : 1193 hours = 49.7 days
5 bytes : 12,726 days = 34.87 years (ignoring leap years)
6 bytes : 8,926 years (hope you used a good battery)

Even the smallest PICs have about 25 bytes of RAM.  Plenty for this task.
Note that the time delay could be preset in 1/1000 second increments
(subject to crystal accuracy of course).

A large binary counter is easily implemented:

       incf    count,f
       skpnz
       incf    count+1,f
       skpnz
       ...    (add bytes as needed)

2 more instructions for each additional byte of counter.  If the Z flag
is set at the end, the count has overflowed.


_____________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
Or call Juno at (800) 654-JUNO [654-5866]

1998\04\30@185303 by paulb

flavicon
face
Hello Abdullah and the other guys.

 I haven't much more really to say.  I'm sure you have all discussed it
quite well.

 Pakistan:  OK guys, I allow that you've actually got a worse exchange
rate/ duties than we have.  That's saying something (;-) and that's sad.

 Nevertheless, if you were going to *build your own* clock instead of
buying some hideous specimen mass-produced in some other country,
presumably because you wanted some special function (example follows),
then there are a few ways of doing it.  You can modify a cheap clock,
build one out of counter chips, or use a PIC.  The first will probably
end up cheapest, since you get the main parts and case to start with.
In fact, you may use all these parts and put in a PIC as well!

 While the second option may *appear* cheap, in fact all these fussy
little CMOS chips, particularly in "hobby" or "few-off" quantities are
not all that cheap, and you end up with quite a few in the end,
equalling the cost of the PIC, even before you consider the cost of the
PCB, the size of the whole assembly, or assembly ("board-stuffing")
costs.

 Even in Pakistan; I suspect that the individual CMOS devices are
*also* getting moderately expensive, and the PIC will win in the end.

 Clocks: Periodically, the experimenter magazines come out with a
"clock" project, either "basic" or with some feature; large digits,
funny display, counts in decimal, multiple time zones etc.  These
generally use discrete counters, gates etc., and are ridiculously large.
They are built presumably by a few rank beginners, sometimes by someone
who wants the special feature, but generally aren't cheap and hardly
represent the "cutting edge" of technology.

 More recently (and curiously, the one I have in mind uses a Motorola
embedded controller!) one or two such projects have featured a single-
chip or minimal-chip implementation but are not *quite* cheap.  There
are certain constraints to publishing "hobby" magazines and some of
these, such as the need to pay authors for material, seem to bode
against an "open" project where the project plan *and* source code are
provided so that you can build it, try it, then the most important part,
*fiddle* with it - optimise, re-work, modify, adapt.

 The web sites I quoted however are just that, so those following this
thread who are *not* familiar with those sites; I commend again, go see;
you *can* build the whole clock on a PIC16F84 (or most others; at least
all the counter functions on a 12C508) plus four transistors, you can
copy and adapt these designs.

 Example of special function; various ways of doing it:  I have a
little domestic problem here.  My wife has a clock radio, and insists on
playing the radio late at night (using the 59-minute "sleep" timer).  I
have a "pillow-fone" speaker but she won't use it unless forced.  Also,
I would much rather she woke up with the alarm in the morning without
disturbing me, but she is so slow to cancel the alarm, it drives me
bats.  Then she only uses the "snooze" button (touch switch actually)
and repeats the performance in 8 minutes!

 Earlier, when *I* wanted the alarm in the mornings (you will see a
"double bind" here; I would like to get to bed earlier but as well as
having so much e-mail to read and write, I can't go to bed early due to
that d***ed radio!), and *she* tended to turn the volume control off, I
simply wired a resistor (100 ohm or so) in the "minimum" leg of the
volume control.  I have now removed this as I prefer the thing off!  I
think at one stage said leg of the VC had a dry joint too, you will
realise what that does!

 What I really want is a relay controlling the radio's internal speaker
so that it would be automatically shut off after a reasonable time at
night, say 10pm, but the speaker jack would still operate the pillow-
fone.  This should also limit the maximum volume on the pillow-fone.
I would also like to swap the "snooze" button to operate "alarm off" so
it only alarms once.

 Probably the easiest way to do both these functions is to perform
simple wiring modifications; cross-wiring "snooze" to "alarm off" and
providing a reed relay which is only on when the radio is *on* and the
"1" on the tens-of-hours is *not*.  This would permit normal radio use
up to 10pm and in the morning (but linking to the AM/PM indicator could
control morning use also if desired).

 {*Did I say* I hadn't much more to say?  I meant in respect of the
theory of implementing counters.  Sure, I'm happy to discuss that if you
want!}

 Cheers,
       Paul B.

More... (looser matching)
- Last day of these posts
- In 1998 , 1999 only
- Today
- New search...