Hi,
I am using MSP430G2xxx controller and I want to enable watchdog timer which can reset system on any abnormalities are found in system. I did try to search sample programs which can help me to implement this feature but unfortunately I don't find any sources for this.
I did following implementation to enabled WDT mode which can reset system if not cleared in certain interval. I am not sure if I need to clear WDT or reload value to WDT to avoid resetting system.
Appreciate if anyone can help me understanding and correcting my implementation.
#include "msp430.h"
#define WDTCONFIG (WDTPW+WDTCNTCL+WDTTMSEL)
int main( void ) {
WDTCTL=WDTCONFIG+WDTIS0;
IE1=WDTIFG; //enable the interrupt _EINT(); while(1); }
#pragma vector=WDT_VECTOR __interrupt void wdttimer(void) {
WDTCTL = WDTPW + WDTCNTCL; //keep clearing the counter to prevent the reset
}
Thanks,