Searching \ for '[PIC] WDT wake-up sanity check' 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: 'WDT wake-up sanity check'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] WDT wake-up sanity check'
2005\05\11@143442 by peiserma

flavicon
face
I need a sanity check on WDT wake-up from sleep. I thought I understand
it, but MPSIM is giving different results.

I'm working with a 12F675. I want it to power down via the sleep
instruction, but periodically wake up, perform some work, and then go
back to sleep. The exact timing between wake-ups is not critical.

I interpret table 10-6 in conjunction with the STATUS register to say if
WDT occurs after the SLEEP instruction was issued, then both /TO and /PD
bits should be cleared (***). In the simulator, the /TO bit is actually
set after the WDT, not cleared as I interpreted from the datasheet.

Is this a problem with the simulator, or am I doing something
fundamentally wrong? To summarize: issue SLEEP command, let the WDT bring
the device out of sleep, perform some work, and repeat.

Thanks for any insight,
Phil Eisermann.

(***) what's the convention for writing active-low signals in a text
editor? I used "/TO" to indicate "NOT TO", but have also seen !TO used.

2005\05\11@150849 by Jose Da Silva

flavicon
face
On May 11, 2005 11:32 am, spam_OUTpeisermaTakeThisOuTspamridgid.com wrote:
> I need a sanity check on WDT wake-up from sleep. I thought I
> understand it, but MPSIM is giving different results.
>
> I'm working with a 12F675. I want it to power down via the sleep
> instruction, but periodically wake up, perform some work, and then go
> back to sleep. The exact timing between wake-ups is not critical.
>
> I interpret table 10-6 in conjunction with the STATUS register to say
> if WDT occurs after the SLEEP instruction was issued, then both /TO
> and /PD bits should be cleared (***). In the simulator, the /TO bit
> is actually set after the WDT, not cleared as I interpreted from the
> datasheet.

TO should be "1" after power-up, CLRWDT or Sleep.
TO is a poor indicator since you do not know if it was a sleep or reset
that triggered it. Therefore leave TO out of your program.

If you let your program run-away, then the WDT is going to reset your
micro and PD would be 1. If your micro was powered-up, then PD is 1.
If you performed a Sleep, then PD is 0.

Since you are doing a sleep, then use PD to differentiate between a
reset-power-up and a sleep-power-up. If your program is overly
complicated, you may want to insert a pair of checksum bytes in RAM,
let's say AAh:55h and if you didn't find those there, then you are
fairly sure you are dealing with a power-up and not a WDT type of
reset.
If your program is fairly simple and rather impossible to get stuck in a
forever-loop of any sort, then just testing PD should be adequate.

2005\05\11@162652 by peiserma

flavicon
face
piclist-bounces@mit.edu wrote:
> TO should be "1" after power-up, CLRWDT or Sleep.

yes. But it should also be '0' after WDT. At least according
to the datasheet. Hence my confusion.

> TO is a poor indicator since you do not know if it was a sleep or
> reset that triggered it. Therefore leave TO out of your program.

makes sense, since according to the datasheet TO will always be
zero after WDT.

I must still be misunderstanding something. The way I read the
tables (10-6, 10-4, and also the STATUS register), TO should always
be zero after WDT, whether the PIC was sleeping or not. But the
simulator shows TO to be '1' So what is it supposed to be? Is the
simulator wrong or the datasheet? Or is it my interpretation?

> If you let your program run-away, then the WDT is going to reset your
> micro and PD would be 1. If your micro was powered-up, then PD is 1.
> If you performed a Sleep, then PD is 0.
>
> Since you are doing a sleep, then use PD to differentiate between a
> reset-power-up and a sleep-power-up.

makes sense, also. my startup code does check that, along with the BOD
and POR bits.

Thanks for the input.

2005\05\11@184643 by Matthew Miller

flavicon
face
Hi,

On Wed, May 11, 2005 at 04:26:30PM -0400, .....peisermaKILLspamspam@spam@ridgid.com wrote:
> piclist-bouncesspamKILLspammit.edu wrote:
> > TO should be "1" after power-up, CLRWDT or Sleep.
>
> yes. But it should also be '0' after WDT. At least according
> to the datasheet. Hence my confusion.

Your not confused. On WDT timeout /TO will equal 0.

> > TO is a poor indicator since you do not know if it was a sleep or
> > reset that triggered it. Therefore leave TO out of your program.
>
> makes sense, since according to the datasheet TO will always be
> zero after WDT.

I don't agree about leaving /TO out of the program. The datasheet seems
pretty clear that on reset /TO is 1. I've got a program on a 12F629 right
now where I check for timeouts using this bit.

> I must still be misunderstanding something. The way I read the
> tables (10-6, 10-4, and also the STATUS register), TO should always
> be zero after WDT, whether the PIC was sleeping or not. But the
> simulator shows TO to be '1' So what is it supposed to be? Is the
> simulator wrong or the datasheet? Or is it my interpretation?

When I see something like this happen in MPLAB I just close and restart the
program. I've had to do this plenty of times with MPLAB 6.x when, for
instance, "movlw 0xf4" would be executed and the watch window would show a
completely different value for W. What version of MPLAB are you using?

Take care, Matthew.

--
"We do not embrace reason at the expense of emotion. We embrace it at the
expense of self-deception." -- Herbert Muschamp

2005\05\12@080203 by peiserma

flavicon
face
piclist-bounces@mit.edu wrote:
> Hi,
>
> On Wed, May 11, 2005 at 04:26:30PM -0400, .....peisermaKILLspamspam.....ridgid.com wrote:
>> EraseMEpiclist-bouncesspam_OUTspamTakeThisOuTmit.edu wrote:
>>> TO should be "1" after power-up, CLRWDT or Sleep.
>>
>> yes. But it should also be '0' after WDT. At least according
>> to the datasheet. Hence my confusion.
>
> Your not confused. On WDT timeout /TO will equal 0.

that's what I thought. I'm just not seeing it in the simulator.

> When I see something like this happen in MPLAB I just close and
> restart the program. I've had to do this plenty of times with MPLAB
> 6.x when, for instance, "movlw 0xf4" would be executed and the watch
> window would show a completely different value for W. What version of
> MPLAB are you using?

I'm using version 7.10. I did some experimenting with the simulator
this morning and found the /TO bit is '1' following a WDT if:
-the device goes to sleep OR
-WDT timer expires and simulator is set to 'break on WDT'

/TO is correctly '0' if the WDT expires without going to sleep and
the simulator is set to 'reset on WDT'

This seems to be a simulator issue. Has anyone else observed this?

2005\05\12@111128 by Peter

picon face


On Wed, 11 May 2005 peisermaspamspam_OUTridgid.com wrote:

> editor? I used "/TO" to indicate "NOT TO", but have also seen !TO used.

There is also ~TO and -TO and _TO in case those characters are not
allowed in symbols ;-)

Peter

2005\05\12@120256 by Alan B. Pearce

face picon face
>> editor? I used "/TO" to indicate "NOT TO",
>> but have also seen !TO used.
>
>There is also ~TO and -TO and _TO in case those
>characters are not allowed in symbols ;-)

Another one would be T0* to signal the negation.

2005\05\13@141657 by Peter

picon face

>> There is also ~TO and -TO and _TO in case those
>> characters are not allowed in symbols ;-)
>
> Another one would be T0* to signal the negation.

TO* contains a character that is illegal in a symbol in most lanuages
;-)

Peter

2005\05\14@032341 by Jose Da Silva

flavicon
face
On May 13, 2005 11:16 am, Peter wrote:
> >> There is also ~TO and -TO and _TO in case those
> >> characters are not allowed in symbols ;-)
> >
> > Another one would be T0* to signal the negation.
>
> TO* contains a character that is illegal in a symbol in most lanuages
> ;-)

My CAD package uses !TO, but it's older than some of the users on this
forumn  hehehe.

2005\05\16@043755 by Alan B. Pearce

face picon face
>>> There is also ~TO and -TO and _TO in case those
>>> characters are not allowed in symbols ;-)
>>
>> Another one would be T0* to signal the negation.
>
>TO* contains a character that is illegal in a symbol in most lanuages
>;-)

fair enough, but I have seen that nomenclature used on circuit diagrams.

2005\05\16@085213 by peiserma

flavicon
face
piclist-bounces@mit.edu wrote:
>>>> There is also ~TO and -TO and _TO in case those
>>>> characters are not allowed in symbols ;-)
>>>
>>> Another one would be T0* to signal the negation.
>>
>> TO* contains a character that is illegal in a symbol in most lanuages
>> ;-)
>
> fair enough, but I have seen that nomenclature used on circuit
> diagrams.

So it seems that prepending the symbols "!" (logical NOT as used in
the C language), "~" (bitwise negation e.g. ones complement, also
used in C) and "/" are commonly understood. Was curious which symbols
people are familiar with. I'll stick  to one of those three in the
future.





2005\05\16@152539 by Peter

picon face

On Mon, 16 May 2005, Alan B. Pearce wrote:

>>>> There is also ~TO and -TO and _TO in case those
>>>> characters are not allowed in symbols ;-)
>>>
>>> Another one would be T0* to signal the negation.
>>
>> TO* contains a character that is illegal in a symbol in most lanuages
>> ;-)
>
> fair enough, but I have seen that nomenclature used on circuit diagrams.

That's understandable because old schematics and printouts would make it
hard to discern between a _ and a smudge ;-(

Peter

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