Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help with ad7747 capacitance -to digital converter

Status
Not open for further replies.

olehansen

Newbie level 1
Joined
Aug 6, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,292
Hi all

I am having an evaluation board from analog devices https://www.analog.com/en/analog-to...gital-converters/ad7747/products/product.html. It is an 24-bit capatcitance -to digital converter with temperature sensor.
This board uses a I2c communiucation bus, but I can't get it to work. Does anyone have a simple example code written in c/c++ for linux?

I have attached my program below. When I run it the write section fails. Could anyone help me, please?


#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <linux/i2c-dev.h>


int main(void)
{
int rv;

int file;
char *filename = "/dev/i2c-3";
if ((file = open(filename, O_RDWR)) < 0) {
printf("Failed to open the i2c bus");
}

if (ioctl(file, I2C_SLAVE, 0x48) < 0) {
printf("Failed to acquire bus access and/or talk to slave.\n");
}


int buf[3] = {0};

buf[0] = 0x48;
buf[1] = 0xA0;
buf[2] = 0x01;


// wirte section
if (rv = write(file, buf, 3) !=3)

{
printf("Error %d", rv);
}
}


Best regards
Ole Hansen
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top