PDA

View Full Version : Clearing LCD



Michael
- 27th July 2006, 13:59
I'm going to be working on a project that looks at a byte of data from a serial connection and displays a word in response to that data on an LCD.

I'm LCDOUT novice so bear with my basic questions.

In intend on displaying different words at different cursor locations on the LCD...
bit0 = LCDOUT $FE, $80, "WORD"
bit1 = LCDOUT $FE, $80 + 10, "WORD2"

etc.

It looks as though you have to clear the entire LCD before writing updated information to it? ($FE,1)

Is there any way you can clear just one line at a time?

Not that it would matter, I suppose, if it cleared and displayed quickly
enough.

Also, are there a lot of complications in using (2) LCD displays on one pic? Would you just run all the data lines in parallel and then do a "select LCD1 or select LCD2"?

Thanks.

--Mike

mugwamp
- 27th July 2006, 14:34
Michael, I've had no problems overwriting data displayed on an LCD. It's not necessary to clear everything. And as for clearing an entire line, would it work for you to send a line of ASCII space characters? That would display a blank line. It's always good practice to clear the display when you first power it up with a "$FE,1". As for multiple LCD's on one PIC, there's been some discussion here. It's not as simple as you think. You should be able to search for those threads.

Acetronics2
- 27th July 2006, 14:45
Hi, Michael

You don't need to clear the entire LCD before writing something else : the simplest way is overwriting the previous data ...only where needed.

So, if you add to some DATAs, spaces to have always the same amount of sent characters, you won't need any clearing !!!
This just implies DATAs must always be sent to fixed positions ... and have same lenght.

For general tips, if you need to clear a character ... overwrite it with "blank" (generally $20)

Alain

paul borgmeier
- 27th July 2006, 16:10
See Keith's method (post #5) from the following link for an easy way to clear a line.

http://www.picbasic.co.uk/forum/showthread.php?t=4137

(note - you may need to adjust for your display width)

Michael
- 27th July 2006, 17:02
Ok great.....thanks.

I assumed there would be something you could throw in quotes....lo and behold it's a simple "blank". (Not mentioned anywhere in the PBP handbook, by the way!).

Of course, it's either something that simple sometimes or something that resembles assembly language.

I'm sure I'll have more questions as I find the time to work on the code.

First impression though, is that LCDOUT is a real lifesaver and pretty easy to work with.

paul borgmeier
- 27th July 2006, 18:53
...I assumed there would be something you could throw in quotes....lo and behold it's a simple "blank". (Not mentioned anywhere in the PBP handbook, by the way!)
It's certainly inferred by the PBP manual :) - see Section 4.8 and Section 4.9 and also demonstrated in an unlikely place, Section 5.24 FOR..NEXT

However for completeness and the main purpose of my response, you also can use 32 instead of " "

Michael
- 27th July 2006, 19:08
Sorry, I didn't read closely enough.

I was under the impression the word "blank" would clear the word.

So you "space,space,space,etc" instead? $20 is the hex for the space key?

So if you have a 4 letter word to clear at line 1 cursor 1.....

LCDOUT $FE,$80, $20,$20,$20,$20 (?)

How is it written?

THANKS.

Michael
- 27th July 2006, 19:13
Is it this?.....

LCDOUT $FE, $80, REP " " \4

mugwamp
- 27th July 2006, 20:32
To put four blank spaces at the beginning of the 1st line:

LCDOUT $FE, $80, " "

It's a simple as that. And nothing else currently displayed on the LCD will be changed. Controlling LCD's with PBPro is awfully easy. I've had a lot more problems with quirky LCD drivers that want to work in 8 line mode but not in 4 line. But at least the programming is easy.

A quick edit. The forum software seems to want to eliminate extra spaces in my line of code, but just push the space bar on your keyboard 4 times with quote marks on either end.

paul borgmeier
- 27th July 2006, 20:34
You can:
a) just write on top of that location - no need to clear unless you want to
b) clear 4 digits with any of the following

LCDOUT $FE, $80, REP " " \4 ' perfect the way you have it
or

LCDOUT $FE, $80, " " ' 4 spaces between the quotes
or

LCDOUT $FE, $80, 32,32,32,32
or

LCDOUT $FE, $80, $20,$20,$20,$20
or
etc.

Michael
- 27th July 2006, 22:13
Wow...thanks Paul. I really appreciate it when I get specific information like that.

It helps me learn "completely".

Can't believe I actually had the last one right....it was an assumption. I'll stick with 4 blank spaces.....my mind likes the higher level language.

I have poor retention for hex and decimal equivalents and the like.

Some people can retain that type of info....I can't.