This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LDC1612: LDC1612

Part Number: LDC1612
HI All ,

i have trying to interface LDC1612 chip to arduino microcontroller .
i have write the code as below I2C read and write operation done properly.
But my receiving is continuously 0 . can anyone resolve my problem.



#include <Wire.h>

int LDC = 0x2A;

int CH0MSB = 0x00;

int CH0LSB = 0x01;

int CH1MSB = 0x02;

int CH1LSB = 0x03;

long initial0 = 0;

long initial1 = 0;

 
unsigned long readChannel0()

{

  unsigned long val = 0;

  word c = 0; //a word stores a 16-bit unsigned number

  word d = 0;

  c = readValue(LDC, CH0MSB);

  d = readValue(LDC, CH0LSB);

  val = c;

  val <<= 16;

  val += d;

  return val;

}

 
unsigned long readChannel1()

{

  unsigned long val = 0;

  word c = 0; //a word stores a 16-bit unsigned number

  word d = 0;

  c = readValue(LDC, CH1MSB);

  d = readValue(LDC, CH1LSB);

  val = c;

  val <<= 16;

  val += d;

  return val;

}

 

void Calibrate()

{

  initial0 = readChannel0();

  initial1 = readChannel1();

}

 

word readValue (int LDC, int reg)

{

  int a = 0;

  int b = 0;

  word value = 0;

  Wire.beginTransmission(LDC);

  Wire.write(reg);

  Wire.endTransmission();

  Wire.requestFrom(LDC, 2);

  while (Wire.available())

  {

    a = Wire.read();

    b = Wire.read();

  }

  value = a;

  value <<= 8;

  value += b;
  
  return value;

}

 

 

void writeConfig(int LDC, int reg, int MSB, int LSB)

{

  Wire.beginTransmission(LDC);

  Wire.write(reg);

  Wire.write(MSB);

  Wire.write(LSB);

  Wire.endTransmission();

}

 

void Configuration()

{

  writeConfig(LDC, 0x14, 0x10, 0x02);//CLOCK_DIVIDERS_CH0

  writeConfig(LDC, 0x1E, 0x90, 0x00);//DRIVE_CURRENT_CH0

  writeConfig(LDC, 0x10, 0x00, 0x0A);//SETTLECOUNT_CH0

  writeConfig(LDC, 0x08, 0x04, 0xD6);//RCOUNT_CH0
  
  writeConfig(LDC, 0x15, 0x10, 0x02);//CLOCK_DIVIDERS_CH1

  writeConfig(LDC, 0x1F, 0x90, 0x00);//DRIVE_CURRENT_CH1

  writeConfig(LDC, 0x11, 0x00, 0x0A);//SETTLECOUNT_CH1

  writeConfig(LDC, 0x09, 0x04, 0xD6);//RCOUNT_CH1
    
  writeConfig(LDC, 0x19, 0x00, 0x00);//ERROR_CONFIG
  
  writeConfig(LDC, 0x1B, 0x82, 0x0C);//MUX_CONFIG

}

 

void setup()

{

  Wire.begin();

  Serial.begin(9600);

 // writeConfig(LDC, 0x1C, 0x10, 0x00);//reset device
   
  delay(200);
  
  //writeConfig(LDC, 0x1C, 0x00, 0x00);//reset device
  
  Configuration();

  delay(500);

  Calibrate();

}

 

void loop()

{

  unsigned long data0 = readChannel0();

//  unsigned long data1 = readChannel1();

  Serial.println(data0);

//  Serial.println(data1);
 
 /* word deviceid = readValue(0x2A,0x7E);
  
  Serial.println(deviceid,HEX);
  
  word device = readValue(0x2A,0x7F);
  
  Serial.println(device,HEX);*/
  delay(5000);

}

  • Santosh,

    It would be better for you to get help with your Arduino code from somewhere focused on that. You could try stack overflow. We can help you with the LDC1612 specific questions.

    Please post here again if you are still having trouble after getting your code checked.

    Thanks,

    -Clancy
  • dear Clancy,

    There is no issue in my code . I don't get the reading from LDC1612 chip.

    All hardware is correct but not responds in output register..

    can you provide me the register specific values for 2 ch reading.... without  or with interrupt.

    void Configuration()
    {
      writeConfig(LDC, 0x14, 0x10, 0x02);
      writeConfig(LDC, 0x1E, 0x90, 0x00);
      writeConfig(LDC, 0x10, 0x00, 0x0A);
      writeConfig(LDC, 0x08, 0x04, 0xD6);
      
      writeConfig(LDC, 0x15, 0x10, 0x02);
      writeConfig(LDC, 0x1F, 0x90, 0x00);
      writeConfig(LDC, 0x11, 0x00, 0x0A);
      writeConfig(LDC, 0x09, 0x04, 0xD6);
        
      writeConfig(LDC, 0x19, 0x00, 0x00);
      
      writeConfig(LDC, 0x1B, 0x82, 0x0C);
    }

  • Are you putting the device into normal mode after you are finished configuring the device? I did not see this in your code.

    The device defaults to sleep mode after starting up, which is when you can write to registers. After configuration, you must set the SLEEP_MODE_EN field to 0 in the CONFIG register (0x1A) to start conversions.
  • I have to design LDC1612 as metal detector.
    Distance 500mm to 1000mm.
    please suggest the L and C values
    Also suggest the config register values for single channel and multiple channel......