Hello everyone,
I just started with programming microcontrollers with the Launchpad MSP430 and CCS. I have the MSP430G2553 chip.
I tried to follow this tutorial:
http://homepages.ius.edu/RWISMAN/C335/HTML/msp430Timer.HTM
which shows how to work with interrupts to get the two LEDs to flash. I copy and pasted the code from section 15. (Toggle red LED every two seconds/green LED every second. ):
#include <msp430g2553.h>
void main(void) {
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
P1DIR |= BIT0; // Set P1.0 to output direction
P1OUT &= ~BIT0; // Set the red LED off
P1DIR |= BIT6; // Set P1.6 to output direction
P1OUT &= ~BIT6; // Set the green LED off
TA0CCR0 = 12000; // Count limit (16 bit)
TA0CCTL0 = 0x10; // Enable Timer A0 interrupts, bit 4=1
TA0CTL = TASSEL_1 + MC_1; // Timer A0 with ACLK, count UP
TA1CCR0 = 24000; // Count limit (16 bit)
TA1CCTL0 = 0x10; // Enable Timer A1 interrupts, bit 4=1
TA1CTL = TASSEL_1 + MC_1; // Timer A1 with ACLK, count UP
_BIS_SR(LPM0_bits + GIE); // LPM0 (low power mode) interrupts enabled
}
#pragma vector=TIMER1_A0_VECTOR // Timer1 A0 interrupt service routine
__interrupt void Timer1_A0 (void) {
P1OUT ^= BIT0; // Toggle red LED
}
#pragma vector=TIMER0_A0_VECTOR // Timer0 A0 interrupt service routine
__interrupt void Timer0_A0 (void) {
P1OUT ^= BIT6; // Toggle green LED
}
It all seemed pretty straighforward to me, but somehow, the second interrupt routine(#pragma vector=TIMER0_A0_VECTOR) is never entered and the green LED never flashes. The first interrupt is entered (which I can see during step by step debug) and the red LED flashes just fine.
I found several other tutorials (eg. http://www.egarante.net/2010/09/msp430-launchpad-tutorial-part-2.html ) that have that vector named #pragma vector=TIMERA0_VECTOR , but if I try this, I get an error '#20 identifier "TIMERA0_VECTOR" is undefined'.
Which vectors / timers do I even have on the MSP430G2553 chip? Is it maybe possible that I don't have a TIMER0_A0_VECTOR timer?
Any help is appreciated!