最近在学习使用455,,参考TI的例程编写455的初始化函数,代码如下:
void main(void)
{
INT8U nSent;
PLL_Init();
IO_init();
delayms(5);
WakeUpPL455();
delayms(5);
COMM_RESET();
SCI_init();
nSent = WriteCommand(0, 12, 0x40, 1, Broadcast_Write);
delayms(10);
WakeUpPL455();
delayms(10);
//清除故障标志
// ID, Register, Data, Length, Command nSent = WriteCommand(0, 107, 0x8000, 2, Broadcast_Write); // nSent = WriteCommand(0, 82, 0xFFC0, 2, Broadcast_Write); // clear all fault summary flags
nSent = WriteCommand(0, 81, 0x38, 1, Broadcast_Write); // clear fault flags in the system status register
//设置455地址
nSent = WriteCommand(0, 14, 0x19, 1, Broadcast_Write); // set auto-address mode on all boards nSent = WriteCommand(0, 12, 0x08, 1, Broadcast_Write); // enter auto address mode on all boards, the next write to this ID will be its address
nSent = WriteCommand(0, 10, 0, 1, Broadcast_Write); // 设置455的地址为0
//清除故障标志
nSent = WriteCommand(0, 82, 0xFFC0, 2, Broadcast_Write); // clear all fault summary flags
nSent = WriteCommand(0, 81, 0x38, 1, Broadcast_Write); // clear fault flags in the system status register
//设置通信
nSent = WriteCommand(0, 16, 0x1080, 2, Single_Write); //使能UART发送和FAULT_N输出
//清除故障标志
nSent = WriteCommand(0, 82, 0xFFC0, 2, Broadcast_Write); // clear all fault summary flags
nSent = WriteCommand(0, 81, 0x38, 1, Broadcast_Write); // clear fault flags in the system status register
while(1)
{ nSent = WriteCommand(0, 10, 0, 1, Single_Read); //读ID为0的455的地址
delayms(500);
}
}
主函数最后,我用while死循环连续读取455的地址,但是刚开始MCU发的几次读取地址的指令,455没有响应,一段时间后455才开始回信息,并且返回的信息是正确的,在示波器上显示如下:
想请教各位大神,为什么455刚开始没有向MCU回复信息?谁遇到过这种情况?
jean jiao:
jun liang zhao:
回复 jean jiao:
你好!请问你配的是什么单片机?