Help with LCD Scroll


Results 1 to 15 of 15

Threaded View

  1. #7
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: Help with LCD Scroll

    So since that was meaningless if you can’t scroll on LCD already, I’ll try an example.

    Code:
    string var byte [16] ‘ because I assume it’s one line of a 2x16 display but you can change this
    character var byte ‘ the current character
    counter var byte ‘ a step counter and index
    lindex var byte ‘ a lookup table index
    Now how you’re getting the string in the first place you didn’t say, it could be being typed in serial,
    or already stored in eprom or something. I’ll go with a longer than 16 char message stored in lookup table,
    and put it in a subroutine at the end of the program.

    Code:
    lookuptable: ‘ get the next character from the table into the character buffer
    LOOKUP lindex,[“CHECK IT OUT A SCROLLING TEXT DEMO!!!”],character ‘ 0-36 length message (37 characters in Human talk)
    return
    We need something to actually rotate the 16 char line buffer and drop the oldest byte off the end
    whenever a new character is shifted in. This goes in a subroutine also at the end of the program.

    Code:
    '
    rotatearray:				‘ rotate line array
    for counter = 16 to 1 step - 1
    string[counter] = string[counter-1]
    next counter
    string[0] = character			‘ insert new character byte at zero index
    return
    ‘
    Then a main cycle is needed to index the lookup table, call the lookup and rotate routines and
    print the line to LCD. After the variable declarations and before the subroutines:

    Code:
    lindex = 0
    CLEARLCD ‘ it’s been a while since I looked at LCDOUT, but whatever two byte code to clear LCD and home.
    '
    cycle:
    HOMELCD ‘ it’s been a while since I looked at LCDOUT, but whatever two byte code to home LCD cursor.
    '
    gosub lookuptable
    lindex = lindex + 1 ‘ increment lookup index
    if lindex > 36 then ‘ limit lookup index to length of message
    lindex = 0
    endif
    gosub rotatearray ‘ rotate line with new character at zero index
    
    for counter = 0 to 15 ‘ print the line to lcd
    LCDOUT string[counter]
    next counter
    
    pause 1000 ‘ delay to see one movement per second
    
    goto cycle ‘ do cycle forever
    Largely untested so if someone has a simulation with LCD pls feel free to run it
    Last edited by Art; - 2nd February 2015 at 19:23.

Similar Threads

  1. Scroll text on LCD second line
    By Raadys in forum General
    Replies: 2
    Last Post: - 25th May 2013, 16:14
  2. trying to do a scroll window
    By AvionicsMaster1 in forum Test Area
    Replies: 0
    Last Post: - 7th September 2011, 14:00
  3. Scroll LCD?
    By polymer52 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 1st March 2010, 20:24
  4. Olympic timer Scroll Text
    By Patrick in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 16th December 2006, 13:03
  5. how to scroll display one character
    By micro in forum General
    Replies: 3
    Last Post: - 13th March 2006, 22:32

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts