Jump to content
43oh

Recommended Posts

I am trying to set up a watchdog timer on the MSP430F5529 LaunchPad, and I can't seem to get it to work.

My code is:

void watchdogenable (int interval) {
  WDTCTL = WDTPW | WDTCNTCL | interval;
}

void watchdogreset () {
  WDTCTL = WDTPW | WDTCNTCL | (WDTCTL & 0x07);
}

void setup() {
  Serial.begin(9600);
  Serial.println("Start");
  watchdogenable(1);
}

int count = 0;

void loop() {
  Serial.println(count++);
  delay(1000);
}

It prints:

Start
0

and then gets no further before being reset by the watchdog 8 seconds later. I would expect it to count up to 8.

If I take out the delay() statement it seems to work properly.

Any suggestions?

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...