Shop OBEX P1 Docs P2 Docs Learn Events
Serial Lcd (4x20) — Parallax Forums

Serial Lcd (4x20)

J^3J^3 Posts: 121
edited 2008-12-17 14:23 in BASIC Stamp
Hi all,

··· I am trying to figure out how to display scrolling text.· I am looking through the download right now, and understand how to move the cursor around, but haven't been able to figure out a routine to do what I want.· Pretty much what I am trying to do is to display the same message on line 0, starting from the right side, scrolling across the screen, and off the left over and over again.

Any help is appreciated, and thanks in advance.

This is where I am so far, thanks again.·
' File:
' Author:
' Date:
' {$STAMP BS2}
' {$PBASIC 2.5}
'----Program Description-------------------------------------------------------
'----PIN Declaration-----------------------------------------------------------
'----Constants-----------------------------------------------------------------
TxPin     CON 0
Baud19200 CON 32
'----Variables-----------------------------------------------------------------
idx  VAR Byte
txmt VAR Byte
'----EEPROM DATA---------------------------------------------------------------
DATA "Hartnell College Robotics Club" '29 characters
'----Initialization------------------------------------------------------------
DEBUG CLS
HIGH TxPin                              'Set pin high to be a serial port
PAUSE 100                               'Pause for Serial LCD to initialize
SEROUT TxPin, Baud19200, [noparse][[/noparse]17]           'Backlight On
'----Program Code---------------------------------------------------------------
Main:
DO
  FOR idx = 0 TO 29
    SEROUT TxPin, Baud19200, [noparse][[/noparse]147]      'Sets cursor position back to line 0
    READ idx, txmt                      'Position 19, but I need previous
    SEROUT TxPin, Baud19200, [noparse][[/noparse]txmt]     'Characters to be shifted left?
    PAUSE 100
  NEXT
LOOP
'----Subroutines---------------------------------------------------------------

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
There are 10 types of people that understand binary, those who do, and those who don't.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-17 05:56
    Unfortunately, the serial LCD doesn't have scrolling ability. What you have to do is to write 20 characters of the message taken from a "window" into the 29 character message and shift the window each time you write like

    1) Write characters 1-20 and pause briefly

    2) Write characters 2-21 and pause briefly

    3) Write characters 3-22 and pause briefly

    4) And so on up to characters 10-29, then pause briefly and start all over again
  • J^3J^3 Posts: 121
    edited 2008-12-17 06:01
    Thanks Mike, I've been studying the download and thought it would be something like that since I haven't found a shift command.· I will give your suggestion a try.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    There are 10 types of people that understand binary, those who do, and those who don't.
  • J^3J^3 Posts: 121
    edited 2008-12-17 14:23
    This is what I finally have, and it works pretty good.· Thanks for the help.
    ' File:Serial 4x20 scroll.bs2
    ' Author:
    ' Date:12-16-08
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    '----Program Description-------------------------------------------------------
    '----PIN Declaration-----------------------------------------------------------
    '----Constants-----------------------------------------------------------------
    TxPin     CON 0
    Baud19200 CON 32
    '----Variables-----------------------------------------------------------------
    message VAR Byte (20)
    idx     VAR Byte
    '----EEPROM DATA---------------------------------------------------------------
    DATA "tics Club           Hartnell College Robotics Club                    " '49 characters
    '----Initialization------------------------------------------------------------
    DEBUG CLS
    HIGH TxPin                                 'Set pin high to be a serial port
    PAUSE 100                                  'Pause for Serial LCD to initialize
    SEROUT TxPin, Baud19200, [noparse][[/noparse]17]              'Backlight On
    '----Program Code---------------------------------------------------------------
    Main:
    DO
      FOR idx = 0 TO 41
        READ idx, message(0), message(1), message(2), message(3), message(4),
                message(5), message(6), message(7), message(8), message(9),
                message(10), message(11), message(12), message(13), message(14),
                message(15), message(16), message(17), message(18), message(19)
        SEROUT TxPin, Baud19200, [noparse][[/noparse]message(0), message(1), message(2), message(3), message(4),
                                  message(5), message(6), message(7), message(8), message(9),
                                  message(10), message(11), message(12), message(13), message(14),
                                  message(15), message(16), message(17), message(18), message(19)]
        IF idx < 41 THEN
          PAUSE 300
        ENDIF
        SEROUT TxPin, Baud19200,[noparse][[/noparse]128]
      NEXT
    LOOP
    '----Subroutines---------------------------------------------------------------
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    There are 10 types of people that understand binary, those who do, and those who don't.
Sign In or Register to comment.