CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

TC74 simple driver

 
Post new topic   Reply to topic    CCS Forum Index -> Code Library
View previous topic :: View next topic  
Author Message
PICoHolic



Joined: 04 Jan 2005
Posts: 224

View user's profile Send private message

TC74 simple driver
PostPosted: Thu May 10, 2007 5:17 am     Reply with quote

Code:

#ifndef  TC74
#define  TC74

#define TMP_write 0B10010000
#define TMP_read  0B10010001
#define _TMPREG_  0x00
#define _CONFREG_ 0x01

void TC74Init()
{
   i2c_start();
   i2c_write(TMP_write);
   i2c_write(_CONFREG_);
   i2c_write(0x00);
   i2c_stop();
}

byte  GetTemp()
{
   byte temp;
   i2c_start();
   i2c_write(TMP_write);
   i2c_write(_TMPREG_);
   i2c_start();      // restart
   i2c_write(TMP_read);
   temp = i2c_read(0);
   i2c_stop();
   return temp;
}

#endif
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> Code Library All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group