Foreign characters on a 16x2 LCD don't show correctly

When I try:
// Danish French German Spanish letters
lcd.print("É é à å");
lcd.print("è ü ñ ö");

The accented letters don't show correctly. I get a mostly funny looking T/J's with a line in top. I looked at the datasheet and it appears that they are possible.

I thought of seeing what I could come up with by using lcd.write() but I'd rather not go that route as it would take a whole lot of parsing and some translation tables I suspect.

Although HS44780 document has an A02 character map with these accented characters, I have not seen any displays using this EPROM map. You can create up to 8 custom characters with whatever shapes you draw. Is 8 enough for you?

I'm already using 2 of the custom and have plans for using a few more. That wouldn't leave enough left to accomplish multiple language support. Also writing the code to parse all strings to look for those characters, and then breaking up the string to print() the normal ones then write() the special ones, then the normal ones would be a real pain and slow.

Any ideas on modifying the LCD library to accommodate these accent characters? I looked at the code and there doesn't seem to be anyplace that sets the ASCII character set or something along those lines.

Any ideas on modifying the LCD library to accommodate these accent characters?

Your problem has nothing to do with the LCD library it has to do with the LCD controller that is driving your display.

(1) You will have to find an LCD controller that has the characters that you need programmed into it's ROM. You are more likely to find such a device in Denmark, France, Germany, or Spain than in New Jersey - but stranger things have happened in New Jersey. The Hitachi HD44780 with ROM code A02 has many, if not all, of the characters you want as liudr has mentioned.

(2) You will have to use the Character Map for this ROM to determine the codes needed for the characters you wish to display. The ñ, for example, would be 11110001.

(3) You will have to use those codes in your lcd.print, (or is it lcd.write ??), statements, as hex or binary numbers, not as ASCII characters (letters in quotes).

Don

OK, so after reading the data sheet I see that they show two ROM code sheets: A00 and A02. What you are saying it that only one ROM code is active/loaded in a given piece of LCD hardware, correct? I may be out of luck as I was planning on using the 3 color LCD 16x2 that adafruit sells. Since they made it special with the 3 color leds and built in resistors I guess I'm out of luck if I stick with that one. Thanks to liudr and floresta for explaining it to me.

What you are saying it that only one ROM code is active/loaded in a given piece of LCD hardware, correct?

Correct.

Don

If no more than 8 custom characters are needed at any given time, you can recycle unused ones in an intermediate library.

I am traveling all day today and didn’t explain what I meant. Also forgot that you are only using 16X2 display. Then 8 custom characters is 50% of the display content so should do. You can use this mechanism:

In arduino sketch, write out the unaltered message with accented characters. Then develop a function to copy these messages to a 32-byte buffer so that the function is equivalent to the combination of lcd.setCursor(c,r); and then lcd.print(char*); like update_buffer(c,r,char*). This does nothing other than updating this 32-byte buffer. No LCD function is even involved. Develop an update_custom_char() function that scans the buffer for unique accented characters and put them in an array. Then use create character to create these characters in the order they appear in the content. Also develop a buffer_to_lcd() that updates the LCD with the content of this buffer one character at a time. If it is a regular character, write to LCD. If it is custom character, search the unique accented characters array and replace it with the right 0-7 values and write to LCD.

To make this more efficient, only create character if the character was not already created. If I have some time between meetings and tweaking my prototype teaching apparatus, I’ll challenge myself to this, only if you say that you are not using more than 8 accented characters at a time.