#include "16F877A.h"
#device ADC=8
void main() //********************************************
{
int adc_value;
int temperature;
set_tris_a(1); //setting port A to output
set_adc_channel(0); //channel 0 selected or pin RA0 selected for adc
setup_adc(ADC_CLOCK_DIV_8);
setup_adc_ports(RA0_ANALOG);
adc_value=read_adc(); //read value off adc
temperature= adc_value*2; //convert adc raw value into temperature in degree celsius
if(temperature<=2 && temperature>=43) //if temperature is more than specified limits, switch off pin D0
output_low(PIN_D0);
}