Pages: 1 [2] 3 4   Go Down
Author Topic: 4x20 LCD I2C Adapter - 1st 4 char of line4 repeated over last 4 char of line2  (Read 1946 times)
0 Members and 1 Guest are viewing this topic.
Lebanon, Indiana, USA
Offline Offline
Full Member
***
Karma: 4
Posts: 132
Old fart playing around with itty bitty control computers.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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
Logged

Always keep the shower curtain INSIDE the tub.

Offline Offline
Faraday Member
**
Karma: 100
Posts: 6081
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

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

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 4409
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 4409
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: March 12, 2014, 09:48:57 pm by floresta » Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 4409
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Faraday Member
**
Karma: 100
Posts: 6081
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

John,
Where did you get your  lcd Constructor ?
Code:
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:
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)
« Last Edit: March 12, 2014, 10:03:57 pm by raschemmel » Logged

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

Lebanon, Indiana, USA
Offline Offline
Full Member
***
Karma: 4
Posts: 132
Old fart playing around with itty bitty control computers.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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!!!! smiley-grin  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
« Last Edit: March 13, 2014, 12:06:19 am by OldSalt1945 » Logged

Always keep the shower curtain INSIDE the tub.

Offline Offline
Faraday Member
**
Karma: 100
Posts: 6081
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 4409
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 4409
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Lebanon, Indiana, USA
Offline Offline
Full Member
***
Karma: 4
Posts: 132
Old fart playing around with itty bitty control computers.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

John,
Where did you get your  lcd Constructor ?
Code:
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:
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
Logged

Always keep the shower curtain INSIDE the tub.

Lebanon, Indiana, USA
Offline Offline
Full Member
***
Karma: 4
Posts: 132
Old fart playing around with itty bitty control computers.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Always keep the shower curtain INSIDE the tub.

Offline Offline
Faraday Member
**
Karma: 100
Posts: 6081
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

Offline Offline
Faraday Member
**
Karma: 100
Posts: 6081
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 ?
Logged

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

Lebanon, Indiana, USA
Offline Offline
Full Member
***
Karma: 4
Posts: 132
Old fart playing around with itty bitty control computers.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Always keep the shower curtain INSIDE the tub.

Pages: 1 [2] 3 4   Go Up
Jump to: