This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Weird error from IAR when using an interrupt

Other Parts Discussed in Thread: MSP430F2619

So I am beginning to familiarize myself with interrupts and how they work on the MSP430.

Below is my code:

#include "msp430f2619.h"
#include "intrinsics.h"

#define LED1 BIT3
#define LED2 BIT4

void main (void)
{
  WDTCTL = WDTPW|WDTHOLD;
  P2OUT = ~LED1;
  P2DIR = LED1|LED2;
  TACCR0 = 49999;
  TACCTL0 = CCIE;
  TACTL = MC_1|ID_3|TASSEL_2|TACLR;
 
  __enable_interrupt();
  for (;;) {
  }
}
#pragma vector = TIMERA0_VECTOR
__interrupt void TA0_ISR (void)
{
  P2OUT ^= LED1|LED2;
}

 

It compiles fine; but when i go to 'rebuild all' there is an issue linking and i get this error msg:

Error[e16]: Segment INTVEC (size: 0x34 align: 0x1) is too long for segment definition. At least 0x14 more bytes needed. The problem occurred while 
processing the segment placement command "-Z(CODE)INTVEC=FFE0-FFFF", where at the moment of placement the available memory ranges were 
"CODE:ffe0-ffff"
   Reserved ranges relevant to this placement:
   ffe0-ffff            INTVEC
Error while running Linker

uhhh help?

  • OK I solved this error but I have another question. When I run this code it simply makes the chip light up and not alternate between off/on like it supposed to. Anyone see why this would be the case?

  • O.K.! I just expanded a sample I've already used in a different posting to fit your needs. Check it out to see if it works now!

    aBUGSworstnightmare

    /*-----------------------------------------------------------------------------
    // Compiler switches
    // used as:
    //            #ifdef  SOMETHING
    //                ...        ; additional code lines for test version only
    //            #endif
    // ONLY USE ONE AT AT TIME (one for speed and one for target selection)!!!!!!!!!!!!!
    //---------------------------------------------------------------------------*/
    #define SLOW                           // slow MCLK settings
    //#define FAST                             // fast MCLK settings

    // target selection
    #define eZ430RF2500
    //#define eZ430F2013

    #ifdef eZ430RF2500
    #include "msp430f2274.h"
    // defines for eZ430-RF2500T
    // LEDs were connected to P1.0 and P1.1
    #define LED1 BIT0
    #define LED2 BIT1
    #endif

    #ifdef eZ430F2013
    #include "msp430f2013.h"
    // defines for eZ430-F2012
    // LED is connected to P1.0
    #define LED1 BIT0
    #define LED2 BIT1        // add a second LED to P1.1 (P3 breadboard connection) if needed; don't forget the resistor!
    #endif

    #include "intrinsics.h"

    void main (void)
    {
      // disable watchdog timer
      //------------------------
      WDTCTL = WDTPW + WDTHOLD;               // Stop WDT

      // clock setting
      //------------------------
      #ifdef FAST
      DCOCTL = CALDCO_16MHZ;                   // Set DCO to 16MHz
      BCSCTL1 = CALBC1_16MHZ;                  // MCLC = SMCLK = DCOCLK = 16MHz
      #endif
     
      #ifdef SLOW
      DCOCTL = CALDCO_1MHZ;                   // Set DCO to 1MHz
      BCSCTL1 = CALBC1_1MHZ;                  // MCLC = SMCLK = DCOCLK = 1MHz
      #endif
      BCSCTL1 |= DIVA_0;                      // ACLK = ACLK/1
      BCSCTL3 = LFXT1S_2;                     // LFXT1 = ACLK = VLO = ~12kHz
      BCSCTL3 &= ~LFXT1OF;                    // clear LFXT1OF flag, 0
     
      P1OUT = ~LED1;
      P1DIR = LED1|LED2;
      TACCR0 = 49999;
      TACCTL0 = CCIE;
      TACTL = MC_1|ID_3|TASSEL_2|TACLR;
     
      __enable_interrupt();
      for (;;)
      {
          __no_operation();
      }
    }
    #pragma vector = TIMERA0_VECTOR
    __interrupt void TA0_ISR (void)
    {
      P1OUT ^= LED1|LED2;
    }

     

**Attention** This is a public forum