CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

ADC with REF

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Guest
Guest







ADC with REF
PostPosted: Sat Feb 19, 2005 12:55 am     Reply with quote

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.
libor



Joined: 14 Dec 2004
Posts: 288
Location: Hungary

View user's profile Send private message

PostPosted: Sat Feb 19, 2005 2:44 am     Reply with quote

You have no channel 5 if you set up RA0_RA1_RA3 only.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group