Padu wrote: >Ok, I didn't have an 100k around, so I did it with a 68k. When I measure it >from RA0 to GND, it is zero allright, but when I connect it to +5V, measured >voltage is 1.27V. If I connect RA0 directly to VCC then it goes to 5V, but I >think that would happen no matter what right? > Forcing an OUTPUT to +5 quite likely exceeded the current specification of the pin driver. It is likely you have damaged the device. Why it is an output is still a mystery to me. >I'm using mikroPascal, which sometimes simplifies lots of things because of >their libraries, but sometimes it screws me up because I have to debug their >libraries for them.... > >Here's a snippet of pascal: > >////////select Vref and analog inputs, in order to use ADC_read >/////////////// > ADCON1 := 0; // all porta pins as analog, VDD as Vref > TRISA := $FF; >//////////////////////////////////////////////////////////////////////////// >//// > >and to read I use this command: > > Ein := ADC_read(0); > >Do I need to do something other than TRISA := FF in order to set RA0 as >input? > > >I'm gonna try to examine the assembly code generate by mP to see what how >they are initializing the ADC. > > A good idea! BTW: What did you assign to ADCON0? -- * | __O Thomas C. Sefranek WA1RHP@ARRL.net |_-\<,_ Amateur Radio Operator: WA1RHP (*)/ (*) Bicycle mobile on 145.41, 448.625 MHz http://hamradio.cmcorp.com/inventory/Inventory.html http://www.harvardrepeater.org -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist