Using Sleep command

Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2005
    Auckland/New Zealand

    Default Using Sleep command

    Hello again,
    Can I ask once more about Sleep command.
    I'm running it OK on 16F84.
    When using 18F1220 I get 1/4 of the delay value.
    On the 16F84 the delay depends on processor voltage but more or less close.
    Usually 12 seconds more for each minute of delay but consistent.
    Do I need to set any registers on the 18F1220.
    Any one please.
    Last edited by suded; - 8th April 2005 at 02:55.

  2. #2
    Join Date
    Jul 2003

    Did you find this post helpful? Yes | No


    The PBP default WDT postscaler is set to 128 in the 18F1220.INC device family header file.

    __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H

    The 18F1220 nominal WDT timeout period is ~4mS. If you accept the default postcaler value of 128 this gives you roughly 4mS * 128 = 512mS. That's why you're seeing roughly 1/4 the sleep period when switching from 16F to 18F.

    PBP can't change the WDT postscaler on the 18F since this is set in the config word. To make sleep work roughly the same on the 18F, just set the WDT postscaler to 512 which gives you 512 * ~4mS = ~2.048S nominal WDT timeout period.

    Set your WDT postscaler to 512.

    __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H

    The 16F WDT timeout period is 18mS. PBP sets OPTION_REG for prescaler assignment to WDT with a rate of 128. This gives ~18mS * 128 = 2.304S.

    With _WDTPS_512_2H this will get you pretty close to the same sleep time periods with the 18F part. If you need to increase this time period, just increase the postscaler.

    tech at

Similar Threads

  1. Active low input?
    By CosMecc in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 8th August 2010, 20:31
  2. Won't go back to SLEEP after 1st Interrupt
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 29th June 2009, 09:00
  3. Sleep Command
    By thye in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 27th October 2007, 15:28
  4. Can I do this???
    By noobie in forum mel PIC BASIC
    Replies: 2
    Last Post: - 10th June 2006, 18:57
  5. SLEEP Command and Interupts 16F648A
    By ghoot in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 28th May 2004, 18:35

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts