Searching \ for 'sleep time' 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/timers.htm?key=time
Search entire site for: 'sleep time'.

Truncated match.
PICList Thread
'sleep time'
1998\11\04@085456 by Hanafi Tanudjaja

flavicon
face
I am asking advice how to increase sleep time to 3 min or more.
In the datasheet the max sleep time only 2.3 sec

TIA
Hanafi Tan

1998\11\04@105156 by John Kirk

flavicon
face
I would suggest letting it wake up every 2.3 sec, check a register,
increment the register, then go back to sleep.  When the register reaches a
78 then clear the register and execute the main program.  That should give
you 78 * 2.3 / 60 = 2.99 minutes.   The time and energy spent in the 78 wake
up cycles should not be a great burden.
Hope my suggestion helps you: John Kirk

{Quote hidden}

1998\11\04@170019 by Sean Breheny

face picon face
Hello,

       I think that you are talking about the WDT timeout period, which is a
maximum of 2.3 seconds. HOWEVER, there are other ways to make a PIC wake up
from sleep.

       You can use the PB0 interrupt on pin change. You could attach a capacito
r
and a resistor in parallel from PB0 to ground. Then, you could also have a
wire from PB0 to some other pin on the pic(PB1, for example), then you
could do this:

bsf STATUS,RP0 ;Set PB1 to output
bcf TRISB,PB1
bcf STATUS,RP0

bsf PORTB,PB1  ;Charge capacitor thru PB1
                 ;Do other stuff for about 1 mS while waiting for large cap to
                 ;charge. You could speed this up with an external transistor.


bsf STATUS,RP0 ;Tri-state PB1
bsf TRISB,PB1
bcf STATUS,RP0

SLEEP           ;Sleep until cap discharges thru resistor and
               ;triggers interrupt on falling edge

You would of course need interrupt code at the interrupt vector (location
0x0004 if I remember correctly) to return from the interrupt. You would
also need to enable the interrupt in you initialization code.

C should be large (but not TOO large, about 10 uF) and
for R you should have about:

R=0.546*T/C

Where R is in ohms
C is in Farads
and T is sleep time in seconds.

Please note that this will be approximate, since it will depend on actual
pin input low threshold, temperature, capacitor and resistor tolerance,
input pin leakage current,etc.
This is only good for delays of up to about 30 seconds maximum.

       For greater or more accurate delays you can use an RTC (real time clock)
chip which will be able to, say, give very accurate pulses once a second.
These pulses could then be sent through a divider and into pin PB0,
triggering the interrupt.


Good luck,

Sean




At 08:47 PM 11/4/98 +0700, you wrote:
>I am asking advice how to increase sleep time to 3 min or more.
>In the datasheet the max sleep time only 2.3 sec
>
>TIA
>Hanafi Tan
>
+-------------------------------+
| Sean Breheny                  |
| Amateur Radio Callsign: KA3YXM|
| Electrical Engineering Student|
+-------------------------------+
Save lives, please look at http://www.all.org
Personal page: http://www.people.cornell.edu/pages/shb7
shb7spamKILLspamcornell.edu  Phone(USA): (607) 253-0315 ICQ #: 3329174

1998\11\05@090237 by Hanafi Tanudjaja

flavicon
face
can you give me a simple example of programme ?
I have tried but every time it's wake up ,it always start from the begining
so the register
never increase it's content .

TIA
Hanafi Tan
{Original Message removed}

1998\11\05@121955 by Dr. Imre Bartfai

flavicon
face
Hi,

if you disable watchdog, the sleep will be infinite until external event
occurs. Hope this helps.

Imre

On Wed, 4 Nov 1998, Hanafi Tanudjaja wrote:

> I am asking advice how to increase sleep time to 3 min or more.
> In the datasheet the max sleep time only 2.3 sec
>
> TIA
> Hanafi Tan
>
>

1998\11\05@164102 by paulb

flavicon
face
Hanafi Tanudjaja wrote:

> can you give me a simple example of programme ?
> I have tried but every time it's wake up, it always starts from the
> beginning so the register never increase it's content .

 It's quite simple.  After your initialisation routines, you use an
instruction which decrements one particular register and if it becomes
zero, re-sets it to the number of timeouts you wish to count *and*
executes the desired "once-in-a-while" routine.

 The tricky bit is the initialisation.  You have to set this register
to this particular value on power-up.  To do this, you have to test the
Power Down and Timeout bits in the reset/ initialisation code to see
whether you are in the first reset after power up or a wakeup from
sleep, and *not* change the counter if it is in fact a wakeup.

/* Reset code */
if power_down then {
   sleep_count = no_sleeps; }
else {
   if (sleep_count--) == 0 then {
       sleep_count = no_sleeps; main_part(); } }

 Can I suggest you study that part of the programming manual awhile and
get back to the list if (and it may well be) it's not clear?
--
 Cheers,
       Paul B.

1998\11\20@071018 by paulb

flavicon
face
Hanafi Tanudjaja wrote:

> can you give me a simple example of programme ?
> I have tried but every time it's wake up, it always starts from the
> beginning so the register never increase it's content .

 It's quite simple.  After your initialisation routines, you use an
instruction which decrements one particular register and if it becomes
zero, re-sets it to the number of timeouts you wish to count *and*
executes the desired "once-in-a-while" routine.

 The tricky bit is the initialisation.  You have to set this register
to this particular value on power-up.  To do this, you have to test the
Power Down and Timeout bits in the reset/ initialisation code to see
whether you are in the first reset after power up or a wakeup from
sleep, and *not* change the counter if it is in fact a wakeup.

/* Reset code */
if power_down then {
   sleep_count = no_sleeps; }
else {
   if (sleep_count--) == 0 then {
       sleep_count = no_sleeps; main_part(); } }

 Can I suggest you study that part of the programming manual awhile and
get back to the list if (and it may well be) it's not clear?
--
 Cheers,
       Paul B.

1998\11\20@074049 by Dr. Imre Bartfai

flavicon
face
Hi,

if you disable watchdog, the sleep will be infinite until external event
occurs. Hope this helps.

Imre

On Wed, 4 Nov 1998, Hanafi Tanudjaja wrote:

> I am asking advice how to increase sleep time to 3 min or more.
> In the datasheet the max sleep time only 2.3 sec
>
> TIA
> Hanafi Tan
>
>

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