Pages: [1] 2   Go Down
Author Topic: Problem with HD44780 LCD  (Read 1626 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 22
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So I just ordered an Arduino and a HD44780 LCD from sparkfun electronics. I had it up and running with the blinking LED in a few minutes. Now my problem is the LCD.

I don't think it as as much of a hardware problem as software. Here is the tutorial I am using
http://www.arduino.cc/en/Tutorial/LCDLibrary
I already know this is outdated because it refers to the wrong location for the libraries, but it is still not working with them in the correct place.

Here is the error I get. Can anyone help me with this?  

Code:
LiquidCrystal.cpp:8: error: declaration of C function 'void pinMode(int, int)' conflicts with
D:\Documents and Settings\Paul\My Documents\arduino-0010\hardware\cores\arduino/wiring.h:74: error: previous declaration 'void pinMode(uint8_t, uint8_t)' here
LiquidCrystal.cpp:9: error: declaration of C function 'void digitalWrite(int, int)' conflicts with
D:\Documents and Settings\Paul\My Documents\arduino-0010\hardware\cores\arduino/wiring.h:75: error: previous declaration 'void digitalWrite(uint8_t, uint8_t)' here
LiquidCrystal.cpp:10: error: declaration of C function 'int digitalRead(int)' conflicts with
D:\Documents and Settings\Paul\My Documents\arduino-0010\hardware\cores\arduino/wiring.h:76: error: previous declaration 'int digitalRead(uint8_t)' here
o: In function `__static_initialization_and_destruction_0':
undefined reference to `LiquidCrystal::LiquidCrystal()'o: In function `setup':
Logged

London
Offline Offline
Faraday Member
**
Karma: 8
Posts: 6240
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


In liquidcrystal.cpp, try removing the following lines:
Code:
 extern void pinMode(int, int);
  extern void digitalWrite(int, int);
  extern int digitalRead(int);
  extern void portMode(uint8_t, uint8_t);
  extern void portWrite(uint8_t, uint8_t);
  extern uint8_t portRead(uint8_t);
in version 010 these functions are defined wiring.h and have different parameters, which is what causes the error message.

I use the similar 4bit LCD library and notice that that does not have (or need) the above definitions.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 22
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So if I got straight to the 4bit I should be fine?
Logged

London
Offline Offline
Faraday Member
**
Karma: 8
Posts: 6240
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It works very for me  smiley

Have you installed the 4bit library to see if it compiles in your environment?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Integration of technology - the next step.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I got mine to compile by changing 'int' in the lines you showed to 'uint8_t'  - haven't tested on hardware though.
Logged

London
Offline Offline
Faraday Member
**
Karma: 8
Posts: 6240
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I got mine to compile by changing 'int' in the lines you showed to 'uint8_t'  - haven't tested on hardware though.
That should work but it has a disadvantage that you may not be aware of. If in some new arduino release, any of those extern function prototypes change you will get compile errors again.

For example, if portRead, portWrite, or portMode function definitions changed in a future release of arduino,  a version of the lcd library with the externs declared as they are now would have compile errors but a version with them removed would compile and run perfectly.

It has been my experience that external declarations in a source file create an avoidable maintenance burden.

Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 22
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

 ;D

I got it working with 4 bits!

My problem is that my LCD doesn't seem to automatically go to the next line. Is there some kind of code I am missing for this?
« Last Edit: January 17, 2008, 09:30:54 pm by l0cke » Logged

London
Offline Offline
Faraday Member
**
Karma: 8
Posts: 6240
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't think there is code in the library to do that. You could add it to the library by writing some code to keep track of the cursor position and the length of strings that are written to the LCD. But then you may want to prevent words from wrapping in the middle and it gets a little complicated. It may be easier to do the formatting you want in your sketch.

good to hear you have it working  smiley
Logged

Brisbane, Australia
Offline Offline
God Member
*****
Karma: 1
Posts: 593
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
My problem is that my LCD doesn't seem to automatically go to the next line. Is there some kind of code I am missing for this?
Thats because for some stupid reason, the LCD's memory is mapped weirdly.

I'll probably make a nice neat library eventually which handles that and stuff like custom characters.
Logged

London
Offline Offline
Faraday Member
**
Karma: 8
Posts: 6240
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I'll probably make a nice neat library eventually which handles that
That would be useful, particularly for those single line displays that has the 9th character starting at address 0x40 :o
Logged

Copenhagen / Denmark
Offline Offline
Edison Member
*
Karma: 5
Posts: 2360
Do it !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I recently bought a box of  red LCD displays in a flea market, they are one line 16 character displays, but i have to set them up as though they are two lines of 8 characters to make them work.
Logged

London
Offline Offline
Faraday Member
**
Karma: 8
Posts: 6240
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I recently bought a box of  red LCD displays in a flea market, they are one line 16 character displays, but i have to set them up as though they are two lines of 8 characters to make them work.
MikMo, they are addressed as two lines of 8 characters. Did you modify the library to allow them to be treated as if one line of 16 chars?

If you have coded the cursor tracking functionality necessary to make this work alongside cursorTo type calls then would you have any objection to posting the code.

Logged

Copenhagen / Denmark
Offline Offline
Edison Member
*
Karma: 5
Posts: 2360
Do it !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I have not modified the lib. I tried the "standard" lib. first without much luck, then i used the 4bit lib. and just initializes the display as a two line display.

I think i had to change a few declarations in the 4 bit lib. to make it compile. Some integer datatypes if i remember corectly.

So now i have a whole lot of 16 char. red on black background displays, that actually work.
Logged

Brisbane, Australia
Offline Offline
God Member
*****
Karma: 1
Posts: 593
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I have not modified the lib. I tried the "standard" lib. first without much luck, then i used the 4bit lib. and just initializes the display as a two line display.
I'm not sure why but when I got my first LCDs the libraries there werent any good either.
Maybe they should be removed and a new one made?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 22
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Quote
My problem is that my LCD doesn't seem to automatically go to the next line. Is there some kind of code I am missing for this?
Thats because for some stupid reason, the LCD's memory is mapped weirdly.

I'll probably make a nice neat library eventually which handles that and stuff like custom characters.

This is the LCD I am using:
http://www.sparkfun.com/commerce/product_info.php?products_id=709

I read another person on this forum had the same 1 line problem with it but he never fixed it as far as I know.
Logged

Pages: [1] 2   Go Up
Jump to: