Hy guys,
i' m working with the method of using interrupts instead of the standard polling method.
I used the code below, but the compiler says " The symbol used in #pragma vector= requires a declaration".
Do you know what that mean?
Chris
#include "msp.h"
#define LED0 BIT0
#define BUTTON BIT3
int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
P1DIR |= LED0; // Set P1.0 to output direction
// P1.3 must stay at input
P1OUT &= ~LED0; // set P1.0 to 0 (LED OFF)
P1IE |= BUTTON; // P1.3 interrupt enabled
P1IFG &= ~BUTTON; // P1.3 IFG cleared
__enable_interrupt(); // enable all interrupts
for(;;)
{}
}
// Port 1 interrupt service routine
#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
{
P1OUT ^= LED0; // P1.0 = toggle
P1IFG &= ~BUTTON; // P1.3 IFG cleared
P1IES ^= BUTTON; // toggle the interrupt edge,
// the interrupt vector will be called
// when P1.3 goes from HitoLow as well as
// LowtoHigh
}