Vous êtes sur la page 1sur 2

WDT_MODULE

****************************************
W D T M O D U L E
****************************************

This module is part of "Advanced Function", a collection of advanced


functions written to use the integrated peripherals of the Atmel SAM3X8E
microcontroller of the Arduino DUE board that are not supported by the
Arduino IDE.

Written by Leonardo Miliani <www DOT leonardomiliani DOT com>

The latest version of this library can be found at:


http://www.leonardomiliani.com/
or at:
https://github.com/leomil72

****************************************
VERSION HISTORY

v. 0.2.0: first working release


v. 0.1.0: first release

****************************************
INSTALL THE LIBRARY

Please refer to file README_FIRST.txt

****************************************
FUNCTIONS

Currently the library supports a part of the functions provided by the WDT
(WatchDog Timer) of the SAM3X8E. The WatchDog Timer is a timer that can reset
the microcontroller if the code becomes trapped in a deadlock. The user can
choose the interval in milliseconds between 1 and 16000.

To access the WDT clock you have to use the "wdt" object.
Its methods are the following:

wdt.enable(interval);
it sets the WDT to trigger after "interval" milliseconds if the user doesn't
reset the timer first. If interval is not passed, 16 is choosen by default.

wdt.disable();
it disables the WDT so that the WDT doesn't reset the MCU anymore

wdt.restart();
this MUST be put at the end of your code. It is needed to restart the WDT
counter
so that it cannot reset the MCU.

If the WDT counter reaches zero before the wdt.restart(), the MCU will be reset.

Page 1
WDT_MODULE
NOTE:
the WDT timer can only be set ONCE so after you had set it up, there's only
a reset to re-set it again.
If you think you won't use WDT in your sketch, put a wdt.disable() at the
very first position of setup() to disable the Watchdog timer (by default,
it resets after 16 seconds).

****************************************
IMPORTANT!

To use the Watchdog Timer module you have to edit the following file of the
Arduino core:
/arduino-1.5.x/hardware/arduino/sam/variants/arduino_due_x/variant.cpp
and comment the line #377 so that it will change from
WDT_Disable(WDT);
to
//WDT_Disable(WDT);

Keep in mind that after this modify, ALL of you sketches will have to disable
the
WDT first in order to avoid a system reset!

****************************************
LICENSE

Please refer to README_FIRST.txt

****************************************
DOCUMENT REVISION

1st revision - 2013/05/11

Page 2

Vous aimerez peut-être aussi