Hello all, I thought I'd try to stimulate some more discussion on this as the=20 previous thread wandered and then died. ;-) After finding out that the datasheet says not to exceed Vdd - 1.5V=20 (3.5V) as a comparator input, my upper voltage tracking is working=20 perfectly (whithin 1mV). Some experimentation shows that (this=20 particular) PIC will work well at up to 4.0V applied to the=20 comparator's input. Anything over that, and the comparator starts=20 acting strange causing me to get ADC readings that vary by more than=20 one LSB. By keeping it less than 4.0V I get consistant readings that=20 vary by only one LSB. As far as feeding the comparator <300mV (even though the data sheet=20 seems to say that's fine), the comparator's output is quite simply=20 wrong. :-O 300mV to the + input and 0V to the - input does *not*=20 result in a high comparator output, even though the + input is at a=20 higher voltage than the - input. Increasing the voltage to above 300mV=20 results in the comparator correctly identifying the fact that 300mV is=20 larger than 0V and setting the output bit high. The cap voltage then=20 immediately rises to match the pot voltage. No offense to Roman, but he seemed to be getting it backwards. ;-) The=20 PIC output has no trouble charging the cap rail-to-rail (within a few=20 mV anyway). The comparator *does* seem to be the problem when operated=20 within 300mV of ground or within 1V of Vdd. Here is some ugly ascii art of the schematic. Obviously it has been=20 simplified for my convenience, but it shows all the components of the=20 feedback loop. The feedback loop/ADC works perfectly as long as you=20 don't push the comparator inputs near the rails. +5V |------------- | V | 16F628 |____/\/\/\/\___ | __________________ | |___RA2__| Comp + Comp - |___RA1___ 10K V | | | Gnd __RA3__| Charge Pin | | | | | | | |_________________| | | | | _________________| | | |____/\/\/\/\____|___|(______ | 4.7K 1uF V Gnd Thanks for any advice anyone may have. -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body