ADS1115的ALERT/RDY引脚可以接在VDD上吗?
我把ALERT/RDY引脚通过一个10K的电阻接到3.3V上了,配置和读取程序如下所示,输入引脚悬空时,读出数据的数据不为0且变化范围很大。恳请各位高手指教。拜托!!!
int ADS1115ReadAIN0(short *psAIN0)
{
unsigned char ConfigRegData[4];
unsigned char ConverRegAddr;
unsigned char ConverRegRdData[2];
// Write to Config register
ConfigRegData[0] = 0x01;//points to Config register
ConfigRegData[1] = 0xC1;//设置配置寄存器的高八位1100 0101,即AINp=AIN0,AINn=GND;满量程FS=+-4.096;连续转换模式
ConfigRegData[2] = 0xE3;//设置配置寄存器的低八位1100 0101
if(I2C_IF_Write(ADS1115_DEV_ADDR,ConfigRegData,3,1) != 0){
DBG_PRINT("Write to Config register failed\n\r");
}
// Read Conversion register
ConverRegRdData[0] = 0x00;
ConverRegRdData[1] = 0x00;
ConverRegAddr = 0x00;
i f (I2C_IF_ReadFrom( ADS1115_DEV_ADDR,
&ConverRegAddr,
1,
ConverRegRdData,
2) == 0 ){
*psAIN0 = ConverRegRdData[0]<<8 |ConverRegRdData[1];
// DBG_PRINT(" Conversion = 0x%02x%02x \n\r",ConverRegRdData[1],ConverRegRdData[0]);
}
else {
DBG_PRINT("No3 I2C_IF_ReadFrom failed\n\r");
}
GUOJIN ZHU:
回复 Kailyn Chen:
感谢 Airwill 先生和Kailyn Chen 先生,
谢谢!!!