# need help with TC74 temperature sensor

Status
Not open for further replies.

#### rashidme

##### Member
below is my code to display temperature on lcd. I am using PicDem 2 Plus board along with MPLab IDE. I don't seem to get anything on the lcd screen. The lcd is working fine since I tried writing to it and it displays it. I think the problem is where i am reading data off of the temp sensor.
Code:
#pragma code
void main()
{
unsigned char i2c_addr = 0x9A;                //b'10011010;

TRISB = 0x00;	//port b bits all output

XLCDInit();	//initialize lcd
XLCDClear();	//clear LCD
XLCDL1home();	//go to line 1

OpenI2C(MASTER, SLEW_ON);

StartI2C();			    //start condition
AckI2C();                             //acknowledge condition
AckI2C();
StopI2C();

while (1)
{
StartI2C();
AckI2C();
if (DataRdyI2C())
{
}

StopI2C();
}
}

Status
Not open for further replies.

Replies
5
Views
2K
Replies
23
Views
7K
Replies
19
Views
2K
Replies
4
Views
2K
Replies
2
Views
2K