TMP100 interface with 24F16KA102

Status
Not open for further replies.

adnan012

Advanced Member level 1
Joined
Oct 6, 2006
Messages
468
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Visit site
Activity points
4,923
i want to use tmp100 temperature sensor with 24F16KA102 in CCS picc by using software i2c.

i am confused about acknowledgment in i2c.
Second how can i convert data in to decimal. i need only decimal .

here is sample code

#use i2c(Master,scl=PIN_b4,sda=PIN_B6,SLOW)


i2c_start();
i2c_write(0x90); // Write to point register
i2c_write(0x01); // Write configuration reg to point register;
i2c_write(conf);
i2c_stop();

tm_setconf(0x60); // value for configuration


i2c_start();
i2c_write(0x90); // Write to point register
i2c_write(0x00); // Write Temp reg to point register;
delay_ms(1);
i2c_start();
i2c_write(0x91);


my_temp = i2c_read();
rec_temp = (int)my_temp;
delay_us(100);
my_temp = i2c_read();
rec_temp = rec_temp << 8;
rec_temp = rec_temp | my_temp;

i2c_stop();
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…