What am I doing wrong??????? I would appreciate any help. Note: this code works on a PIC12C671. The ADC does not work, I have tried init in ASM and C. Still does not work. CCS C V. 3.127 MPLAB5.70.40 PIC12F675 ---------------------------------------------------------------------- ------------------------------------------------------ #include <12F675.h> #use delay(clock = 20000000,RESTART_WDT) // 1/(20000000/4) = 1/5000000 = .0000002 (200ns) #fuses HS,WDT,PUT,NOCPD,NOPROTECT,NOMCLR,BROWNOUT #use fast_io(A) int8 value; //adc value int8 s1; //adc sample #1 int8 s; int8 loop; //loop for off time int8 p; void ADtest(void) { //read the input voltage do { restart_wdt(); // value = read_adc(); //read the ADC #asm asis bsf 0x1F,0x0 nop bsf 0x1F,0x1 nop ag: btfsc 0x1F,0x1 //I do not see the compiler turning this bit on or off goto ag //using the read_adc() command, so I wrote it in ASM. movf adresh,W //I get a small variation in the output but no ADC to speak of. movwf value bcf 0x1F,0x0 #endasm output_high(42); delay_ms(10); output_low(42); delay_ms(10); s1=value; do { //this routine will pulse one time for each bit output_high(42); //measured in the ADC. delay_ms(1); output_low(42); delay_ms(1); s1=(s1-1); } while(s1 <= 1); p = 0; delay_ms(100); } while(p == 0); } ////////////////////////////////////////////////////////////////////// ////////////////////////////// #zero_ram void main() { setup_wdt(wdt_144ms); setup_timer_0(RTCC_INTERNAL | RTCC_DIV_4); setup_comparator(NC_NC_NC_NC); setup_vref(false); setup_adc(ADC_CLOCK_DIV_32); //I tried this in ASM also, still does not work setup_adc_ports(AN0_ANALOG); set_adc_channel(0); restart_wdt(); set_tris_A(0b00111011); delay_cycles(10); output_A(0b00111011); delay_cycles(10); restart_wdt(); ADtest(); } ---------------------------------------------------------------------- ------------------------- Gordon Varney -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body