0
\$\begingroup\$
  • I am using PIC18F67K22 controller in my circuit.

  • I don't know how to enable or configure Watch Dog Timers(WDT) in my controller.

  • Any one have explanation with some demo code of Enable Watch Dog Timer ???

regards,

shailesh

\$\endgroup\$
  • 4
    \$\begingroup\$ Pages 419-420 of the PIC18F67K22 datasheet seem pretty clear. What specifically are you having trouble with? \$\endgroup\$ – Dave Tweed Oct 18 '13 at 13:02
  • \$\begingroup\$ Here you have a step-by-step on what it is and how to set it up: gooligum.com.au/tutorials/baseline/PIC_Base_A_7.pdf \$\endgroup\$ – woliveirajr Oct 18 '13 at 13:06
  • 2
    \$\begingroup\$ -1 for clearly not even looking at the datasheet. \$\endgroup\$ – Olin Lathrop Oct 18 '13 at 13:09
  • 3
    \$\begingroup\$ This question doesn't belong here since it is answered clearly and directly in the datasheet. We are not here to read the datasheet for you. \$\endgroup\$ – Olin Lathrop Oct 18 '13 at 13:11
  • 1
    \$\begingroup\$ This isn't obvious to a newcomer: control registers can be confusing, and the WDT can be particularly intimidating to new comers (I always left it off until I was more comfortable with the feature). There are two ways of setting it: 1. you can set it in code at initialization, or 2. MPLab has a "Configure" menu, select this, then select "Configuration Bits...", and here you can setup the crystal, WDT and other device specific configurations. Be careful with your configuration initialization. \$\endgroup\$ – Bob Oct 18 '13 at 17:08
3
\$\begingroup\$

Set the 0th bit in WDTCON register

WDTCON.0 = 1

The rest of the bits in WDTCON let you configure this peripheral, see datasheet for more brief notes. In this context, datasheets and microcontroller-header are your best-friends.

enter image description here

Note: Before you enable SWDTEN, You will have to make sure WDTEN is disabled, else you wouldn't be able to enable Watchdog Timer via SWDTEN. This can be done by clearing WDTEN bits in CONFIG2H Register.

\$\endgroup\$
  • \$\begingroup\$ You mean init of WDT is only set this bit??? How to use this two function "char isWDTTO(void)" and "char isWDTWU(void)"?? \$\endgroup\$ – shail korat Oct 18 '13 at 13:11
  • \$\begingroup\$ Yes. That sounds like a new question where you'd want to submit its code. Based on a small search, it's a method to detect if reset is required. \$\endgroup\$ – Iancovici Oct 18 '13 at 13:19

Not the answer you're looking for? Browse other questions tagged or ask your own question.