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 <msp430.h> #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
TL431 wrote: >
1 | > LED2 = !(IFG1 & WDTIFG); |
2 | >
|
> This should do the same.
it decreases to errors to
"expression must be a modifiable value" in line 16 again
so what is wrong i can't find
>#define LED4 BIT1
How is LED4 defined?
You can solve this by something like that:
1 | #define LED4_ON P2OUT &=~ BIT0 // LED @ P2.0
|
2 | #define LED4_OFF P2OUT |= BIT0 // LED @ P2.0
|
3 | |
4 | if (IFG1 & WDTIFG) LED4_ON; |
5 | else LED4_OFF; |
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
Log in with Google account
No account? Register here.