SLEEP mode 16F628A


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    974


    Did you find this post helpful? Yes | No

    Default caution

    Hi Michael

    I'm not sure if this will help. The sleep statement needs to be followed by at least a nop. Read the datasheet carefully - it has a mention of this. Anyway, I am too lazy to read it and point it out at this time. I use the 16F628A in sleep and successfully.

    The statement sequence should be

    @sleep
    @nop
    @nop

    Also, make sure that the pending interrupt is cleared before you put the PIC to sleep.

    Jerson

  2. #2


    Did you find this post helpful? Yes | No

    Default

    Ok....that's a new one. A NOP?

    Everything I think is fine...as always a stupid mistake on my part by not taking PORTB.0 low with a pulldown and letting it float....(a great way to get "unpredictable" behavior).

    It was probably sensing a false high and interfering with the sleep routine.

    I had put a pause following sleep as I had read in the archives (Melanie?) suggested it's use, to let the PIC wake up and get some coffee.

    Maybe what your saying is the NOP would do the same thing?

    Sort of a safety buffer before it gets back to work?

  3. #3
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    974


    Did you find this post helpful? Yes | No

    Default Ok, Here it is

    See section 14.8.1 of the datasheet on page 110/168. This is the excerpt

    When the SLEEP instruction is being executed, the
    next instruction (PC + 1) is pre-fetched. For the device
    to wake-up through an interrupt event, the correspond
    ing interrupt enable bit must be set (enabled). Wake-up
    is regardless of the state of the GIE bit. If the GIE bit is
    clear (disabled), the device continues execution at the
    instruction after the SLEEP instruction. If the GIE bit is
    set (enabled), the device executes the instruction afte
    the SLEEP instruction and then branches to the inter
    rupt address (0004h). In cases where the execution of
    the instruction following SLEEP is not desirable, the
    user should have an NOP after the SLEEP instruction.

    Jerson

Similar Threads

  1. High Power Consumption in Sleep Mode
    By ngeronikolos in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 18th September 2014, 13:29
  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. Need help with SLEEP mode
    By aggie007 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 28th November 2007, 09:56
  4. Replies: 3
    Last Post: - 27th November 2007, 08:56
  5. 16F628A current high during sleep
    By Rubicon in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 9th October 2006, 10:21

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