# Driving a 24 BPP display in 5:6:5 mode

I have a TFT display which accepts 24 Bits Per Pixel (BPP) display data, but my connector mechanism supports only 5:6:5 mode.

What is the prefered way of getting the display to drop the extra pixel data and use the 5:6:5 data?

Should I just pull-down the unused data lines?

There are two common approaches. One approach is to wire all the unused bits to a fixed value (typically zero). This will cause a slight loss of brightness, but 3% really isn't worth worrying about. The other is to wire them to the upper bits, in sequence, so a 5-bit color value would be wired as [D4 D3 D2 D1 D0 D4 D3 D2]. This will cause every fourth brightness step to increase the pixel brightness by 9 instead of 8, and uses the entire dynamic range.

In deciding on a method, though, one should consider what software is going to be expecting. I prefer 5:5:5 to 5:6:5 (using the upper bit as something like a transparency key) because values with R=G=B will all have the same chrominance and hue. With a 5:6:5 display, software seeking a uniform gray scale might use either (n,2n,n) for all values (assuming white to be 31,62,61), or it might add 1 to the green values for n>=16. If software is going to simply be copying the upper bit of the "green" value to the lower bit, you may achieve the better results with [D5 D4 D3 D2 D1 D0 D4 D3] or [D5 D4 D3 D2 D1 D5 D4 D3] than you'd get with [D5 D4 D3 D2 D1 D0 D5 D4] (which would give the most uniform 63-step ramp). If software will simply be leaving the lower bit blank, you'd be best off with [D5 D4 D3 D2 D1 D5 D4 D3].

• Good complete answer with reasoning and examples. – James May 8 '12 at 14:14

For maximum brightness range, connect the unused lsbits to the lowest bit of your source. Just connecting to 0 will limit maximum brightness slightly.

A very simple solution would be to connect your r/g/b buses to the most significant bits of corresponding display buses, i.e. input R4 -> display R7, ..., input R0 -> display R3, and similarly for other subpixels. This way you can at least preserve most of the dynamic range of your display. Remaining (least significant) bits can be hardwired to either 0 or 1 as you like. If they're all 0 you will lose some dynamic range at the top but keep it at the bottom (near 0), and vice versa. This transformation can be expressed as

R = R << 3 + (0...7);
G = G << 2 + (0...3);
B = B << 3 + (0...7);


Image quality isn't going to be great but that's a limitation you can't overcome (you can't create information that doesn't exist).

• Would the ideal solution be to source a 16bbp display, rather than a 24bbp one? – James May 2 '12 at 11:42
• @James: of course, if possible. – Thorn May 2 '12 at 11:55