5 years, 3 months ago.

Cannot write on LCD


I have a problem of writing data on LCD. A simple hello world cannot be printed on my LMB162ABC-1. The LCD jst displays blocks on the first row, what could be the problem because i checked my connections and they are correct?

Thanks in advance.

Question relating to:

1 Answer

5 years, 3 months ago.

Blocks in the top line of a 16x2 display means that you have power and contrastvoltage, but the display is not initialised. This may be due to bad or missing wiring or simply because the code is not running. Did you use some illegal pin? Did you connect the RW (pin 5) to GND? The TextLCD lib (either Simons original or my improved Lib) does not read back from the display and it expects RW to be hardwired to GND.

Yes I wired my RW to GND, what do you mean by illegal pin? Here are my connections 1 - GND; 2 - 3.3V; 3 - Variable resistor; 4 - RS - pin 18; 5 - RW- pin 19 -GND; 6 - E - pin20; 11 - DB4 - pin 17; 12 - DB5 - pin 16; 13 - DB6 - pin 15; 14 - DB7 - pin 14, 15 - 5V and 16 - GND

Your help is much appreciated. Thanks

posted by Mpho Gololo 06 Oct 2014

Illegal pins means that you have defined a NC pin somewhere which may lead to a crash. Is your code actually running? Do you get some printed messages or flashing LEDs? It seems that you have wired RW to pin 19. That means that DigitalOut pin should be pulled low (GND). It is easier to simply hardwire the RW pin to GND and not connect it to a processor pin.

Your code should look something like this:

// Hello World! for the TextLCD
#include "mbed.h"
#include "TextLCD.h"
TextLCD lcd(p18, p20, p17, p16, p15, p14); // rs, e, d4-d7
int main() {
    lcd.printf("Hello World!\n");

posted by Wim Huiskamp 06 Oct 2014