I am using CAN module of MC9S12XHZ512 microcontroller, I successfully archive transmitting of data from my microcontroller, but problem is that I am able to receive data only one time after that my controller get hang, I think that I have not clear my CAN receiver interrupt flag, can anyone tell me where I can get CAN receiver interrupt flag in datasheet, I post my interrupt code for CAN below. Do MC9S12XHZ512 compiler support sprintf function.
#pragma CODE_SEG __NEAR_SEG NON_BANKED
interrupt void Vcan1RxISR(void)
{
unsigned char RxBuffer[8],u8Length=8;
unsigned int R,temp;
LCD_Cmd(0x80);
R = CAN1RXDSR0;
Convert(R);
LCD_Data(D);
delay();
LCD_Data(C);
delay();
LCD_Data(B);
delay();;
LCD_Data(A);
delay();
PORTA = 0xFF;
CAN1RFLG_RXF = 1;
}
The Receive Buffer Full Flag(RXF) is bit 0 in MSCAN Receiver Flag Register (CANRFLG).
After the CPU has read that message from the RxFG buffer in the receiver FIFO, the RXF flag must be cleared to release the buffer.
For details, please see section 14.3.2.5 in data sheet:
http://cache.freescale.com/files/microcontrollers/doc/data_sheet/MC9S12XHZ512.pdf
And MC9S12XHZ512 compiler supports sprintf function, please include the head file <stdio.h>.
Fiona Kuang
Technical Information & Commercial Support
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
RXF indicate Receiver FIFO get full , I am looking for CAN Receiver interrupt flag.
Thanks for sprintf function