Searching \ for 'Software reset?!' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=software+reset
Search entire site for: 'Software reset?!'.

Truncated match.
PICList Thread
'Software reset?!'
2000\03\23@091558 by johnny

flavicon
face
Hi all!
Is there a way to implement a "soft reset"? Like a jump to the
startadress but something that clears the stack as well, is this
possible?
Or perhaps it's unnecessary? If the stack is FIFO type it might not be a
problem? Are there any other things (registers)  to consider?

Regards,
Johnny Lindholm
[Note: In Sweden it's perfectly okay to be given the name of "Johnny" so
that is my real name, not a nick for "John"...  ;o)  ]

2000\03\23@134003 by Mark Willis

flavicon
face
Johnny Lindholm wrote:
> Hi all!
> Is there a way to implement a "soft reset"? Like a jump to the
> startadress but something that clears the stack as well, is this
> possible?
> Or perhaps it's unnecessary? If the stack is FIFO type it might not be a
> problem? Are there any other things (registers)  to consider?
>
> Regards,
> Johnny Lindholm
> [Note: In Sweden it's perfectly okay to be given the name of "Johnny" so
> that is my real name, not a nick for "John"...  ;o)  ]

You can pull ~MClr to Ground - perhaps with a (diode, logic, RC low-pass
filter) 'gate' in front to force you to do something unusual to pull
~MClr low.  (unusual combination of pin states, or a normal state but
for a way long duty cycle.)  Or connect a PIC's pin directly, if you
have a spare PIC Pin (Ha!  That'll be the day! <G>)

I'm not current on stack clearing - Vaguely remember "you cannot get
there from here", but am not SURE of it - Do know a little hardware will
get you there by forcing ~MClr low, definitely.

 Mark

2000\03\23@145448 by Robert Rolf

picon face
Mark Willis wrote:
> Johnny Lindholm wrote:
> > Hi all!
> > Is there a way to implement a "soft reset"? Like a jump to the
> > startadress but something that clears the stack as well, is this
> > possible?
> > Or perhaps it's unnecessary? If the stack is FIFO type it might not

It's unnecessary.

The stack is implemented in hardware and behaves like a circular
queue. Falling off the bottom simply wraps around to the top. It is
irrelevant to your code where the pointer starts. You can only
push 8 levels before you wrap and get major problems.

be a
> > problem? Are there any other things (registers)  to consider?

On stack overflow? Clearing INTCON to stop further overflows
comes to mind.

Reset does restore a bunch of bits to known states, but one
shouldn't write code that 'assumes' bits are a certain way (unless
you like it to break easily). Init -everything- that needs to
be init'd, and then you'll -know- that a jump to the reset vector
will get you restarted correctly. Clearing the INTCON register (to
prevent interrupts) should be the first thing you do in a 'recovery'
routine.

Robert

2000\03\23@153727 by paulb

flavicon
face
Johnny Lindholm wrote:

> Is there a way to implement a "soft reset"? Like a jump to the
> startadress but something that clears the stack as well, is this
> possible?

 No.

> Or perhaps it's unnecessary?

 It is indeed, unnecessary to clear the stack.

>  If the stack is FIFO type it might not be a problem?

 It's not that it's a FIFO which it obviously must be.  It's that it is
circular - overloading it loses the first entry each time.  If at any
time you consider it "empty" and thereafter only call it as many times
as its depth permits, and do no more RETURNs than you did CALLs prior
(which is always a requirement of course), you would never notice that
it was not "clear".

> Are there any other things (registers) to consider?

 Yes, but if your reset code makes *no* assumptions (such as RB0 being
clear to start, which is commonly assumed) and initialises everything
you wish to use, then all should be well.
--
 Cheers,
       Paul B.

More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...