Guest Guest
|
ADC with REF |
Posted: Sat Feb 19, 2005 12:55 am |
|
|
void Read_Humity()
{
setup_adc_ports(RA0_ANALOG_RA3_RA2_REF);
setup_adc(ADC_CLOCK_DIV_2);
set_adc_channel( 0 );
delay_us(10);
value = read_adc();
setup_adc( ADC_OFF );
humi = value/1023*100;
printf("%c%c%c",0xa1,0,1);
printf("%cAD=%04lu Humi=%03f %c",0xa2, value, humi, 0);
}
void Read_Temp()
{
setup_adc_ports(RA0_RA1_RA3_ANALOG);
setup_adc(ADC_CLOCK_DIV_2);
set_adc_channel( 5 );
delay_us(10);
value = read_adc();
setup_adc( ADC_OFF );
temp = value/1023*100;
printf("%c%c%c",0xa1,0,2);
printf("%cAD=%04ld Temp=%03f%c",0xa2, value, temp, 0);
}
It's Can't get AD value...
Please check this...
thank you. |
|