Arduino Forum

Forum 2005-2010 (read only) => Software => Interfacing => Topic started by: zorka on Aug 05, 2010, 11:40 am

Title: LiquidCrystal.begin()
Post by: zorka on Aug 05, 2010, 11:40 am
I'm looking at the liquidCrystal library which comes with arduino 0018 and I'm wondering what the cols parameter is used for. I know it's supposed to represent the number of columns on the display, but as far as I can see, it isn't used anywhere in the code..... (but then again, I might be wrong, that's why I ask)
Title: Re: LiquidCrystal.begin()
Post by: mowcius on Aug 05, 2010, 12:48 pm
you mean in the code?

It is often used as

lcd.begin(cols, rows);

rather than using

lcd.begin(16, 2);

The definitions of cols and rows are then at the top of the code for easy modification.

I presume that is what you are referring to.
Title: Re: LiquidCrystal.begin()
Post by: zorka on Aug 05, 2010, 12:51 pm
No, I mean, if you look in the library code itself, cols is never used (as far as I can see)
Title: Re: LiquidCrystal.begin()
Post by: mowcius on Aug 05, 2010, 01:18 pm
right, not sure what you mean.

You mean it's defined in the library but never used?
Does it matter?  :D

I would recommend liquidcrystal440 anyway. Newer and works much better.

Mowcius
Title: Re: LiquidCrystal.begin()
Post by: floresta on Aug 05, 2010, 04:42 pm
Quote
You mean it's defined in the library but never used?

It's worse than that.   Not only is 'cols' not used, but 'rows' is only checked to see if it is greater than 1,  the actual value isn't used.  

If they had used the 'cols' value then they could have made the 16x4 displays function correctly, right now they offset the third and fourth rows.

Another unusual characteristic is that the library defaults to a 16x1 display if you don't invoke LiquidCrustal.begin().  Those displays are relatively rare, most 16x1s are actually 8x2 internally and should be invoked as such.

I suppose the values are defined for future expansion such as that done by jrraines in his LiquidCrystal440 library.

Don
Title: Re: LiquidCrystal.begin()
Post by: mowcius on Aug 05, 2010, 05:13 pm
Quote
I suppose the values are defined for future expansion such as that done by jrraines in his LiquidCrystal440 library.

I would hope that in the next arduino IDE, it is included as standard as the liquidcrystal library has many issues.

Mowcius
Title: Re: LiquidCrystal.begin()
Post by: zorka on Aug 05, 2010, 05:24 pm
Quote
Quote:
You mean it's defined in the library but never used?

It's worse than that.   Not only is 'cols' not used, but 'rows' is only checked to see if it is greater than 1,  the actual value isn't used.  

If they had used the 'cols' value then they could have made the 16x4 displays function correctly, right now they offset the third and fourth rows.

Another unusual characteristic is that the library defaults to a 16x1 display if you don't invoke LiquidCrustal.begin().  Those displays are relatively rare, most 16x1s are actually 8x2 internally and should be invoked as such.


thanks, that's indeed what I ment and saw