Dear all,
I'm just starting to use the ADS7142 with a TMR in order to save as much power as possible when the device is battery powered.
I'm encountering some difficulties implementing the I2C communication under Arduino using the ATtiny1634.
In details my read and write function are below:
void writeADCRegister(byte address, byte value)
{
Wire.beginTransmission(ADC_ADDRESS & 0x7F);
Wire.write(0x08); // Single Register Write Opcode
Wire.write(address);
Wire.write(value);
Wire.endTransmission(); // send the bytes in the buffer
}
uint8_t readADCRegister(byte address)
{
uint8_t value;
Wire.beginTransmission(ADC_ADDRESS & 0x7F);
Wire.write(0x10); // Single Register Read Opcode
Wire.write(address);
Wire.endTransmission();
Wire.write(ADC_ADDRESS | 0x80);
Wire.requestFrom(ADC_ADDRESS, 1);
while(!Wire.available());
value = Wire.read();
Wire.endTransmission();
return value;
}
where:
#define ADC_ADDRESS 0x18 // ADDR pin to ground
It seems to work after a bit of proofs