Shouldnt the #use delay(clock=10000000) be 20000000 as I am using a 20MHz clock? 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? 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. Dean Matthews Reliability Engineering Ford Engine Plant Bridgend South Wales, U.K Tel No:(01656)672597 Fax No:(01656)672558 Email: dmatth14@ford.com ` Please consider your environmental responsibility before printing this e-mail -----Original Message----- From: D Lloyd [mailto:dan.lloyd@GB.ABB.COM] Sent: 29 October 2001 12:04 To: PICLIST@MITVMA.MIT.EDU Subject: Re: [PIC]: USING CCSC C COMPILER Hi, "Does anybody have any example C programs using the CCSC compiler for using the onboard A2D converter on the PIC16F877." A derivative of one of CCS' own examples - presumably they won't mind me posting it if they sell a compiler on the back of it ;-) #use delay(clock=10000000) void main (void) { int value; setup_port_a( ALL_ANALOG ); // Next 3 lines are inbuilt functions setup_adc( ADC_CLOCK_INTERNAL ); set_adc_channel( 0 ); do { value = Read_ADC(); delay_ms(100); printf("\n\r%2X\r\n", value); } while (TRUE); } Regards, Dan -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads