Pages: [1]   Go Down
Author Topic: LiquidCrystal.begin()  (Read 450 times)
0 Members and 1 Guest are viewing this topic.
Belgium
Offline Offline
Newbie
*
Karma: 0
Posts: 30
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
« Last Edit: August 05, 2010, 04:40:53 am by zorka » Logged

North Yorkshire, UK
Offline Offline
Faraday Member
**
Karma: 104
Posts: 5531
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: August 05, 2010, 05:49:15 am by mowcius » Logged

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

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

North Yorkshire, UK
Offline Offline
Faraday Member
**
Karma: 104
Posts: 5531
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

right, not sure what you mean.

You mean it's defined in the library but never used?
Does it matter?  smiley-grin

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

Mowcius
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 36
Posts: 4307
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: August 05, 2010, 09:44:52 am by floresta » Logged

North Yorkshire, UK
Offline Offline
Faraday Member
**
Karma: 104
Posts: 5531
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

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

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
Logged

Pages: [1]   Go Up
Jump to: