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
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?
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':
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.
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.
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.
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.
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.
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?
So I have gotten it to go to the second line, but not on demand. It will just wrap around whenever it feels like it. I noticed in the inatialiing code there is a bit that in the comments says it makes the LCD 1-line, anyone know how I would change this to two lines?
///////////////////////////////////////////////////// 4 pin initialization
LcdCommandWrite(0x03); // function set:
// 4 pin initialization
delay(64);
LcdCommandWrite(0x03); // function set:
// 4 pin initialization
delay(50);
LcdCommandWrite(0x03); // function set:
// 4 pin initialization
delay(50);
LcdCommandWrite(0x02); // function set:
// 4 pin initialization
delay(50);
LcdCommandWrite(0x2C); // function set:
// 4-bit interface, 1 display lines, 5x7 font
///////////////////////////////////////////////////// end of 4 pin initialization