Eric, Yes, my original code was for the 10 bit ADC when that did not work, I converted to 8 bit. The left and right justify through me at first, mostly trying to figure out why I would want it right justified. Then it hit me (thump) Oh, left Justify for 8 bit and read only the ADRESH register, or right justify and read both for 10 bit. Actually, there is a bug in MPLAB V5.70.00 and v. 5.70.40, in the debugger. If you are trying to simulate the PIC12F675 the debugger will not activate some of the registers, and you can not simulate the ADC. I found this out last night after putting a Microchip app. engineer on the spot. If you are using a PIC12F675 you need to be using MPLAB v. 6.10.00 or newer, however CCS will not be compatible until v 6.20.00. You can use v. 6.10.00 and read in the CCS hex file. MPLAB will then load the xxx.c file. Set the part type and simulate. This works great. I hope to find the problem this morning. Gordon Varney www.iamnee.com www.talk2it.com Voice recognition project. > --- Gordon Varney wrote: > > What am I doing wrong??????? I would appreciate any > > help. > > > > Note: this code works on a PIC12C671. > > > > > 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 > > > > Gordon, > the 12C671 is an 8-bit ADC, the 12F675 is 10-bit. You > need to select if you want the value left-justified or > right-justified in ADRESH and ADRESL (look at the ADFM > bit in ADCON0). If you have it right-justified, then > ADRESH only has the top 2 msb's, and you won't get > much response! > > hope this helps, > Eric > -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu