CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Why PIC18 has only watchdog time set in fuses?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Eduardo__



Joined: 23 Nov 2011
Posts: 197
Location: Brazil

View user's profile Send private message

Why PIC18 has only watchdog time set in fuses?
PostPosted: Thu Apr 19, 2012 12:10 pm     Reply with quote

Why PIC18 has only watchdog time set in fuses?

I was thinking: Why Microchip changed PIC18 WDT feature function for changing only using #fuses? Question
_________________
Eduardo Guilherme Brandt
Ttelmah



Joined: 11 Mar 2010
Posts: 19518

View user's profile Send private message

PostPosted: Thu Apr 19, 2012 2:55 pm     Reply with quote

To do the job it is really 'meant' to do, ideally it'd be basically impossible to change _anything_ about the watchdog, once the chip is running!....
Remember that every thing that allows you to stop, or increase the time delay associated with it, increases the risk of it being interfered with incorrectly by software. Sharing the use of the timer prescaler, increased the risk of something being incorrectly changed, and stopping it resetting the chip when it should. So the watchdog can on later chips be set to start when the chip starts, with no option to change anything, except reset the timer. You do still have the option of stopping it in software (if this is enabled), and if you want to have an extended timeout, then you can do this by implementing (say) a tick interrupt, and have this count down another register, resetting the watchdog, till this reached zero, to give programmable timeout's.
Problem is that since a lot of people use the watchdog for 'other tasks', the lack of flexibility can be annoying, but it really is better practice in terms of fulfilling the real aim of the watchdog.

Best Wishes
Eduardo__



Joined: 23 Nov 2011
Posts: 197
Location: Brazil

View user's profile Send private message

PostPosted: Fri Apr 20, 2012 7:10 am     Reply with quote

Thank you Ttelmah.


What do you think of using WDT to wakeup from sleep? Is it a good practice?
_________________
Eduardo Guilherme Brandt
Ttelmah



Joined: 11 Mar 2010
Posts: 19518

View user's profile Send private message

PostPosted: Fri Apr 20, 2012 7:46 am     Reply with quote

If you want a reasonably accurate time, use a watch crystal, and timer1. Much more flexible and accurate, and typically draws less power than the WDT oscillator...
It is one of those "can't really get your head round why Microchip do it this way". I'd much prefer to have the watchdog as a completely separate system, only used for it's real job, and for them to have offered a separated timer to do the wake up. They do this with Timer1, but at a cost of two pins. They approach this, on some of the nanowatt chips. The actual number of gates used by these parts of the chip are so small that it seems a strange shortcoming.
C'est la vie.

Best Wishes
Eduardo__



Joined: 23 Nov 2011
Posts: 197
Location: Brazil

View user's profile Send private message

PostPosted: Fri Apr 20, 2012 8:13 am     Reply with quote

Thank you Ttelmah.

Just a remark, in the case of PIC16F628A,
• Watchdog Timer Current:
- 1μA @ 2.0V, typical
• Timer1 Oscillator Current:
- 1.2μA @ 32 kHz, 2.0V, typical

really both WDT and TIMER1 oscillators have low operation currents.


Thanks for your opinion and clean information. Razz
_________________
Eduardo Guilherme Brandt
Ttelmah



Joined: 11 Mar 2010
Posts: 19518

View user's profile Send private message

PostPosted: Fri Apr 20, 2012 9:00 am     Reply with quote

On several of the PIC18 nanowatt parts, the WDT draws significantly more (typically twice) the timer1 current.

Slightly puzzled by your figure, since the minimum operating voltage for the 16F628A, is 3V.....
I _hope_ you are actually using the 16LF628A?.

Note also though that if the voltage is anything higher, then timer1 'wins' at 3v, it still only draws 1.3uA, while the WDT has risen to 2uA. At 5v, the timer goes up to 1.8uA, while the WDT has risen to 9uA. Terrible!... Smile

Best Wishes
Eduardo__



Joined: 23 Nov 2011
Posts: 197
Location: Brazil

View user's profile Send private message

PostPosted: Fri Apr 20, 2012 2:47 pm     Reply with quote

Yes, I´m using PIC16F628A from 2 to 3V, zinc-air battery powered.

But, thank you for the remark about Supply voltage versus WDT supply current.

Razz


It seems that in the real world, most of the times, we have no best option.
We´ve always several options on the wall, to choose from.

Come vous avez dit:
C´est la vie! Smile
_________________
Eduardo Guilherme Brandt
Ttelmah



Joined: 11 Mar 2010
Posts: 19518

View user's profile Send private message

PostPosted: Fri Apr 20, 2012 3:02 pm     Reply with quote

Eduardo__ wrote:
Yes, I´m using PIC16F628A from 2 to 3V, zinc-air battery powered.

But, thank you for the remark about Supply voltage versus WDT supply current.

Razz


It seems that in the real world, most of the times, we have no best option.
We´ve always several options on the wall, to choose from.

Come vous avez dit:
C´est la vie! Smile


Change your chip.....

The _F_ chip is only rated to reliably work down to 3V. You need the _LF_ part to operate down to 2v. As with most things in electronics, you may well 'get away' with running outside the specification, but it is not the way to generate things to be reliable.....

Best Wishes
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Fri Apr 20, 2012 4:45 pm     Reply with quote

Eduardo__ wrote:
What do you think of using WDT to wakeup from sleep? Is it a good practice?


It is like using a parachute to get out of an airplane. It ought to work but it won't be accurate and leaves no backup if it fails.
_________________
The search for better is endless. Instead simply find very good and get the job done.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group