请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号:ADS127L01 工具/软件:TI C/C++编译器
我们在设计 DAQ 测量系统时使用 ADS127L01和 Raspberry PI B3。 ADC 工作正常、但在某些读取中、无论输入变化如何、器件都会读取恒定值7FFFFF。此问题会在我们的系统中引起很多问题。请就此提供帮助。固件中遵循了断电引脚建议。请分享可能的任何其他修复 解决问题
公共异步任务 connect()(连接) { SpiController spiController =等待 SpiController.GetDefaultAsync (); VAR 设置=新 SpiConnectionSettings (0) { ClockFrequency = 16000000、// TODO! 调查此号码! MODE = SpiMode.Mode1、 DataBitLength = 8 }; _ADS127L01 = spiController.GetDevice (设置); GPIO_init(); GPIO_SET (HRPin);//HR = 1 延迟(0x1fff); SET_PGA (2);//0:增益= 2.02//1:增益= 6.6//2:增益= 13.2 Set_Filters (2);//0:64K 1:128K 2:256K 3:512K 延迟(0x1fff); ADS127L01_init(); 延迟(0x1fff); GPIO_SET (StartPin); 返回 true; } void ADS127L01_init() { GPIO_SET (Cs0Pin); 延迟(0x1fff); GPIO_Reset (Cs0Pin); 延迟(0x1fff); GPIO_SET (ResetPin); 延迟(0x1fff); GPIO_Reset (ResetPin); 延迟(0x1fff); GPIO_SET (ResetPin); 延迟(0x1fff); WriteRegister (_ADS127L01、0x41); WriteRegister (_ADS127L01、0x05);//REG NUM-1 WriteRegister (_ADS127L01、0x02);//conF1 WriteRegister (_ADS127L01、0x00);//OFC0默认值 WriteRegister (_ADS127L01、0x00);//OFC1默认值 WriteRegister (_ADS127L01、0x00);//OFC2默认值 WriteRegister (_ADS127L01、0x00);//FSC0默认值 WriteRegister (_ADS127L01、0x80);//FSC1 default } 公共异步空启动() { 任务 t =新任务(()=> { while (真) { 双采样= readadc (); 采样=((采样/ 8388607)* 2.5)*(3/6.6); Debug.WriteLine (示例); } }); T.Start(); } 专用 int readadc () { byte[] receiveBuffer =新字节[3]; while (DRDY.READ ()=GpioPinValue.High){} _ADS127L01.Write (new[]{Command.ReadData}); _timing.WaitMicroseconds (6); _ADS127L01.read (receiveBuffer); UINT 结果=((uint) receiveBuffer[0]<< 16)|((uint) receiveBuffer[1]<< 8)| receiveBuffer[2]; if ((receiveBuffer[0]& 0x80)!= 0) { 结果|= 0xFF000000; } 返回未选中的(((int)Result); }