初学DSP,学习到CAN通讯时没有例程,就自己写了点程序。发送时,CANTA一直不能发送置为1.死在红 {MOD}字体部分。求指教!!!
void CANASendMessage(void)
{
EALLOW;
ECanaMboxes.MBOX0.MDH.all = 0xA0000000;
ECanaMboxes.MBOX0.MDL.all = 0;
ECanaShadow.CANTRS.all = ECanaRegs.CANTRS.all;
ECanaShadow.CANTRS.bit.TRS0 = 1;
ECanaRegs.CANTRS.all = ECanaShadow.CANTRS.all;
do
{
ECanaShadow.CANTA.all = ECanaRegs.CANTA.all;
}while(ECanaShadow.CANTA.bit.TA0 != 1);
ECanaShadow.CANTRS.bit.TRS0 = 0;
ECanaRegs.CANTRS.all = ECanaShadow.CANTRS.all;
ECanaShadow.CANTA.bit.TA0 = 1;
do
{
ECanaRegs.CANTA.all = ECanaShadow.CANTA.all;
}while(ECanaShadow.CANTA.bit.TA0 != 0);
EDIS;
}
一周热门 更多>