Using Sleep


Closed Thread
Results 1 to 3 of 3

Thread: Using Sleep

Hybrid View

  1. #1
    Join Date
    Apr 2005
    Location
    Virginia
    Posts
    65


    Did you find this post helpful? Yes | No

    Default Additional Note

    I apologize, I posted prematurely. I tried running this without the sleep statement, as I should have done sooner, and my interrupt routine isn't working. I still need help with the proper use of sleep, but I'm attempting to locate the interrupt problem first. I'll post the working interrupt version as soon as I figure this out. If you happen to see anything obvious, I'm all ears, well, eyes anyway. I think the problem is in my configurations, but we'll see. Thanks all.

  2. #2
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    969


    Did you find this post helpful? Yes | No

    Default

    I haven't specifically used the 18F2525, so I cannot offer you specific advice. However, on the 16F628 and 16F917 that I have used, this is how I do it(from memory)

    Enable PORTB interrupt on change. Global interrupts <B>need not</B> be enabled. Then when you want the processor to sleep, just do this
    Code:
    @ sleep
    @ nop
    @ nop
    Any change on Portb pins RB4 to RB7(depends on specific bits being set) would trigger an interrupt flag being set. This event causes the PIC to wake up from sleep even though the global interrupt is disabled. Just in case you need you interrupts to be enabled at that time, you have to ensure that the ISR will read PORTB and reset the Change Flag.

    That's all there is to it

    Jerson

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. 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