Project

General

Profile

Statistics
| Revision:

root / trunk / code / projects / colonet / utilities / dragonfly_wireless_relay / reset.c @ 13

History | View | Annotate | Download (540 Bytes)

1 13 emarinel
/*
2
reset.h - contains reset() function that resets the AVR
3
author: James Kong
4

5
Last Modified:
6

7
3.7.2007 - James
8
    created reset.c
9
*/
10
11
#include <avr/interrupt.h>
12
#include <util/delay.h>
13
#include <reset.h>
14
15
/*
16
Resets the AVR when called.  Sets the watchdog timer and lets it overflow
17
to reset the AVR.  The reset clears all memory and resets all registers
18
with the exception of the Watchdog Reset Flag (WDRF) in the MCU Control
19
and Status Register (MCUCSR).
20
*/
21
void reset(void)
22
{
23
    WDTCR &= 0xF8;
24
    WDTCR |= 0x08;
25
    _delay_ms(15);
26
}