LiquidCrystal libraray

Hello,

i have several topics concerning liquidcrystal library:

Firstly. In Tutorial (http://arduino.cc/en/Tutorial/LiquidCrystal) all pictures and all circuit seems to be bad - like they tell in 4bit mode to connect diplay to D0-D3, correct it should be D4-D7. On my display, the D4 - D7 contacts are on the place of the picture, there is perhaps just bad labeling. This is also mentioned in text several times.

Secondly: Mightbe in new version is svapped eg. lcd.begin(2, 16), according to the code of the library it should be void

LiquidCrystal::begin(uint8_t cols, uint8_t lines, uint8_t dotsize)

so lcd.begin(16,2).

But after finding all this bugs it still works just sometimes... :frowning: i have 1602B display and cant get working the second row. It worked the first one, but now i am stucked back with no row working.. :frowning: .

Jan

Secondly: Mightbe in new version is svapped eg. lcd.begin(2, 16), according to the code of the library it should be void

LiquidCrystal::begin(uint8_t cols, uint8_t lines, uint8_t dotsize)

so lcd.begin(16,2).

What are you trying to say? Lcd.begin is defined with a default argument so charsize is optional.

void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS);

i am trying to say, that if i have standard 16x2 display i have 16 cols and 2 rows? In examples, you are initializing lcd.begin(2,16) - 2 columns and 16 rows?

i looked deeper into the code

void LiquidCrystal::begin(uint8_t cols, uint8_t lines, uint8_t dotsize) {
  if (lines > 1) {
    _displayfunction |= LCD_2LINE;
  }
  _numlines = lines;

and seems that code works ok, when initializing display with more than one row... :-), but in

void LiquidCrystal::setCursor(uint8_t col, uint8_t row)
{
  int row_offsets[] = { 0x00, 0x40, 0x14, 0x54 };
  if ( row > _numlines ) {
    row = _numlines-1;    // we count rows starting w/0
  }

it can make difficulties... shouldnt it be here something like MAX_ROWS and

if (row > MAX_ROWS){
 row = MAX_ROWS-1;
}

in which part of memory will it read the address?

Jan

Jan, although the examples have the rows and columns swapped in the begin method, with two or four line displays this should not make any difference if you give the correct values to the setCursor method.

Looking at that code, I think you will only have a problem if you try and set the cursor to a row that is higher then the actual number of rows on the LCD.

yes, but is there some-one who can i ocntact and submit patches?also the web pages are wrong... :frowning:

I reported your issues yesterday in this thread: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1248931045