Sleep & nap


Closed Thread
Results 1 to 25 of 25

Thread: Sleep & nap

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    there can be many things that can go wrong
    That is when the fun starts

    Can you post your whole code?
    The actual problem might be someplace else.
    Dave
    Always wear safety glasses while programming.

  2. #2


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    That is when the fun starts

    Can you post your whole code?
    The actual problem might be someplace else.
    Here, the fun has alredy started

    Code:
    DEFINE LOADER_USED 1
    DEFINE RESET_ORG 1000h      ' For Microchip USB Bootloader
    DEFINE INTERRUPT_ORG 1008h  ' For Microchip USB Bootloader
    define WDT_ON
    define WDTPS 128 
    
    DEFINE LCD_DREG       PORTD	' Set LCD Data port
    DEFINE LCD_DBIT       4		' Set starting Data bit (0 or 4 if 4-bit bus)
    DEFINE LCD_RSREG      PORTC	' Set LCD Register Select port
    DEFINE LCD_RSBIT      2		' Set LCD Register Select bit
    DEFINE LCD_EREG       PORTC	' Set LCD Enable port
    DEFINE LCD_EBIT       1		' Set LCD Enable bit
    DEFINE LCD_BITS       4		' Set LCD bus size (4 or 8 bits)
    DEFINE LCD_LINES      4		' Set number of lines on LCD
    DEFINE LCD_COMMANDUS  2000	' Set command delay time in us, 2000 us = 2ms
    DEFINE LCD_DATAUS     50	' Set data delay time in us, 50 us = 0,05ms
    
    powerOut     var PORTE.0
    onOffPressed var PORTD.2
    b var byte
    clear
    
    TRISE = %00001000   
    TRISC = %10110000   
    TRISD = %00001100
    powerOut = 1
       
    pause 1
    lcdout $FE, 1
    pause 1
    
    pstart:
      powerout = not onoffpressed
      lcdout $FE,2, "b=", dec b
      pause 100
      b = b + 1
      'nap 5
    goto pstart
    So, I can see b living with nap or sleep commented, but it hangs when not commented.

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Hi,

    From " The Manual" $ 5.46


    The 16-bit
    core devices, including the 17Cxxx and 18Xxxxx parts use a postscaler
    set at programming time to configure the Watchdog timeout period.

    The compiler will disregard the Period set in the NAP instruction for the 16-
    bit core devices.
    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  4. #4


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Hi,

    From " The Manual" $ 5.46

    Alain
    TRUE!

    But SLEEP should work, shouldn't it?
    The problem is somewhere else, but where?

  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Question

    Hi,

    You want a ~1 sec PAUSE ...

    use PAUSE 1000 !!!

    a PAUSE can be "interrupted" so, there are no problem to use it ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

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


    Did you find this post helpful? Yes | No

    Default

    If you're using the Microchip USB loader, it may have WDT disabled in config.

    Try inserting WDTCON.0=1 before any NAP or SLEEP commands to enable WDT.
    Regards,

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

  7. #7


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    If you're using the Microchip USB loader, it may have WDT disabled in config.

    Try inserting WDTCON.0=1 before any NAP or SLEEP commands to enable WDT.
    One would have think that would work, but it did not
    What might be wrong?

    WDTCON.0=1
    sleep 1
    lcdout $FE, $C0, "ok"

    Can't still se the "ok"

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