EmbeddedRelated.com
Forums
Memfault State of IoT Report

MSP430 WDT Application Problem?

Started by Tunahan June 30, 2011
Hello everybody.

I took this program from Davie's book for MSP430-1121STK as well
Code:
Listing 8.1: Program wdtest1.c to demonstrate the watchdog timer.

// wdtest1 .c - trival program to demonstrate watchdog timer
// Olimex 1121 STK board , 32 KHz ACLK
// J H Davies , 2007 -05 -10; IAR Kickstart version 3.42 A
// ----------------------------------
# include < io430x11x1 .h> // Specific device
// ----------------------------------
// Pins for LEDs and button
# define LED1 P2OUT_bit . P2OUT_3
# define LED2 P2OUT_bit . P2OUT_4
# define B1 P2IN_bit . P2IN_1
// Watchdog config : active , ACLK /32768 -> 1s interval ; clear counter
# define WDTCONFIG ( WDTCNTCL | WDTSSEL )
// Include settings for _RST / NMI pin here as well
// ----------------------------------
void main ( void )
{
WDTCTL = WDTPW | WDTCONFIG ; // Configure and clear watchdog
P2DIR = BIT3 | BIT4 ; // Set pins with LEDs to output
P2OUT = BIT3 | BIT4 ; // LEDs off ( active low )
for (;;) { // Loop forever
LED2 = IFG1_bit . WDTIFG ; // LED2 shows state of WDTIFG
if (B1 == 1) { // Button up
LED1 = 1; // LED1 off
} else { // Button down
WDTCTL = WDTPW | WDTCONFIG ; // Feed / pet /kick / clear watchdog
LED1 = 0; // LED1 on
}
}
}

and i changed it for MSP430FG4618 board.It's pin descriptions are different than above.

it is
Code:
#include

#define LED4 BIT1
#define LED1 BIT2
#define SW1 BIT0

#define WDTCONFIG (WDTCNTCL|WDTSSEL)

void main (void)
{
WDTCTL=WDTPW|WDTCONFIG;
P5DIR=BIT1;
P2DIR=BIT2;
for(;;)
{
LED4=~IFG1_bit.WDTIFG;
if(SW1==1)
{
WDTCTL=WDTPW|WDTCONFIG;
P2OUT=BIT2;
}
else
{
P2OUT=0x00;
}
}
}
But when i compile i take 3 errors

-expected a field name
-expression must be a modifiable value
-identified "IFG1_bit" is undefined (all of are in line 16 LED2 = IFG1_bit . WDTIFG ; )

i feel that i have to change LED2 = IFG1_bit . WDTIFG
but what i must write instead of it

then i downloaded and setup iar and i changed the header to and gives one error with that line again

Beginning Microcontrollers with the MSP430


Memfault State of IoT Report