I am trying to access the sensor data from the LDC1614 using an Arduino over I2C. Following the "Typical Application" section in the LDc1614 data sheet, I am still not able to get the project working. I connected the SCL and SDA pins to the proper ones on the Arudino, and the ADDR pin to ground and the power to 3.3V. Can someone tell me if there is an issue with my code (I use the Wire Arduino Library). Also, even though the power supply is 3.3V, the pin voltage is 5V; is that too high?
#include <Wire.h>
int ADDR_L=0x2A; //ADDR pin connected to ground; device address
#define DATA_MSB_CH0 0x00
#define DATA_LSB_CH0 0x01
#define CLOCK_DIVIDERS_CH0 0x14
#define CH0_SETTLECOUNT 0x10
#define CH0_RCOUNT 0x08
#define DRIVE_CURRENT_CH0 0x1E
#define MUX_CONFIG 0x1B
#define ERROR_CONFIG 0x19
#define CONFIG 0x1A
unsigned int M0,L0;
void setup()
{
Wire.begin();
Serial.begin(9600);
Wire.beginTransmission(ADDR_L);
Wire.write(CLOCK_DIVIDERS_CH0);
Wire.write(0x1002);
Wire.endTransmission();
Wire.beginTransmission(ADDR_L);
Wire.write(CH0_SETTLECOUNT);
Wire.write(0x000A);
Wire.endTransmission();
Wire.beginTransmission(ADDR_L);
Wire.write(CH0_RCOUNT);
Wire.write(0x04D6);
Wire.endTransmission();
Wire.beginTransmission(ADDR_L);
Wire.write(DRIVE_CURRENT_CH0);
Wire.write(0x9000);
Wire.endTransmission();
Wire.beginTransmission(ADDR_L);
Wire.write(MUX_CONFIG);
Wire.write(0x020C); //grammar inconsistentcy on data sheet... is it 0x020C or 0x820C
Wire.endTransmission();
Wire.beginTransmission(ADDR_L);
Wire.write(CONFIG);
Wire.write(0x1401); //datasheet says 0x1601, but I want to use internal clock source
Wire.endTransmission();
Wire.beginTransmission(ADDR_L);
Wire.write(ERROR_CONFIG);
Wire.write(0x0000);
Wire.endTransmission();
delay(100);
}
void loop()
{
Wire.beginTransmission(ADDR_L);
Wire.write(DATA_MSB_CH0);
Wire.endTransmission();
Wire.requestFrom(ADDR_L,1);
if(Wire.available()<=1)
{ M0=Wire.read();}
Serial.println(M0);
Wire.beginTransmission(ADDR_L);
Wire.write(DATA_LSB_CH0);
Wire.endTransmission();
Wire.requestFrom(ADDR_L,1);
if(Wire.available()<=1)
{ L0=Wire.read();}
Serial.println(L0);
}