Go Down

Topic: 4x20 LCD I2C Adapter - 1st 4 char of line4 repeated over last 4 char of line2 (Read 2745 times) previous topic - next topic

OldSalt1945

Fixed up test code.  I didn't have a setCursor(0,0) because I was using home() and clear().  There is no (0,4), it's 0 thru 3.
Code: [Select]
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x20, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address

void setup()
{
  lcd.begin(20,4);               // initialize the lcd
   lcd.home();
   lcd.clear();
}

void loop()
{
   lcd.setCursor ( 0,0);
   lcd.print("Line2GoofedUpExample");
   delay (5000);
   lcd.setCursor ( 0,1);
   lcd.print("ThisIsTheSecondLine2");
   delay (5000);
   lcd.setCursor (0,2);
   lcd.print("ThisIsTheThirdLine33");
   delay (5000);
   lcd.setCursor(0,3);
   lcd.print("LastLineFirst4Repeat");   
   delay (5000);
}


The test result is the same.  The last 4 of line2 shares memory with the first 4 of line4.

John
Always keep the shower curtain INSIDE the tub.

raschemmel

Quote
You start your counting with 1 but most programmers start with 0.


I guess that means I'm not a programmer yet...
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

floresta

You can check out your hardware by using a variation of the following program which does not involve any addressing. 

Here's what I typically recommend for a traditional parallel connection, you will need some minor modifications for your I2C setup.

Code: [Select]
#include <LiquidCrystal.h>

//LiquidCrystal lcd(rs,en,d4,d5,d6,d7);
  LiquidCrystal lcd(12, 11, 5, 4, 3, 2);       // put your pin numbers here

void setup()
  {
    lcd.begin(20, 4);                          // put your LCD parameters here
    for (char i=47; i<127; i++)                // send 80 consecutive displayable characters to the LCD
      {
        lcd.print(i);
        delay(100);                            // this delay allows you to observe the addressing sequence
      }
  }


void loop()
  { 
  }


Don

floresta

Quote
I didn't have a setCursor(0,0) because I was using home() and clear().  There is no (0,4), it's 0 thru 3

Correct!

John, do all of us a favor and get your display functioning properly with all of the code in setup before getting involved with loop.


Don

floresta

Quote
I guess that means I'm not a programmer yet...


I'm not either and I've been around longer than either of you (if the '1945' means what I think it does).

Don

raschemmel

John,
Where did you get your  lcd Constructor ?
Code: [Select]
LiquidCrystal_I2C lcd(0x20, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address

The reason I ask is that in your other post you said you used this constructor and it worked with fm's library:
Code: [Select]
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7);

You said you downloaded the Guessor but never said anything about actually running it or about the backlight blinking 3 times so I am wondering if you ever ran it and what happened ? (and why the difference in constructors)
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

OldSalt1945

OK, Don.  I moved it back to Setup.  If I want to see it repeat, I can always hit the reset button.

I ran the sketch you provided and it printed line 1,
then line 3,
then line 2 with the last 4 characters also printing to line 4,
then line 4 with the first 4 characters also printing over the last 4 of line 2.

Line 2 now reads WXYZ****_\abcdefklmn           (I put * for symbols I couldn't find on the keyboard)

Line 4 now reads klmnopqrstuvwxyz{|}*                         "

1945 means I am 1 thousand nine hundred and forty-five years old.  I started programming computers when I was 3.  I win!!!! :D  Unfortunately, I forgot everything and am having to start over.  My first program was written in Autocoder on an IBM 1403.  It had 4K of core RAM built in and a 16K add-on core memory.  The computer was the size of 3 or 4 refrigerators bolted together.  The 16K core memory unit was about 24" x 24" x 24".  It generated enough heat that we warmed our pies (from the cafeteria) in it.  80-column punch cards and tape drives.  Who could afford hard disk drives?

John
Always keep the shower curtain INSIDE the tub.

raschemmel

Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

floresta

Quote
I ran the sketch you provided and it printed line 1,
then line 3,
then line 2 with the last 4 characters also printing to line 4,
then line 4 with the first 4 characters also printing over the last 4 of line 2.

This seems to point toward the LCD module itself.  Are your old eyes good enough to do some de-soldering?

Quote
1945 means I am 1 thousand nine hundred and forty-five years old.   I win!!!!

Using that reasoning you would indeed win.

Quote
My first program was written in Autocoder on an IBM 1403.

Wasn't that a printer?

I vaguely remember using a 1620 and paper tape.


Don

floresta

Quote
If the computers keep shrinking you'll need a microscope...

I can't speak for John but I already need one for most everything.

Don

OldSalt1945


John,
Where did you get your  lcd Constructor ?
Code: [Select]
LiquidCrystal_I2C lcd(0x20, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address

The reason I ask is that in your other post you said you used this constructor and it worked with fm's library:
Code: [Select]
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7);

You said you downloaded the Guessor but never said anything about actually running it or about the backlight blinking 3 times so I am wondering if you ever ran it and what happened ? (and why the difference in constructors)


I had hardwired the I2C  and LCD to use Arduino pin D13 to turn on the backlight because I didn't know any better way to do it.

Bill (bperrybap) helped me to do it right.  The "LiquidCrystal_I2C lcd(0x20, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); " worked perfectly and I removed the hack to D13.

John
Always keep the shower curtain INSIDE the tub.

OldSalt1945


Quote
I ran the sketch you provided and it printed line 1,
then line 3,
then line 2 with the last 4 characters also printing to line 4,
then line 4 with the first 4 characters also printing over the last 4 of line 2.

This seems to point toward the LCD module itself.  Are your old eyes good enough to do some de-soldering?

Quote
1945 means I am 1 thousand nine hundred and forty-five years old.   I win!!!!

Using that reasoning you would indeed win.

Quote
My first program was written in Autocoder on an IBM 1403.

Wasn't that a printer?

I vaguely remember using a 1620 and paper tape.


Don


I'll send the LCD back to the ebay vendor.  Or just not use those areas.  They are cheap, I'll get a few more, test them and send back duds.

You're right.  1403 printer (600 lines per minute).  The computer was a 1401. 
I had to write a couple of programs for the 1620 for a course at Purdue.
I also had to wire up boards with patch cables for an accounting machine, a 402, I think.  Later, I worked for a couple of companies that were actually using the old beasts for production jobs.

Don't tell anyone that I gave Brutus the knife.

John
Always keep the shower curtain INSIDE the tub.

raschemmel

John,
Have you tried running Rokkit's code from Reply#9 of your other post ?
Robert
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

raschemmel

Quote
you said you downloaded the Guessor but never said anything about actually running it or about the backlight blinking 3 times so I am wondering if you ever ran it and what happened ? ( 


Did you ever run the Guesser ? Did the backlight blink 3 times ?
Did it display the same constructor you are using ?
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

OldSalt1945


John,
Have you tried running Rokkit's code from Reply#9 of your other post ?
Robert


It works perfectly, except for the last 4 characters of line 2.  Of course, they are repeated on the first 4 characters of line 4.

Damn blasted display.   Grrrrrrrrr.

John
Always keep the shower curtain INSIDE the tub.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy