breeze
Joined: 22 Aug 2013 Posts: 2
|
CCS C, PIC18F67K22 ADC problem ? |
Posted: Fri Aug 23, 2013 3:54 am |
|
|
Hi, guys.
I'm trying to get a ADC value from AN0 pin with PIC18F67K22.
PIC18F67K22 has 12bit ADC module.
c code with CCS C.
#DEVICE PIC18F67K22 ADC=12
main()
{
unsigned int adc_value=0;
setup_adc_ports(sAN0, VSS_VDD ); // VDD=5V, VSS=GND
setup_adc(ADC_CLOCK_INTERNAL); //
set_adc_channel(0);
delay_ms(100);
adc_value = read_adc();
printf("adc0 = %4X , ", adc_value};
}
then, outptut of printf() is adc0=0079;
BTW, ADRESH = CDh, ADRESL = 79, it means adc0 = ADRESL.
why adc_value doesn't include ADRESH value ?
please help me. |
|