Software reset


Closed Thread
Results 1 to 17 of 17

Thread: Software reset

Hybrid View

  1. #1
    Join Date
    Feb 2005
    Location
    Portugal
    Posts
    79

    Default Software reset

    There are any way to do a software reset, not an hardware reset?

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


    Did you find this post helpful? Yes | No

    Default

    By software only ... no.... and yes.

    If you connect one extra i/o to your MCLR pin... yes
    Steve

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

  3. #3
    Join Date
    Feb 2005
    Location
    Portugal
    Posts
    79


    Did you find this post helpful? Yes | No

    Default MCLR pin

    What your saying is to connect, for example, porta.1 to MCLR pin and "write" porta.0 = 0 to make a software reset?!

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


    Did you find this post helpful? Yes | No

    Default

    yep. just make sure your PORTA.1 is set to high or as input when you boot the pic and that's it.

    EDIT: i don't know if it's working but i just read my 18F2320 datasheet about the STKPTR register. Probably you can set the stack register full and do few gosub to get a Stack Full Resets too. never tested it. i'll try this now and let you know.
    Last edited by mister_e; - 21st February 2005 at 19:32.
    Steve

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

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


    Did you find this post helpful? Yes | No

    Talking

    Mouhaha it's working
    Code:
    ' program to perfom an software reset
    ' PIC18F2220
    DEFINE LOADER_USED 1
    DEFINE OSC 20
    
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_TXSTA 24h
    DEFINE HSER_BAUD 9600
    
    loop var byte
    begin:
    STKPTR = 0 ' clear Stack resets bits
    hserout ["software RESET",13,10]
    start:
        for loop = 10 to 0 step -1
            hserout ["reset in ",dec loop,13,10]
            pause 1000
        next
        
        STKPTR = $FF ' full stack pointer
        
        gosub there
        
        pause 1000
        goto start
    there:
         hserout ["I'm supposed to be die now ;o("]
         pause 1000
         gosub there2
         return
    there2:
         hserout ["I'm supposed to be die now for the 2nd time ;o("]
         pause 1000
         gosub there3
         return
              
    there3:
         hserout ["I'm supposed to be die now for the 3rd time ;o("]
         pause 1000
         return
    it never jump to 'there' or 'there2' and for sure 'there3'
    cool stuff!
    Steve

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

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    if you're using an 18F type pic, you can just use the reset command.

    @ reset

    if using a 16F,

    asm
      clrf PCLATH
      goto 0
    endasm


    Darrel
    DT

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


    Did you find this post helpful? Yes | No

    Default

    @ reset

    yup... always read the whole datasheet.
    Steve

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

Similar Threads

  1. IC12F508 with Internal Oscillator and Software Reset
    By karan123 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 2nd October 2009, 16:13
  2. Software Stack
    By yasser hassani in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th December 2007, 10:04
  3. Replies: 3
    Last Post: - 26th November 2006, 21:47
  4. How to reset the pic by software ?
    By Shamir in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th October 2006, 16:43
  5. Software Driven Reset Routine
    By Tissy in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th April 2005, 00:53

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