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?
Asked
Active
Viewed 497 times
1 Answers
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
-
do u also have knowledge about programming in energia?? – Abhishek Tyagi Jan 23 '15 at 19:06
-
2I don't even have knowledge of programming MSP430 in CCS - I just know how to read a manual! ;-) – Clifford Jan 23 '15 at 23:04