Sleep & nap


Closed Thread
Results 1 to 25 of 25

Thread: Sleep & nap

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    How long are you waiting? If the WDT poscaler in config is set to 32,768 it's going to take around 131 seconds before it wakes-up.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  2. #2


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    How long are you waiting? If the WDT poscaler in config is set to 32,768 it's going to take around 131 seconds before it wakes-up.
    the WDTPS is 128 as in #9, and actually it takes several seconds before that sleep instrucion is reached in the demo code (#9) as well as in the "big" code where I spotted this phenomena/error/failure at first.

    I have never seen sleep working, yet...
    but I would really like to see it

  3. #3
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    How are you setting the WDT postscaler to 128?
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  4. #4


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    How are you setting the WDT postscaler to 128?
    Like this:
    define WDT_ON
    define WDTPS 128

    Is that ok?

  5. #5
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    The watchdog timer postscaler & on/off options are configuration options. These are set at
    program time.

    PBP allows you to DEFINE pretty much anything without throwing an error, but that doesn't
    mean your defines are doing anything.

    If you're using the older version Microchip USB boot-loader firmware, these are set in the C
    code.

    Code:
    #pragma config WDT      = OFF
    #pragma config WDTPS    = 32768
    You can open the loader .HEX file with your programmer, change WDTPS from 32768 to 128
    then save the .HEX file & re-program your 4550 with the modified loader firmware. Then you
    will have a postscaler of 128. I would leave WDT=OFF, and use the software enable option
    WDTCON.0=1.

    You'll also want to use DEFINE OSC 48 so PBP will use the correct timing. Without defining
    the osc speed PBP defaults to 4MHz.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  6. #6


    Did you find this post helpful? Yes | No

    Default

    Thank you Bruce!

    Quote Originally Posted by Bruce View Post
    The watchdog timer postscaler & on/off options are configuration options. These are set at program time.

    PBP allows you to DEFINE pretty much anything without throwing an error, but that doesn't mean your defines are doing anything.
    So, this means that you can not override them later with your running program?
    If you're using the older version Microchip USB boot-loader firmware, these are set in the C code.
    The date for the "USB Device - HID - HID Bootloader - C18 - PIC18F4450.hex" is 19.6.2008. I opened the zip-file maybe 1,5-2 month ago.
    Code:
    #pragma config WDT      = OFF
    #pragma config WDTPS    = 32768
    You can open the loader .HEX file with your programmer, change WDTPS from 32768 to 128 then save the .HEX file & re-program your 4550 with the modified loader firmware. Then you will have a postscaler of 128. I would leave WDT=OFF, and use the software enable option WDTCON.0=1.
    I don't grasp this. How can I see or found WDTPS in a .HEX file?

    You'll also want to use DEFINE OSC 48 so PBP will use the correct timing. Without defining the osc speed PBP defaults to 4MHz.
    My program has DEFINE OSC 48, so that can not be the reason for this sleep-error.

  7. #7
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    So, this means that you can not override them later with your running program?
    Some 18F parts allow you to change config settings at run-time, but I wouldn't advise trying this until you're a bit more familiar with how to set them & what they all do. If you're using a boot-loader, you'll need to know every setting the loader expects, or you may end up doing a lot of loader firmware re-programming. If you search here for modifying config settings on-the-fly you'll find a couple routines showing you how.

    [The date for the "USB Device - HID - HID Bootloader - C18 - PIC18F4450.hex" is 19.6.2008. I opened the zip-file maybe 1,5-2 month ago.
    You probably have the latest version then.

    I don't grasp this. How can I see or found WDTPS in a .HEX file?
    Easy. Open the loader .HEX file with your programmers software. Change it, save the .HEX file, and re-program the loader into your PIC.

    My program has DEFINE OSC 48, so that can not be the reason for this sleep-error.
    OK. It wasn't shown in the example you posted. Note this won't have anything to do with the WDT or sleep error. Only timing for PBP commands.

    If your programmers software doesn't allow you to read a .HEX file and make changes to config settings, then you can re-compile the loader firmware with the free version of C18.

    Or I can send you a modified version .HEX file if you need it.

    What USB board are you using?
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. 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
  2. Battery powered applications
    By NavMicroSystems in forum Off Topic
    Replies: 7
    Last Post: - 22nd June 2009, 07:12
  3. 16F628A current high during sleep
    By Rubicon in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 9th October 2006, 10:21
  4. Wierd sleep issue
    By orca in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 14th March 2006, 22:06
  5. Replies: 5
    Last Post: - 5th February 2006, 16:51

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