INT from SLEEP... not going where I wanted


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2009
    Location
    Utah, USA
    Posts
    427

    Default INT from SLEEP... not going where I wanted

    Hey Group,

    So I have this project... The PIC goes to SLEEP as it is supposed to, Then I have two pins PortA.3 and PortA.4 that have INT on change (going from high to low) enabled. I also have the WDT enabled to wake the PIC up every 60 seconds.

    When the PIC is awakened from sleep by the WDT it executes as expected... ie, it displays the message "awake" (see code below)

    When the PIC is awakened from sleep by either A.3 or A.4 it does NOT go to the location defined by ON INTERRUPT, if it did I would see the message "Int" displayed and I never do.

    I know I should probably convert to DT's instant interrupts... but I have not YET.


    Here is the relevant portion of the code, simplified for this discussion... (I can post more if needed)

    Code:
    On Interrupt goto MyInt 
    INTCON = %10001000 'enable interupt on change
    '=========================================================
    '============= SLEEP HANDLER =============================
    '=========================================================
     
    SleepNow:
    INTCON.0 = 0 'clear interrupt flag register
     
      ENABLE
    SleepHere:
    @ SLEEP
      DISABLE
     
    pause 500
    arraywrite msg,["Awake"]
    len=5:GOSUB Message
     
    goto SleepHere
    END 
    '=======================================================
    '========================= Interrupt Handler
    '=======================================================
    MyInt:
    INTCON.0 = 0 'clear interrupt flag register
    pause 500
    arraywrite msg,["Int"]
    len=3:GOSUB Message
     
    goto SleepNow 
    What I thought should happen is that when the PIC is awakened by the WDT it would execute the code after the @SLEEP... It does.

    While SLEEP'ing and one of the two push buttons A.3 or A.4 is pressed the PIC should execute the code in the MyInt: section where ON INTERRUPT says it should go when interrupted... IT DOES NOT. What it does do is display "Awake" and then keeps looping "Awake" (I think I need to clear an interrupt flag to stop this)

    But I never get to my code in the MyInt: section.

    WHY???

    Any ideas are appreciated.


    PS: as you can see I only ENABLE interrupts while I am sleeping... I do not want to be interrupted at other times.

    Would it be better to use the regular PBP SLEEP command instead of @ SLEEP ??

    Thanks in advance
    Dwight
    These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.

  2. #2
    Join Date
    Oct 2009
    Location
    Utah, USA
    Posts
    427


    Did you find this post helpful? Yes | No

    Default Re: INT from SLEEP... not going where I wanted

    Hold that thought...

    In looking at my whole program I realized I did not have the letter "I" defined in my display routine... the the PIC may be getting to MyInt after all and just not able to display the message "Int".

    At work now... will report back tonight.

    embarrased... dwight
    Dwight
    These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.

Members who have read this thread : 1

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