1

I am coding msp430g2553 ussing CCS 5.5 . I have two interrupts enabled in my code. I am not able to understand how should i go about writing two different ISR for these two interrupts. How should i indicate in my code, which ISR corresponds to which interrupt. Can anybody help me out with the syntax for this?

Abhishek Tyagi
  • 153
  • 1
  • 9

1 Answers1

1

From the MSP430 Optimizing C/C++ Compiler v 4.4 User's Guide it appears you can achieve this is one of three ways:

Using GCC __attribute__ syntax:

#define TIMER_A0 20
volatile int tick = 0 ;
__attribute__((interrupt(TIMER_A0))) void tick_isr() 
{
    tick++ ;
}

Using __interrupt + #pragma vector:

#define TIMER_A0 20
volatile int tick = 0 ;
#pragma vector=TIMER_A0
__interrupt void tick_isr( void )
{
    tick++ ;
}

Using #pragma interrupt + #pragma vector:

#define TIMER_A0 20
volatile int tick = 0 ;
#pragma interrupt( tick_isr )
#pragma vector=TIMER_A0
void tick_isr( void )
{
    tick++ ;
}

The GCC syntax is probably simplest. Note that the syntax for #pragma interrupt is different in C++ code:

#pragma interrupt
#pragma vector=TIMER_A0
void tick_isr( void )
{
    tick++ ;
}
Clifford
  • 88,407
  • 13
  • 85
  • 165