1602 LCD display shifted characters

I'm using a Nano and a LCD display 16,2 with dcsbios (dcs is digital combat simulator) to mirror some of the cockpit's lcds. I have no problem displaying capital letters and number's but when the program shows "error" i get "pww0w".
If i run a standard "hello world" program i can display all charaters without any trouble.
Do i need to set a language or something?



/*
  Tell DCS-BIOS to use a serial connection and use the default Arduino Serial
  library. This will work on the vast majority of Arduino-compatible boards,
  but you can get corrupted data if you have too many or too slow outputs
  (e.g. when you have multiple character displays), because the receive
  buffer can fill up if the sketch spends too much time updating them.
  
  If you can, use the IRQ Serial connection instead.
*/
#define DCSBIOS_DEFAULT_SERIAL
#define ENABLE_PULLUPS
#include "DcsBios.h"
#include "LiquidCrystal.h"
//#include "LCD03.h"

const int rs =2,
  en =3,
  
  d4 =6,
  d5 =7,
  d6 =8,
  d7 =9;
  
  LiquidCrystal lcd (rs, en, d4, d5, d6, d7);

   

/* paste code snippets from the reference documentation here */


void onUfcScratchpadNumberDisplayChange(char* newValue) {

//lcd.clear();
lcd.setCursor(2, 0);
lcd.print (newValue);
}

DcsBios::StringBuffer<8> ufcScratchpadNumberDisplayBuffer(0x7446, onUfcScratchpadNumberDisplayChange);


void onUfcScratchpadString1DisplayChange(char* newValue) {

//lcd.clear();
lcd.setCursor(0, 0);
lcd.print (newValue);
}
 
DcsBios::StringBuffer<2> ufcScratchpadString1DisplayBuffer(0x744e, onUfcScratchpadString1DisplayChange);
 

void onUfcScratchpadString2DisplayChange(char* newValue) {

//lcd.clear();
lcd.setCursor(1, 0);
lcd.print (newValue);
}
DcsBios::StringBuffer<2> ufcScratchpadString2DisplayBuffer(0x7450, onUfcScratchpadString2DisplayChange);





//............


void setup() {
 Serial.begin (9600);
 lcd.begin(16,2);
lcd.clear();

DcsBios::setup();
}
void loop() {
 DcsBios::loop();
}


error =  65  72  72  6F  72
pWW0W =  70  77  77  30  77
diff  =   5   5   5 -3f   5

Hmm... verify LCD ground pin to the controlling device?

[edit]
What is the reason you commented-out this library?

//#include "LCD03.h"

Hi.
The comment is just because i didn't see any difference.
The ground pin is fine, i used the simple hello world and it worked

i tested again with some special characters and i think it might have to do with language. I printed "ç" and i get something like a japanese simbol


You might have a different ROM. See this LCD reference on Wokwi... under "Variant"

ç is in UTF-8 a two byte character: 0xC3A7
so your LCD is printing the character from the character set in 0xC3 -> which is by default in the character ROM this "Japanese" letter.
You don't see the second A7 character as your line is full already.

If you need to print UTF-8 multibyte characters I propose to use my LCD library.
https://werner.rothschopf.net/202009_arduino_liquid_crystal_intro.htm

You can either replace all multibyte characters by plain ASCII representation or use special characters to support your language specific characters. You should find a lot of examples in the ZIP.
https://werner.rothschopf.net/microcontroller/202012_arduino_liquid_crystal_language_en.htm

read both links to get a better understanding of UTF-8 vs. the character ROMs of the LCDs

i'll try it thanks.
Although my main problem isn't with special characters, it's just that the game shows "error" on screen and i get "pww0w" on the lcd. I'm not sure if your library will adress that

I suspect that is a problem of your code, the include file or the componet sending the text. Not the LCD.

1 Like

you can see my previous posts, there's the code

I can see your posts, but I can't compile your snippets.
code = full compileable program, with links to all dependencies like libraries.

1 Like

can't help there. Some of the code relates to the game. If you're not playing DCS you can't replicate the problem.
Anyway thanks for trying to help.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.