TFT LCD 3.5" unicode

Bonjour à tous,

j'utilise un arduino uno et j'arrive avec le Serial.print à afficher des caractères japonais en utilisant l'unicode par exemple (\u3042) jusqu'ici tout va bien... :slight_smile:

Le problème c'est que je souhaite afficher le caractère japonais sur un TFT LCD 3.5" est là c'est le drame rien ne s'affiche... je ne comprends pas d'ou viens le problème... :o

si vous avez des réponses je suis preneur :slight_smile:

merci d'avance !!


Good morning all,

I use an arduino uno and I arrive with Serial.print to display Japanese characters using unicode for example (\ u3042) that's work

The problem is that I want to display the Japanese character on a TFT LCD 3.5 " nothing is displayed ... I do not understand where the problem comes ...: o

if you have answers tell me please :slight_smile:

Thanks !

Which TFT?
Which library?

If you are using an Adafruit_GFX style library, you can use U8g2_for_Adafruit_GFX.h which is available via the Library Manager.

David.

Thanks David for responding,

i use Kuman SC3A-NEW-UK, UNOR3 3.5"

and library is:

#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_TFTLCD.h> // Hardware-specific library

Install the library.

Try:

#include <Adafruit_TFTLCD.h>

#define LCD_CS A3 // Chip Select goes to Analog 3
#define LCD_CD A2 // Command/Data goes to Analog 2
#define LCD_WR A1 // LCD Write goes to Analog 1
#define LCD_RD A0 // LCD Read goes to Analog 0
#define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin
Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);

#include <U8g2_for_Adafruit_GFX.h>
U8G2_FOR_ADAFRUIT_GFX u8g2_for_adafruit_gfx;

void setup()
{
    tft.begin(tft.readID());
    u8g2_for_adafruit_gfx.begin(tft);                 // connect u8g2 procedures to Adafruit GFX
    u8g2_for_adafruit_gfx.setForegroundColor(0xFFFF); //TFT_WHITE
    u8g2_for_adafruit_gfx.setBackgroundColor(0x0000); //TFT_BLACK Adafruit GFX color
}

void loop(void) 
{
    u8g2_for_adafruit_gfx.setFont(u8g2_font_unifont_t_japanese1);  // use japanese
    //u8g2_for_adafruit_gfx.setFont(u8g2_font_unifont_t_chinese2);  // use chinese2
    //u8g2_for_adafruit_gfx.setFont(u8g2_font_10x20_t_cyrillic);  // use Russian
    u8g2_for_adafruit_gfx.setFontDirection(0);
    tft.fillScreen(0x0000); //TFT_BLACK);
    u8g2_for_adafruit_gfx.setCursor(0, 30);
    u8g2_for_adafruit_gfx.print("Hello World!");
    u8g2_for_adafruit_gfx.setCursor(0, 60);
    u8g2_for_adafruit_gfx.print("こんにちは世界");        // Japanese "Hello World"
    //u8g2_for_adafruit_gfx.print("你好世界");        // Chinese "Hello World"
    //u8g2_for_adafruit_gfx.print("Привет, мир");        // Russian "Hello World"
    delay(1000);
}

Untested. I just wrote in the Browser

Edit. Changed to u8g2_font_unifont_t_japanese1

Actually when i test your code it's write: "u8g2_font_unifont_t_japanese1"

so where find "u8g2_font_unifont_t_japanese1" ? i need to download it ?

i take screen print and i see that in U8g2_font_c

No, it comes with Olikraus's U8g2_for_Adafruit_GFX.h library.

I tested that font on a STM32. Note that Japanese fonts are very BIG. Too big for a Uno. You need a Zero, Due, Mega, Teensy3.x, ...

If you are just printing some fixed messages, you could save them as monochrome bitmap images.
This might use less memory than loading the font in Flash memory.

I suspect that the only practical solution for Chinese and Japanese is to use external Font chips.

David.

well i will buy a Mega so because i want to trained my self with kana so ithink it's the better way,

thanks for you time ! :slight_smile:

Well, i bought a MEGA and know i have some error can someone help ?

Arduino : 1.8.10 (Windows 10), Carte : "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

c:\Temp\cc9CIyC2.ltrans0.ltrans.o: In function `main':

:(.text.startup+0x2a6): undefined reference to `u8g2_font_unifont_t_japanese1'

:(.text.startup+0x2aa): undefined reference to `u8g2_font_unifont_t_japanese1'

:(.text.startup+0x2ae): undefined reference to `u8g2_font_unifont_t_japanese1'

:(.text.startup+0x2b2): undefined reference to `u8g2_font_unifont_t_japanese1'

:(.text.startup+0x2b6): undefined reference to `u8g2_font_unifont_t_japanese1'

c:\Temp\cc9CIyC2.ltrans0.ltrans.o::(.text.startup+0x2b8): more undefined references to `u8g2_font_unifont_t_japanese1' follow

collect2.exe: error: ld returned 1 exit status

Plusieurs bibliothèque trouvées pour "Adafruit_TFTLCD.h"
Utilisé : C:\Users\Documents\Arduino\libraries\libraries\Adafruit_TFTLCD
Plusieurs bibliothèque trouvées pour "Adafruit_GFX.h"
Utilisé : C:\Users\Documents\Arduino\libraries\libraries\Adafruit_GFX
Plusieurs bibliothèque trouvées pour "U8g2_for_Adafruit_GFX.h"
Utilisé : C:\Users\Documents\Arduino\libraries\libraries\U8g2_for_Adafruit_GFX
exit status 1
Erreur de compilation pour la carte Arduino/Genuino Mega or Mega 2560

Thanks

You appear to have a screen like this:

It probably contains an ILI9486 controller.
Life is complicated with "Adafruit_TFTLCD" because it is NOT available via the Library Manager and has been hacked many times. You have to "configure" it to suit the Uno shield on a Mega2560.
I suspect that KUMAN have done the hacking for you on the CD.

Life is easier with MCUFRIEND_kbv library.
Install via IDE Library Manager.

Replace the

#include <Adafruit_TFTLCD.h>

#define LCD_CS A3 // Chip Select goes to Analog 3
#define LCD_CD A2 // Command/Data goes to Analog 2
#define LCD_WR A1 // LCD Write goes to Analog 1
#define LCD_RD A0 // LCD Read goes to Analog 0
#define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin
Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);

with

#include <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;

David.

Oops. My apologies. I posted a program but only tested it on a STM32.

Sure enough. The program will not build on a Mega2560 because the Font is too big.

It runs fine on a Zero, Due, Teensy3.x, STM32, ...

Oliver's Simplified Chinese Font u8g2_font_unifont_t_chinese2 will run on a Mega2560
If there is a smaller Japanese font you might be ok.
e.g. u8g2_font_b10_t_japanese1 runs on a Mega2560 but is too small for my eyesight.

Since you have a Shield, it would be wise to find an Arduino with proper headers.
A Due clone is pretty cheap.
I like the Zero but it is expensive.
If you buy an STM32 Nucleo board it works very well e.g. Nucleo-F446 or Nucleo-L476. (And you can buy from your local ST Distributor)

David.