Hi, I am very new to programming microcontrollers. I tried to do an LED blink code with the help of Timer_A interrupts of EZ430-RF2500 wireless development tool (msp430f2274) by using msp430 toolchain in eclipse (Indigo version) enivronment.
#include "msp430f2274.h" #include "bsp_msp430_defs.h" #include "bsp.h" #include "mrfi.h" #include "bsp_leds.h" #include "bsp_buttons.h" #include "signal.h" void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer P1DIR |= 0x01; // Set P1.0 to output direction P1OUT = 0x00; //Initial Condition TACCTL0 = CCIE; // TACCR0 interrupt enabled TACCR0 = 12000; // ~1 second TACTL = TASSEL_1 + MC_1; // ACLK, upmode __enable_interrupt(); } #pragma vector=TIMERA0_VECTOR __interrupt void Timer_A (void) { P1OUT ^= 0x01; }
The LED was supposed blink continuously, but didn't happenTo verify whether the interrupt flag of the Timer_A is working, I used the following code.
#include "msp430f2274.h" #include "bsp_msp430_defs.h" #include "bsp.h" #include "mrfi.h" #include "bsp_leds.h" #include "bsp_buttons.h" #include "signal.h" void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer P1DIR |= 0x01; // Set P1.0 to output direction P1OUT = 0x00; //Initial Condition TACCTL0 = CCIE; // TACCR0 interrupt enabled TACCR0 = 12000; // ~1 second TACTL = TASSEL_1 + MC_1; // ACLK, upmode __enable_interrupt(); for (;;) { for (i=10; i>0 ; ) { if (TAIV == 0x0A) { P1OUT ^= 1; i--; } } for (i=10; i>0; ) { if (TAIV == 0x0A) { P1OUT ^= !P1OUT; i--; } } }
Here the interrupt flag was working fine. So I guess the problem is the way I called the interrupt function. I looked into many examples. I am not able to understand the problem with my first code. Please help. Thanks in advance