inverted X on PCD8544.

Hi all, this is my first post on this forum so thanks to everyone for sharing and helping.

I've found a display from a Nokia 5210. B/W.
i'm trying to use the PCD8544 library with the example sketch 'Helloworld', and it works, but the only problem is that the writing is inverted.
it seems like if the display pixel (0,0) is at the top-right of the screen instead of the top-left, so that all the characters are drawn mirrored, and the first character 'H' is on the top-right corner.

is it a already known issue?

is there a solution?

thanks, Davide.

It sounds like you have wired it up wrong. Where is your schematic?

hallo and thanks for answering.
i've followed this code:
http://www.arduino.cc/playground/Code/PCD8544
and guessed the LCD pin where from right to left, 1 to 8, watching them at the bottom.

so i'm using:
Pin 1 - +3.3V
Pin 2 - (SCLK) Arduino digital pin 3
Pin 3 - (SDIN/MOSI) Arduino digital pin 4
Pin 4 - (D/C) Arduino digital pin 5
Pin 5 - (SCE) Arduino digital pin 7
Pin 6 - Ground
Pin 7 - 10uF capacitor to Ground
Pin 8 - (RST) Arduino digital pin 6

i've found here a short thread with another guy having the same issue on another forum (not solved): http://forum.lcdinfo.com/viewtopic.php?t=1566

here: module.ro i've found the datasheet of the philips PCD8544 chip.

at pag 14 i could find something about an 'inverted display mode' bit. so i think that is the point.
i'm trying to set that bit, but as i'm not a good programmer, if anyone can do it before me, please write here.

thanks, Davide.

ehm.. no.
inverted display mode is intended W/B against B/W. so, in all the specifications pdf there's no mention about inverting Left with Right.

it seems like if this LCD needs counting from 83 to 0 to draw columns, instead of 0 to 83...but, i can't understand if/where i can change that into the library code.

any idea?

anyone who can help?

I just found an LCD project called libMyLCD on sourceforge that explicitly mentions this issue of mirrored (as opposed to inverted) displays on 5210.

The only solution is to modify the column indexing by doing something like

newColumnIndex = numColumns - oldColIndex

where required

SOLVED, in a static way.
First of all, I am not a programmer. So if you find a better way to make this lcd work please post your thoughts.

Problem 1. Character is printed inverted ( ex. 3 is printed as ? ).
Character "3" has 5 bytes (?) in the array ACSII,

{0x21, 0x41, 0x45, 0x4b, 0x31} // 33 3

If you change the 1st with the 5th and the 2nd with the 4th byte, character "3" will be printed in the way we want :D.

{0x31, 0x4b, 0x45, 0x41, 0x21} // 33 3

BUT it doesn't seem to be a very convenient way to do this! So why don't we find the function which writes the bytes for each character and prints them from the end to the beginning!

void LcdCharacter(char character)
{
  LcdWrite(LCD_D, 0x00);
  for (int index = 0; index <5; index++)
  {
    LcdWrite(LCD_D, ASCII[character - 0x20][index]);
  }
  LcdWrite(LCD_D, 0x00);
}

We see that it starts from index 0 until index 4. What if we change it to something like this:

void LcdCharacter(char character)
{
  LcdWrite(LCD_D, 0x00);
  for (int index = 4; index >= 0; index--)
  {
    LcdWrite(LCD_D, ASCII[character - 0x20][index]);
  }
  LcdWrite(LCD_D, 0x00);
}

Problem 1 Solved! (If you changed manual character "3" bytes, change them back after fixing the for loop).

Problem 2. A string is printed reversed! "Hello World!" is printed as "!dlroW olleH"
But what if we say to our Arduino to print a string that is already reversed?

  LcdString("!dlroW olleH"); // prints "Hello World!"

There are online tools that reverse your text, but it isn't as convenient either and i havent found a way to automate the reversing of a string. Anyone who finds a way please let us know.
Problem 2 Solved.

Problem 3. There is some space at the beginning of the first line.
Replace "LcdInitialise" function with this:

void LcdInitialise(void)
{
  pinMode(PIN_SCE, OUTPUT);
  pinMode(PIN_RESET, OUTPUT);
  pinMode(PIN_DC, OUTPUT);
  pinMode(PIN_SDIN, OUTPUT);
  pinMode(PIN_SCLK, OUTPUT);
  digitalWrite(PIN_RESET, LOW);
  digitalWrite(PIN_RESET, HIGH);
  LcdWrite(LCD_C, 0x20 );
  LcdWrite(LCD_C, 0x0C );
}

Problem 3 Solved.

Problem 4. I wanted my string to have spaces to the right and not at the left.
Ex.

LcdString("ih"); //"          hi"

after solution:

LcdString("          ");
LcdString("ih"); // Prints  "hi          "

Problem 4 solved. I printed 10 spaces before a 2 letter word.