In addition if I comment out the line that turns on PWM I get no voltage drop across the input resistor and the A/D reads the voltage correctly. It almost appears as if the PWM is affecting the A/D.
In addition if I comment out the line that turns on PWM I get no voltage drop across the input resistor and the A/D reads the voltage correctly. It almost appears as if the PWM is affecting the A/D.
If you connect your PWM output to a scope or even an LED, does it behave correctly?
Thanks to everyone for their help! I found the actual problem yesterday. As it turns out there was a transient coming in on an A/D pin other than the one I was using to measure the high voltage. I removed that input and the product regulates precisely. Lesson learned: transient voltages on any A/D input can effect the operation of other inputs of the A/D input multiplexer.
TR
It's hair pulling stuff when your programming problem was really an electronics problem,
or vice versa.
Bookmarks