{"id":363,"date":"2019-03-07T10:22:54","date_gmt":"2019-03-07T10:22:54","guid":{"rendered":"https:\/\/arduino-developer.com\/arduino\/?p=363"},"modified":"2020-02-27T11:50:46","modified_gmt":"2020-02-27T11:50:46","slug":"enabling-the-arduino-watchdog-timer-wdt","status":"publish","type":"post","link":"https:\/\/arduino-developer.com\/arduino\/programming\/watchdog-timer\/enabling-the-arduino-watchdog-timer-wdt","title":{"rendered":"Enabling the Arduino Watchdog Timer (WDT)"},"content":{"rendered":"\n<h5 class=\"wp-block-heading\">Include the header file:<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;avr\/wdt.h><\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">Enable the WDT<\/h5>\n\n\n\n<p>Typically in your applications setup() function<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wdt_enable(WDTO_1S);<\/code><\/pre>\n\n\n\n<p><em>Possible issue: We&#8217;ve had issues with the watchdog enabled and program uploading never leaving the &#8220;Uploading&#8230;&#8221; stage, where disabling the watchdog would fix the issue.   There may be a need to delay turning on the WDT at start &#8211; TBC.<\/em><\/p>\n\n\n\n<p>Available time periods:<\/p>\n\n\n\n<p>ATMega 8, 168, 328, 1280, 2560:<br>WDTO_15MS (15 ms )<br>WDTO_30MS (30 ms)<br>WDTO_60MS (60 ms)<br>WDTO_120MS (120 ms)<br>WDTO_250MS (250 ms)<br>WDTO_500MS (500 ms)<br>WDTO_1S (1 sec)<br>WDTO_2S (2 sec)<br><\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Reset the watchdog<\/h5>\n\n\n\n<p>For instance in your main loop<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wdt_reset();<\/code><\/pre>\n\n\n\n<p><br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Include the header file: Enable the WDT Typically in your applications setup() function Possible issue: We&#8217;ve had issues with the watchdog enabled and program uploading never leaving the &#8220;Uploading&#8230;&#8221; stage, where disabling the watchdog would fix the issue. There may be a need to delay turning on the WDT at start &#8211; TBC. Available time [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[37],"tags":[],"class_list":["post-363","post","type-post","status-publish","format-standard","hentry","category-watchdog-timer"],"_links":{"self":[{"href":"https:\/\/arduino-developer.com\/arduino\/wp-json\/wp\/v2\/posts\/363","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/arduino-developer.com\/arduino\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/arduino-developer.com\/arduino\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/arduino-developer.com\/arduino\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/arduino-developer.com\/arduino\/wp-json\/wp\/v2\/comments?post=363"}],"version-history":[{"count":2,"href":"https:\/\/arduino-developer.com\/arduino\/wp-json\/wp\/v2\/posts\/363\/revisions"}],"predecessor-version":[{"id":554,"href":"https:\/\/arduino-developer.com\/arduino\/wp-json\/wp\/v2\/posts\/363\/revisions\/554"}],"wp:attachment":[{"href":"https:\/\/arduino-developer.com\/arduino\/wp-json\/wp\/v2\/media?parent=363"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/arduino-developer.com\/arduino\/wp-json\/wp\/v2\/categories?post=363"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/arduino-developer.com\/arduino\/wp-json\/wp\/v2\/tags?post=363"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}