thank you so much I'll try to understand itYou will not like it. It takes a lot of parts to do this function in analog.
I built this up a few years ago. 0 to 10 volts input at TP5 will give you 0 to 100% brightness. You will have to rescale for a different voltage input.
It is so so much simpler to do this in software. You would have less parts than you do now.
Mark
for the software solution,I know that the pic has an A/D converter but it has a D/A converter too??