Other Parts Discussed in Thread: MSP430G2553
Hi,
Below is the code to configure Timer0 on MSP430G2553 in up mode. On interrupt (i.e when timer value rolls over), I am toggling the LED. LED toggles when compiled and flashed with IAR but it doesnt work when compiled and flashed with CCS. Please help me with this issue.
#include <msp430.h>
/*
* main.c
*/
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
P1DIR |= 0x01;
TACTL=0x152; // Select Clock source, clock divider and enable timer interrupt
TACCTL0=CCIE; // Select compare mode and enable compare interrupt.
TACCR0=32768; // Timer Value register.
_EINT(); // Enable Global Interrupts.
for(;;)
{
}
}
#pragma vector=TIMER0_A0_VECTOR
__interrupt void TIMER0_ISR (void)
{
P1OUT ^= 0x01; // Toggle the LED each time the timer rolls over after max value.
}
Thanks and regards,
Shivakumar V W