for(i=0x80;i>0x00;i=(i/2))
{
//masking value with i , write to SENSI-BUS
if (i & value)
DATA_TO_1();//DATA=1;
else
DATA_TO_0();//DATA=0;
Delay(1);
SCK_TO_1();//SCK=1;
Delay(1);
SCK_TO_0();
Delay(4);
}
//change DATA line to input pin,check wether there is an ack
//The SHTxx indicates the proper reception of a command
//by pulling the DATA pin low(ACK bit)
//after the falling edge of the 8th SCK clock.
DATA_TO_1();//DATA=1;
Delay(1);
rGPECON &= ~0xc0000000;
//The DATA line is released(and goes high)after the falling edge of the 9th SCK clock.