At 11:39 PM 7/17/97 -0400, you wrote: >I am using a '509 to read a pot and output a PWM on one of the ports for LED >dimming. I charge a cap then measure the discharge time through the pot for >the A/D conversion. It works, but my code is clunky and too slow to do the >PWM at a high enough frequency. Someone out there must have already done >this. Any code or advice would be appreciated. > Brian, Some off the wall suggestions .... a. use your pot in a _high_ frequency oscillator and measure the change in frequency b. cap charging to 63% of supply rail is very linear (1/RC). So use a comparator set for 1/2 of 63% and time comparator switch point and double. c. (tongue in cheek) throw away the pic and use a 555 and pot to vary your led's brightness. Regards, Ross McKenzie Melbourne Australia