I wanted to use the PWM module to control the contrast of a LCD display but having tested it out it doesn’t really work as I expected.
I’m not really very good with electronics but I think it might be that the contrast is usually connected to earth or something.
Anyway any advice would be appreciated.
LCD Contrast control
There was a thread on GLCDs which touched on this topic. There are two basic types floating around, standard temperature and high temperature. Standard uses a bias level between 0 and 5 volts. Extended typically runs between -5 and +5 volts, and can even run lower. The character displays are typically standard, thought there are a few extended in existance. The GLCDs can be either. Some ET GLCDs have built-in DC-DC converters, and furnish -5V to use with this.
The first thing that you need to do is determine what you have. For a manual pot, look at the mB manual; there is a diagram. For standard temp, one side connects to +5, the other to Gnd, and the wiper to the LCD. I would verify operating this way first.
IF you have standard, PWM should be able to produce the right voltage, but I don't know about the current. Also, an RC network is necessary with PWM.
If you have ET, there is an op-amp circuit which will produce -5 to +5 V out as the input goes from 0 to +5V. Of course, you will need a -5 supply, and the PWM output needs an RC filter.
If you want the diagram for the circuit, I will describe it: You need a rail-to-rail op amp. High rail to +5, low rail to -5. Two resistors of equal value (maybe 100K), in series between +5 and op amp output. + input to PWM (RC net), - input to the node between the two resistors. As the + input goes from 0 to +5, the output will go from -5 to +5.
The first thing that you need to do is determine what you have. For a manual pot, look at the mB manual; there is a diagram. For standard temp, one side connects to +5, the other to Gnd, and the wiper to the LCD. I would verify operating this way first.
IF you have standard, PWM should be able to produce the right voltage, but I don't know about the current. Also, an RC network is necessary with PWM.
If you have ET, there is an op-amp circuit which will produce -5 to +5 V out as the input goes from 0 to +5V. Of course, you will need a -5 supply, and the PWM output needs an RC filter.
If you want the diagram for the circuit, I will describe it: You need a rail-to-rail op amp. High rail to +5, low rail to -5. Two resistors of equal value (maybe 100K), in series between +5 and op amp output. + input to PWM (RC net), - input to the node between the two resistors. As the + input goes from 0 to +5, the output will go from -5 to +5.
Code: Select all
R
pic<------------------------/\/\/\/\----------|------------> Analog Out
|
|
------ +
uF
------
|
|
\/ Ground