BigCrystal LCD Scrolling?

Another way to explain;

The letters that are "off screen", and yet to scrollin from the right are wrapped on to the bottom line, and they all scroll.

Dizzwold.

Just tested it with "Dizzy's" @ column starting point 13 so "Dizzy's" is fully printed on the right, last 7 segments of the display.

This works fine, no wrapping, so its something to do with the character's that are off screen with a column starting point of 19?

Dizzwold.

The letters that are "off screen", and yet to scrollin from the right are wrapped on to the bottom line, and they all scroll.

The HD44780 controller has 80 bytes of display memory and your 20x4 display can display 80 characters. Hence any character code that you store in any of those 80 bytes will result in the corresponding character being displayed somewhere on your display.

On the other hand when using an HD44780 with a 16x2 display some of the characters stored in the 80 bytes of memory may not be displayed since they could be in memory locations corresponding to one of the 48 (80 - 32) that do not correspond to the visible characters.

For a complete description of how the memory relates to the display you should follow the LCD Addressing link at http://web.alfredstate.edu/retired/weimandn.

Don

Hi Don,

Thank you for your reply and the info. Very grateful.

I've managed to fix this text wrapping issue and now I can completely scroll in from the right and completely scroll out to the left with the text "Dizzy's", starting at segment 19.

It feel's like I'm cheating the code abit, but it works.

Now I'll move on and test with a longer text input, see how it handles that then try the bigCrystal printBig text. Here's the current sketch;

#include <LiquidCrystal.h>

// Set up according to your LCD pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
char * message = "Dizzy's";

void setup()
{
  lcd.begin(20, 4);
}
void loop()
{
  for (int printStart = 19; printStart >= 0; printStart--)  //scroll on from right
  {
    showLetters(printStart, 0);
  }

  for (int letter = 1; letter <= strlen(message); letter++)  //scroll off to left
  {
    showLetters(0, letter);
  }
}

void showLetters(int printStart, int startLetter)
{
  lcd.setCursor(printStart, 1);
  for (int currentLetter = startLetter; currentLetter < strlen(message); currentLetter++)
  {
    lcd.print(message[currentLetter]);
  }
  lcd.print(" ");
  lcd.setCursor(0, 3);
  lcd.print("                    ");
  delay(250);
}

Dizzwold.

Try this

void scrollOn()
{
  byte messageLength = strlen(message);
  for (int printStart = 15; printStart >= 0; printStart--)
  {
    byte currentLetter = 0;
    lcd.setCursor(printStart, 0);
    while ( (currentLetter < messageLength) && (currentLetter + printStart < 16) )  //don't stray beyond the message or LCD width
    {
      lcd.print(message[currentLetter]);
      currentLetter++;
    }
    if (printStart < 16 - messageLength)
    {
      lcd.print(" ");
    }
    delay(500);
  }
}

void scrollOff()
{
  byte messageLength = strlen(message);
  for (int startLetter = 1; startLetter <= messageLength; startLetter++)  //no need to display first character again
  {
    lcd.setCursor(0, 0);
    for (int currentLetter = startLetter; currentLetter < messageLength; currentLetter++)
    {
      lcd.print(message[currentLetter]);
    }
    lcd.print(" ");
    delay(500);
  }
  lcd.setCursor(0, 0);
  lcd.print(" ");
}

void loop()
{
  scrollOn();
  scrollOff();
}

My LCD display does not appear to wrap excess characters into other lines as yours does so I can't test this code properly. When scrolling on the original code printed all of the characters in the message whether or not they would fit on the screen when scrolling on. This version tries to avoid that by using a while loop instead of a for loop in the scrollOn() function.

I would be interested in knowing what it does on your display. As before you will need to adjust the constants that refer to the screen width. This could be handled much better by using global constants as could the message length so feel free to change the code to use them.

Hi All,

Ok, this now work's fine on the 20,4 display using normal sized text and longer text using the sketch above in post #23. I've had it scrolling from a blank screen, scrolling in the from right, to scrolling out to the left "Dizzy's Warm Section", nicely, but;

Moving on to using the bigCrystal library, it print's on the 2 middle lines as required, but print's a load of rubbish. I even get a complete colon and complete question mark amongst the rubbish, when there is neither in the text string. So I question if this is possible.

2 line's of the sketch that I think might be causing the problems, if possible are in void showLetters;

  {
    bigCrystal.printBig(message[currentLetter],printStart,1);
  }
  bigCrystal.printBig(" ",message,1);

I've used printStart,1 as the coordinates need by the bigCrystal library, but I don't know what I need to use to print the space at the end of the message.

Here's the full sketch;

#include <BigCrystal.h>
#include <LiquidCrystal.h>

// Set up according to your LCD pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
BigCrystal bigCrystal(&lcd);
char * message = "Dizzy's Warm Section";

void setup()
{
  bigCrystal.begin(20, 4);
}
void loop()
{
  for (int printStart = 19; printStart >= 0; printStart--)  //scroll on from right
  {
    showLetters(printStart, 0);
  }

  for (int letter = 1; letter <= strlen(message); letter++)  //scroll off to left
  {
    showLetters(0, letter);
  }
}

void showLetters(int printStart, int startLetter)
{
  bigCrystal.setCursor(printStart, 1);
  for (int currentLetter = startLetter; currentLetter < strlen(message); currentLetter++)
  {
    bigCrystal.printBig(message[currentLetter],printStart,1);
  }
  bigCrystal.printBig(" ",message,1);
  lcd.setCursor(0, 3);
  lcd.print("                    ");
  delay(250);
}

Dizzwold.

Hi UKHeliBob,

Just read your post, sent while I was posting.

Thank you for the sketch to try, I'll give it go and post back the results, as ourselves and others may find them useful.

Did you have a look at the link that Don "floresta" posted in post#22. In there you can see why my 20,4 display was text wrapping yet your 16,2 worked fine. Very useful information.

Dizzwold.

    bigCrystal.printBig(message[currentLetter],printStart,1);

The 3 parameters appear to be what to print, where to print it and something else

  bigCrystal.printBig(" ",message,1);

If what I wrote above is correct then the parameters are wrong. They are certainly different from one another.

As a matter of interest what is the third parameter ?

Hi UKHeliBob,

I'm not quite sure I understand?

My novice understanding is that;

(message[currentLetter] is asking it to print the next current letter from the message string?
,printStart is telling it to start printing at column 19?
and the ,1) is the row/line number?

So printing at 19,1?

Dizzwold.

    bigCrystal.printBig(message[currentLetter],printStart,1);

(message[currentLetter] is asking it to print the next current letter from the message string?
,printStart is telling it to start printing at column 19?
and the ,1) is the row/line number?

If that is true then in the case of

bigCrystal.printBig(" ",message,1);

which column does that print in ?

Hi UKHeliBob,

which column does that print in ?

Point taken, I'll have a play with it in a few moments.

Sorry for the delay in trying your sketch, but I'd been watching the F1, then some computer issues.

Your sketch above in post #24, works straight-out-the-box, with display size settings changed with normal sized text. I'll also see if I can get it working with the bigCrystal library.

Here's the sketch for other for the 20,4 display;

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
char * message = "Dizzy's Warm Section";

void setup()
{
  lcd.begin(20, 4);
}

void scrollOn()
{
  byte messageLength = strlen(message);
  for (int printStart = 19; printStart >= 0; printStart--)
  {
    byte currentLetter = 0;
    lcd.setCursor(printStart, 0);
    while ( (currentLetter < messageLength) && (currentLetter + printStart < 20) )  //don't stray beyond the message or LCD width
    {
      lcd.print(message[currentLetter]);
      currentLetter++;
    }
    if (printStart < 20 - messageLength)
    {
      lcd.print(" ");
    }
    delay(500);
  }
}

void scrollOff()
{
  byte messageLength = strlen(message);
  for (int startLetter = 1; startLetter <= messageLength; startLetter++)  //no need to display first character again
  {
    lcd.setCursor(0, 0);
    for (int currentLetter = startLetter; currentLetter < messageLength; currentLetter++)
    {
      lcd.print(message[currentLetter]);
    }
    lcd.print(" ");
    delay(500);
  }
  lcd.setCursor(0, 0);
  lcd.print(" ");
}

void loop()
{
  scrollOn();
  scrollOff();
}

Thank you for the sketch, I'm now spoilt for choice.

Dizzwold.

Sorry for those that just read the above, I copied the wrong sketch. Now corrected.

Dizzwold.

Going back to the sketch in post #25 I've changed the;

bigCrystal.printBig(" ",message,1);

To;

bigCrystal.printBig(" ",printStart,1);

And to;

bigCrystal.printBig(" ",19,1);

Both show less rubbish on screen, but still unreadable.

My novice thinking would say that the following should have been correct;
bigCrystal.printBig(" ",printStart,1);

I'm either incorrect or this is not possible with the bigCrysatl library?

Dizzwold.

Here is the latest sketch, but still not correct.

#include <BigCrystal.h>
#include <LiquidCrystal.h>

// Set up according to your LCD pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
BigCrystal bigCrystal(&lcd);
char * message = "Dizzy's Warm Section";

void setup()
{
  bigCrystal.begin(20, 4);
}
void loop()
{
  for (int printStart = 19; printStart >= 0; printStart--)  //scroll on from right
  {
    showLetters(printStart, 0);
  }

  for (int letter = 1; letter <= strlen(message); letter++)  //scroll off to left
  {
    showLetters(0, letter);
  }
}

void showLetters(int printStart, int startLetter)
{
  bigCrystal.setCursor(printStart, 1);
  for (int currentLetter = startLetter; currentLetter < strlen(message); currentLetter++)
  {
    bigCrystal.printBig(message[currentLetter],printStart,1);
  }
  bigCrystal.printBig(" ",printStart,1);
  lcd.setCursor(0, 3);
  lcd.print("                    ");
  delay(250);
}

Is the following line correct;

bigCrystal.printBig(" ",printStart,1);

Dizzwold.

The whole of the showLetters() function has problems when used with the bigCrystal library because it incorporates the column and row numbers in the printBig() function unlike the normal LCD print() function.

When used with the normal library you can set the LCD cursor, print a letter and when you print the next one it will be alongside the first one because the cursor position is automatically updated unlike the printBig() function, or so it seems.

So you need to think where the cursor needs to be positioned before each character is printed. In general you need to print in column (printStart + currentLetter) but that will not work for both scrolling on and scrolling off so you need 2 different functions to print the right range of letter in the right place.

Hi UKHeliBob,

So I need a function to reposition the cursor, as the normal lcd library uses 1 segment for 1 character, but the bigCrystal library uses 3 segments for 1 character?

Dizzwold.

No need for a function to position the cursor as that is part of the printBig() function.

Take a piece of paper and on the first line write down the index number of the first character to output when scrolling on and the column number it should go in. These form 2 of the parameters for the printBig() function. The actual character needs to be referred to by its index in the character array. The third parameter is the row number, which is fixed.

Do the same on line 2 for the second character/column, then the third character/column and so on

You will see a pattern emerge showing that you can derive the character index from the column number or vice versa. Use a for loop to produce one of the numbers and simple maths to calculate the second. This is how the current program works if you look.

Now you can use the character to be printed, column number and row number in the printBig() function inside the for loop to put the correct character in the correct column.