Request(); /* send start pulse */
Response(); /* receive response */
I_RH=Receive_data(); /* store first eight bit in I_RH */
D_RH=Receive_data(); /* store next eight bit in D_RH */
I_Temp=Receive_data(); /* store next eight bit in I_Temp */
D_Temp=Receive_data(); /* store next eight bit in D_Temp */
CheckSum=Receive_data();/* store next eight bit in CheckSum */
if ((I_RH + D_RH + I_Temp + D_Temp) != CheckSum)
{
LCD_String_xy(0,0);
LCD_String("Eroare senzor");
}
else
{
itoa(I_RH,data,10); /* convert int to string */
LCD_String_xy(1,6);
LCD_String(data);
LCD_String(".");
itoa(D_RH,data,10);
LCD_String(data);
LCD_String("%");
itoa(I_Temp,data,10);
LCD_String_xy(2,6);
LCD_String(data);
LCD_String(".");
itoa(D_Temp,data,10);
LCD_String(data);
LCD_Char(0xDF);
LCD_String("C ");
}
_delay_ms(10);