16x1 LCD only shows 8 leftmost characters

I hate to start still another LCD thread, but...

Two similar HD44780 LCD 16x1 boards work fine displaying all 16 characters on two other PIC projects that also use the same 4 data bits and 3 control lines. Neither work on Arduino where I only get the leftmost 8 characters.

Using official LCD library and Arduino 14.

4 bit using code example listed for LiquidCrystal () configured LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);

Wired LCD pin Arduino Pin 4 --------------> 12 5 --------------> 11 6 --------------> 10 11-------------> 5 12-------------> 4 13-------------> 3 14-------------> 2

I've tried LCD Pin 5 (R/W) grounded and ungrounded. Works the same either way—no apparent effect.

I've used it on a couple of different sketches from different contributors, including one that scrolls ("I love pinball!") and only the first 8 character positions work.

At this point I don't know if it is a hardware or software issue. Picture shows a PIC-EL board (hams might know what it is) on the left and Arduino display on the right.

Thanks for any help.

Eric

Eric:

Two similar HD44780 LCD …

I am assuming that ‘similar’ does not mean 'identical. There are two different configurations for 16x1 LCDs. If there is an auxiliary controller along with the HD44780 then the appropriate memory addresses for the 16 characters would be 00h - 0Fh. This should be initialized as a 1-line device. If there is no auxiliary controller then the first 8 characters are at 00h - 07h and the others are at 40h - 47h. This must be initialized as a 2-line device. The number of ‘lines’ referred to in the initialization refers to the memory in the controller, not the characters on the display. For a more complete explanation check out the LCD Addressing link at http://web.alfredstate.edu/weimandn.

Don

Thanks Don. That makes sense. My LCD modules are different manufactures (Emerging Displays and Lumex), but both have a single epoxy blob housing an HD44780 "equivalent". Spec sheets say one is a KS0066, the other a KS0072.

I'm looking at the Function Set instruction for the Lumex (KS0066) module and I'm guessing somewhere in LiquidCrystal.cpp I'm going to find some way to change the instruction that is sent. I have to find some way to look at the source code, then I have to find some way to recompile it or will the Arduino IDE do that?

I'm pretty much a newbie when it comes to C/C++ so any guidance you or anyone else can give will be appreciated.

BTW, I tried the LCD4bit library as well, and can't get as far along as I am with the LiquidCrystal library, so I'm going to stick with getting it working with the official library. I should be OK as soon as I can learn how to initialize the modules as 2 line.

Eric

Eric:

With a single blob your displays are using 2 ‘lines’ of memory. Both LiquidCrystal and LCD4bit set up the controller for 2-lines so you are ok there.

In order to use the second row on your display you have to set the address using the lcd.setCursor(col, row) function. You want col = 0 and row = 1 since the numbering starts with 0 instead of 1.

You could try this program which sends 80 printable ASCII codes to the 80 memory locations in the controller. That way something should appear in each location on your display so you can verify that it works. Don’t forget to use the appropriate pin numbers for your setup.

include <LiquidCrystal.h>

//LiquidCrystal lcd(rs,rw,en,d4,5,6,7);
  LiquidCrystal lcd(12,11,2,7,8,9,10);

void setup()
  {
    for (int i=47; i<127; i++)
    {
    lcd.print(i,BYTE);
    }
  }
void loop()
  {
  }

I don’t know much C/C++ myself, just enough to be dangerous.

Don

Ok, that really helps. I was able to fill all 16 columns. Then I tried a string and had to resort to splitting the string at 8 char and inserting an lcd.setCursor(0,1), then printing the remaining characters of the string. I'm not sure that's how it is supposed to work, but it does work.

The application I have for the 16x1 LCD module is to simulate a zero center analog meter. lcd.setCursor() is actually going to be how I move the "needle". I'll probably print 16 characters as a background scale, then as the "needle" is supposed to move left or right from center, I'll just move the cursor and write a new "needle" character there.

No secret about what I'm doing. It will have a differential pressure sensor in it to measure the manifold vacuum in the two cylinders of my BMW motorcycle. The two cylinders have to be balanced to get the legendary smoothness. I'll translate the difference into a cursor position on the 16x1 screen, and hopefully have enough resolution to make it work. I could have just bought a 16x2 and saved myself two days, but I have about a dozen of these 16x1's :)

Thanks for the help. The LiquidCrystal library is terrific.

Eric