Part Number: PGA305EVM-034
I did the ADC & DAC Calibration and calculated all the coefficients needed. Now I'm trying to read the compensated values. I am using an Arduino Uno as a master and this is the code. I'm trying to follow the steps in the table. However, the values I get are equal to 0. I don't know where the problem is. I tried with the address equals to 20 too (because I can't find any pin i2caddr so I don't know if I should use I2C equals 0 or 1) and it happened the same.
#include <Wire.h>
int SlaveAddress = 0x20;
// Device address in which is also included the 8th bit for selecting the mode, read in this case.
int X0=0;
void setup() {
Wire.begin(); // Initiate the Wire library
Serial.begin(9600);
delay(100);
// Enable measurement
}
void loop() {
// CHANGE MODE
Wire.beginTransmission(SlaveAddress); // Begin transmission to the Sensor
//Ask the particular registers for data
Wire.write(0x09);
Wire.write(0x04);
Wire.endTransmission();
//1st REQUEST
Wire.beginTransmission(SlaveAddress);
//Ask the particular registers for data
Wire.write(0x04);
Wire.endTransmission();
Wire.requestFrom(SlaveAddress,1);
if(Wire.available()) { //
X0 = Wire.read(); // Reads the data from the register
}
Serial.print("1st= ");
Serial.println(X0);
// CHANGE MODE
Wire.beginTransmission(SlaveAddress); // Begin transmission to the Sensor
//Ask the particular registers for data
Wire.write(0x09);
Wire.write(0x70);
Wire.endTransmission();
//SECOND REQUEST
Wire.beginTransmission(SlaveAddress); // Begin transmission to the Sensor
//Ask the particular registers for data
Wire.write(0x05);
Wire.endTransmission(); //
Wire.requestFrom(SlaveAddress,1);
if(Wire.available()) {
X0 = Wire.read(); // Reads the data from the register
}
Serial.print("2nd= ");
Serial.println(X0);
delay(500);
//THIRD REQUEST
Wire.beginTransmission(SlaveAddress); // Begin transmission to the Sensor
Wire.write(0x04);
Wire.endTransmission();
Wire.requestFrom(SlaveAddress,1);
if(Wire.available()) { //
X0 = Wire.read(); // Reads the data from the register
}
Serial.print("3rds= ");
Serial.println(X0);
delay(500);
}