Go Down

Topic: LiquidCrystal 4x40 library for Arduino 1.0.1 (Read 1 time) previous topic - next topic

Bemused

Jul 28, 2012, 10:35 am Last Edit: Jul 28, 2012, 10:38 am by Bemused Reason: 1
Hello, looking for a 4x40 LiquidCrystal library for Arduino 1.0.1
HD44780 based.
I assume the standard LiquidCrystal library will not handle 4 x 40 displays.
Can you help

Many thanks
Tony

danimath

It will handle - the method begin () is your friend.  :)

best regards
Andreas
http://danimathblog.blogspot.com

#define true '/'/'/'
#define false '-'-'-'

Bemused

#2
Jul 28, 2012, 12:30 pm Last Edit: Jul 28, 2012, 12:41 pm by Bemused Reason: 1
Andreas thanks
So
lcd.begin(40, 4);

Syntax

LiquidCrystal(rs, enable, d4, d5, d6, d7)
LiquidCrystal(rs, rw, enable, d4, d5, d6, d7)
LiquidCrystal(rs, enable, d0, d1, d2, d3, d4, d5, d6, d7)
LiquidCrystal(rs, rw, enable, d0, d1, d2, d3, d4, d5, d6, d7)

But my display has 2 enable lines

floresta

#3
Jul 28, 2012, 04:24 pm Last Edit: Jul 28, 2012, 04:32 pm by floresta Reason: 1
Quote
It will handle - the method begin () is your friend.

No it won't.

There is a library written specifically for the 40x4 displays.  Start here: http://code.google.com/p/liquidcrystal440/

Also - there's another method using two instances of the regular library mentioned here: http://arduino.cc/forum/index.php/topic,113807.msg856018.html#msg856018


Don


Bemused

Hi Don
The two instances of the regular library looks a little trick for me regarding incorporation into what I already have.
The liquidcrystal440 looks ideal but I am unsure of which download to take.
I assume LiquidCrystal440.zip/enhanced arduino liquidcrystal library /Apr 2010 will not be compatible with IDE1.0.1

Is this (top one on download page) the version I need to take LiquidCrystal1.0.zip/LiquidCrystal for Arduino 1.0/Sep 2011

Many thanks
Tony

Tom Carpenter

#5
Jul 28, 2012, 04:56 pm Last Edit: Jul 28, 2012, 11:28 pm by Tom Carpenter Reason: 1
Using the two instances method, if you know what line you want to print on, you can use this method:
Code: [Select]

byte line = 2; //This is which line you want, it could come from anywhere
lcd[(line/2].setCursor(0,(line%2));
lcd[(line/2].cursor();
lcd[(line/2)?0:1].noCursor();
lcd[(line/2)].println("Prints to the correct line");


If you chose the other library, the version for 1.0 will almost certainly work fine with 1.0.1
~Tom~

Bemused

#6
Jul 28, 2012, 05:37 pm Last Edit: Jul 28, 2012, 05:42 pm by Bemused Reason: 1
Well I feel as though I am getting closer   :)

I renamed the LiquidCrystal library that came with IDE1.0.1

I then copied in the new library from LiquidCrystal1.0.zip/LiquidCrystal for Arduino 1.0/Sep 2011
as 'LiquidCrystal'

I then changed the code
//New line below
//Syntax
//LiquidCrystal lcd(RS,RW,Enable1,Enable2, data3,data2,data1,data0);
LiquidCrystal lcd(13,255,12,7, 11,10,9,8);

// Old line below
//LiquidCrystal lcd(13, 12, 11, 10, 9, 8);

In the void setup() I put
lcd.begin(40, 4);    // Set up the LCD's number of columns and rows:

On compile I get
no matching function for call to 'LiquidCrystal::LiquidCrystal(int,int,int,int,int,int,int,int)
MyProgName:345: error: no matching function for call to 'LiquidCrystal::LiquidCrystal(int, int, int, int, int, int, int, int)'
C:\arduino-1.0.1\libraries\LiquidCrystalorg/LiquidCrystal.h:56: note: candidates are: LiquidCrystal::LiquidCrystal(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t)

I notice the compile error refers to LiquidCrystalorg, I renamed the original library to org

I have tried restarting IDE


Edit
I have now moved the  LiquidCrystalorg out of the Library folder whilst IDE was shutdown and get a good compile.
It seems as though IDE tracked the rename of the original library and did not like the additional parameters I passed in.
Will try the hardware tomorrow
Thanks

Tom Carpenter

If you rename a library, or change its file path, or add a new one, you have to restart the IDE to get it to register the changes.
~Tom~

floresta

If you use the two instance technique then you will have to deal with two cursors (if you use visible cursors).  I believe that John took care of this in LiquidCrystal440 and in LiquidCrystal1.0.

Don

Tom Carpenter

Good point. I changed the code snippet I posted to account for the cursor problem.
~Tom~


Go Up