I want to adjust LCD contrast using PWM. Waveform generated using a 8-bit timer running at 16MHz (no prescaler) in fast PWM mode.
If I connect PWM pin directly to V0, sometimes LCD shows some garbage characters or skips some commands; probably because of the noise which PWM waveform generates.
I tried RC low-pass filter but it didn't help unless I increase resistance a lot which caused a reduced contrast range.
I wanted to create another type of filter; so I inserted a 470Ω resistor between PWM pin and V0 before other steps. Surprisingly, LCD started working perfectly! No more garbage character or command skipping even while printing characters very fast. Contrast adjusting also worked perfectly.
What's going on? How did a simple resistor solve the problem?