基于dsPIC33FJ128MC506的CAN通信(07-100)
——
fltEnRegAddr = (unsigned int *)(&C1FEN1);
本文引用地址:http://www.ex-cimer.com/article/92042.htm/* 將ID按規(guī)定分配到相關(guān)的寄存器中*/
if(exide==1) { //擴(kuò)展幀的ID
eid15_0 = (identifier & 0xFFFF);
eid17_16= (identifier>>16) & 0x3;
sid10_0 = (identifier>>18) & 0x7FF;
*sidRegAddr=(sid10_0)<<5 + 0x8 + eid17_16;
*(sidRegAddr+2)= eid15_0;
}else{ //標(biāo)準(zhǔn)幀的ID
sid10_0 = (identifier & 0x7FF);
*sidRegAddr=(sid10_0)<<5;
*(sidRegAddr+2)=0;
}
*bufPntRegAddr = (bufPnt << (4*(n&3))); // 寫緩沖指針寄存器CiBUFPNTn內(nèi)容*maskSelRegAddr = (maskSel << (2*(n&7))); // 確定關(guān)連屏蔽寄存器
CiFMSKSELn *fltEnRegAddr = (0x1 << n); //使能第n個(gè)濾波器
C1CTRL1bits.WIN=0; //恢復(fù)寄存器地址選擇位
}
/*
評論