LM75 and Arduino

Hello!
I have home an I2C temp sensor based on LM75.
Here is the code i`ve written to take the temp from it, but i want it to be in decimal format. With this code i have it in int format, some suggestions ?

#include <Wire.h>
int t,l;
void setup()
{
Wire.begin();
Serial.begin(9600);
}
void loop()
{
Wire.requestFrom(0x4F, 2);
while(Wire.available())
{
t = Wire.receive(); 
l = Wire.receive();      
Serial.print("temperature = ");
Serial.println(t);
Serial.print("lsb = ");
Serial.println(l);
}
delay(500);
}

I may be wrong, since I am just learning I2C myself. but I think the MSB needs to be shifted 4 bits left and the LSB must be shifted 4 bits right. the LSB gives you the decimal and the msb is the whole number.

so:
it would be like wire receive ( t << 4)
wire receive ( l >> 4)

or something to that nature. I think I saw an example on the playground with the specifics.

Can you post the link from the playground?

http://www.datasheetcatalog.org/datasheet/nationalsemiconductor/DS012658.PDF describes the dataformat on page 9.

On page 7 there is a small table how to interpret the bytes:

The first value t are the whole degrees, and the second value l is + or - 0.5 degrees. As these are bytes you should read them as bytes. As the temperature is accurate at 0.5 degrees you should store it in a float. However as bytes are unsigned I use the int8_t instead (that is an 8 bit integer) for msb and lsb.

 int8_t msb = Wire.receive();
int8_t lsb = Wire.receive();
// strip one bit of the lsb
lsb = (lsb & 0x80 ) >> 7; // now lsb = 0 or 1
// add to to form an float
float f = msb + 0.5 * lsb;
Serial.println(f,2);

Don't have such a sensor so I can't check it. Let us know the results. Rob

Yes Rob it`s working very good. Now i want to use this sensor with the ethernet shield + php server + mysql server to generate a flash graph to display it on a website. Thank you for your help !