PDA

View Full Version : clear a single row



japer
05-16-2006, 06:24 AM
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

PJ Allen
05-16-2006, 07:34 AM
ˇ 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

PJ Allen
05-16-2006, 09:37 AM
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, [$9A] 'picks/starts LINE 1, Position 6

FOR BLANK = 0 to cursorpos
SEROUT 1, 84, [" "]
NEXT

Chris Savage
05-16-2006, 10:37 AM
There is also the REP formatter for the DEBUG and SEROUT commands...From the Help File:

http://forums.parallax.com/attachment.php?attachmentid=73721

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com (mailto:csavage@parallax.com)

PJ Allen
05-18-2006, 07:09 AM
Awesome ,Mr. Japer

Chris Savage
05-18-2006, 09:48 AM
That's great.ˇ But remember if you ever want to compact your code, the following uses less program space.

SEROUT LCD, Baud, [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 (mailto:csavage@parallax.com)

PJ Allen
05-18-2006, 06:56 PM
Hey, it's cool.ˇ I'm extravagant with program memory, a real spendthrift. 'tis true.

So, with SEROUT LCD, Baud, [REP " "\10], a variable could be used in place of the 10, then ( SEROUT LCD, Baud, [REP " "\A] )?

Chris Savage
05-18-2006, 09:11 PM
PJ,

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

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com (mailto:csavage@parallax.com)

japer
05-25-2006, 05:26 AM
hello

that is cool that you could use a variable Mr. Savage.
. it Truly is a flexible language !
japer