mc9s12xdp512 interrupt problems.

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

mc9s12xdp512 interrupt problems.

1,535件の閲覧回数
sergioloncan
Contributor I


In this simple code, the loop execute some times no more than 10x,

 

and the debugger shoew the ILLEGAL_BP message.

 

When disable the interrupts, it Works fine.

what its the cause of this problem???

Thanks for your attention.. and sorry if i port in wrong place...

 

#include <hidef.h>
#include "derivative.h"


void main()

    {
         unsigned int i;
        __asm(sei); /* Disable interrupts */
        DDRB = 0xff; /* Make Port B output */
        DDRD = 0x3c; // PORT D OUTPUT 2 3 4 5
        PORTD = 0x3c;//portd leds on 2 3 4 5
        PORTB = 0xff;// portb leds on
        TSCR1 = 0x80; /* Turn on timer */
        TSCR2 = 0x8f; /* Enable timer overflow interrupt, set prescaler */
        TFLG2 = 0x80; /* Clear timer interrupt flag */
        __asm(cli); /* Enable interrupts (clear I bit) */
        while (1)
             {
                for (i=0;i<50000;i++)
                  {
                   _FEED_COP(); /* feeds the dog */
                  }
                
                 PORTB =~PORTB;
                
                                  
            }
     }
void interrupt toi_isr(void)
    {
        PORTD = ~PORTD; /* NOT */
        TFLG2 = 0x80; /* Clear timer interrupt flag */
       
    }

ラベル(1)
0 件の賞賛
返信
4 返答(返信)

1,310件の閲覧回数
iggi
NXP Employee
NXP Employee

Hi Sergio,

Here are some forum answers you may want to read:

Illegal BP at starting the engine (KIT33812ECUEVME)

ILLEGAL_BP

Find attached the interrupt catcher example code. Use the link above for the instructions.

Hope it helps.

0 件の賞賛
返信

1,310件の閲覧回数
sergioloncan
Contributor I

Thanks for the reply , you solved the problem and worked perfectly.

0 件の賞賛
返信

1,310件の閲覧回数
sergioloncan
Contributor I

Sorry for the delay.

0 件の賞賛
返信

1,310件の閲覧回数
kef2
Senior Contributor V

Looks like you forgot to initialize interrupt vectors table. Interrupt vectors can be initialized using one of these ways

- inserting proper interrupt after number after "interrupt" keyword. Like    void interrupt N isr(void)

- using "VECTOR N isr" form in prm file

- initializing vectors table array in *.c file

I won't bother providing examples for each of these. Try using forums search. There must be some examples.

BTW, unless you are using small memory model, you need to allocate your ISR's in nonbanked memory using CODE_SEG pragmas:

#pragma CODE_SEG __NEAR_SEG NON_BANKED

// your ISR comes here

#pragma CODE_SEG DEFAULT

Edward

0 件の賞賛
返信