Hello,
I am working on msp430FR6922 controller. I have attached code for reference. during testing sometimes my code is getting stuck in " while(!((P4IN&BIT6)==0)){} " statement.
I want to reset msp430 controller using WDT after 1 second when code is stuck in while statement. So, controller restart the code...
int main(void) { WDTCTL = WDT_ARST_1000 ; // Stop WDT dev_init_16M(); // Microcontroller set on 16MHz __enable_interrupt(); // Re-enable all interrupts __bis_SR_register(GIE); // Enter LPM3, interrupts enabled DelayStart=1; while (1) { if(DelayStart==1) // For sample 1 send LC data after every 1 sec to tare the LC readings { // (DCO=MCLK=16MHZ )so, // Count/MCLK freq=Time // 16000000/16MHz=1sec __delay_cycles(16000000); // delay calculate on 16 MHz //timer interrupt on while(!((P4IN&BIT6)==1)){} // Wait until data ready CurrentLCValue=ReadData(); // Read load cell data CurrentLCValue1=CurrentLCValue&0x7FFF; LongtoInt.LongData=CurrentLCValue; // Split 3 byte data into single byte giTransmitBuffer[0]=LongtoInt.ByteSplit[1]; giTransmitBuffer[1]=LongtoInt.ByteSplit[0]; giTransmitBuffer[2]=0x00; for(i=0;i<3;i++) // Upto array from start to CRC lenth { while(!(UCA0IFG&UCTXIFG)); UCA0TXBUF = giTransmitBuffer[i]; } } }my question is WDT is helpful when controller is getting stuck in while statement?? is there any other way to reset the controller through software?? if yes write code for msp430fr6922 controller.