This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Understanding Watchdog timer



Hi all,

 I have a confusion on the following code how the watchdog timer will run.

#include <msp430.h>

int main(void)
{
  volatile unsigned int i;
      
  WDTCTL = WDTPW + WDTHOLD;                 // Stop watchdog timer - SET BREAKPOINT HERE
  P1DIR |= 0x01;                            // Set P1.0 to output direction
  TA0R = 0x3FFF;                            // Valid opcode (for "jmp $")

  while(1)
  {
    P1OUT ^= 0x01;                          // Toggle P1.0 using exclusive-OR

    for(i = 50000; i > 0; i--);             // Delay loop 
    
    // C code to directly call an address location
    ((void (*)())0x350)();                  // Invalid fetch ("call #0350h")
    
    /* 0x350 is address of TA0R register and is within the module register memory
    address range (0x0100 --0x0FEF) */
  }                                         
}

In the code after intialising the variable 'i', they stop the watchdog timer using the 'WDTHOLD' bit,but stll it resets the system. can any one knows what is exactly happened in the code releated to WDT.

Thanks in advance.

**Attention** This is a public forum