简体   繁体   中英

Only scrolling some Text in 16x2 LCD(HD44780 display programm

I have a program which display as follows .

first Line : Volt : Over Voltage Second Line : Current : Over Current.

In LCD the cant fully display the letter OVer Voltage or Over Current . I just want to scroll these . But the Volt : and current : letter will be there that will not need to scroll ?

So you will need to create a routine to cycle thru the messages you want to display.

As an example, first time send "Volt: Over Volta" Then a second later send "Volt: ver Voltag" then "Volt: er Voltage" and so on.

The other option would be to create a routine to display the value part with a starting index after determining the len.

The following puesdo code is not compiled/tested.

char buf[17];
char label[]= "Current";
char value[]= "Over Current";

while(1)
{
    if (++start_pos >= (strlen(value)+strlen(label)-16)
    {
          start_pos=0;
          delay(500); //ms
    }
    snprintf(buf,16,"%s: %s",label,value[start_pos]);
    puts(buf);  // whatever the name of your routine to send string to LCD
    if (start_pos==0)
    {
         delay(500); //ms
    }
    delay(1000); //ms NOTE: you probably want to go do some other code during this time.
 }

You may want to see if you're LCD has a scroll command. Some LCDs have a character buffer where you can write data to then give a scroll command to shift which are displayed. For example I've used an LCD that can store 40 characters per line in DDRAM while displaying only 16. If I remember correctly, you have to scroll both lines at once this way, though.

If this doesn't tickle your fancy, another way is to shift your buffer in code and re-write all of it to the LCD. You can do this fast enough that it doesn't look terrible.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM