Index: webserver/example/EnergyMeters/Source/EnergyMeters/Meters.c =================================================================== --- webserver/example/EnergyMeters/Source/EnergyMeters/Meters.c (revision 52) +++ webserver/example/EnergyMeters/Source/EnergyMeters/Meters.c (revision 53) @@ -72,4 +72,7 @@ xSemaphoreTake( xMetersSemaphore, 1000 ); /* timeout 1 sec */ + + + feedWatchdog(); /* we need to feed the watchdog regularly */ /* Yield in case cooperative scheduling is being used. */ Index: webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/main.c =================================================================== --- webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/main.c (revision 45) +++ webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/main.c (revision 53) @@ -75,4 +75,6 @@ void setRTC(void); void startRTC(void); +void feedWatchdog(void); +void startWatchdog(void); /* @@ -113,4 +115,6 @@ int main (void) { + + startWatchdog(); startRTC(); /* start the RTC */ @@ -268,2 +272,22 @@ RTC_CCR |= 0x00000001; // Start RTC Clock } + + +void startWatchdog(void) +{ + WDCLKSEL = 2; /* feed Watchdog from RTC */ + WDTC = 32768*10; /* timeout value (gets multiplied x4) */ + WDMOD = 3; /* WDEN and WDRESET: reset microcontroller in case of time-out */ + + /* activate watchdog */ + feedWatchdog(); + +} + +void feedWatchdog(void) +{ + portENTER_CRITICAL(); + WDFEED = 0xAA; + WDFEED = 0x55; + portEXIT_CRITICAL(); + } Index: webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/EnergyMeters.hzs =================================================================== --- webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/EnergyMeters.hzs (revision 46) +++ webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/EnergyMeters.hzs (revision 53) @@ -21,5 +21,4 @@ - @@ -58,8 +57,8 @@ - - + + - + @@ -68,24 +67,29 @@ - + - - - + + + - - - - - + + + + + - + - + + + + + + - +