Go Down

Topic: LiquidCrystal.begin() (Read 494 times) previous topic - next topic

Zorka

Aug 05, 2010, 11:40 am Last Edit: Aug 05, 2010, 11:40 am by zorka Reason: 1
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)

mowcius

#1
Aug 05, 2010, 12:48 pm Last Edit: Aug 05, 2010, 12:49 pm by mowcius Reason: 1
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.

Zorka

No, I mean, if you look in the library code itself, cols is never used (as far as I can see)

mowcius

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

floresta

#4
Aug 05, 2010, 04:42 pm Last Edit: Aug 05, 2010, 04:44 pm by floresta Reason: 1
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

mowcius

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

Zorka

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

Go Up