__interrupt void ecan_rec_isr(void)
{
int ax,mailbox_num;
ax=ECanaRegs.CANGIF0.all;
if(ax<0)
{
mailbox_num=ax&0x0f;
can_msg[msg_cnt].mail_num=mailbox_num;
switch(mailbox_num)
{
case 0: can_msg[msg_cnt].MDH=ECanaMboxes.MBOX0.MDH.all;
can_msg[msg_cnt].MDL=ECanaMboxes.MBOX0.MDL.all;
ECanaRegs.CANRMP.bit.RMP0=1; //clear receive int;
break;
case 1: can_msg[msg_cnt].MDH=ECanaMboxes.MBOX1.MDH.all;
can_msg[msg_cnt].MDL=ECanaMboxes.MBOX1.MDL.all;
ECanaRegs.CANRMP.bit.RMP1=1; //clear receive int;
break;
case 2: can_msg[msg_cnt].MDH=ECanaMboxes.MBOX2.MDH.all;
can_msg[msg_cnt].MDL=ECanaMboxes.MBOX2.MDL.all;
ECanaRegs.CANRMP.bit.RMP2=1; //clear receive int;
break;
case 3: can_msg[msg_cnt].MDH=ECanaMboxes.MBOX3.MDH.all;
can_msg[msg_cnt].MDL=ECanaMboxes.MBOX3.MDL.all;
ECanaRegs.CANRMP.bit.RMP3=1; //clear receive int;
break;
case 4: can_msg[msg_cnt].MDH=ECanaMboxes.MBOX4.MDH.all;
can_msg[msg_cnt].MDL=ECanaMboxes.MBOX4.MDL.all;
ECanaRegs.CANRMP.bit.RMP4=1; //clear receive int;
break;
case 5: can_msg[msg_cnt].MDH=ECanaMboxes.MBOX5.MDH.all;
can_msg[msg_cnt].MDL=ECanaMboxes.MBOX5.MDL.all;
ECanaRegs.CANRMP.bit.RMP5=1; //clear receive int;
break;
}
msg_cnt++;
}
else
{
ECanaRegs.CANGIF0.all|=0xffffffff; //clear undesired int
}
PieCtrlRegs.PIEACK.bit.ACK9 = 1; // Enables PIE to drive a pulse into the CPU
}
以上是一段eCAN的接收中断的程序,我的疑问是ax=ECanaRegs.CANGIF0.all;
if(ax<0)
这里的判断ax也就是CANGIF0寄存器怎么会是小于零的,在什么情况下是小于零的? |