I2C temperatur Sesnor

hi…

I am trying to interface an I2C temperature sensor to the arduino. i followed the examples for the wire librarary but it doesn’t seem to work. when i observe it on the scope i can see some signals flashing on the clock line and SDA. but when i display the returned value it is the same as what i initialized it with…

its a DS1624

Thankyou

does anyone know of anything i might have overlooked. here is my code:

#include <Wire.h>
int temp1=0x11ab;
int temp2=0x7Fcd;
void setup()
{
Wire.begin(); // join i2c bus (address optional for master)
Serial.begin(9600); // start serial for output

Wire.beginTransmission(0x90);
Wire.send(0xAC); // access config reg. command
Wire.send(0x4A); // byte to be sent to config.reg
delay(500);
Wire.send(0xEE); // start conversion command
delay(100);
Wire.send(0xAA); // read conversion command

Wire.endTransmission();
}
void loop()
{

Serial.print(temp1,HEX);
Serial.print("-");
Serial.print(temp2,HEX);
Serial.print(" ");

Wire.beginTransmission(0x90);
Wire.send(0xAA); // read conversion command
delay(100);
Wire.endTransmission();

Wire.beginTransmission(0x90);

Wire.requestFrom(0x90, 2);
delay(100);
if(Wire.available())
{
temp1 = Wire.receive();
}
delay(100);
if (Wire.available())
{
temp2 = Wire.receive();
}
// Wire.endTransmission();

Serial.print(temp1,HEX);
Serial.print("-");
Serial.print(temp2,HEX);
Serial.print(" ");

delay(25);

There is some code here that the poster says works: http://www.homebrewtalk.com/f51/arduino-2wire-smbus-digital-thermometer-104974/

I have no experience with this chip, but I hope that helps.

I see that you put some delays after many of the Wire.send()-calls. This won't help - no data is sent on the I2C-bus until you call Wire.endTransmission(). So if you need to send a byte, wait and then send another byte, you need separate beginTransmission/send/endTransmission-sessions for each byte.

Wire.send only puts bytes in a buffer, it's Wire.endTransmission that does the actual transmission.

hey skumlerud.. thanx for your reply unfotunately i did not read it after i got the previous reply which had a link and it worked perfectly

i had an addressing error in my code... i forgot to account the fact that the least significant bit is compensated by the wiring library..

thanx again