I2C programming

26 posts   Page 2 of 2   1, 2
by diggy » Wed Jan 02, 2013 2:22 am
psycho_moggie wrote:// read the temperature

if ((temperature = i2c_smbus_read_byte_data(file, 0xaa)) < 0) {
printf("No temperature measurement\n");

Hi there.
I've been trying hard to find a C paradigm for i2c and DS16xx sensors, so thank you. The topic's title is kind of insufficient.

I've had DS1631 working by bitbanging a serial port using VB (in Windows) and Qt (Windows & Linux) for more than 5 years but I believe it's time to integrate it in RaspberryPi.
I have trouble getting the two's complement value from the sensor to have both digits and sign received (int and fraction).

As I my C knownledge is limited could you provide a working snippet to get both bytes?

Thanks in advance.

PS. Sorry for ressurecting an old post.
Posts: 20
Joined: Fri Aug 19, 2011 9:52 pm