Hi guys i have RGB888 ST7789 LCD display and i have strange problems with Adafruit GFX, it can only display RGB565 Thats bad, how to display a RGB888 on it
The controller only has memory for 18 bits i.e. 666.
Adafruit_GFX uses 16 bits i.e. 565
Apart from making everything slower there is not much point in using the extra 2 bits.
I doubt that you will notice the difference on a full colour 24-bit BMP picture. i.e between 565 or 666.
David.
i notice its greener bcz it g has 6 bits r and b has 5 (also is it possible to make it 666 with editing the library?
It does not become greener with 6 bits. The R, G, B depend on the most significant 5 bits.
Because G has an extra least significant bit there are 2 possible "green" components. But you will hardly notice the difference.
Yes, most TFT controllers can be setup for 666 or 565. Some even have some very low-res options.
If you have plenty of parallel pins you can use 8080-18 (for 666) instead of 8080-16 (for 565). There are corresponding 8080-9 and 8080-8 interface options.
I suspect that you are using 4-wire SPI on your ST7789. This can write a 565 pixel in two 8-bit SPI bytes. Or write a 666 pixel in three SPI bytes.
This also applies to other Sitronix, Himax, ... controllers.
However only some Ilitek controllers can write two SPI bytes. e.g. ILI9341
ILI9481, ILI9486, ILI9488 always use three SPI bytes.
This is why Red SPI displays with ILI9488 perform so badly.
You can make your SPI ST7789 perform badly too if that is what you want.
I have a non-public SPI library that can write 3-byte pixels instead of 2-byte pixels.
Incidentally reading pixels via SPI uses 3-bytes on every make of controller.
Using 8080-18 Parallel is no problem with a 32-bit ARM. But it involves extra Ports on an 8-bit AVR.
David.
can you send it with message in zip? (only txts with links,executable/programs not allowed on zips)
Post a link to the actual RGB888 ST7789 display that you have bought.
Say which Arduino you intend to use e.g. Zero, Due, ESP32, ...
I will post a program that displays a BMP photo from SD card in 565 and in 666 mode using a specific library e.g. Adafruit_ST7789
You will see if you can spot the difference.
David.
i dont have ant sd card reader or usb, i have Arduino UNO (I usually use ROM to store),
i have 7 pins 240 x 240 IPS type LCD https://www.hepsiburada.com/alkatronik-ips-1-3-inch-7-pin-spi-240x240-lcd-tft-modul-ekran-hd-full-color-pm-HBC00000UF914 (i also have 2 char lcd and 1x nokia 5110 lcd)
also color i use is so noticable
Here is a sketch that will run on your Blue ST7789 display. You might need to change your constructor to suit your TFT_DC, TFT_RST wiring.
Look at each coloured band with a magnifying glass. You should see the bottom half of each band is "smoother" because there are 64 distinct colours. The top half only has 32 distinct colours for Red, Blue, Gray but has 64 colours for Green.
I find it difficult to see the difference between 32 shades and 64 shades on the ST7789. But anyone with a bigger screen (e.g. ILI9341) should be able to see.
Incidentally, the Adafruit library has wrong colours and wrong directions (in my opinion)
David.
#if 1
#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789
Adafruit_ST7789 tft(10, 9, 8); //TFT_CS, TFT_DC, TFT_RST
//Adafruit_ST7789 tft(10, 9, 11, 13, 8); //TFT_CS, TFT_DC, TFT_MOSI, TFT_SCK, TFT_RST
#define TFT_BEGIN() { tft.init(240, 240, SPI_MODE3); tft.invertDisplay(1); }
#else
#include <Adafruit_ILI9341.h> // Hardware-specific library for ILI9341
Adafruit_ILI9341 tft(10, 9, 8); //TFT_CS, TFT_DC, TFT_RST
#define TFT_BEGIN() tft.begin()
#endif
void fillRectRGB(int x, int y, int w, int h, uint8_t r, uint8_t g, uint8_t b)
{
tft.startWrite();
tft.writeCommand(0x003A); //COLMOD
tft.spiWrite(0x66); // 666 mode
tft.setAddrWindow(x, y, w, h);
while (h--) {
for (int cnt = 0; cnt < w; cnt++) {
tft.spiWrite(r);
tft.spiWrite(g);
tft.spiWrite(b);
}
}
tft.writeCommand(0x003A); //COLMOD
tft.spiWrite(0x55); // 565 mode
tft.endWrite();
}
void fillBothRGB(int x, int y, int w, int h, uint8_t r, uint8_t g, uint8_t b)
{
tft.fillRect(x, y, w, h / 2, tft.color565(r, g, b)); //top half in 565
fillRectRGB(x, y + h / 2, w, h / 2, r, g, b); //bottom half in 666
}
void setup(void) {
TFT_BEGIN(); // Init ST7789 240x240
tft.setRotation(1); //Landscape
tft.setTextSize(2);
}
void loop() {
int x, y = 40, ofs = 47, w;
w = (tft.width() > 240) ? 4 : 3;
tft.fillScreen(0x0000); //BLACK
tft.setCursor(0, 0);
tft.print("ANY DIFFERENCE ?");
for (int i = 0; i < 4; i++) { //empty boxes
tft.setCursor(0, i * 40 + y);
tft.print("565\n666");
tft.drawRect(ofs - 1, i * 40 + y - 1, 64 * w + 2, 34, 0xFFFF); //WHITE
}
for (int i = 0; i < 64; i++) { //coloured bands
x = i * w + ofs;
uint8_t c = i * 4;
fillBothRGB(x, y + 0, w, 32, c, 0, 0); //RED
fillBothRGB(x, y + 40, w, 32, 0, c, 0); //GREEN
fillBothRGB(x, y + 80, w, 32, 0, 0, c); //BLUE
fillBothRGB(x, y + 120, w, 32, c, c, c); //GRAY
}
delay(5000);
}
i buyed an micro sd one (first i do sample pcm on buzzer)
Please run the program that I pasted in #9.
Does it work on your Blue display ?
Can you see any difference between 565 and 666 RGB on your screen ?
Your Blue 240x240 display has no CS pin. This means that you can not share the SPI bus with an SD card.
I suggest that you buy a different display e.g. one with SD card (separate TFT_CS and SD_CS pins). Since you have a Uno you want to buy a display with 3.3V level shifters on the same pcb.
David.
also pins overlap
I suspect that English is not your first language.
Do you understand my question ?
Please say what your country is. There are probably fellow members from your country that can help to explain my question.
turkey
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.