16x2 LCD Scrolling Improperly for array with more then 5 strings

Hi

I wrote the code below to scroll an array of string but the display in the LCD becomes improper if I extend the number of strings to 6 from 5.

By 'Improper' I mean, the display is something like this,

(Sorry for the poor image quality)

char* var[]={"RISHI ","RIPUNJOY ","BIKASH ","CHAMPAK ","DEEP ","MADHURJYA "};
#include <LiquidCrystal.h>


LiquidCrystal lcd(12, 11, 5, 4, 3, 2);


void setup() {
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  
  for(int i=0;i<6;i++){
      lcd.print(var[i]);  
  }  
  delay(1000);
}


void loop() {  
  // to move it offscreen left:
  for (int positionCounter = 0; positionCounter < 46; positionCounter++) {
        lcd.scrollDisplayLeft();     
        delay(500);
  }
  delay(1000);
}

As you can see, instead of showing the string 'MADHURJYA' it show 'MADHURISHI' and the lettes 'RJYA' shift to second row. This problem does not arises if I keep the string restricted to 5

Take a look at this article on lcd addressing and memory locations. It explains what you are experiencing.

http://web.alfredstate.edu/weimandn/lcd/lcd_addressing/lcd_addressing_index.html

You are wrapping to the second row at 40 characters. It is not the number of elements in the array.

Such a helpful article. :slight_smile:

How did you manage to find it ? (Google ? Really ? :relaxed:)

Issue Solved. Thank You

Such a helpful article.

Thanks.

How did you manage to find it ? (Google ? Really ?)

He may remembered it from other posts on this forum over the years.

Finding things in Google relies a lot on using an appropriate search term, one that appears in the material you are searching for. Determining what search term to use is the hard part.

In this case searching for 'LCD Addressing' will bring it right up (at least here in the USA), but of course you did not know that it was an addressing issue.

Don