> Shouldnt the #use delay(clock=10000000) be 20000000 as I am using a 20MHz clock? Yes. > Also, the delay of 100ms. Why have you chosen this, is it the time > for the pic to register and process the analogue to digital > conversion, so after 100mS it is ready to sample again? Nope, it's just a loop delay - the PIC reads the ADC value and prints every 100mS. You could just as easily use a one-second delay or whatever. > I assume that the result of the conversion is stored in value. Say for > example I nputed 2.5v into the PIC how can I actually see what this > value is to ensure that the A2D is functioning correctly. In the example given, the line "value = Read_ADC();" will put the ADC reading into the variable named "value". Actually in that particular case you'll only get an 8-bit result, since value is an int. I would use a long and make sure to set "#device PIC16F877 ADC=10" to get all 10 bits. Here's a snippet of code from one of my projects that uses trhe ADC: #device PIC16F877 *=16 ADC=10 #use delay (clock=20000000 #define volt_input 1 // Analog input from VMM #define amp_input 0 // Analog input from shunt isolation amp setup_adc_ports(A_ANALOG); // Set up analog pins setup_adc_ports // (RA0_RA1_ANALOG_RA3_REF); setup_adc(ADC_CLOCK_DIV_32); // Set up ADC clock temp = 0; for(x=0;x<16;x++) { set_adc_channel(amp_input); delay_ms(1); // Chosen somewhat arbitrarily. // You actually only need a few // microseconds sample time. temp += read_adc(); } What you'll get is a number from 0 to 1023, corresponding to the input voltage compared to the reference voltage. In other words, if Vref = 5V and Vin = 2.5V, the ADC reading will be 512. Hope this helps... Dale -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads