PCD8544 - Inverting Characters

Hi

Im trying to invert characters on this Nokia-LCD

with...

lcd.setInverse(0x0d);

it inverts the whole Display,but I only want to invert some sentences or chars like on this picture

Deck A...

In the german section of this forum I got this hint :
" In the program you have a variable who store the value of every char (5 bytes). This function writes these 5 bytes in the RAM and then transfer it to the display
Try to create (copy) a function who invert this value. Use for this a XOR with 255."

Im sorry, but Im not that C-Pro and want to ask if anyone can explain me that with some democode or something...

Best Regards
MTE

The character drawing is done inside the library. You'll have to modify the library to add inverted text drawing. The new function will be very similar to the existing 'write' except for two lines:

    // Output one column at a time...
    for (unsigned char i = 0; i < 5; i++) {
        this->send(PCD8544_DATA, ~glyph[i]);  //// Invert each column...
    }

    // One column between characters...
    this->send(PCD8544_DATA, 0xFF);  //// ...and the space between characters.

Yayyy works :slight_smile:

only for one character, not for sentences, but Im a big step forward.....thank you !

OK, the code goes huge when I write char by char inverted....is there any chance that I make a function to write whole sentences inverted ?

You could add code to the PD8544 object to maintain an inverseText flag and test the flag inside write(). Then the print functions which call write() will display in inverse as long as that flag is set:

LCD.setInverseText();
LCD.println("This text will display in inverse.");
LCD.println("So will this.");
LCD.setNormalText();
LCD.println("but this line will be normal");
LCD.setInverseText();
LCD.println("This text will display in inverse.");
LCD.println("So will this.");
LCD.setNormalText();
LCD.println("but this line will be normal");

This is logic for me, Ive trying this since days :slight_smile: but my C-knowledge isnt that like yours :slight_smile:

I need some hints how I implement this into the driver...

like

 for (unsigned char i = 0; i < 5; i++) {
        this->send(PCD8544_DATA, ~glyph[i]);

and

 this->send(PCD8544_DATA, 0xFF);

:slight_smile:

Try these:

The syntax is:

LCD.setInverseText(true);
LCD.println("This text will display in inverse.");
LCD.println("So will this.");
LCD.setInverseText(false);
LCD.println("but this line will be normal");

Note: I have not actually tested this code. It is a fairly simple change so I don't anticipate any problems. :slight_smile:

Works like a charm :slight_smile:

Thank you so much !!!!