I've attached my LCD Display (AV1624YRB-SJ) to my Arduino Nano on the following pins:
#define LCD_RS 7
#define LCD_ENABLE 8
#define LCD_D4 9
#define LCD_D5 10
#define LCD_D6 11
#define LCD_D7 12
#define LCD_CONTRAST 6 //PWM Wave with capacitor for contrast
and im initializing it this way:
LiquidCrystal lcd(LCD_RS, LCD_ENABLE, LCD_D4, LCD_D5, LCD_D6, LCD_D7);
byte arrow[8] = {
B00000, B00100, B00010, B11111, B00010, B00100, B00000,
};
void setup() {
pinMode(LCD_CONTRAST, OUTPUT);
pinMode(LCD_D4, OUTPUT);
pinMode(LCD_D5, OUTPUT);
pinMode(LCD_D6, OUTPUT);
pinMode(LCD_D7, OUTPUT);
analogWrite(LCD_CONTRAST, STARTCONTRAST); // Set LCD Contrast
lcd.begin(16, 2);
lcd.createChar(CHAR_ARROW, arrow);
lcd.setCursor(3, 0);
lcd.print("Welcome To");
lcd.setCursor(1, 1);
lcd.print("My Test");
delay(2000);
}
The Problem is, that there is nothing to see on the display. If i crank up the contrast slightly you can see something like a rolling shutter effect.
http://i.imgur.com/FOIEwVj.gif
The display worked just fine 3 days ago. Where could be a mistake. I don't remember changing something, but i tried rewiring.
-
Your method of handling the contrast is unusual. Normal is a potentiometer as in this diagram codb.coocox.org/component/doc/coocox-master/1602IIC/…6v6gt– 6v6gt2017年03月03日 00:15:59 +00:00Commented Mar 3, 2017 at 0:15
-
The Potentiometer just produces a given voltage. PWM plus Lowpassfilter equals a voltage too. This way i can adjust the contrast digitally.Diego– Diego2017年03月03日 06:38:26 +00:00Commented Mar 3, 2017 at 6:38
-
1I'd temporarily replace it with a pot to rule out that this is the problem. Also, try pressing down on the black border of the LCD. It could be a connection problem between the glass and the pcb of the display.Gerben– Gerben2017年03月03日 08:40:23 +00:00Commented Mar 3, 2017 at 8:40
1 Answer 1
As I noted in a comment to the question Arduino LCD is displaying gibberish, sometimes, a PWM's sharp-cornered waveform might introduce a lot of noise into the LCD. If you have to use PWM, you probably should put a good low-pass filter between PWM and LCD pin 3.
Check whether using a fixed voltage (from a voltage divider or pot) fixes the problem. That fixed the problem in the case of the linked question.
If you need programmable control of contrast, and can't get PWM to work without heroic measures involving op-amp based filters, you could use a digital pot or a DAC.
-
The contrast works pretty fine. As stated my Display used to work and with an Encoder i could set the contrast digitally. PS: I've added some imformationDiego– Diego2017年03月03日 06:36:35 +00:00Commented Mar 3, 2017 at 6:36
-
If this is set up on a breadboard, maybe one of the wires is loose; try reinserting them.James Waldby - jwpat7– James Waldby - jwpat72017年03月03日 07:22:22 +00:00Commented Mar 3, 2017 at 7:22