How to ADC

Status
Not open for further replies.

richiealex

New Member
How to ADC ?

setup_adc_ports(ALL_ANALOG);
setup_adc(ADC_CLOCK_DIV_64);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_INTERNAL|T1_DIV_BY_1);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);

set_adc_channel(0);
delay_ms(800);
volt = read_adc();


lcd_gotoxy(1,1);
printf(lcd_putc, "\fVoltage : %3.1f " , volt );
delay_ms(500);


why cant this work?
 
hi,
I dont do 'C', but dont you have to init the LCD somewhere in the program.?
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…