??? 05/28/05 07:05 Read: times Msg Score: +1 +1 Informative |
#94036 - write sequence not correct Responding to: ???'s previous message |
Hi,
In 4 bit mode there should be two writes one for high nibble and other for lower niblle. I have given a sample init LCD code for your understanding. void init_LCD(void) { LCD_RW = 0 ; delay(200); // Wait 20ms LCD_E = 0; LCD_RS = CTRL_REG; // Switch to inruction register //Set LCD_DATA to high nibble of Software Reset LCD_DATA = (LCD_DATA&0x0F)|0x30; LCD_E = 1; LCD_E = 0; // Write data to display delay(50); // Wait 5ms LCD_E = 1; LCD_E = 0; // Write data to display again (SW Reset) delay(50); // Wait 5ms LCD_E = 1; LCD_E = 0; // Write data to display again (SW Reset) delay(50); // Wait 5ms // Set LCD_DATA to high nibble of Function Set (4Bit) LCD_DATA = (LCD_DATA&0x0F)|0x20; LCD_E = 1; LCD_E = 0; // Write data to display delay(4); // Set LCD_DATA to high nibble of Function Set : 4 bit, 2 lines, 5*7 font LCD_DATA = (LCD_DATA&0x0F)|0x20; LCD_E = 1; LCD_E = 0; // Write data to display // Set LCD_DATA to lower nibble of Function Set : 4 bit, 2 lines, 5*7 font LCD_DATA = (LCD_DATA&0x0F)|0x80; LCD_E = 1; LCD_E = 0; // Write data to display delay(4); // Wait 400µs // Set LCD_DATA to high nibble of Display On/Off Control : display off, cursor off, don´t blink LCD_DATA = (LCD_DATA&0x0F)|0x00; LCD_E = 1; LCD_E = 0; // Write data to display // Set LCD_DATA to lower nibble of Display On/Off Control : display off, cursor off, don´t blink LCD_DATA = (LCD_DATA&0x0F)|0x80; LCD_E = 1; LCD_E = 0; // Write data to display delay(4); // Wait 400µs // Set LCD_DATA to high nibble of Clear Display LCD_DATA = (LCD_DATA&0x0F)|0x00; LCD_E = 1; LCD_E = 0; // Write data to display // Set LCD_DATA to lower nibble of Clear Display LCD_DATA = (LCD_DATA&0x0F)|0x10; LCD_E = 1; LCD_E = 0; // Write data to display delay(50); // Wait 5ms // Set LCD_DATA to high nibble of Entry Mode Set : increment DD-RAM address, move cursor LCD_DATA = (LCD_DATA&0x0F)|0x00; LCD_E = 1; LCD_E = 0; // Write data to display // Set LCD_DATA to lower nibble of Entry Mode Set : increment DD-RAM address, move cursor LCD_DATA = (LCD_DATA&0x0F)|0x60; LCD_E = 1; LCD_E = 0; // Write data to display delay(4); // Wait 400µs return; } |
Topic | Author | Date |
LCD PROBLEM ( 4 bit ) | 01/01/70 00:00 | |
Try... | 01/01/70 00:00 | |
Tried | 01/01/70 00:00 | |
3 things | 01/01/70 00:00 | |
3 things | 01/01/70 00:00 | |
No hidden secrets | 01/01/70 00:00 | |
Re:LCD PROBLEM ( 4 bit ) | 01/01/70 00:00 | |
write sequence not correct | 01/01/70 00:00 | |
Great | 01/01/70 00:00 | |
you are welcome![]() | 01/01/70 00:00 |