ARGH !! The PICkit2 (and "demo boards") datasheets is a bit of a mess. Of course I was looking at the wrong "demo board". On the one with a 16F690, AN0 is shared with ICSPDAT, of course. And since ICSPDAT is internaly pulled down with 4.7 kohm in the PICkit2, this is what happens if one keep the PICkit2 connected (which is logical, to get power supply for the denmo board!). How the heck could they select AN0/ICSPDAT for the pot on the demo board ? Sorry for the trouble... Jan-Erik. On 2010-07-29 19:55, Joep Suijs wrote: > RA0 is also wired to the ICSP connector. I guess you have disconnected > the programmer? > > Joep > > 2010/7/29 Jan-Erik Soderholm: >> >> >> On 2010-07-29 18:56, alan.b.pearce@stfc.ac.uk wrote: >>>> No, just the standard "PICkit2 Starter Kit" : >>>> http://www.microchip.com/pickit2/ >>>> >>>> The 28-pin demo board in that kit : >>>> http://ww1.microchip.com/downloads/en/DeviceDoc/41301A.pdf >>>> Scematic at page 9, the pot at the top of fig A-1. >>>> >>>> It's the voltage drop over R7 that is my concern. >>>> >>>> >>>> Jan-Erik. >>> >>> Well, I suspect we are at a point where something in your code is >>> setting RA0 to an output and setting it low, i.e. writing 0 to both >>> TRISA and PORTA. >> >> It's not "my" code. :-) >> >> The code is "lesson 4" in the PICkit2 low-pin-count demo code kit. >> I have put a copy of the actual code here : >> http://jescab2.dyndns.org/pub_docs/a2d_asm.txt >> >> I tried to do some minor adjustments (only enabling AN0, shutting >> WPU off and so on) but no changes at all. >> >> >> >>> >>> AIUI having a port bit set to analogue doesn't stop it being used as a >>> digital output port. This is used to advantage in some sneaky schemes >>> for doing things like making capacitance meters, by discharging the cap >>> and then using the A/D or comparator to measure the time it takes to ge= t >>> to a certain voltage. >>> >> -- >> http://www.piclist.com PIC/SX FAQ& list archive >> View/change your membership options at >> http://mailman.mit.edu/mailman/listinfo/piclist >> --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .