Clear Disaply but not position

Hello.

I would like to Clear the display on the LCD without changing the positon, I used lcd.clear() but it also initialize the position as well.
Is there a way to do this?

Thank You.

That's not possible. At least not with a single command.
You need to keep track of the position and issue a cursor position command immediately after the clear command.

I think you could do it simply by sending 80 'spaces' (0x20) to the display. When you get done the address pointer should be right where it was when you started.

Follow the LCD Addressing link at http://web.alfredstate.edu/weimandn if you want the background information on why this should work.

Don

Nice simple and easy solution, floresta.
Saves some hassle of keeping track of where you are.
I didn't read the link, but doesn't it matter what size display (as in number of characters) you're controlling ?

I didn't read the link, but doesn't it matter what size display (as in number of characters) you're controlling ?

You wouldn't be asking the question if you had read the link !

The LCD controller has 80 bytes of RAM corresponding to the largest display it can handle (20x4 or 40x2). On the smaller displays not all of the RAM is used unless you do some display shifting (which is called scrolling in Arduinoese) but it is still there.

Don

I was afraid you'd say that.
Thanks again for explaining.