Modify LCD initialization to reduce failure
Modify LCD initialization to reduce failure , Thanks Garry Change initialization sequence and modify some timing not sure it solve issue of random white screen during printpull/20/head
rodzic
8d52744098
commit
d653f5c807
|
@ -490,7 +490,7 @@ void initializeLCD()
|
|||
// according to datasheet, we need at least 40ms after power rises above 2.7V
|
||||
// before sending commands. Arduino can turn on way before 4.5V.
|
||||
// is this delay long enough for all cases??
|
||||
HAL::delayMilliseconds(235);
|
||||
HAL::delayMilliseconds(500);
|
||||
SET_OUTPUT(UI_DISPLAY_D4_PIN);
|
||||
SET_OUTPUT(UI_DISPLAY_D5_PIN);
|
||||
SET_OUTPUT(UI_DISPLAY_D6_PIN);
|
||||
|
@ -503,6 +503,7 @@ void initializeLCD()
|
|||
|
||||
// Now we pull both RS and R/W low to begin commands
|
||||
WRITE(UI_DISPLAY_RS_PIN, LOW);
|
||||
HAL::delayMicroseconds(5);
|
||||
WRITE(UI_DISPLAY_ENABLE_PIN, LOW);
|
||||
|
||||
//put the LCD into 4 bit mode
|
||||
|
@ -519,20 +520,33 @@ void initializeLCD()
|
|||
HAL::delayMicroseconds(5500); // I have one LCD for which 4500 here was not long enough.
|
||||
// second try
|
||||
lcdWriteNibble(0x03);
|
||||
HAL::delayMicroseconds(180); // wait
|
||||
HAL::delayMicroseconds(150); // wait
|
||||
// third go!
|
||||
lcdWriteNibble(0x03);
|
||||
HAL::delayMicroseconds(180);
|
||||
HAL::delayMicroseconds(150);
|
||||
// finally, set to 4-bit interface
|
||||
lcdWriteNibble(0x02);
|
||||
HAL::delayMicroseconds(180);
|
||||
HAL::delayMicroseconds(150);
|
||||
|
||||
lcdCommand(LCD_DISPLAYOFF);
|
||||
HAL::delayMicroseconds(120);
|
||||
|
||||
lcdCommand(LCD_CLEAR); //- Clear Screen
|
||||
HAL::delayMilliseconds(10); // clear is slow operation
|
||||
|
||||
// finally, set # lines, font size, etc.
|
||||
lcdCommand(LCD_4BIT | LCD_2LINE | LCD_5X7);
|
||||
HAL::delayMicroseconds(120);
|
||||
|
||||
lcdCommand(LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKINGOFF); //- Display on
|
||||
HAL::delayMicroseconds(150);
|
||||
|
||||
lcdCommand(LCD_INCREASE | LCD_DISPLAYSHIFTOFF); //- Entrymode (Display Shift: off, Increment Address Counter)
|
||||
HAL::delayMicroseconds(150);
|
||||
|
||||
lcdCommand(LCD_CLEAR); //- Clear Screen
|
||||
HAL::delayMilliseconds(2); // clear is slow operation
|
||||
lcdCommand(LCD_INCREASE | LCD_DISPLAYSHIFTOFF); //- Entrymode (Display Shift: off, Increment Address Counter)
|
||||
lcdCommand(LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKINGOFF); //- Display on
|
||||
HAL::delayMilliseconds(10); // clear is slow operation
|
||||
|
||||
uid.lastSwitch = uid.lastRefresh = HAL::timeInMilliseconds();
|
||||
uid.createChar(1,character_back);
|
||||
uid.createChar(2,character_degree);
|
||||
|
|
Ładowanie…
Reference in New Issue