Ondrej Machek

interrupt MSCAN illegal bp - M68EVB912DP256  MC9S12DP256

Discussion created by Ondrej Machek on Dec 1, 2008
Latest reply on Dec 2, 2008 by Ondrej Machek
I have problem with my interrupt, at the end of interrupt, jump to command Illegal BP and asm BGND.
Do anybody know please, where is problem?
Thank you very much to all.
void interrupt 39 Tx_CAN0(unsigned long id, unsigned char Priority, unsigned char length, unsigned char *Data){
unsigned volatile char i, buf_num;
unsigned char ERR_BUFFER_FULL = 'E';
if(!CAN0TFLG)                         /*transmi buffer empty? TXEx*/
    //return ERR_BUFFER_FULL;
CAN0TIER = 0x00;                      /*TXEIE 0 - no interrupt request*/
buf_num = CAN0TFLG;                    /*ulozeni volnych buffer*/
CAN0TBSEL = buf_num;                   /*TXx dany buffer je vybran*/
buf_num = CAN0TBSEL;

*((unsigned long *) ((unsigned long)(&CAN0TXIDR0))) = id;  /*nastaveni id*/
for(i=0; i<length;i++){
 *(&CAN0TXDSR0 + i) = Data[i];       /*kopirovani zpravy*/
 CAN0TXDLR = length;                         /*nastaveni delky*/
 CAN0TXTBPR = Priority;                /*nastaveni priority*/
 CAN0TFLG = buf_num;                         /*transmit dat*/
 while((CAN0TFLG & buf_num) != buf_num);   /*počká na konec přenosu*/
}  /*konec preruseni*/
Added p/n to subject.

Message Edited by NLFSJ on 2008-12-01 11:19 AM