Searching \ for '[PIC]: How to reset PIC (without WDT enabled) by t' 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/microchip/devices.htm?key=pic
Search entire site for: 'How to reset PIC (without WDT enabled) by t'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: How to reset PIC (without WDT enabled) by t'
2001\08\11@115403 by Wojciech Zabolotny

flavicon
picon face
Hi All,

I need a possibility to reset the PIC by the software (after receiving
a special command via serial interface). The design does not use WDT
(otherwise it would be enough to stop executing the CLRWDT commands).

The simplest solution is to tie one of output pins to the ~MCLR pin (maybe
via a small resistor). After reset that in is in high impedance state
so it does not change the behaviour of the reset circuit, then it may be
repogrammed by the software to the output with "0" level, causing the PIC to
reset.

Is it really the simplest way to achieve my goal? Can it be done without
loosing one pin (and resistor)?
--
                       TIA & Regards
                       Wojciech Zabolotny
                       spam_OUTwzabTakeThisOuTspamise.pw.edu.pl

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\08\12@013947 by Jinx

face picon face
> The design does not use WDT (otherwise it would be enough
> to stop executing the CLRWDT commands)

Not possible in your design to use WDT and do that ?

> Is it really the simplest way to achieve my goal? Can it be done
> without loosing one pin (and resistor) ?

Why not jump to your start address and set registers as you
would want them

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\08\12@043056 by wzab

flavicon
picon face
On Sun, Aug 12, 2001 at 05:38:33PM +1200, Jinx wrote:
> > The design does not use WDT (otherwise it would be enough
> > to stop executing the CLRWDT commands)
>
> Not possible in your design to use WDT and do that ?

Unfortunately not.

> > Is it really the simplest way to achieve my goal? Can it be done
> > without loosing one pin (and resistor) ?
>
> Why not jump to your start address and set registers as you
> would want them

Too many things to clean up. (Additionally the "software reset" should be
triggered from the interrupt routine).
--
                             Wojciech M. Zabolotny
       http://www.ise.pw.edu.pl/~wzab  <--> .....wzabKILLspamspam@spam@ise.pw.edu.pl

http://www.debian.org  Linux - free OS for free people!

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\08\12@044549 by Quentin

flavicon
face
Wojciech Zabolotny wrote:
>
> On Sun, Aug 12, 2001 at 05:38:33PM +1200, Jinx wrote:
> > > The design does not use WDT (otherwise it would be enough
> > > to stop executing the CLRWDT commands)
> >
> > Not possible in your design to use WDT and do that ?
>
> Unfortunately not.
You don't have to have WDT on all the time. When you want to do the
reset, you switch it on and let it time out. You don't even use CLRWDT.
When your code restarts, you switch it off in your init routine.
>
> > > Is it really the simplest way to achieve my goal? Can it be done
> > > without loosing one pin (and resistor) ?
> >
> > Why not jump to your start address and set registers as you
> > would want them
>
> Too many things to clean up. (Additionally the "software reset" should be
> triggered from the interrupt routine).
WDT can be switch on in ISR. Personally, I prefer the GOTO 0 routine,
but that's me.

Quentin

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\08\12@051952 by Jinx

face picon face
> Is it really the simplest way to achieve my goal? Can it be
> done without loosing one pin (and resistor)?

Do you have two output pins that have an unused truth table
combination you could put through a logic gate ? For example
if the two pins are normally never high or low at the same time
you could AND or NAND them as a reset control. Maybe you
have a spare gate in the circuit ?

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\08\12@075537 by wzab

flavicon
picon face
On Sun, Aug 12, 2001 at 10:40:11AM +0200, Quentin wrote:
> You don't have to have WDT on all the time. When you want to do the
> reset, you switch it on and let it time out. You don't even use CLRWDT.
> When your code restarts, you switch it off in your init routine.

My platform is 16F877 and 16C774 (the software should be almost the same
for both chips). AFAIK the WDT is enabled by CONFIG word. How can
I enable/disable it in software?

> > Too many things to clean up. (Additionally the "software reset" should be
> > triggered from the interrupt routine).
> WDT can be switch on in ISR. Personally, I prefer the GOTO 0 routine,
> but that's me.

Well, if I could imitate the RESET by "goto 0", I would be glad.
But there are a few problems:
1) I need to convert my "interrupt thread" into the "main thread",
  is setting of GIE, PEIE... enough to achieve it?
2) I should extend my INIT routine so that it sets the initial values in all
  important registers...
--
                               TIA & Regards,
                             Wojciech M. Zabolotny
       http://www.ise.pw.edu.pl/~wzab  <--> wzabspamKILLspamise.pw.edu.pl

http://www.debian.org  Use Linux - an OS without "trojan horses" inside

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\08\12@091356 by Byron A Jeff

face picon face
On Sun, Aug 12, 2001 at 01:53:22PM +0200, Wojciech Zabolotny wrote:
> On Sun, Aug 12, 2001 at 10:40:11AM +0200, Quentin wrote:
> > You don't have to have WDT on all the time. When you want to do the
> > reset, you switch it on and let it time out. You don't even use CLRWDT.
> > When your code restarts, you switch it off in your init routine.
>
> My platform is 16F877 and 16C774 (the software should be almost the same
> for both chips). AFAIK the WDT is enabled by CONFIG word. How can
> I enable/disable it in software?

Actually Woj, all PIC are like that. The WDT is not program configurable. If
it were it wouldn't be very useful because if your chip wanders into the weeds
it could come across some code that disables the WDT.

The best you can do is to use the prescalar on the WDT to extend the timeout
time.

{Quote hidden}

Not sure.

> 2) I should extend my INIT routine so that it sets the initial values in all
>    important registers...

Good programming pratice dictates that you should do this anyway.

But in answer to your original question, Tying a I/O pin to MCLR is your
best bet. Completely reliable. Extremely simple.

BAJ

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\08\12@093332 by Jinx

face picon face
> Well, if I could imitate the RESET by "goto 0", I would be glad.
> But there are a few problems:

> 1) I need to convert my "interrupt thread" into the "main thread",
>    is setting of GIE, PEIE... enough to achieve it?

Unfortunately you know your program flow better than we do so
that's a little hard to answer. Just think of the ISR as just another
routine. The RTI address that will be unresolved by goto 0 from
the ISR will eventually be over-written (if that even matters at all)

> 2) I should extend my INIT routine so that it sets the initial values
> in all  important registers...

The data book will show the post-reset state of the micro's registers.
These will also be how they will have been set when you power up,
so you're already dealing with that. That leaves just your RAM
locations, which are also dealt with by the program you have now,
so goto 0 doesn't seem to present a problem

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\08\12@094554 by mike

flavicon
face
On Sun, 12 Aug 2001 10:40:11 +0200, you wrote:

>Wojciech Zabolotny wrote:
>>
>> On Sun, Aug 12, 2001 at 05:38:33PM +1200, Jinx wrote:
>> > > The design does not use WDT (otherwise it would be enough
>> > > to stop executing the CLRWDT commands)
>> >
>> > Not possible in your design to use WDT and do that ?
>>
>> Unfortunately not.
>You don't have to have WDT on all the time. When you want to do the
>reset, you switch it on and let it time out. You don't even use CLRWDT.
>When your code restarts, you switch it off in your init routine.
You can't do this on the PIC - the WDT on/off state is selected at
programming time.
>> > > Is it really the simplest way to achieve my goal? Can it be done
>> > > without loosing one pin (and resistor) ?

>> > Why not jump to your start address and set registers as you
>> > would want them
>>
>> Too many things to clean up. (Additionally the "software reset" should be
>> triggered from the interrupt routine).
The fact that it's triggered by an interrupt routine shouldn't be an
issue - the stack is cyclic and so doesn't need reinitialisation. If
you initialise all the registers it should be OK. If there is some
problem, have your int routine set a bit which causes the foreground
code to fake a reset.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\08\12@103357 by alice campbell

flavicon
face
-----Original Message-----
From: Jinx <.....joecolquittKILLspamspam.....CLEAR.NET.NZ>
Date:         Mon, 13 Aug 2001 01:32:13 +1200
To: EraseMEPICLISTspam_OUTspamTakeThisOuTMITVMA.MIT.EDU
Subject:      Re: [PIC]: How to reset PIC (without WDT enabled) by the s/w)

Perhaps you might check the status register bits for powerup and timeout, and make separate initilization routines depending on whether this is a powerup, a watchdog reset, an MCLR event, or a manual reset, and set things appropriately.

alice



{Quote hidden}

--

_______________________________________________
FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup

Talk More, Pay Less with Net2Phone Direct(R), up to 1500 minutes free!
http://www.net2phone.com/cgi-bin/link.cgi?143

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\08\12@120700 by Olin Lathrop

face picon face
> You don't have to have WDT on all the time. When you want to do the
> reset, you switch it on and let it time out.

The watchdog timer is enable in the configuration fuses and can not be
enabled/disabled at run time.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinspamspam_OUTembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\08\12@120705 by Olin Lathrop

face picon face
> The simplest solution is to tie one of output pins to the ~MCLR pin (maybe
> via a small resistor). After reset that in is in high impedance state
> so it does not change the behaviour of the reset circuit, then it may be
> repogrammed by the software to the output with "0" level, causing the PIC
to
> reset.

Depends on how much of the PIC you want to reset and for what purpose, and
what part of the overall system you don't trust that motivates the reset in
the first place.  With properly written code you can jump to 0 to
effectively reset things.

I don't understand why you need to do a hard reset.  You should step back
and make sure this isn't a kludge around a bad design.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, @spam@olinKILLspamspamembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\08\12@132301 by Quentin

flavicon
face
Olin Lathrop wrote:
>
> > You don't have to have WDT on all the time. When you want to do the
> > reset, you switch it on and let it time out.
>
> The watchdog timer is enable in the configuration fuses and can not be
> enabled/disabled at run time.
Yes, my bad. I have never used it this way, but I remember somebody
mentioned reseting this way a few weeks ago instead of Goto 0, but my
memory failed me and I over looked the obvious. :)
Had a look back to that thread, they use WDT and then go to:
loop    goto    loop

Sorry Wojciech!

Quentin

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\08\12@142123 by Andy Jancura

picon face
Hello,

the best, if you have an reset IC in the circuit, use one with manual reset
input and connect IO pin to this input. When you use the GOTO 0, the
registers may not be set-up correctly with software. Another way may be the
PIC18 family with RESET instruction.

Andrej




Hi All,

I need a possibility to reset the PIC by the software (after receiving
a special command via serial interface). The design does not use WDT
(otherwise it would be enough to stop executing the CLRWDT commands).

The simplest solution is to tie one of output pins to the ~MCLR pin (maybe
via a small resistor). After reset that in is in high impedance state
so it does not change the behaviour of the reset circuit, then it may be
repogrammed by the software to the output with "0" level, causing the PIC to
reset.

Is it really the simplest way to achieve my goal? Can it be done without
loosing one pin (and resistor)?
--
                       TIA & Regards
                       Wojciech Zabolotny
                       KILLspamwzabKILLspamspamise.pw.edu.pl



_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\08\13@041609 by Vasile Surducan

flavicon
face
On Sun, 12 Aug 2001, Olin Lathrop wrote:

>
> I don't understand why you need to do a hard reset.  You should step back
> and make sure this isn't a kludge around a bad design.

 Olin, if you remember, a while ago I've asked the same question. My
purpose was an autobaud asynchronous routine. This sort of routines have
usual a calibration character. Well, I've done it without this, but I need
a reset. I'm still search for good  software reset. Else I can't switch
from 115200 bauds to one step backward ( measured in standard baud rate ).
This could be a good reason, or do you have another method ?

Cheers, Vasile ( Washington behind bars, remember ? )

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


2001\08\13@080840 by Olin Lathrop

face picon face
>   Olin, if you remember, a while ago I've asked the same question. My
> purpose was an autobaud asynchronous routine. This sort of routines have
> usual a calibration character. Well, I've done it without this, but I need
> a reset. I'm still search for good  software reset. Else I can't switch
> from 115200 bauds to one step backward ( measured in standard baud rate ).
> This could be a good reason, or do you have another method ?

You don't need to reset the processor to change the baud rate, just change
the SPBRG register and possibly the BRGH bit in TXSTA.

> ( Washington behind bars, remember ? )

No, what are you referring to here?


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, spamBeGoneolinspamBeGonespamembedinc.com, http://www.embedinc.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email TakeThisOuTlistservEraseMEspamspam_OUTmitvma.mit.edu with SET PICList DIGEST in the body


2001\08\13@131114 by Mike Mansheim

flavicon
face
> I need a possibility to reset the PIC by the software (after receiving
> a special command via serial interface). The design does not use WDT
> (otherwise it would be enough to stop executing the CLRWDT commands).

This was recently discussed, where I mentioned I was causing a reset
using the watchdog.  It was suggested that such a reset was unnecessary,
and that 'goto 0' with the registers properly set up was all that was
required.  Might that work for you?

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservspamTakeThisOuTmitvma.mit.edu with SET PICList DIGEST in the body


2001\08\14@073439 by Vasile Surducan

flavicon
face
On Mon, 13 Aug 2001, Olin Lathrop wrote:

> >   Olin, if you remember, a while ago I've asked the same question. My
> > purpose was an autobaud asynchronous routine. This sort of routines have
> > usual a calibration character. Well, I've done it without this, but I need
> > a reset. I'm still search for good  software reset. Else I can't switch
> > from 115200 bauds to one step backward ( measured in standard baud rate ).
> > This could be a good reason, or do you have another method ?
>
> You don't need to reset the processor to change the baud rate, just change
> the SPBRG register and possibly the BRGH bit in TXSTA.
>
 Its's not enough. Will work only first time after a reset. I've tested.
Next time when will come a character with other baud rate, the receiver
it's still stick on the old baudrate and a frame error will occur. Before
setting a new value for SPBRG and BRGH, a reset must be produced and new
values could be written in those register.

Vasile

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestEraseMEspam.....mitvma.mit.edu


2001\08\14@101622 by Jeff DeMaagd

flavicon
face
----- Original Message -----
From: Vasile Surducan <EraseMEvasilespamL30.ITIM-CJ.RO>
> > You don't need to reset the processor to change the baud rate, just
change
> > the SPBRG register and possibly the BRGH bit in TXSTA.
>
>   Its's not enough. Will work only first time after a reset. I've tested.
> Next time when will come a character with other baud rate, the receiver
> it's still stick on the old baudrate and a frame error will occur. Before
> setting a new value for SPBRG and BRGH, a reset must be produced and new
> values could be written in those register.

Is that what the data sheet suggests?  I'm curious why this needs to happen,
I am thinking maybe part of the procedure is being left out here, but I
don't know.

Jeff

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestEraseMEspamEraseMEmitvma.mit.edu


2001\08\14@120740 by Olin Lathrop

face picon face
>   Its's not enough. Will work only first time after a reset. I've tested.
> Next time when will come a character with other baud rate, the receiver
> it's still stick on the old baudrate and a frame error will occur. Before
> setting a new value for SPBRG and BRGH, a reset must be produced and new
> values could be written in those register.

I know you say you've tested this, but I still find this very hard to
believe.  Did you try completely disabling the UART, changing the baud rate,
then enabling the UART again?  I have a feeling something else was going on
in your test that made it appear as if the processor had to be reset to
change baud rate.

I don't have time to test this now myself, but this is just too bizarre for
me to believe without seeing it myself where I can carefully control the
conditions to my own satisfaction.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, RemoveMEolinspam_OUTspamKILLspamembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestTakeThisOuTspamspammitvma.mit.edu


2001\08\14@123131 by Alan B. Pearce

face picon face
>>   Its's not enough. Will work only first time after a reset. I've tested.
>> Next time when will come a character with other baud rate, the receiver
>> it's still stick on the old baudrate and a frame error will occur. Before
>> setting a new value for SPBRG and BRGH, a reset must be produced and new
>> values could be written in those register.

>I know you say you've tested this, but I still find this very hard to
>believe.  Did you try completely disabling the UART, changing the baud
rate,
>then enabling the UART again?  I have a feeling something else was going on
>in your test that made it appear as if the processor had to be reset to
>change baud rate.

>I don't have time to test this now myself, but this is just too bizarre for
>me to believe without seeing it myself where I can carefully control the
>conditions to my own satisfaction.


I do not believe it either. Have a look in the archive for some code that
someone posted where they change the baud rate on the fly, using the A/D
converter and a pot as the input method to get the new baud rate. If there
really are problems like you describe, then this should show you how to
overcome them.

--
http://www.piclist.com hint: To leave the PICList
EraseMEpiclist-unsubscribe-requestspamspamspamBeGonemitvma.mit.edu


2001\08\14@164720 by Bob Ammerman

picon face
I agree with Olin.

Disabling and reenabling the serial port ought to be enough to get this
straight.

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)



{Original Message removed}

2001\08\14@182847 by Tony Nixon

flavicon
picon face
Olin Lathrop wrote:
>
> >   Its's not enough. Will work only first time after a reset. I've tested.
> > Next time when will come a character with other baud rate, the receiver
> > it's still stick on the old baudrate and a frame error will occur. Before
> > setting a new value for SPBRG and BRGH, a reset must be produced and new
> > values could be written in those register.
>
> I know you say you've tested this, but I still find this very hard to
> believe.  Did you try completely disabling the UART, changing the baud rate,
> then enabling the UART again?  I have a feeling something else was going on
> in your test that made it appear as if the processor had to be reset to
> change baud rate.
>
> I don't have time to test this now myself, but this is just too bizarre for
> me to believe without seeing it myself where I can carefully control the
> conditions to my own satisfaction.


I've got an idea I got caught with this also.

It was a while ago, but from memory I had to transmit a dummy byte to
"flush" the UART and then it would work ok.


--
Best regards

Tony

mICros
http://www.bubblesoftonline.com
RemoveMEsalesKILLspamspambubblesoftonline.com

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestSTOPspamspamspam_OUTmitvma.mit.edu


2001\08\16@023054 by Vasile Surducan

flavicon
face
On Tue, 14 Aug 2001, Olin Lathrop wrote:

> >   Its's not enough. Will work only first time after a reset. I've tested.
> > Next time when will come a character with other baud rate, the receiver
> > it's still stick on the old baudrate and a frame error will occur. Before
> > setting a new value for SPBRG and BRGH, a reset must be produced and new
> > values could be written in those register.
>
> I know you say you've tested this, but I still find this very hard to
> believe.  Did you try completely disabling the UART, changing the baud rate,
> then enabling the UART again?

I will check again how I done UART disabling and re-enabling. The problem
could be here. Thanx.
Vasile

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\08\16@023156 by Vasile Surducan

flavicon
face
On Tue, 14 Aug 2001, Alan B. Pearce wrote:

{Quote hidden}

 don't you remember the whole subject name ?
 Thanks, Vasile

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\08\16@032346 by dr. Imre Bartfai

flavicon
face
Hi,
it is enough to clear the OERR (and maybe the FERR) bit. If all other
fails, turn reception off by clearing CREN, set the new baud rate, and
turn it on again. Be aware to empty the FIFO!

I hope this helps.
Regards,
Imre



+-----------------------------------------------------------------------+
| The information transmitted is intended only for the person or entity |
| to which it is addressed and may contain confidential and/or          |
| privileged material.  Any review, retransmission, dissemination or    |
| other use of, or taking of any action in reliance upon, this          |
| information by persons or entities other than the intended recipient  |
| is prohibited. If you received this in error, please contact the      |
| sender and delete the material from any computer.                     |
+-----------------------------------------------------------------------+

On Tue, 14 Aug 2001, Vasile Surducan wrote:

{Quote hidden}

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\08\16@034555 by Vasile Surducan

flavicon
face
Thank's very much Imre !
Laci



On Thu, 16 Aug 2001, dr. Imre Bartfai wrote:

{Quote hidden}

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\08\16@040441 by Alan B. Pearce

face picon face
>>Have a look in the archive for some code that
>> someone posted where they change the baud rate on the fly, using the A/D
>> converter and a pot as the input

>don't you remember the whole subject name ?
>  Thanks, Vasile

I just remember it being in the interfacing section on UARTS. I saw it there
recently when looking for some other code examples.

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


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