![]() |
Forum Index : Microcontroller and PC projects : Supported color depth of a given LCD screen
Author | Message | ||||
karlelch![]() Senior Member ![]() Joined: 30/10/2014 Location: GermanyPosts: 244 |
Hi, maybe I overlooked it, but is it possible to retrieve the usable color depth of a connected LCD display? Or is it always the same (e.g., RGB332)? I am using a round panel with a ST7789 chip with the newest beta firmware (I don't have the full OPTION list here right now but the LCD is connected as follows: OPTION LCD SPI GP18,GP19,GP16 OPTION LCDPANEL ST7789_320BUFF, P, GP22,GP15,GP17,GP14 I want to create color maps to represent heatmaps (e.g. from blue to white to red) using the maximum number of color steps. The trial-and-error approach is a bit unsatisfying. Thanks Thomas |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 5221 |
Hi Thomas, Please note that if you use framebuffers, you are tied to the framebuffer color depth. In most cases that color depth is inferior to the actual LCD screen. The color depth of the framebuffers is listed in the user manual. Volhout PicomiteVGA PETSCII ROBOTS |
||||
karlelch![]() Senior Member ![]() Joined: 30/10/2014 Location: GermanyPosts: 244 |
Hi Volhout thanks for your reply. Good point, however, currently, I don't use framebuffers because I had errors with framebuffers (earlier firmware versions). As the display is updated fast enough, I did not revisit this. The manual says: I guess I was expecting a "convenience" function that reports the target format of the connected display (e.g., MM.INFO$(RGB) returning "565"). Best Thomas P.S. The way I currently approach the color map question is to use Claude to write me Python code that uses the MatPlotLib color map of my choice, convert it to, e.g., RGB332, show the color map, and create MMBasic code (just the DATA statements) for the map. I then displayed it on the LCD and inspected if if looked "nice" ![]() |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10388 |
In general LCD screens are native RGB565. ILI9488 and ILI9481IPS are RGB666. SSD1963s in 8-bit mode is RGB888. The buffered drivers are a special case. The buffer is RGB332 but they support the MAP command and function allowing you to set any of the RGB565 space to the 256 RGB332 slots (Same as various HDMI resolutions). This functionality is untested in the field. Use the manual section explaining this for HDMI for the syntax. As Volhout notes, Framebuffers are RGB121. However, using the map command and function with the buffered drivers you could choose any 16 RGB565 colours to be displayed when you copy the framebuffer to the physical screen. |
||||
phil99![]() Guru ![]() Joined: 11/02/2018 Location: AustraliaPosts: 2689 |
'A Display colour counter Clear : Option Base 0 Dim String S$(2) = (" Blues", " Greens", " Reds") Dim Integer a, b, c, d For a = 0 to 2 'cycle through blue , green and red b = 0 'initialize colour count For c = 0 to 255 'set the brightness d = c << (a * 8) 'make a 24bit colour Pixel 9, 9, d 'send it to a pixel If d = Pixel(9, 9) Then 'read that pixel back from the screen Inc b 'if the colour is the same as the one sent count it EndIf next Print b; S$(a) 'show counted colours next End Footnote added 2025-09-06 07:47 by phil99 The Print statement can be changed to show the number of bits. Print b; S$(a), "= "; Int(Log(b)*1.442695); " bits" 'show counted colours Footnote added 2025-09-06 07:52 by phil99 Typo above, use Cint instead of Int. Print b; S$(a), "= "; CInt(Log(b)*1.4427); " bits" 'show counted colours |
||||
karlelch![]() Senior Member ![]() Joined: 30/10/2014 Location: GermanyPosts: 244 |
Thanks, Peter! I will try as soon as I get back to my gear. One question: for the buffered driver, when I use MAP RESET and them redefine the colors, say, from 100 on and them use MAP SET, are the first 16 entries kept or do I always have to define the complete mapping? Thanks! |
||||
karlelch![]() Senior Member ![]() Joined: 30/10/2014 Location: GermanyPosts: 244 |
Thanks, Phil. Elegant solution! |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2627 |
The manual says MAP command is HDMI VERSION ONLY and VGA VERSION ONLY? Or am I mistaken? |
||||
Bleep Guru ![]() Joined: 09/01/2022 Location: United KingdomPosts: 661 |
Try reading what Peter said! |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |