[En-Nut-Discussion] nutdevice devLcd not working properly
Sam Van Den Berge
sam.van.den.berge at telenet.be
Tue Feb 26 18:46:32 CET 2013
I've recently picked up my old code build with ethernut 4.8.7. Back then I
made a simple test program to write some text to my LCD:
NutRegisterDevice(&devLcd, 0,0), freopen, printf(ESC_CLRHOME) and a line
printf("Hello"). After that I've put an endless loop with NutSleep in it.
That program worked like a charm. I saved the hex-file and today I flashed
that hex-file into my device ( atmega128, ethernut v2.1 rev. B. ). It still
worked and I could see the text on the LCD.
Now I downloaded the most recent ethernut version (5.1.0), recompiled my
project but nothing happened. The screen does get initialized by calling
NutRegisterDevice(..). I know that because the black squares on the display
disappear. Unfortunately, my text doesn't come on the display anymore. The
LCD remains blank.
I've downloaded a random HD44780 library and made a test program without
Nut/OS. That program works perfectly.
Now by first getting some text on the display using the third party lib, and
then immediately afterwards programming the board again with the Nut/OS
version of controlling the display, I was able to get some weird text on the
I've found a pattern, namely, it looks like the high and low nibble of every
character gets switched. For example, if I write "7777777" (7 = 0x37 ) to
the display, I get "ssssss_" (s = 0x73 ) on the LCD. So does W (=0x57 ) gets
translated in u (=0x75).
As a reaction, I tried to rebuild ethernut and instead of using the mask
0xF0 for the data port ( LCD in 4-bit mode ), I now tried to use the mask
0x0F. But that is even worse. Now I couldn't find any relation with my
Is there anyone who could confirm that the LCD HD44780 driver in 4-bit mode
is still working properly? Or someone who might have an idea where to look
I tried rebuilding ethernut 4.8.7 but I get errors about methods that are
deprecated. I have also checked HD44780.c and found out that the methods inp
and outp are replaced by inb and outb in the method LcdSendNibble.
Thanks in advance.
More information about the En-Nut-Discussion