You could write an easy-to-use TMP100 library and post that somewhere. The "Playground" section of the Arduino site (see link at the top of the page) is a place where people publish libraries and examples.
Thanks, how do i make my post solved status?
Final Code Working!:
/* Dudley Tolken
Temp Sensor
06-03-2012
Thanks to the following person(s):
1. John Wasser, on the Aruindo Forums
Description:
This project interfaces at Arduino Uno (SMD) with a TMP100 (Texas Instruments).
Temperature Reading:
The TMP100 sends 2 bytes of data for the current sampled temperature. The first byte containts the MSB(Integer) and the second
byte contains the LSB(Decimal).Although the decimal value is only 4 bits long, the decimal value is stored from bit 4 to bit 7
in the LSB, while bit 0 to bit 3 is 0.
To read temperature from the TMP100 the folllowing algorithm is used.
(1).Wire.beginTransmission(Slave_Address) <-Initiate transmision
(2).Wire.write(ponter_address_temp) <-Access temp register in Pointer Register
(3).Wire.endTransmission() <-End transmission
(4).Wire.requestFrom(Slave_Address,2); <-Request 2 bytes(MSB, LSB) from the TMP100 address
Convert the MSB and LSB to the actual temperature.
(1).temp_MSB = Wire.read() <--Store the MSB value into a integer variable(temp_MSB)
(2).temp_LSB = Wire.read() <--Store the LSB value into a integer variable(temp_LSB)
Note:
The MSB is the actual integer value of the current temperature that the sensors measures.
The LSB will look something like this (Remember the actual measurement of the LSB is ONLY 4 bits!!):
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
1/0 1/0 1/0 1/0 0 0 0 0
(3).int temp_deci = map(temp_LSB >> 4, 0, 15,0,99); <- temp_LSB >> 4, it shifts the decimal value of the measured temperature right by 4, so that it sits now between Bit 3 to Bit 0, so conversion to integer is easy
<- 4 Bits goes from 0 to 15 Decimal, so to get an accurate reading, just scale it to be from 0 to 999
Write to Configuration Register.
(1).Wire.beginTransmission(temp_address) <-Initiate transmision
(2).Wire.write(pointer_address_config) <-Access config register in Pointer Register
(3).Wire.write(config); <-Write data to configuration register
(4).Wire.endTransmission(); <-End transmission
Arduino UNO (SMD) -> Master
TMP100 -> Slave
MASTER SLAVE
|----------------------------|
|--------------| | |--------------| |
| Arduino Uno | | | TMP100 | |
| GND|----------------|GND(2) (5)ADD0|---------|
| Vcc(5V)|----------------|Vcc(4) (3)ADD1|---------|
| (SDA)A4|----------------|SDA(6) |
| (SCL)A5|------------|---|SCL(1) |
| | | | |--------------|
|--------------| | |
(pull up) 10K 10K (pull up)
| |
VCC VCC
*/
#include <Wire.h> //Include I2C library
int ponter_address_temp = 0; //Pointer address 0 = Temperature output.
int temp_address = 72; //slave address of TMP100
int pointer_address_config = 1; //Pointer address 1 = Configuration Register
byte temp_MSB, temp_LSB; // Because the TMP100 sends 2 bytes
int config = 224; //Configuration Register - To have 12 bit resolution. Refer to TMP100 for the Configuration Register
void setup()
{
Serial.begin(9600); //serial baud rate
Wire.begin(); //Start I2C
Wire.beginTransmission(temp_address); //Sends slave address with Rwite
Wire.write(pointer_address_config);//Access config register in Pointer Register
Wire.write(config); //Write data to configuration register
Wire.endTransmission(); //End Transmission
}
void loop()
{
Wire.beginTransmission(temp_address); //Sends slave address with Rwite
Wire.write(ponter_address_temp); //Access temp register in Pointer Register
Wire.endTransmission();//End Transmission
Wire.requestFrom(temp_address,2); //Request 2 bytes(MSB, LSB) from the TMP100 address
temp_MSB = Wire.read(); //Store first byte from TMP100 (MSB) into a variable
temp_LSB = Wire.read(); //Store seconds byte from TMP100 (LSB) into a variable
int temp_deci = map(temp_LSB >> 4, 0, 15,0,999); // Shift LSB 4 bits to the rightm and scale it to range from 0 to 999
//Prints to the serial window.
Serial.print("Temp: ");
Serial.print(temp_MSB);
Serial.print(".");
Serial.println(temp_deci);
delay(1000);
}