各位大侠好,最近在使用TMS320F28379D用其CLB功能实现ENDAT2.2协议时与海德汉的编码器进行通讯。程序初始化一直不成功,有哪位大侠做过相关的研究啊?
下面是初始化程序
PM_endat22_setFreq(ENDAT_INIT_FREQ_DIVIDER);
//Encoder Receive Reset - Command ERR 传输命令(接受置位)
//data1:18/6位数据或地址
//data2:18/6位数据或地址
//nAddData:启用附加数据的个数(0,1,2)
retval1 = PM_endat22_setupCommand (ENCODER_RECEIVE_RESET, 0xAA, 0x2222, 0); //data1=any; data2=any
PM_endat22_startOperation(); //调用启动ENdat传输的函数
while (endat22Data.dataReady != 1) {} //[b]当程序初始化到这句就一直在这里循环了
//Encoder Receive Reset - Command ERR 传输命令(接收置位)
//nAddData:启用附加数据的个数(0,1,2)无附加值
retval1 = PM_endat22_receiveData(ENCODER_RECEIVE_RESET, 0);
DELAY_US(1000000L); //Delay 1s
retval1 = PM_endat22_setupCommand (ENCODER_RECEIVE_RESET, 0xAA, 0x2222, 0); //data1=any; data2=any
PM_endat22_startOperation();
while (endat22Data.dataReady != 1) {}
retval1 = PM_endat22_receiveData(ENCODER_RECEIVE_RESET, 0);
DELAY_US(2000L); |