HI,
从朋友那里拿来一块MC9S08DZ16的板子,他是用CW6.0写的程序,接收发送CAN通信正常。
我想用CW10最新软件来写程序,初始化如下,发送数据正常,但是不能接收数据。查看CANRIER = 0x01; 查看CANR标志寄存器,发现当数据进来时,RXF位无反应,始终为零。请问怎么解决啊?
初始化如下:
void can_init(void){
CANCTL0=0x01; /* Enter initialisation Mode */
while (!(CANCTL1&0x01)); /* loop until initialisation confirmed */
CANIDMR0 = 0xFF;
CANIDMR1 = 0xFF;
CANIDMR2 = 0xFF;
CANIDMR3 = 0xFF;
CANIDMR4 = 0xFF;
CANIDMR5 = 0xFF;
CANIDMR6 = 0xFF;
CANIDMR7 = 0xFF; /* Ignore all the filters */
CANBTR0 = 0x81;
CANBTR1 = 0x23; /* Bit Rate 250kbps*/
CANCTL1 = 0x80;
CANCTL0 = 0x00; /* Initialisation End */
while(CANCTL1 & 0x01); /* Confirm MSCAN get out of Initialisation */
while(!(CANCTL0 & 0x10)); /* MSCAN is synchronised to the CAN bus */
CANRIER = 0x01; /* Receiver Full Interrupt Enable */
}
|