2534 views|3 replies

28

Posts

1

Resources
The OP
 

General method of displaying pictures and texts on TFT color screen [Copy link]

 
This post was last edited by lemon1394 on 2022-9-25 21:30

To display pictures and text on a TFT color screen, several problems need to be overcome:

1. Get the RGB data of the image for use by TFT .

TFT color screens generally need dot matrix data of images, but only BMP format files have dot matrix information, which needs to be extracted by yourself. Common images are JPG, so use PS to convert them.

BMP images are commonly used in RGB888 format, that is, each pixel is represented by three bytes. If you want to extract it, you need to understand the BMP file format. You can read the file in binary mode, offset to the position of RGB data, and then read the RGB data.

2. The RGB data format does not match the data required by the TFT screen

What TFT needs is RGB565 dot matrix information, and BMP is generally in RGB888 mode. At this time, RGB888 needs to be converted to RGB565.

The conversion method is to take the high 5 bits of R, the high 6 bits of G, and the high 5 bits of B, and combine them into a new 2 bytes, a total of 16 bits to represent a pixel.

In fact, you can use PS to convert it, and then read the RGB565 data in binary mode.

At this time, you will find that the displayed picture is upside down and left and right. Adjust it again. Of course, you can also adjust the TFT driver. After adjusting the driver, the displayed text will be upside down again. . .

You can also convert it yourself. It's okay for small screens, a 240X320 screen. I converted it and it took 6 seconds for a PC, let alone a single-chip computer.

3. You can use the firmware shared by some netizens.

These firmwares can display text and pictures, but you can only use their firmware. If they don't update, you can't use the new firmware.

Moreover, I can't do anything with other people's ready-made products, and I have no idea how they achieve it. If I want to achieve an effect of my own, I don't know what to change, and I can't change it because it's in the firmware.

4. Display HZK16, ASC16, HZK32

Using framebuf is more efficient, but it can only use the default small font. I want to use 16X16 HZK16, but the format is wrong.

You can write a program to expand an RGB565 framebuf according to the dot matrix information. Just writing the program will take a long time to think and adjust, but the key conversion efficiency must be gratifying.

5. Summary:

If you want to display pictures and text on the TFT screen without using other firmware, you will have to step into many pitfalls, and many of them are basically impossible to climb out of.

Using other people's firmware, it can only display text on some screens, and even fewer can display pictures. The main problem is that it is not flexible.

Regarding other methods of displaying pictures and texts on TFT screens, I have not seen a perfect solution yet, and I don’t know how everyone solves this problem.

Latest reply

Search github for fb-boost firmware that meets all the requirements  Details Published on 2023-2-27 10:49
 
 

85

Posts

0

Resources
2
 

As long as you can draw some points on it, everything can be solved!

 
 
 

6060

Posts

6

Resources
3
 

Once you get used to it, it will be fine. Generally, the sequence problem will only occur for the first time or when the hardware is changed. Subsequent use will basically not cause such a problem. You have to understand that the design is constantly reorganized, and the first use is the accumulation of basic knowledge.

Personal signature

在爱好的道路上不断前进,在生活的迷雾中播撒光引

 
 
 

65

Posts

0

Resources
4
 
Search github for fb-boost firmware that meets all the requirements
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Related articles more>>

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews

Room 1530, Zhongguancun MOOC Times Building, Block B, 18 Zhongguancun Street, Haidian District, Beijing 100190, China Tel:(010)82350740 Postcode:100190

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list