A 16 X 4 acting like 32 X 2

Hi guys;

I just purchase this LCD ( see pictures ) and I code at first using lcd.begin(16, 4); and I use the lcd.setCursor(0,3); and lcd.setCursor(0,4); but it did not display at the 0 location, only the 2 top row, the bottom row start at location 4. I read the tutorial and it say: when you write a long string of letters/numbers, it is going to write into the 3rd row or 4th row. So I re-write my code and write for lcd.begin(32, 2); instead and test for position higher than 16. Guess what… it work…

I wonder why ?

Here the code : Bad one

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);

void setup() {
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 4`);
  lcd.clear();
  // Print a message to the LCD.
  lcd.setCursor(0,0);
  lcd.print("test 0");
  lcd.setCursor(0,1);
  lcd.print("test 1");
  lcd.setCursor(0,2);
  lcd.print("test 2");
  lcd.setCursor(0,3);
  lcd.print("test 3");
  }
void loop()
{
}

The code that work :

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);

void setup() {
  // set up the LCD's number of columns and rows: 
  lcd.begin(32, 2);
  lcd.clear();
  // Print a message to the LCD.
  lcd.setCursor(1,0);
  lcd.print("test 0");
  lcd.setCursor(4,1);
  lcd.print("test 1");
  lcd.setCursor(17,0);
  lcd.print("test 2");
  lcd.setCursor(18,1);
  lcd.print("test 3");
  }
void loop()
{
}

Top picture : Don’t work right

Bottom picture : Working right

Read towards the bottom about 16X4 displays:

http://web.alfredstate.edu/weimandn/lcd/lcd_addressing/lcd_addressing_index.html

IIRC, you need to modify the lcd library's row starting DDRAM address values to make them work on this display. If you don't want to do this (mess up regular 20X4 displays), try lcd.setCursor(16,0) for lcd.setCursor(0,2) and lcd.setCursor(16,1) for lcd.setCursor(0,3)

So I re-write my code and write for lcd.begin(32, 2);

Mucking about with the lcd.begin parameters will not help until the LiquidCrystal library is updated. All of the versions up 'till now do not do much with the two parameters.

The first parameter is ignored completely - it just isn't used at all. It is probably there so that if and when they decide that fixing the cursor positioning problems with 16x4 displays is important they will have the information they need.

The second parameter is only checked to see if the number is '1' or something greater than '1'. This is really all the information that is needed in order to initialize the LCD controller properly. If they ever decide to implement line wrapping etc. then they will need more information from this parameter.

Don

@liudr

you need to modify the lcd library’s row starting DDRAM address values to make them work on this display. If you don’t want to do this (mess up regular 20X4 displays), try lcd.setCursor(16,0) for lcd.setCursor(0,2) and lcd.setCursor(16,1) for lcd.setCursor(0,3)

Nice to know…I am not ready to mess the lcd library yet… but your tip will definaly work well. And thank for the informative link.

@floresta

The first parameter is ignored completely - it just isn’t used at all. It is probably there so that if and when they decide that fixing the cursor positioning problems with 16x4 displays is important they will have the information they need.

The second parameter is only checked to see if the number is ‘1’ or something greater than ‘1’. This is really all the information that is needed in order to initialize the LCD controller properly. If they ever decide to implement line wrapping etc. then they will need more information from this parameter.

Thank floresta…nice to know that litle peice of info regarding lcd.Begin(16, 2);… Interesting

That was floresta's website so thank floresta :)

So floresta is the LCD display expert than .... Thank you for the info, floresta

Techone: So floresta is the LCD display expert than .... Thank you for the info, floresta

That's right. I am just a user of the LiquidCrystal library with some troubleshooting experience. I don't know the details of how to communicate with these LCDs beyond calling the library functions :)

@liudr

The raison I buy this expensive ( $20.00 ca ) LCD 16 X 4 is I need for my Voltage & Frequency Monitor Project. The 16 X 2 don't have any more space to display. And that particular LCD connection are 2 mm type not 2.5 mm type :P

Heh, I make it work... 8) I check for 2 mm connectors so I can make my own "adapter" to fit a 2.5 mm connectors / breadboard spacing. the site : http://www.iteadstudio.com have them.

I wonder where did you get your 16 X 4 LCD display ? Same site ?

Mine are 20*4, not 16*4. They are much like 16*2 so the setCursor works nicely. If you find more old cpus, I can trade with you. I have plenty of these displays. I bought them from an eBay store. I'm not purchasing from eBay anymore and just pay the store through paypal, less fees for them.

If you find more old cpus ...

Are you interested in some of the peripheral chips as well. I think some of mine survived the last purge of junk.

Don

floresta:

If you find more old cpus ...

Are you interested in some of the peripheral chips as well. I think some of mine survived the last purge of junk.

Don

Don,

What do you have? Besides, I'm also interested in old literature say intel's 8088 book or old games on floppy. PM me if you have a list :)