AnsweredAssumed Answered

Illegal BP with interrupts using DEMO9S12XEP100

Question asked by Oscar Suro on Aug 24, 2012
Latest reply on Aug 25, 2012 by kef

I have had a really bad time trying to find a way to enable interrupts using my demo board. I have been reading in the forum and added pragmas, interrupt vectors and a lot of code. However that doesnt work. 

 

I think im missing something really easy, but its my first time with Freescale. Any help or tip will be a lot of help.

 

Its a demo code to blink the onboard leds. Im sure the toggling code works, but have no idea how to trigger the interrupt or solve the Ilegal BP problem.

 

#include <hidef.h>      /* common defines and macros */#include "mc9s12xep100.h"      /* derivative-specific definitions */#pragma LINK_INFO DERIVATIVE "mc9s12xep100"// Unsecured status flashconst unsigned char flash_security  @0xFF0F = 0xFE;volatile unsigned int x;volatile Bool manuel;void TimerInit(void);/* Start interrupts */  #pragma CODE_SEG __NEAR_SEG NON_BANKED__interrupt 0xEE void TimerOverflow_ISR(void){            TIM_TFLG1 = 0x01;            PORTA = 0x0F;            manuel ^= 1;             TIM_TC0 = TIM_TCNT + 0x0FFF;}#pragma CODE_SEG DEFAULT/* End interrupts */void TimerInit(void){    // setup Timer System Control Registers    TIM_TSCR1  = 0x80; // TSCR1 - Enable normal timer    TIM_TSCR2  = 0x00; // TSCR2 - 0x80 Timer Interrupt Enable    TIM_TSCR2 |= 0x07; // TSCR2 - 0x07 128 Prescaler        TIM_PACTL  = 0x00; // Setup Timer Preset  }void PeriphInit(void){    DDRA  = 0x0F; // Configure A[3..0] as outputs     PORTA = 0x00; // Output 0}void main(void) {    manuel = 0;            PeriphInit();    TimerInit();        TIM_TIOS = 0x01;    TIM_TIE  = 0x01;    TIM_TC0  = TIM_TCNT + 50;         EnableInterrupts;        for(;;) {                if (manuel){               PORTA = 0x0F;        }                else{            PORTA = 0x00;        }            } /* loop forever */  } /* please make sure that you never leave main */

Outcomes