On Sat, Jun 14, 2008 at 09:59:37AM -0700, nfml wrote: > > hi all, > > I really need some help on this matter, I'm a litle bit desperate. > basically I have a PIC 16F877 but the ADC ports stoped working(always > returns 0). > > 1: what could cause the ADC to be ruined completly? > > 2: how can I physically test (with a multimeter) if the A/D converter is > ruined? > > 3: software test: the device is a DLP-2232PB-G (ftdi + pic) and I use PICC > to compile: > > #include <16F877A.H> > #device ADC=10 > #fuses HS,WDT,NOPUT,NOBROWNOUT,LVP,NOWRT,NOPROTECT > #use delay(clock=20000000,restart_wdt) > > setup_adc_ports( 0 ); // 0=ALL_ANALOG > delay_ms(40); > run_AD(); > > void run_AD()//0xA9 > { > int16 dataword; > > set_adc_channel( buffer[2] ); > delay_us(10); > dataword = read_adc(); > //return as two bytes to host - LSByte first > send((int8)(dataword & 0x00ff));//LSByte > send((int8)(dataword >> 8));//MSByte > strobe_SND();//send now through ftdi > } > > the whole firmware is much larger and is given by dlp-design. I use a dlp > software to upload the firmware to the PIC and all is working fine except > the ADC values. > which internal registers can I test to evaluate whether the A/D converter is > ruined? > > please give me some feedback or personal opinion like: "buy a new one!!!" Hi, I use assembly for all my PIC programming, but from looking the code you provided one thing I see missing is a function call that turns on the ADC module. Maybe the read_adc() function turns it on? You should check your compiler manual about this question. Where is the variable buffer defined? The watch dog timer is enabled. Do your delay routines clear the watch dog timer? I'm out of ideas! :) Good luck. Matthew -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist