Permanent sleep


Closed Thread
Results 1 to 40 of 59

Thread: Permanent sleep

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Heuuu

    No GIE = No Sleep ( RTFDatasheet ... $ 14.8.1 - Greyed Note ), so we set GIE Bit

    Then ... Executes the 1St NOP

    Then ... Branches to location 0004 ...

    But there is a supposed Interrupt stubb here instead of falling into the "program" ...

    a single " DEFINE INTHAND INIT " without any interrupt stubb ( LOL ! ) would push the libs away from the 4 first program locations ... and allow restarting the PIC as a first power up ...

    We could also Branch to the "Pause 100" ... to have some visual effect before re-entering sleep ... ( wich is better ...I think)

    Sooo ...

    we add :

    DEFINE INTHAND _BLINK ' near top of program

    and

    BLINK:

    Before

    Pause 100 ' Needed for system Wake-Up
    HIGH LED : PAUSE 200 : LOW LED
    GOTO CYCLE




    I am right, Mel ???

    Alain

    PS: We are aboard PBC list ... what about interrupts in PBC ???
    Last edited by Acetronics2; - 12th May 2007 at 15:14. Reason: PBC or PBP used ???
    ************************************************** ***********************
    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 " !!!
    *****************************************

  2. #2
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Post

    "Super Acetronics" - I think he might be right. He should change his name to Supertronics

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


    Did you find this post helpful? Yes | No

    Wink

    Hehe, Trend ...

    You did not know about the Underscored Inthand name ... I presume.

    Permits LOTS of good things, especially if context must not be saved ( what is lots of encountered situations ...).

    Also REALLY Instant Basic Pseudo-Interrupts !!! ( The return adress MUST be explicitly given )

    Alain
    Last edited by Acetronics2; - 12th May 2007 at 14:45.
    ************************************************** ***********************
    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
    Join Date
    Sep 2003
    Location
    Vermont
    Posts
    373


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Heuuu

    No GIE = No Sleep ( RTFDatasheet ... $ 14.8.1 - Greyed Note ), so we set GIE Bit

    Then ... Executes the 1St NOP

    Then ... Branches to location 0004 ...

    But there is a supposed Interrupt stubb here instead of falling into the "program" ...

    a single " DEFINE INTHAND INIT " without any interrupt stubb ( LOL ! ) would push the libs away from the 4 first program locations ... and allow restarting the PIC as a first power up ...

    We could also Branch to the "Pause 100" ... to have some visual effect before re-entering sleep ... ( wich is better ...I think)

    Sooo ...

    we add :

    DEFINE INTHAND _BLINK ' near top of program

    and

    BLINK:

    Before

    Pause 100 ' Needed for system Wake-Up
    HIGH LED : PAUSE 200 : LOW LED
    GOTO CYCLE




    I am right, Mel ???

    Alain
    I am using the '690. In that FM, the processor will still wake from sleep if the flag is set without the GIE set. With the GIE set you have to service the interrupt. Without, it starts up right after the sleep command.

    Ron

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


    Did you find this post helpful? Yes | No

    Wink Always a new feature to discover ...

    Hi Ron,

    You're perfectly right with the '690 ... but, care ... GIE settings do not have the same effects for the '628 ... and GIE *must* be set to enter sleep ( sleep ignored if GIE = 0 ) .

    Alain
    Last edited by Acetronics2; - 12th May 2007 at 16:04.
    ************************************************** ***********************
    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
    Sep 2003
    Location
    Vermont
    Posts
    373


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Hi Ron,

    You're perfectly right with the '690 ... but, care ... GIE settings do not have the same effects for the '628 ... and GIE *must* be set to enter sleep ( sleep ignored if GIE = 0 ) .

    Alain
    I did check the '628 book and you are correct sir! I reread it twice to catch it.
    Ron

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


    Did you find this post helpful? Yes | No

    Post

    Hi, Charudatt

    Do not worry !!! This is certainly one of the least documented feature of PBP ...

    DEFINE INTHAND _INTER ...

    1) keeps prog mem locations 2 and 3 free ...

    2) places a GOTO _INTER at location 4 ... or a bit further if more than 1 program page ...and COULD need context saving.
    _INTER ( Note the Leading Underscore ) is the PBP "INTER:" Label readable by Assembler ...

    Consider it as a "classical" GOTO ... but you reach it when an "interrupt reason" occurs ... no latency then.

    INIT (Without Underscore !!! ) is the first ASSEMBLER line your Program really executes at power ON ...

    So, as is ... you can i.e. restart your PIC, ... without using MCLR - if not disposable !!!
    ... or goto the label you want !!!

    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 " !!!
    *****************************************

  8. #8
    Join Date
    Sep 2003
    Location
    Vermont
    Posts
    373


    Did you find this post helpful? Yes | No

    Default

    Allain,
    I was right. Clearing GIE does work as it does on the '690. It will wake and continue without needing an interrupt handler.

    Ron

  9. #9
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    <table><td>Vermont : 1
    France : 0</td><td></td></table>
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Ron Marcus View Post
    Allain,
    I was right. Clearing GIE does work as it does on the '690. It will wake and continue without needing an interrupt handler.

    Ron
    What about ENTERING sleep ??? 628A datasheet clearly says IF GIE = 0 , the SLEEP command is treated as a NOP ...

    I'm a bit confused here ... or I do not have the latest datasheet !!!

    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 " !!!
    *****************************************

  11. #11
    Join Date
    Sep 2003
    Location
    INDIA
    Posts
    161


    Did you find this post helpful? Yes | No

    Default

    Hello Ron and Other,

    I did not understand the Int_handler part. You mean to say , declare a Int_handler without a lable and make the pic reset.

    Well setting GIE made it to go to sleep (LED not blinking but current 6mA) but did not come out of it.

    any further help?

    regards

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. Using Sleep
    By elec_mech in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 17th August 2008, 04:05
  4. 16F628A current high during sleep
    By Rubicon in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 9th October 2006, 10:21
  5. Wierd sleep issue
    By orca in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 14th March 2006, 22:06

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