#include <12f683.h>
#device ADC=10
#fuses NOWDT,INTRC_IO,NOMCLR,BROWNOUT
#use delay (clock=4000000)
#use rs232(baud=9600,xmit=pin_a1,parity=N,stop=1)
#use fast_io(a)
unsigned long int okunan;
float voltaj;
void main ( )
{
set_tris_a(0x01);
output_a(0x01);
setup_adc(adc_clock_div_32);
setup_adc_ports(sAN0);
while(true)
{
set_adc_channel(0);
delay_us(20);
okunan = read_adc();
voltaj = okunan * 0.00488 * 100;
printf("\fSicaklik:%2.2f",voltaj);
if(voltaj >= 40)
{
output_high(pin_a2);
printf("\n\rSicaklik 40 derece ustunde !");
}
else
{
output_low(pin_a2);
}
delay_ms(1000);
}
}