pandu.ranganadh
Joined: 28 Apr 2008 Posts: 12 Location: hyd
|
problem with using ADC channel 1-8 |
Posted: Mon May 12, 2008 12:46 am |
|
|
Hi
I am using pic16f877 and microchip old version board.
My problem is i am unable to get ADC output through channels 1-8.
#include <16F877.H>
#device adc=10
//#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=16000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
#include "flex_lcd.c"
//============================
void main()
{
int16 adc_value;
float volts,a=10.25;
lcd_init();
setup_adc_ports(RA0_ANALOG);
//setup_adc_ports(ALL_ANALOG);
setup_adc(ADC_CLOCK_INTERNAL);
set_adc_channel(5);
//set_adc_channel(1);
delay_us(20);
while(1)
{
adc_value = read_adc();
volts = (float)(adc_value * 5)/1023.0; // This is the fixed formula
//lcd_putc("\f Output \n");
printf(lcd_putc,"\f %3.4f Volts\n",volts);
delay_ms(500);
}
}
My ccs c compiler version is 4.
Please help me to read ADC channels 1-8.
Bye
Thanking you, |
|