How to force a 16F628A to reset using PBP statement.


Closed Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    Feb 2007
    Posts
    37

    Unhappy How to force a 16F628A to reset using PBP statement.

    Hi to all.

    I have made more search but I do not have found a way to reset the PIC using PBP statement.

    I need at run time, in some particular condition, to force the PIC to reset; a reset similar to momentary ground the MCLR pin.

    Many thanks for you help.

    Leo

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Hello Wirecut
    Here is 1 way, tie an unused pin to the mclr pin and bring it low in software.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  3. #3
    Join Date
    Feb 2007
    Posts
    37


    Did you find this post helpful? Yes | No

    Unhappy

    Hi Joe.

    many thanks for your suggestion, but unfortunatelly I do not have spare pins to dedicate to this use.

    Ciao

    Leo

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


    Did you find this post helpful? Yes | No

    Default

    Hi,

    Other solution ... WDT Timeout ! ...


    Alain
    Last edited by Acetronics2; - 10th March 2008 at 09:32.
    ************************************************** ***********************
    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 " !!!
    *****************************************

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


    Did you find this post helpful? Yes | No

    Default

    You could use the WDT, but then you would need to insert an assembler routine that looped
    until the WDT reset the PIC. Otherwise PBP will automatically clear the WDT.

    You have the option of telling PBP not to clear WDT, but then it's up to you to manage it,
    and that can really be a pain.

    Another option is to just jump to location 0. PCLATH=0 followed by @ GOTO 0 works if you
    just want to start over from 0.
    Regards,

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

  6. #6
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    ....

    Another option is to just jump to location 0. PCLATH=0 followed by @ GOTO 0 works if you
    just want to start over from 0.
    Bruce,

    Could you be a little more specific with your example please?

    Thanks,
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

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


    Did you find this post helpful? Yes | No

    Default

    Sure. If you want to re-start from location 0, then;

    Code:
    X VAR BYTE
    
    TOGGLE 0
    
    Main:
        FOR X = 0 TO 50
         IF X = 20 THEN
          PCLATH = 0
          @ GOTO 0 ' start over from 0 if X = 20
         ENDIF
        NEXT X
        GOTO Main
        
        END
    This isn't exactly the same as a hardware reset, but it's close.
    Regards,

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

  8. #8
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Thanks Bruce.

    Since you say that it is not a hard reset but close, will this clear any return addresses in the stack if there is any?


    Thanks.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

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


    Did you find this post helpful? Yes | No

    Default

    No it does not clear the stack.
    Regards,

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

Similar Threads

  1. PBP Book
    By Bruce in forum Off Topic
    Replies: 83
    Last Post: - 4th October 2021, 12:55
  2. Indexer not indexing...a basic PBP problem??
    By jellis00 in forum General
    Replies: 8
    Last Post: - 24th March 2009, 16:53
  3. Help Pbasic to PBP
    By azmax100 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 2nd March 2009, 18:35
  4. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  5. Compiler differences between PBP 2.33 & 2.46
    By nikopolis in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd May 2006, 19:01

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