求助DSP28335 eCAN发送问题
时间:10-02
整理:3721RD
点击:
初学DSP,学习到CAN通讯时没有例程,就自己写了点程序。发送时,CANTA一直不能发送置为1.死在红色字体部分。求指教!
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;
}
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;
}
学习学习,谢谢分享!
小编问题解决了吗