Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : colours - colour table - bit per pixel
Page 2 of 2 | |||||
Author | Message | ||||
hhtg1968 Senior Member Joined: 25/05/2023 Location: GermanyPosts: 123 |
ah. slowly i understand the "resistor network" that is the "colour table". many thanks... the colour "names" (yellow) etc are only keywords for concrete rgb values. so you cannot program a so called colour scrolling feature... hhtg |
||||
Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1114 |
So far nothing wrong with this, the LCD usualiy has more than 16 Colors so it will work fine there. But it will not fit into PM VGAs RGB 1-2-1 Color generation so you'll get false colors on VGA. Edited 2023-06-15 18:33 by Martin H. 'no comment |
||||
hhtg1968 Senior Member Joined: 25/05/2023 Location: GermanyPosts: 123 |
i think such a LCD has its own (screen) memory (and own principe of colours). therefore you "talk" to such screens with commands, no direct write into the memory. |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6798 |
The colour handling can be interesting on a PicoMite. :) If several RGB() values are in an array then you can, of course, loop through them by changing the array index value. That can be quite effective. It's also fun to use it in Mode 1, where you can get instant background colour changes without affecting the foreground colours - or vice versa. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
RS data sheet for ili9341 says- The module display area contains 240X320 pixels and can display up to 262K colors Why RS used colors? they're Bwitish but anyway must be different to vga. I was happy using ili9341 with just 8 colours on 8 bit pics. |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9129 |
The way that all versions of MMbasic work (slightly simplified but essentially correct) is the colours are always expressed as RGB888. i.e. 24-bits per pixel This internal representation is then converted by a display specific driver to the actual display The drivers have a very small number of function calls DrawRectangle DrawBitMap DrawBuffer ReadBuffer ScrollScreen The later two functions only apply to output devices that can be read (local framebuffer like VGA, external framebuffer like ILI9341) So, irrespective of the display the BOX command will call DrawRectangle with a 24-bit number. It is then up to the display specific version of DrawRectangle to convert the 24-bit number to a resolution the display understands. In the case of the PicoMite VGA 16-colour display it uses this algorithm unsigned char colour = ((c & 0x800000)>> 20) | ((c & 0xC000)>>13) | ((c & 0x80)>>7); which gives the 4 bits of the RGB121 output For a ILI9341 the output is RGB565 (2-bytes per pixel) so the algorithm is col[0]= ((c >> 16) & 0b11111000) | ((c >> 13) & 0b00000111); col[1] = ((c >> 5) & 0b11100000) | ((c >> 3) & 0b00011111); The SSD1963 supports full RGB888 with three bytes per pixel so the algorithm is col[0]=c>>16 col[1]=(c>>8) & 0xFF col[2]= c & 0xFF One wrinkle appears when you read the display framebuffer. In this case the driver has to convert the data from the display back to 24-bits. So for a 4-bit VGA colour display the code for a pixel "val" is: const int colours[16]={0x00,0xFF,0x4000,0x40ff,0x8000,0x80ff,0xff00,0xffff,0xff0000,0xff00FF,0xff4000,0xff40ff,0xff8000,0xff80ff,0xffff00,0xffffff}; colour=colours[val]; |
||||
stanleyella Guru Joined: 25/06/2022 Location: United KingdomPosts: 2129 |
I just saved that in documents for future reference. I didn't know there was a scroll function though there's a youtube video about it using mmbasic. A good explanation of colours. Cheers stan |
||||
hhtg1968 Senior Member Joined: 25/05/2023 Location: GermanyPosts: 123 |
that is very well descripted. and i wrote wrong, then mmbasic writes to the memory of the external LCDs. i will store this explanation too. |
||||
Page 2 of 2 |
Print this page |