Write blank character to LCD screen

I'm working with my parallel 20x4 LCD screen, and want to clear one segment. How can I write a null character? I tried lcd.print(""); but that just doesn't print anything. Any suggestions?

lcd.print(" "); ?

That seems to work, but I was hoping for something maybe a little efficient... I think it should do the job though.

I've found a different solution, maybe others are interested.

RIght now I have a 3 position switch set up to select between different modes of operation. To make the screen smooth, I just used a previous variable to detect when the mode changes, and only clear the screen then. So far it works pretty well.

Rather than using "lcd.print(" ")" you can use "lcd.write(' ')".

When you pass double quoted arguments to print they are processed as strings. This requires a loop (for every character in string until zero) which in turn will call the write method for every single character within the quoted string. Calling print with a string argument adds the overhead of executing the loop, additional storage for the zero terminated string, a function call with a 16 bit reference argument and the additional function call to write within the print string method. Also write is implemented within the lcd driver whereas the print methods are in a class by themselves (adding a layer of indirection).

In the bigger scope of things, the print methods are quite efficient and it makes a lot of sense to use them when needed. There is one execption however and that is for single character output where calling write is much more efficient.

255?
Isn't that ASCII space?
I think there are other ASCII characters that you could use also but just printing a space works just as well.

Mowcius

255?
Isn't that ACSII space?

The ascii code for a space is 32.

The ascii code for a space is 32.

So it is. What's 255 then? Space also?

Mowcius

Hon these hitachi compatible LCDs 255 is the fully filled in box. 254 is also the blank. So if you wanted to clear a specific space you could do it like this.

lcd.setCursor(x,y);
lcd.write(254);

Have a look at the data sheet on the Hitachi controller. Pages 17 and 18 are the 2 possible character maps available. Most often these displays use the character map on page 17.

What's 255 then? Space also?

Well, since ASCII is only a seven bit code, 255 is a little out-of-range.

Well, since ASCII is only a seven bit code, 255 is a little out-of-range.

Extended ACSII has up to 255...


255 is a blank rectangle...

Cuboids in two dimensions...who'd'a thought it?

Cuboids in two dimensions...who'd'a thought it?

Dunno what you're talking about ;D

It was late when I wrote that... :-/