Software Reset

Coding and general discussion relating to user created compiler modules

Moderators: David Barker, Jerry Messina

Post Reply
Widgetman
Posts: 136
Joined: Sun Dec 16, 2007 7:39 pm
Location: Florida

Software Reset

Post by Widgetman » Sun Apr 20, 2008 8:32 pm

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

Doj
Posts: 362
Joined: Wed Apr 11, 2007 10:18 pm
Location: East Sussex

Post by Doj » Sun Apr 20, 2008 8:39 pm

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

Widgetman
Posts: 136
Joined: Sun Dec 16, 2007 7:39 pm
Location: Florida

Post by Widgetman » Sun Apr 20, 2008 9:27 pm

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

Doj
Posts: 362
Joined: Wed Apr 11, 2007 10:18 pm
Location: East Sussex

Post by Doj » Mon Apr 21, 2008 12:36 am

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?

Widgetman
Posts: 136
Joined: Sun Dec 16, 2007 7:39 pm
Location: Florida

Post by Widgetman » Mon Apr 21, 2008 12:22 pm

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.

Post Reply