TI中文支持网
TI专业的中文技术问题搜集分享网站

ADS1015配置问题 配置寄存器配置的与读取的结果不一样

ADS1015的配置寄存器配置为0xC483但是读出的数据为0x4483,如果配置为0x8583读取的就是0x8583,不知道哪里出现问题,求TI大神帮忙解答啊

if(I2cMsgOut1.MsgStatus == I2C_MSGSTAT_SEND_WITHSTOP)
{
Error = I2CA_WriteData(&I2cMsgOut1,0x48,0x01,0xC483,0x01);
// If communication is correctly initiated, set msg status to busy
// and update CurrentMsgPtr for the interrupt service routine.
// Otherwise, do nothing and try again next loop. Once message is
// initiated, the I2C interrupts will handle the rest. Search for
// i2c_int1a_isr in this file.
if (Error == I2C_SUCCESS)
{
CurrentMsgPtr = &I2cMsgOut1;
I2cMsgOut1.MsgStatus = I2C_MSGSTAT_WRITE_BUSY;
}
} // end of write section
DELAY_US(10);
///////////////////////////////////
// Read data from EEPROM section //
///////////////////////////////////

// Check outgoing message status. Bypass read section if status is
// not inactive.
if (I2cMsgOut1.MsgStatus == I2C_MSGSTAT_INACTIVE)
{
// Check incoming message status.
if(I2cMsgIn1.MsgStatus == I2C_MSGSTAT_SEND_NOSTOP)
{
// EEPROM address setup portion
while(I2CA_ReadData(&I2cMsgIn1,0x48,0x01) != I2C_SUCCESS)
{
// Maybe setup an attempt counter to break an infinite while
// loop. The EEPROM will send back a NACK while it is performing
// a write operation. Even though the write communique is
// complete at this point, the EEPROM could still be busy
// programming the data. Therefore, multiple attempts are
// necessary.
}
// Update current message pointer and message status
CurrentMsgPtr = &I2cMsgIn1;
I2cMsgIn1.MsgStatus = I2C_MSGSTAT_SEND_NOSTOP_BUSY;
}
// Once message has progressed past setting up the internal address
// of the EEPROM, send a restart to read the data bytes from the
// EEPROM. Complete the communique with a stop bit. MsgStatus is
// updated in the interrupt service routine.
else if(I2cMsgIn1.MsgStatus == I2C_MSGSTAT_RESTART)
{
// Read data portion
while(I2CA_ReadData(&I2cMsgIn1,0x48,0x01) != I2C_SUCCESS)
{
// Maybe setup an attempt counter to break an infinite while
// loop.
}
// Update current message pointer and message status
CurrentMsgPtr = &I2cMsgIn1;
I2cMsgIn1.MsgStatus = I2C_MSGSTAT_READ_BUSY;
}
} // end of read section

user151383853:

要分析这个寄存器的功能,也许有些位是不能同时置位的, 系统会自动配置为合适的配置吧

B Z:

回复 user151383853:

好像是这个样子,配置寄存器地8位,如果配置为1的就可以读正常,如果配置为0就不能正常,我能问一下,ADS1015配置完成后,需要延时一段时间然后才能读取,如果设置完成,立即读取,读取的数值为0?

赞(0)
未经允许不得转载:TI中文支持网 » ADS1015配置问题 配置寄存器配置的与读取的结果不一样
分享到: 更多 (0)