PDA

View Full Version : "PS2Keyboard Library" - Problem with LCD Output for german special Characters



rab
04-08-2013, 06:47 PM
Hello to the Forum,

i am new to this forum, and i need your help for my following, hopefully understandable described problem, with Pauls "PS2Keyboard Library" in conjunction with a german PS/2 Keyboard.

What i want to do:
---------------------
Build a ARDUINO controlled "German Text-System with LCD-Display" to display static or random Alarm-Text, Menu-Text, etc.
- create text
- store created text in eeprom
- edit/change text on demand (characters, words, sentences)
- store edited text in eeprom
- display text during text creation on lcd-display
- display text during editing on lcd-display
- grab text fromm eeprom during runtime and display text on lcd-display

Hardware:
------------
- ARDUINO UNO
- Standard German PS/2 Keyboard
- either 16 x 2 LCD with Standard HITACHI 44780 Character Codes and Character Patterns (ROM Code: A00)
- or 20 x 2, 16 x 4, 20 x 4 LCD with Standard HITACHI 44780 Character Codes and Character Patterns (ROM Code: A00 or A02)

Software:
-----------
- ARDUINO 1.0.3 IDE
- PS2Keyboard 2.4 Library
- ARDUINO Sketch with "PS2Keymap_German"

Preparations:
---------------
First check availability for german Characters "", "", "", "", "", "", "", "" in LCD Character Codes and Character Patterns for ROM Code A00 and A02
ROM Code A00: http://html.alldatasheet.com/html-pdf/63673/HITACHI/HD44780/4262/17/HD44780.html
ROM Code A02: http://html.alldatasheet.com/html-pdf/63673/HITACHI/HD44780/4513/18/HD44780.html
- ROM Code A00 has characters for "", "", "", ""
- ROM Code A00 has no characters for "", "", "" (capital Umlaute characters) and no character for "" (EURO currencs character)
- ROM Code A02 has characters for "", "", "", "", "", ""
- ROM Code A02 has no characters for "" (german special character) and no character for "" (EURO currencs character)

Please note:
--------------
Since i use a 16 x 2 LCD with ROM Code A00 i have to customize my code to this LCD, which means:
- generally you can create up to 8 own characters max.
- i have to create the missing characters for "", "", "", "" by myself

Now create the missing characters in the ARDUINO code for "", "", "", ""
---------------------------------------------------------------------------------------
// create lcd-characters for german special characters
// EURO-Zeichen (Euro currency symbol)
byte euro[8] = {
B00110,B01001,B11110,B01000,
B11110,B01001,B00110,B00000
};
// -Zeichen, groes (capital letter )
byte A_umlaut[8] = {
B01010,B00100,B01010,B10001,
B11111,B10001,B10001,B00000
};
// -Zeichen, groes (capital letter )
byte O_umlaut[8] = {
B01010,B01110,B10001,B10001,
B10001,B10001,B01110,B00000
};
// -Zeichen, groes (capital letter )
byte U_umlaut[8] = {
B01010,B10001,B10001,B10001,
B10001,B10001,B01110,B00000
};

Find the LCD ROM Code A00 Addresses (in BIN) for "", "", "", ""
-----------------------------------------------------------------------------
- "" = 11100010 = 226
- "" = 11100001 = 225
- "" = 11101111 = 239
- "" = 11110101 = 245

Find the libraries key-code output for a. m. characters in the ARDUINO Serial Monitor
------------------------------------------------------------------------------------------------
// ARDUINO test snippet code for key-codes
void loop() {
if (keyboard.available()) {
// DEC code of the character
int key = keyboard.read();
....
....
// DEC character code control output for serial monitor
Serial.println(key);
delay(20);
}
}

Character dependency table
--------------------------------
char! Library Constant ! Serial Monitor Output ! LCD ROM Code A00 Addresses
-----!-------------------------------------------!-------------------------!--------------------------------------
"" ! #define PS2_SHARP_S 223 ! 159 ! 226
"" ! #define PS2_a_DIAERESIS 228 ! 164 ! 225
"" ! #define PS2_A_DIAERESIS 196 ! 132 ! custom created character
"" ! #define PS2_o_DIAERESIS 246 ! 182 ! 239
"" ! #define PS2_O_DIAERESIS 214 ! 150 ! custom created character
"" ! #define PS2_u_DIAERESIS 252 ! 188 ! 245
"" ! #define PS2_U_DIAERESIS 220 ! 156 ! custom created character
"" ! #define PS2_CURRENCY_SIGN 164 ! 164 ! custom created character

Attention Paul Stoffregen:
The PS2_CURRENCY_SIGN is defined as "", and not ""! Is that by error or by purpose? Please explain!

In the a. m. "Character dependency table" you can see the first problem:
character "" and character "" do have the same "Serial Monitor Output" (key-code 164). Consequently they collide, which results in pressing "" key will display character "" instead of character ""!

My simple function to map the key-codes (Serial Monitor Output) to the corresponding LCD ROM Code A00 Addresses
---------------------------------------------------------------------------------------------------------------
// function - get character and DEC key-code and return the
// appropriate lcd address for the german special characters/Umlaute
uint8_t germanSpecialCharacters(int c, int key) {
// check key-codes for (159), (164), (132), (182), (150), (188), (156), (164)
if (key == 159 || key == 164 || key == 132 || key == 182 || key == 150 || key == 188 || key == 156) {
switch(key) {
case 159:
c = uint8_t(226); //
return c;
break;
case 164:
c = uint8_t(225); // - conflicts with -key and -key conflicts with LEFTARROW-key
return c;
break;
case 132:
c = uint8_t(1); // - conflicts with TAB-key
return c;
break;
case 182:
c = uint8_t(239); //
return c;
break;
case 150:
c = uint8_t(2); // - conflicts with DOWNARROW-key
return c;
break;
case 188:
c = uint8_t(245); //
return c;
break;
case 156:
c = uint8_t(3); // - conflicts UPARROW-key
return c;
break;
}
}
}

Test result:
------------
It seams, that i can control "" with key-code 159, "" (lowercase) with key-code 182, and "" (lowercase) with key-code 188 without conflicts. At least my tests didn't show me any collissions with other characters!

But for "", "", "", "", "" conflicts exists as following:
- "" --> conflicts with TAB key (if i press TAB key "" is displayed)
- "" --> conflicts with DOWNARROW (if i press DOWNARROW key "" is displayed)
- "" --> conflicts with UPARROW (if i press UPARROW key "" is displayed)
- "" --> conflicts with LEFTARROW (if i press LEFTARROW key "" is displayed)
- "" --> conflicts with "" (if i press AltGr+E for "" character "" will be displayed instead of "")

Summary
-------
The character dependency between library key-code for "", "", "" output and ROM Code A00 seems to be OK. Mapping 159 to 226 for "", 182 to 239 for "", and 188 to 245 for "" seems to be OK. So far i didn't find any character conflicts.

The custom created charaters for "", "", "", "" will be displayed correctly too, but they have conflicts as a. m. with other keys, which means:
- the "PS2Keyboard" library produces for the concerned characters the same key-codes!?

Solution
--------
- for each a. m. pressed character key you need a unique key code, which only exists once, no matter which other key on the german ps/2 keyboard one will press!

Please help to find the german key-code problem so i can check in a "switch-case" statement for a unique key-code, and map this key-code to the appropriate lcd rom code.

Many thanks in advance, and best
Regards from Germany
rab

PaulStoffregen
04-08-2013, 07:24 PM
Can you please post a small but complete example program? There is an example at "Find the libraries key-code output for a. m. characters in the ARDUINO Serial Monitor", but it is not a complete program I can run here for testing.

Also, for the sake of troubleshooting, let's just focus on the PS2Keyboard portion for now, ok? I know your project involves a LCD and the LiquidCrystal library, but 2 problems at the same time makes this much more difficult. Let's just look at the keyboard part.

Please post a small but complete sample program. I will run it here, looking for this:



But for "", "", "", "€", "" conflicts exists as following:
- "" --> conflicts with TAB key (if i press TAB key "" is displayed)
- "" --> conflicts with DOWNARROW (if i press DOWNARROW key "" is displayed)
- "" --> conflicts with UPARROW (if i press UPARROW key "" is displayed)
- "€" --> conflicts with LEFTARROW (if i press LEFTARROW key "€" is displayed)
- "€" --> conflicts with "" (if i press AltGr+E for "€" character "" will be displayed instead of "€")

rab
04-08-2013, 10:08 PM
OK Paul, here is my simple test program - please skip the the lcd part!

please note:
the libraries relevant key-code output you will find in the loop-function. have a look there at:

// DEC character code control output for serial monitor
Serial.println(key);
...
...
// DEC code of the character
int key = keyboard.read();

<<< --- Begin of my test program --- >>>

/* PS2Keyboard library, International Keyboard Layout Example
http://www.pjrc.com/teensy/td_libs_PS2Keyboard.html

keyboard.begin() accepts an optional 3rd parameter to
configure the PS2 keyboard layout. Uncomment the line for
your keyboard. If it doesn't exist, you can create it in
PS2Keyboard.cpp and email paul@pjrc.com to have it included
in future versions of this library.
--------------------------------------------------------------------
Test Program for displaying german special characters/Umlaute
on a 16 x 2 LCD-Display
*/

// include the PS2-Keyboard Library code:
#include <PS2Keyboard.h>
// include the LCD Library code:
#include <LiquidCrystal.h>

// create lcd-characters for german special characters
// EURO-Zeichen € (Euro currency symbol)
byte euro[8] = {
B00110,B01001,B11110,B01000,
B11110,B01001,B00110,B00000
};
// -Zeichen, groes (capital letter )
byte A_umlaut[8] = {
B01010,B00100,B01010,B10001,
B11111,B10001,B10001,B00000
};
// -Zeichen, groes (capital letter )
byte O_umlaut[8] = {
B01010,B01110,B10001,B10001,
B10001,B10001,B01110,B00000
};
// -Zeichen, groes (capital letter )
byte U_umlaut[8] = {
B01010,B10001,B10001,B10001,
B10001,B10001,B01110,B00000
};

// PINs for the PS/2 keyboard
const int IRQpin = 2; // Clock
const int DataPin = 3; // DATA

// create an instance of keyboard object
PS2Keyboard keyboard;
// initialize the LCD-Library with the numbers of the interface pins
LiquidCrystal lcd(7,8,9,10,11,12);
// pin 13 will control the backlight
int backLight = 13;

void setup() {
pinMode(backLight, OUTPUT);
// turn backlight on
digitalWrite(backLight, HIGH);
//keyboard.begin(DataPin, IRQpin, PS2Keymap_US);
keyboard.begin(DataPin, IRQpin, PS2Keymap_German);

Serial.begin(9600);

// generating german special characters
lcd.createChar(0, euro); // €
lcd.createChar(1, A_umlaut); //
lcd.createChar(2, O_umlaut); //
lcd.createChar(3, U_umlaut); //

// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
}

void loop() {
if (keyboard.available()) {
// character
char c = keyboard.read();
// DEC code of the character
int key = keyboard.read();
// set the cursor to column 0, line 1
lcd.setCursor(0, 1);
// dipsplay on LCD all characters, incl. german special
// characters and Umlaute - , , , , , ,
// LCD-Ausgabe aller Zeichen, inkl. deutscher
// Sonderzeichen und Umlaute - , , , , , ,
lcd.write(germanSpecialCharacters(c, key));
delay(20);
// character control output for serial monitor
//Serial.println(c);
// DEC character code control output for serial monitor
Serial.println(key);
}
}

// function - get character and DEC key-code and return the
// appropriate lcd address for the german special characters/Umlaute
uint8_t germanSpecialCharacters(int c, int key) {
// check key-codes for , , , , , ,
// prfe auf deutsche Sonderzeichen und Umlaute - , , , , , ,
if (key == 159 || key == 164 || key == 132 || key == 182 || key == 150 || key == 188 || key == 156) {
switch(key) {
case 159:
c = uint8_t(226); //
return c;
break;
case 164:
c = uint8_t(225); //
return c;
break;
case 132:
c = uint8_t(1); //
return c;
break;
case 182:
c = uint8_t(239); //
return c;
break;
case 150:
c = uint8_t(2); //
return c;
break;
case 188:
c = uint8_t(245); //
return c;
break;
case 156:
c = uint8_t(3); //
return c;
break;
}
}
}

<<< --- End of my test program --- >>>

Hope this is what you asked me for.
Best Regards from Germany.
rab

PaulStoffregen
04-09-2013, 12:38 AM
I deleted all the LCD stuff (you could have done this.... rather than making me do it)

Here's what's remaining:



// include the PS2-Keyboard Library code:
#include <PS2Keyboard.h>

// PINs for the PS/2 keyboard
const int IRQpin = 2; // Clock
const int DataPin = 3; // DATA

// create an instance of keyboard object
PS2Keyboard keyboard;

void setup() {
keyboard.begin(DataPin, IRQpin, PS2Keymap_German);
Serial.begin(9600);
}

void loop() {
if (keyboard.available()) {
// character
char c = keyboard.read();
// DEC code of the character
int key = keyboard.read();
Serial.println(key);
}
}


Before I try to use this, I have one question. Why do you use keyboard.read() twice?

rab
04-09-2013, 11:16 AM
sorry paul,

because the lcd part does not bother the other code you asked for, i thought it's better for your understanding to have my complete test code. if you load my supplied test code without the lcd hardware connected, the ARDUINOs Serial Monitor Output will be the same as with connected lcd hardware!

In the loop() part i use keyboard.read() twice as following:

// character
char c = keyboard.read();
// DEC code of the character
int key = keyboard.read();

because variable c then contains the character, and variable key then contains the dec number for that character (key-code) from your library.

With

// character control output for serial monitor
//Serial.println(c);
// DEC character code control output for serial monitor
Serial.println(key);

in the loop() part i then can check the character in variable c and the corresponding key-code in variable key supplied by your library in ARDUINOs Serial Monitor.

Furthermore i use both variables c and key for the LCD-Part in my function germanSpecialCharacters(int c, int key) with a "switch - case" statement in the loop() part to:
- check the pressed key (key-code in variable key)
- and to map the pressed key (character in variable c) to the corresponding lcd ROM Code A00 address

Please note:
this is just my simple test program to understand what's going on. Of course this is not my final solution to run the system!

Best Regards from Germany.
rab

rab
04-13-2013, 03:12 PM
Hello Forum,
Hello Paul,

another try to make the problem clear. Following please find my test-sketch without any lcd-part. This time i took Pauls original test-sketch from
http://www.pjrc.com/teensy/td_libs_PS2Keyboard.html
and adapted it to my german ps/2 keyboard hardware.


/* PS2Keyboard library, International Keyboard Layout Example.
Test-Sketch to show the problem of none-standard ASCII-Code characters
in the german version of the PSKeyboard Library (version 2.4).

This Sketch is the original test sketch from Paul Stoffregen found on his website
http://www.pjrc.com/teensy/td_libs_PS2Keyboard.html
adapted to my ps/2 keyboard hardware, and extended to the problematic chracters.
*/

// include the PS2-Keyboard Library code:
#include <PS2Keyboard.h>

// PINs for the PS/2 keyboard
const int IRQpin = 2; // Clock
const int DataPin = 3; // DATA

// create an instance of keyboard object
PS2Keyboard keyboard;

void setup() {
//keyboard.begin(DataPin, IRQpin, PS2Keymap_US);
keyboard.begin(DataPin, IRQpin, PS2Keymap_German);

Serial.begin(9600);
}

void loop() {
if (keyboard.available()) {

// read the next key
char c = keyboard.read();

// check for some of the special keys
if (c == PS2_ENTER) {
Serial.println();
} else if (c == PS2_TAB) {
Serial.print("[Tab]"); // Serial Monitor print out is correct
} else if (c == PS2_ESC) {
Serial.print("[ESC]"); // Serial Monitor print out is correct
} else if (c == PS2_PAGEDOWN) {
Serial.print("[PgDn]"); // Serial Monitor print out is correct
} else if (c == PS2_PAGEUP) {
Serial.print("[PgUp]"); // Serial Monitor print out is correct
} else if (c == PS2_LEFTARROW) {
Serial.print("[Left]"); // Serial Monitor print out is correct
} else if (c == PS2_RIGHTARROW) {
Serial.print("[Right]"); // Serial Monitor print out is correct
} else if (c == PS2_UPARROW) {
Serial.print("[Up]"); // Serial Monitor print out is correct
} else if (c == PS2_DOWNARROW) {
Serial.print("[Down]"); // Serial Monitor print out is correct
} else if (c == PS2_DELETE) {
Serial.print("[Del]"); // Serial Monitor print out is correct
// check for some of the problematic german/european characters
} else if (c == PS2_CURRENCY_SIGN) {
Serial.print("[EURO]"); // Serial Monitor print out should be EURO, but is ¤
} else if (c == PS2_SHARP_S) {
Serial.print("[SZ]"); // Serial Monitor print out should be SZ, but is Ÿ
} else if (c == PS2_a_DIAERESIS) {
Serial.print("[ae]"); // Serial Monitor print out should be ae, but is ä
} else if (c == PS2_A_DIAERESIS) {
Serial.print("[AE]"); // Serial Monitor print out should be AE, but is „
} else if (c == PS2_o_DIAERESIS) {
Serial.print("[oe]"); // Serial Monitor print out should be oe, but is ö
} else if (c == PS2_O_DIAERESIS) {
Serial.print("[OE]"); // Serial Monitor print out should be OE, but is –
} else if (c == PS2_u_DIAERESIS) {
Serial.print("[ue]"); // Serial Monitor print out should be ue, but is ü
} else if (c == PS2_U_DIAERESIS) {
Serial.print("[UE]"); // Serial Monitor print out should be UE, but is œ
} else if (c == PS2_DEGREE_SIGN) {
Serial.print("[DEGREE]");// Serial Monitor print out should be DEGREE, but is °
} else {

// otherwise, just print all normal characters
Serial.print(c); // so far OK, but not all key combinations tested yet.
}
}
}

Any idea, any helpful answer is apprechiated. Please help.
rab

Nantonos
04-13-2013, 04:41 PM
This is a classic encoding mismatch. Unicode characters sent as UTF-8 encoding and the bytes being mis-interpreted as Latin-1. For example in UTF-8 is two bytes, 0xC3 0x86. In Latin-1, C3 is which is what you are seeing. Some handy tools to investigate further
http://www.ltg.ed.ac.uk/~richard/utf-8.cgi?input=%C3%86&mode=char
http://rishida.net/tools/conversion/

In other words the problem is in the serial terminal, whose encoding is not Unicode.

rab
04-13-2013, 05:58 PM
Hello Nantonos,

thanks for your answer, but i know that there is a character code mismatch. In fact, that's the rason why the problem occurs!

In Pauls library file "PS2Keyboard.h" all the special characters are defined as extended ASCII-Code (ISO-8859-Family).
#define PS2_a_DIAERESIS 228 // german
#define PS2_A_DIAERESIS 196 // german

But i cannot control these characters by


if (c == PS2_a_DIAERESIS) {
Serial.print("[ae]"); // Serial Monitor print out should be ae, but is ä
} else if (c == PS2_A_DIAERESIS) {
Serial.print("[AE]"); // Serial Monitor print out should be AE, but is Ä
}

because variable c does not contain 228 or 196 as expected. I need to know which DEC-Value (integer) is associated to variable c for each pressed key. This calculation is somewhere "hidden" in Pauls "PS2Keyboard.cpp" file. It would be very nice and helpful, if Paul could help and tell me/us what to do, or where and how to recode the characters so they can be controlled by the ARDUINO C and displayed on a standard 44780 LCD.

I am pretty sure that Pauls Library will work if i would store the characters/texts to a SD-memory card, and that i could open the stored text on my PC within a text-program which can handle UTF-8 coded text. But my application is not a PC-application, but a machine control application.

rab

PaulStoffregen
04-14-2013, 01:42 PM
Try adding this in PS2Keyboard.cpp:



int PS2Keyboard::readUnicode() {
int result;

result = CharBuffer;
if (!result) result = get_iso8859_code();
if (!result) return -1;
UTF8next = 0;
return result;
}


and this in PS2Keyboard.h:



static int readUnicode();


Please let me know if this solves your problem? If so, I'll publish is in the next version.

rab
04-14-2013, 03:02 PM
Hello Paul,

thanks. I added your code at the very end of "PS2Keyboard.cpp" file and at the very end of "PS2Keyboard.h" file. No change, still the same problem!
Sorry, i am not a perfect c/c++ programmer, and to avoid further misunderstandings or errors from my side please advise exactly where to add your new code fragments into the files.
On top? In the middle? At the end? In a certain function? After which line number? Do i have to delete a certain function for the new function(s), and if, which function(s) do i have to delete?

rab

PaulStoffregen
04-14-2013, 05:54 PM
You also have to start using readUnicode() in your program, instead of the normal read().

It doesn't matter where you add them, if you do not get any error. If you add it in the private section in the .h, you'll get an error that the function is private when you try to use it.

rab
04-15-2013, 02:24 PM
Hello Paul,

thanks for your answer. As you told me i placed your new code snippets as described into "PS2Keyboard.cpp" and "PS2Keyboard.h", and i even inserted the code snippets at the beginning, in the middle, and at the end of "PS2Keyboard.cpp" and "PS2Keyboard.h" files. In the "loop()" function now i start with "readUnicode()" like follwing:


void loop() {
if (keyboard.available()) {
// read the next key
char c = keyboard.readUnicode();
...
instead of using "read()" as following:


void loop() {
if (keyboard.available()) {
// read the next key
char c = keyboard.read();
...

The compiler accepts the old function "keyboard.read()", but not the new function "keyboard.readUnicode()"! With "keyboard.readUnicode()" function the compiler shows following error message:


test_ps2_ohne_lcd.ino: In function 'void loop()':
test_ps2_ohne_lcd:31: error: 'class PS2Keyboard' has no member named 'readUnicode'

Sorry Paul, but i am pretty sure that i misplaced the new code snippets within the .cpp and .h file. Once again, i am not a c/c++ specialist!! So please tell me exactly where to place your new code snippets within the .cpp and .h file, and don't leave a c/c++ layman like me with answers which could be easily misinterpreted. Thanks.

rab

PaulStoffregen
04-15-2013, 05:23 PM
Use these files.

rab
04-16-2013, 10:50 AM
Hello Paul,

thanks for the new files, but as i can see now, i had added the new code snippets in the same place as you did, which means, even with your new posted 2 files the problem is still the same. The compiler always ends the compilation with the error message

test_ps2_ohne_lcd.ino: In function 'void loop()':
test_ps2_ohne_lcd:31: error: 'class PS2Keyboard' has no member named 'readUnicode'
To avoid library mismatch problems i even deleted my existing "PS2Keyboard 2.4 Library" and reinstalled it, including your new posted files. But the compiler error message ist still there!

The new function "readUnicode()" is declared in "PS2Keyboard.cpp" and inserted in "PS2Keyboard.h" within the "public:" part of the class "PS2Keyboard {}"! Why the compler cannot find the new "readUnicode()" function?

rab

PaulStoffregen
04-16-2013, 11:01 AM
Please post a small but complete sample program.

To investigate almost any problem that results in a compiler error, I require a sample program which I can compile here to get the same error. I answer many questions daily. I simply do not have time to investigate problems with partial information. Yes, I could write a program which does this, but I have limited time and many questions to answer, and many new features to develop for many people. Investigating problems goes much faster if you post a complete sample which I can simply copy into Arduino and click Verify to see the problem.

I can also do more, with limited time, to help you and everyone else if I do not have to always write this same request, over and over, asking you to provide a complete (and hopefully minimal) sample program. Please remember this and always provide a small but complete program when you report any problem that results in a compile error, or almost any type of problem involving the software where a sample program would help!

rab
04-16-2013, 02:36 PM
Hello Paul,
please have a look at my post in this thread dated "04-13-2013, 04:12 PM" (3 days ago!). At that time i have already posted your once again asked small but complete sample program.

OK, once again, and this time as an ".ino file attachment" you will find my sample program, which ends up in the posted compiler error message. The attached ".ino file" has a german file name, and it simply means translated in english "test_ps2_without_lcd.ino".

I hope this will help to resolve the problem.
rab

PaulStoffregen
04-16-2013, 04:03 PM
I just compiled this code without any error. I could not reproduce the "test_ps2_ohne_lcd:31: error: 'class PS2Keyboard' has no member named 'readUnicode' " error you mentioned. It compiles correctly.

Here is a screenshot:

398

I do not know why you are seeing that error. It does not happen here when I compile your code.

rab
04-16-2013, 10:42 PM
Ups, that's strange.

All my other sketches are compiled without any problems. Then somethimg must be wrong with my ARDUINO installation. I will uninstall my ARDUINO 1.0.3 and reinstall the new version 1.0.4. Keep you informed about the result.

rab

rab
04-17-2013, 01:44 PM
Solved the compiler problem!
Before going further to my test result of the new "readUnicode()" function, maybe it's of interest for some users to know how i have fixed this strange ARDUINO compiler problem:


My PC-System:
- windows 7 ultimate 64 Bit
- intel core i7-2600k CPU
- 16 GB RAM
- 256 GB SSD for windows operating system
- 2 TB HD RAID

What i have done:
- i uninstalled ARDUINO 1.0.3
- i deleted ARDUINOs "preferences.txt" file in the users path
- i cleaned up the windows operating system "Registry" with the software tool "CCleaner"
- i made a new installation of ARDUINO 1.0.4
- i restarted windows
- i copied the "PS2Keyboard" library with the new "PS2Keyboard.cpp" and with the new "PS2Keyboard.h" into users Sketchbook path

Please be aware, just delete ARDUINO and reinstall it didn't solve my problem! I had to delete the old "preferences.txt" file too, and i had to clean the registry, and i had to restart windows. I don't know why, and i don't know what happened to my ARDUINO 1.0.3 installation, but a. m. steps did solve my compiler problem.

OK, here is the result of the new function "readUnicode()", based on the already supplied sample test program, displayed in ARDUINOs Serial Monitor:


- first, and in contrast to the "read()" function, now each key press will result into an endless character printout (see attached .jpg screenshot)
- german characters , , , , , , will now be printed/displayed correct, but, as already m. a., the characters will be printed in an endless line (see attached .jpg screenshot)
- instead of the EURO sign/character "" the character "" will be printed in an endless line (see attached .jpg screenshot)

Before having tested the 2 new library changes with my planned lcd printout, from my point of view there are only 2 problems left (thanks to Paul):


1.) endless character printout, instead of 1 key press = 1 printed character
2.) the EURO sign "" printout is still wrong ("")

Paul:
any idea how David Chochoi has solved the "" sign problem in his french library version?

If we can fix the endless character printout and the "" sign problem we are almost done. Then i can start to match the character "Serial Monitor" printout to the character "LCD" printout.

rab

PaulStoffregen
04-17-2013, 02:20 PM
OK, here is the result of the new function "readUnicode()", based on the already supplied sample test program, displayed in ARDUINOs Serial Monitor:

first, and in contrast to the "read()" function, now each key press will result into an endless character printout (see attached .jpg screenshot)


Opps, I see the bug. Here is a new copy which should fix that problem. Please let me know how this works?

The Euro sign in the Arduino Serial Monitor is not a bug in PS2Keyboard. Arduino simply doesn't support printing that character in the serial monitor.

rab
04-17-2013, 03:21 PM
Thanks Paul,

with your new "PS2Keyboard.cpp" file the endless character problem is fixed! I didn't know that the "" sign cannot be displayed within ARDUINOs Serial Monitor. So this character problem should be OK now, too.
Anyway, many thanks for your help. I will go ahead now and map the special german characters to the Standard Hitachi 44780 LCD Character ROM Code A00. If problems will occure, i will come back to this Form.

rab