#include <18f4550.h>
#device ADC=10
#fuses HS,NOWDT,NOPUT,NOPROTECT,NODEBUG,NOLVP,NOCPD,NOWRT,NOMCLR,INTRC_IO,NOPBADEN,BROWNOUT,PUT
#use delay(crystal=48000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7,ERRORS)
#include<flex_lcd416.c>
void main()
{
unsigned int8 t0,t1,T;
unsigned int8 h;
lcd_init();
setup_adc(ADC_CLOCK_INTERNAL);
setup_adc_ports(ALL_ANALOG);
set_adc_channel(0);
delay_ms(10);
t0=read_adc()/2;
delay_ms(10);
set_adc_channel(1);
delay_ms(10);
t1 = read_adc()/2;
delay_ms(10);
T=t0-t1;
lcd_gotoxy(1,2);
printf(lcd_putc,"Temp::\t%3.0d \xDFC ",(signed int8)T);
printf("Temp::\t%3.0d \xDFC\r",(signed int8)T);
set_adc_channel(2);
delay_ms(10);
h=read_adc()/2;
delay_ms(10);
lcd_gotoxy(1,1);
printf(lcd_putc,"Humidity::%3.0u",(unsigned int8)h);
output_high(PIN_B3);
}