Shop OBEX P1 Docs P2 Docs Learn Events
clear a single row — Parallax Forums

clear a single row

japerjaper Posts: 105
edited 2006-05-24 22:26 in BASIC Stamp
hello
Is their a way to clear a single row or a single cursor area
on a "27979 " 4 X 20 LCD using bs2?
haven't found anything yet .without completely clearing the screen
thanks for any direction
japer

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-05-16 00:34
    · How about over-writing the position in question with a "space"?

    · Look on pages 7-9 of your documentation -- because you have commands with which you can move the cursor to any position of the 4x20.· Place the cursor as appropriate·and then do a space and you have your postion "cleared."

    Post Edited (PJ Allen) : 5/16/2006 12:47:37 AM GMT
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-05-16 02:37
    If you need to clear several positions in a row then you could make the SEROUT part of a FOR...NEXT loop.· This subroutine will SEROUT a SPACE as many times (= cursorpos)·as you need (Nib max = 16 times):

    cursorpos VAR Nib
     
    SEROUT 1, 84, [noparse][[/noparse]$9A]        'picks/starts LINE 1, Position 6
     
    FOR BLANK = 0 to cursorpos
      SEROUT 1, 84, [noparse][[/noparse]" "]
      NEXT
     
    
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-05-16 03:37
    There is also the REP formatter for the DEBUG and SEROUT commands...From the Help File:

    attachment.php?attachmentid=73721

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
    668 x 37 - 3K
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-05-18 00:09
    Awesome ,Mr. Japer
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-05-18 02:48
    That's great.· But remember if you ever want to compact your code, the following uses less program space.

    SEROUT LCD, Baud, [noparse][[/noparse]REP " "\10]·· <-- uses 10 bytes.

    The original used 26 bytes plus variables.· No variables were needed with this solution.· As I said, either works, but you should be aware of it in case you some day run out of one or both.· PJ, not knocking your code.· =)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-05-18 11:56
    Hey, it's cool.· I'm extravagant with program memory, a real spendthrift. 'tis true.

    So, with SEROUT LCD, Baud, [noparse]/noparse]REP " "\[color=red]10[/color, a variable could be used in place of the 10, then ( SEROUT LCD, Baud, [noparse][[/noparse]REP " "\A] )?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-05-18 14:11
    PJ,

    ·· That is correct...the constant 10 could be replaced with a variable.·

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • japerjaper Posts: 105
    edited 2006-05-24 22:26
    hello

    that is cool that you could use a variable Mr. Savage.
    . it Truly is a flexible language !
    japer
Sign In or Register to comment.