Page 1 of 1

Software Reset

Posted: Sun Apr 20, 2008 8:32 pm
by Widgetman
Hi All,
Does anyone know how to do a effective equivalent to a Hardware reset thru Software ?
I tried using a absolute GOTO, but that does not reset everything. Any thoughts are appreciated.
thanks

Posted: Sun Apr 20, 2008 8:39 pm
by Doj
If you did a quick search on the forum you would find its this:-

Code: Select all

Public Sub pic_reset()
    ASM
        reset
    End ASM

End Sub

Posted: Sun Apr 20, 2008 9:27 pm
by Widgetman
Hi DOJ,
I did try that and found that some of my variables did not get initialized correctly so I assumed I was doing something wrong. I will investigate some more and see if I can figure out why my code works differently if I cycle power vs using the ASM routine you posted.
Thanks

Posted: Mon Apr 21, 2008 12:36 am
by Doj
As far as I know there is a list of what type of reset occured and it is stored in a register, there are also details of what eisters are reset and to what value all in the magic data sheet(I read it sometime but not entirely sure without looing!)

What is it that is not doing what you expect?, which is not to suggest there is an issue with the PIC, rather, do you think it should do something it does not?

Posted: Mon Apr 21, 2008 12:22 pm
by Widgetman
Hi DOJ,
I got it to work, but depending on where I place the ASM routine in the list of other subroutines I get different results. I had to place it as the first subroutine after my Dim statements. If I put it at the end I did not get a clean reset when my code finished at the bottom of the file. When I get some time I will look further into it. Thanks for all teh help.