主题中讨论的其他器件: BQ79616-Q1
大家好!
我使用的是 BQ79656-Q1、当我将 GPIO1-GPIO8用作唯一的 ADC 时 、 我在 GPIO1-GPIO3上只获得结果而在 GPIO4-GPIO8上却得不到结果
以下是我的配置、请帮我。
wake79600 ();//向桥接设备发送唤醒 ping
delayus (3500);//等待 Tsu (WAKE_SHUT)、至少3.5ms
wake79600 ();//向桥接设备发送唤醒 ping
delayus (3500);//等待 Tsu (WAKE_SHUT)、至少3.5ms
//初始化 BQ79616-Q1堆栈
WriteReg (0、control1、0x20、1、FRMWRT_SGL_W); //向堆栈设备发送唤醒信号
延迟(11.6*TOTALBOARDS);//唤醒音持续时间为每个电路板~1.6ms +每个电路板10ms、用于从关断中唤醒器件=每个616电路板11.6ms
//自动寻址
AutoAddress();//自动地址序列
//从启动开始重置任何 COMM 故障条件
WriteReg (0、FAULT_RST1、0xFF、1、FRMWRT_STK_W); //重置堆叠器件上的故障
WriteReg (0、FAULT_RST2、0xFF、1、FRMWRT_STK_W); //重置堆叠器件上的故障
WriteReg (0、Bridge_FAULT_RST、0x22、1、FRMWRT_SGL_W); //桥接器件上的 FAULT_COMM 和 FAULT_SYS 复位
//启用 BQ79616-Q1主 ADC
WriteReg (0、CONTROL2、0X01、FRMWRT_SGL_W);
delayus(1500);
WriteReg (2、GPIO_CONF1、0x12、1、FRMWRT_SGL_W);
delayus(100);
WriteReg (2、GPIO_CONF2、0x12、1、FRMWRT_SGL_W);
delayus(100);
WriteReg (2、GPIO_CONF3、0x12、1、FRMWRT_SGL_W);
delayus(100);
WriteReg (2、GPIO_CONF4、0x12、1、FRMWRT_SGL_W);
delayus(100);
WriteReg (2、ACTIVE_CELL、0x0A、1、FRMWRT_STK_W); //将所有电池设置为活动状态
WriteReg (2、ADC_CTRL1、0x06、1、FRMWRT_STK_W); //连续运行和 MAIN_GO
delayus(200 );
执行{
ReadReg (2、/* AUX_GPIO_HI*/GPIO1_HI、Response_frameA、2、0、 FRMWRT_SGL_R);
delayus(100);
ReadReg (2、/* AUX_GPIO_HI*/GPIO2_HI、Response_frameB、2、0、FRMWRT_SGL_R);
delayus(100);
ReadReg (2、/* AUX_GPIO_HI*/GPIO3_HI、Response_frameC、2、0、 FRMWRT_SGL_R);
delayus(100);
ReadReg (2、/* AUX_GPIO_HI*/GPIO4_HI、Response_Framed、2、0、 FRMWRT_STK_R);
delayus(100);
ReadReg (2、/* AUX_GPIO_HI*/GPIO5_HI、Response_frameE、2、0、 FRMWRT_STK_R);
delayus(100);
ReadReg (2、/* AUX_GPIO_HI*/GPIO6_HI、Response_frameF、2、0、 FRMWRT_STK_R);
delayus(100);
ReadReg (2、/* AUX_GPIO_HI*/GPIO7_HI、Response_frameG、2、0、 FRMWRT_STK_R);
delayus(100);
ReadReg (2、/* AUX_GPIO_HI*/GPIO8_HI、Response_frameH、2、0、 FRMWRT_STK_R);
delayus(100);
for (int i=0;i<5;i++)
{
// GPIO 1
uint16 rawDataA =(response_frameA[4]<< 8)| response_frameA[5];
浮点 CellvoltageA = rawDataA*0.00015259;//RawData*VLSB_ADC
printConsole ("fst GPIO--%f\n"、CellvoltageA);
// GPIO 2
uint16 rawDataB =(response_frameB[4]<<8)| response_frameB[5];
浮点 CellvoltagB = rawDataB*0.00015259;//RawData*VLSB_ADC
printConsole ("2nd GPIO--%f\n"、CellvoltagB);
// GPIO 3
uint16 rawDataC =(response_frameC[4]<< 8)| response_frameC[5];
浮点 CellvoltagC = rawDataC*0.00015259;//RawData*VLSB_ADC
printConsole ("3rd GPIO--%f\n"、CellvoltagC);
//// GPIO 4
Uint16 rawDataD =(Response_Framing[4]<<8)| Response_Framing[5];
浮点 CellvoltagD = rawDataD*0.00015259;//RawData*VLSB_ADC
printConsole ("4rd GPIO--%f\n"、CellvoltagD);
// GPIO 5
uint16 rawDataE =(response_frameE[4]<<8)| response_frameE[5];
浮点 Cellvoltag = rawDataE*0.00015259;//RawData*VLSB_ADC
printConsole ("5th GPIO--%f\n"、Cellvoltag);
//// GPIO 6
uint16 rawDataF =(response_frameF[4]<<8)| response_frameF[5];
浮点 CellvoltagF = rawDataF*0.00015259;//RawData*VLSB_ADC
printConsole ("6th GPIO--%f\n"、CellvoltagF);
//// GPIO 7
uint16 rawDataG =(response_frameG[4]<<8)| response_frameG[5];
浮点 CellvoltagG = rawDataG*0.00015259;//RawData*VLSB_ADC
printConsole ("7th GPIO--%f\n"、CellvoltagG);
//// GPIO 8
uint16 rawDataH =(response_frameH[4]<<8)| response_frameH[5];
浮点 CellvoltagH = rawDataH*0.00015259;//RawData*VLSB_ADC
printConsole ("8th GPIO--%f\n"、CellvoltagH);
}
}
谢谢