when I used ADS7828 IC, I have faced a "READING DATA" problem. below show how I wrote the firmware read the CH1 value , ( below shown part of code in my firmware , I2c Initiation and other begin code work well. )
uint8_t txBuffer2[1];
uint8_t rxBuffer2[2];
txBuffer2[0] = 0x90; // address byte for write
uint8_t txBuffer3[1];
uint8_t rxBuffer3[2];
txBuffer3[0] = 0xC4; // command byte for select ch1 and Internal Reference OFF and A/D Converter ON ( not sure that last 4 bit setting )
uint8_t txBuffer4[1];
uint8_t rxBuffer4[2];
txBuffer4[0] = 0x91; // address byte for read
while (1){
i2cTransaction.targetAddress = 0x48 ;
i2cTransaction.writeBuf = txBuffer2;
i2cTransaction.writeCount = 1;
i2cTransaction.readBuf = rxBuffer2;
i2cTransaction.readCount = 0;
if (I2C_transfer(i2c, &i2cTransaction))
{
}
else
{
}
i2cTransaction.targetAddress = 0x48 ;
i2cTransaction.writeBuf = txBuffer3;
i2cTransaction.writeCount = 1;
i2cTransaction.readBuf = rxBuffer3;
i2cTransaction.readCount = 0;
if (I2C_transfer(i2c, &i2cTransaction))
{
}
else
{
}
i2cTransaction.targetAddress = 0x48 ;
i2cTransaction.writeBuf = txBuffer4;
i2cTransaction.writeCount = 1;
i2cTransaction.readBuf = rxBuffer4;
i2cTransaction.readCount = 2;
if (I2C_transfer(i2c, &i2cTransaction))
{
}
else
{
}
}
but I always received 0x0F+ACK and 0XFF+NACK . so what is problem.? how can I solve this problem I want to read CH1 voltage reading. when I variable CH1 voltage always reply 0x0F+ACK and 0XFF+NACK. Nothing any deferent result.