Pages: [1] 2   Go Down
Author Topic: IIC/I2C/TWI 2004 20X4 Character LCD Module Display  (Read 8564 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Has anyone got any sketch to compile for Arduino uno? I have tried IDE 0023 thru 152
I use LiquidCrystal_I2C and wire library with the examples, and I have found 4 examples but none will
compile, with one I got real close with only one error "does not name a type" after fixing expected unqualified id..,
I have even tried the simple "hello World" only 22 lines of code, and it will not compile.
 
This display is 20 X 4 has an interface on the back, YwRobot Arduino LCM1602 IIC V1, connections are  GND VCC SCA SCL this model has the blue pot on the board. came from E-bay e4u2011 is the seller.
Thank you for you help!!!
now back to C++ for DOS GBASIC GUYS....

Logged

Sydney, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1287
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Can you compile any other software (eg, the blink sketch)? This establishes a baseline for whether your installation actually works.

Can you also try and just include LiquidCrystal.h (even if it does not ultimately work wih the hardware) to see if that will compile?

Are you including all the required libraries?

Which Arduino and what operating system on the computer?

Posting the actual error message would be helpful.
Logged

Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

Offline Offline
Newbie
*
Karma: 1
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Make sure you have selected the proper board under the Tools menu.  I'm having good success with the library called "LiquidCrystal_I2C" on displays 16x2 and 20x4.

After you compile the sketch, you can use the "I2C" library example sketch "i2crepl" to scan the port and find the I2C address of your LCD.
« Last Edit: April 21, 2013, 07:49:56 pm by borland » Logged

Dee Why NSW
Offline Offline
Edison Member
*
Karma: 48
Posts: 2314
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I use LiquidCrystal_I2C and wire library with the examples, and I have found 4 examples but none will
compile, with one I got real close with only one error "does not name a type"

You appear to have the same display and library as me. I use the line

LiquidCrystal_I2C lcd(0x27,20,4);

error "does not name a type"  can, and may always, mean it cannot find the library. It is likely that you simply have it in the wrong place. There is instruction in the getting started about this. If you put it with the other libraries under the IDE, it should work. You may find that fartarsing around with a swag of IDEs was more likely to exacerbate the problem than solve it.

« Last Edit: April 22, 2013, 10:13:00 am by Nick_Pyner » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm having a similar issue, same board (Arduino UNO) and same lcd 20x4. I even got the sketch to compile and upload but I still end up with two black bars.. any suggestions??
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My 20x4 is working fine with version 1.1 of the LiquidCrystal_I2C library.  Won't work with a later 2.0 version.  Don't know why.
Logged

Dee Why NSW
Offline Offline
Edison Member
*
Karma: 48
Posts: 2314
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm having a similar issue, same board (Arduino UNO) and same lcd 20x4. I even got the sketch to compile and upload but I still end up with two black bars.. any suggestions??

I guess, if a library is dodgey, it won't stop the programme compiling and uploading.  
I have two libraries, each in its own subdirectory, for 2x16 and 20x4. I guess the line

LiquidCrystal_I2C lcd(0x27,20,4);

determines which is used.

I see that the first line in the library is

//YWROBOT

which is the same as the crowd that makes the I2C adapter on the back of the LCD. 
The display works perfectly on Uno and Mega.


 
« Last Edit: April 29, 2013, 07:28:10 pm by Nick_Pyner » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

the other library's will compile just fine and upload to the Arduino uno, but the LiquidCrystal_I2C lcd(0x27,20,4); will not compile I'm using 1.03 on windows 8 as 1.52 has problems compile the libraries that 1.03 will compile, my next attempt will be to use a clean XP with 1.03 and only LiquidCrystal_I2C lcd(0x27,20,4);

Logged

Dee Why NSW
Offline Offline
Edison Member
*
Karma: 48
Posts: 2314
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

to use a clean XP with 1.03 and only LiquidCrystal_I2C lcd(0x27,20,4);


OK, good luck. I find it hard to believe that would be the problem. If it was, it would be common knowledge but I am using 1.0.1 on XP. Have you checked the library has

//YWROBOT

in the first line?
Logged

SG
Offline Offline
God Member
*****
Karma: 11
Posts: 535
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you try the New LCD library?
http://playground.arduino.cc//Code/LCD
Quote
New LCD library - Replacement for the original LiquidCrystal Library to control LCDs with different control interfaces: 4bit, 8bit, I2C, ShiftRegister, SPI comming soon. The library is faster than the original, more flexible and extendable.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've tried a zillion libraries until I found this one that worked well with my LCD:
http://arduino-info.wikispaces.com/LCD-Blue-I2C

hope it helps...

M
Logged

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

Normally I tend to be a bit skeptical about web pages that use large multicolor fonts but the one in your link appears to be generated by Terry King, a long time contributor to this forum, so you should be able to trust the information you find there.

You should be aware that all of the 20x4 displays are essentially the same and any differences that you experience are more likely due to differences in the small interface pc board that is attached between your Arduino and the display.  It is also not inconceivable that there may be some mix and match involved.  That is a specific display may have a different interface pc board used with it at a later date. 

The interface pc boards are all essentially the same as well.  There are two almost identical ICs that can be used.  The version with a 'A' suffix has a base address of 0x38 and the version without the 'A' (there may be other letters on each version) has a base address of 0x20.  The board may or may not have jumpers available to change the address.  The jumpers, if they exist, are typically solder blobs labeled A0, A1, and A2.  If you are lucky there may be removable jumpers instead of the solder blobs.  If you are even luckier there may be switches.  I haven't seen either of these on the photographs posted lately.


Don

Logged

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 70
Posts: 2766
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The interface pc boards are all essentially the same as well.  There are two almost identical ICs that can be used.  The version with a 'A' suffix has a base address of 0x38 and the version without the 'A' (there may be other letters on each version) has a base address of 0x20.  The board may or may not have jumpers available to change the address.  The jumpers, if they exist, are typically solder blobs labeled A0, A1, and A2.  If you are lucky there may be removable jumpers instead of the solder blobs.  If you are even luckier there may be switches.  I haven't seen either of these on the photographs posted lately.[/color]

Don


Just to add to this.
From what I've seen on ebay and other vendors selling i2c to lcd boards,
the vast majority are "essentially the same" since they use the same i2c chip (pcf8574).
However, not all boards use the PCF8574 chip. Some like the adafruit i2c to lcd board use a MCP23008 chip.
For those not aware, the pcf8574 and MCP23008 are two different i2c i/o expanders.
While they are both i2c 8 bit i/o expanders, they do not work the same and require slightly
different code to drive them.

But for the boards that do use the pcf8574,
the biggest difference between them, and the reason for most of the issues people are having,
is how that i2c chip is wired up to the hd44780 interface (lcd module).
While the hd44780 pinout and interface is standardized, how you hook up a pcf8574 chip
to an hd44780 interface is not.
Different i2c to lcd boards wire up the 8 output pins to the lcd module differently.
There is no way for the s/w to determine how the pcf8574 chip is wired up to the lcd module.
Because of this, the s/w has must "know" how the i2c chip is wired to the LCD.
Most libraries are hard coded for a particular wiring, some like fm's library allow the sketch
to configure the wiring.
If the library is hard coded and the library's assumptions on the wiring do not match the actual wiring,
the library will think everything is working ok, but the LCD will not work
correctly and usually just sit there with a row of boxes on the top line.

Compounding this, is that vendors are taking the same "LiquidCrystal_I2C" library code
and modifying it to match their particular i2c to lcd board and providing links to
their modified libraries.
So that means that are several different versions of the "LiquidCrystal_I2C" libraries
floating around. Unless you look closed at the library code, you cannot tell which version
of the library you have.

Even worse, some vendors provide links to versions of the libraries that do not
match the hardware they are selling.

What all this means is that when using the "LiquidCrystal_I2C" library, it isn't
guraranteed that the library will necessarily match the i2c to lcd board that you have.
And if the library is not matched to the board you have, it won't work.

fm's library, mentioned above, is different. It can be configured. This means that the sketch
must tell the library how the pcf8574 chip is wired to the hd44780 interface.
The user's sketch must fill in the library's constructor to tell the library how
the pcf8574 is wired up to the hd44780 interface.

While the libraries that used hard coded pcf8574 to hd44780 pin mappings
are slightly easier to use, in that the user does not have to fill in the mappings,
the user must ensure that he has the correct version of the library since there
is more than one version of the library because not all boards use the same pin
mappings.

--- bill
Logged

Dee Why NSW
Offline Offline
Edison Member
*
Karma: 48
Posts: 2314
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK, so it looks like luck is a bit of a player here.

My 20x4 looks exactly the same as that alluded to above. Attached is the library I use with IDE 1.0.1 under XP.
I can't recall where I got it, probably a link on eBay.


* LiquidCrystal_I2C2004V1.zip (19.23 KB - downloaded 150 times.)
Logged

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 70
Posts: 2766
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK, so it looks like luck is a bit of a player here.

My 20x4 looks exactly the same as that alluded to above. Attached is the library I use with IDE 1.0.1 under XP.
I can't recall where I got it, probably a link on eBay.


No. It's not luck.
It is a matter of making sure that the s/w matches the hardware.
The library you linked to used the following hardcoded mappings:
Code:
PCF8574 BIT     HD44780 Function
0               RS
1               RW
2               EN
3               backlight (POSITIVE)
4               D4
5               D5
6               D6
7               D7
My preference is to use fm's library which can be configured for any
mapping/wiring vs being hard coded.

Getting the pin mappings correct is pretty important since
most of these i2c to hd44780 boards are hooking up the RW line to the PCF8574.
IMHO, this is a very dumb thing to do since it isn't really used
and can potentially damage the LCD module or i2c chip.
The hd44780 RW line should be connected directly to ground instead.

By connecting it to a PCF8574 output pin
damage can potentially occur if the s/w and the hardware do not match.
For example, it is possible that the pcf8574 output pins could be configured
in such a way that the LCD is in read mode and driving the data bus at
the same time the PCF8574 is driving the bus. You now have shorts
on the d4 to d7 lines and is is possible that one of the components could
be damaged.

Getting it correct is not luck, and trial really shouldn't be used either.
It is best to understand how the hardware is wired up and then make the s/w match the hardware.

--- bill



Logged

Pages: [1] 2   Go Up
Jump to: