You are on page 1of 4

Interfacing of Temperature & Humidity Sensor

SHT75 with picf16877A

For flex_lcd.c and sht75.c You will need to update library .if you need than code so Inbox us at our
www.facebook.com/ELECTRONICS.LOVERZ page our team will provide both codes
For flex_lcd.c and sht75.c You will need to update library .if you need code so Inbox us at our
www.facebook.com/ELECTRONICS.LOVERZ page our team will provide both codes
Main c code .

///////////////////////////////////////////////////////////////////////////////

// //

// Driver file for SHT75 Temperature & Humidity Sensor //

// Presented By Electronics Lovers //

// //

///////////////////////////////////////////////////////////////////////////////

#include <16f877a.h>

#device adc=10 // Set ADC resolution to 10Bit

#fuses XT,NOLVP,NOWDT,NOPROTECT

#use delay(clock=4000000)

#include "flex_lcd.c"

#include "sht75.c"

#define LOAD PIN_B7

#define THRES 25.0 // load switching threshold in Celsius

float restemp, truehumid;

void main()

/* Peripherals Configurations */

lcd_init(); // Turn LCD ON, along with other initialization commands

output_low(LOAD); // the load is initially OFF

lcd_gotoxy(1,1); // point LCD cursor to col1 row1


lcd_putc(" Electronics Love "); // print on LCD

lcd_gotoxy(1,2); // point LCD cursor to col1 row1

lcd_putc(" Presents "); // print on LCD

delay_ms(3000);

lcd_init();

sht_init();

while(1)

sht_rd (restemp, truehumid);

lcd_gotoxy(1,1);

printf(lcd_putc, "Temp : %3.1f %cC ", restemp, 223);

printf(lcd_putc, "\nRH : %3.1f %% ", truehumid);

delay_ms(500); //delay 500 ms between reading to prevent self heating of sensor

if(restemp>=THRES) output_high(LOAD); // Control Load

else output_low(LOAD);

delay_ms(1000); // 1 second delay between readings

You might also like