Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 06:56 02 Aug 2025 Privacy Policy
Jump to

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 : F4: when is rgb(yellow) not rgb(yellow)?

Author Message
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3378
Posted: 01:27am 17 May 2021
Copy link to clipboard 
Print this post

On my F4 (IPS display, if it matters), I see the following:

> ?hex$(rgb(yellow))
FFFF00
> pixel 700,110,rgb(yellow)
> ?hex$(pixel(700,110))
F8FC00

Why aren't they the same? The same thing happens with CIRCLE and LINE. The problem that I have is that PIXEL(x,y) doesn't give me what appears to have been written with PIXEL x,y,somecolor (and I'm testing for a color match).

This is with "ARMmite MMBasic Version 5.07.00b12"

The same occurs on "ARMmite MMBasic Version 5.07.00b8" with an ili9341_16 LCD.
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 1003
Posted: 01:52am 17 May 2021
Copy link to clipboard 
Print this post

All F4 display drivers use RGB565. So do an AND with F8FCF8 to see what your color really is.
Latest F4 Latest H7 FotS
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2642
Posted: 02:09am 17 May 2021
Copy link to clipboard 
Print this post

Ditto with "ARMmite MMBasic Version 5.07.00b12" and standard "OPTION LCDPANEL ILI9341_16, RLANDSCAPE"

> cls &hFFFF00
> ? hex$(pixel(100,100))
F8FC00
>
> cls &H00FFFF
> ? hex$(pixel(100,100))
FCF8
> cls &HFF00FF
> ? hex$(pixel(100,100))
F800F8
> cls &HFFFFFF
> ? hex$(pixel(100,100))
F8FCF8
>
Because it's RGB565 not RGB888

From the manual:-

16-bit interface to SSD1963, ILI9341 and OTM8009A Based LCD Displays
The Armmite F4 drives the SSD1963 and some other 16-bit parallel bus LCD displays. For for extra speed the
SSD1963 controllers run with a reduced colour range (65 thousand colours RGB565) compared to 16 million
colours with the normal 8-bit interface. SPI touch is supported. The ILI9341 16 bit LCD that is purchased with
the STM32F407VET6 development board, while only 320*240 pixels, plugs directly into the board via the 32
pin FSMC connector. All other LCD panels will require an adaptor board.
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3378
Posted: 12:54pm 17 May 2021
Copy link to clipboard 
Print this post

Thanks, that explains it. In vegipete's CMM2 Renewed Defense of the Green Hills the bounding color of a circle is used to detect collision of an incoming missile with an explosion. On the F4, there was no match.

I fixed it by beginning by writing a pixel of the desired color, reading it back and, and then doing the collision detection using that saved RGB565 version of the color.

Yes, ANDing the color with &HF8FCF8 gives the right color on the F4.

~
Edited 2021-05-17 22:56 by lizby
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025