Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 16:12 01 Dec 2026 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 : LCD Mirror

Author Message
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 1071
Posted: 04:56am 30 Nov 2026
Copy link to clipboard 
Print this post

Is there a smart way to mirror text on an LCD such as the ILI9488 or do I need to rewrite the FONT files to convert them?

OA47
 
ville56
Guru

Joined: 08/06/2022
Location: Austria
Posts: 693
Posted: 07:04am 30 Nov 2026
Copy link to clipboard 
Print this post

Accoring to the datasheet there is a register to do such things

There is a command for the display called "Memory Access Control (36h)"

 D7 MY Row Address Order
 D6 MX Column Address Order
 D5 MV Row/Column Exchange
 These 3 bits control the direction from the MPU to memory write/read.

so with "POKE DISPLAY &h36, &bxxxxxxxx" you can control the setting of these bits.

you can/should do a
"Read Display MADCTL (&h0B)" first to get the current values and set/clear the bits with AND/OR you want to change This is something like

PEEK DISPLAY &h0B, p1, p2         for reading out

in p2 the bits 7,6,5 reflect the current values.

Best to read the manual sections for this. Basically it's easy to do.
I haven't tried with ILI9488 in particular but done this with other displays. They all work more or less the same so this should be no problem at all.

Gerald
                                                                 
73 de OE1HGA, Gerald
 
Volhout

Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 6318
Posted: 07:14am 30 Nov 2026
Copy link to clipboard 
Print this post

Hi OA47,

The simplest method I know is to print the text normal on the LCD,
Then read it in as a picture (blit read),
Then write the picture back mirrored (blit write).



That is simple for static text. But it will not do for scrolling text.
For this to work you need MISO connected on the ILI display.

Volhout
Edited 2026-11-30 17:17 by Volhout
PicomiteVGA PETSCII ROBOTS
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 3474
Posted: 08:06am 30 Nov 2026
Copy link to clipboard 
Print this post

To connect MISO to an ILI9488 see the diagram:-

PicoMite User Manual -> Display Panels -> Example SPI LCD Panel Configuration
 
ville56
Guru

Joined: 08/06/2022
Location: Austria
Posts: 693
Posted: 08:49am 30 Nov 2026
Copy link to clipboard 
Print this post

sorry, PEEK DISPLAY does not exist. So no easy way to read out the existing bit setting in the display module.

So you have to try out which combination of the 3 bits in POKE DISPLAY give the desired result for you. This is dependant on the initial setup (landscape, portrait and invert). What I found out so far:

bit D3 is normal/invert mode
bit D5 is landscape/portrait mode
bits D6 and D7 do mirror the axis x and y

The mode/axis changes always take effect at the next write to the display, the current image is not affected.
                                                                 
73 de OE1HGA, Gerald
 
mozzie
Guru

Joined: 15/06/2020
Location: Australia
Posts: 530
Posted: 04:36pm 30 Nov 2026
Copy link to clipboard 
Print this post

G'day,
To extend Volhouts idea further, the use of a framebuffer may help:

Framebuffer create f
Framebuffer write f
Text 0,0,"HELLO REVERSED OLLEH",,1,2,RGB(red),RGB(Blue)
Blit Read #1,0,0,480,24
Framebuffer write n
Blit Write #1,0,0,1


No read from the screen necessary, tested and works on ILI9488 although I ran out of heap trying to do a whole 480 x 320 at once, not really surprising  

Regards, Lyle.
 
ville56
Guru

Joined: 08/06/2022
Location: Austria
Posts: 693
Posted: 05:37pm 30 Nov 2026
Copy link to clipboard 
Print this post

thanks for the example ... didn't know that blit read can actually read in the reverse order.

For IPS displays in landscape mode the following code does the same and POKE has to be executed only once and does not eat up heap:

poke display &h36, &b10101000           'setup display
Text 0,0,"HELLO REVERSED OLLEH",,1,2,RGB(red),RGB(Blue)

Explanation:
poke display &h36, &b10101000
                                ^^^ ^------ 1=IPS, 0=TFT
                                |||-------- 1=Landscape, 0=Portrait
                                ||--------- 1=invert along short side
                                |---------- 1=invert along long side
(hope I got it right)
sorry for the bad formatting ... the first ^ should be aligned with the first 1


Note: the setting of the display can easily be restored to original state with GUI RESET LCDPANEL

Gerald
Edited 2026-12-01 03:40 by ville56
                                                                 
73 de OE1HGA, Gerald
 
mozzie
Guru

Joined: 15/06/2020
Location: Australia
Posts: 530
Posted: 05:56pm 30 Nov 2026
Copy link to clipboard 
Print this post

G'day Gerald,
I think BLIT reads normally but can write in reverse or upside down, it was Volhout's post that highlighted it.

Very good idea to use POKE DISPLAY to reverse the direction, had to give it a try:

ILI9488:
PORTRAIT = Poke Display &h36,&h48 = Normal : &h36,&h08 = Reverse
RPORTRAIT = Poke Display &h36,&h88 = Normal : &h36,&hC8 = Reverse
LANDSCAPE = Poke Display &h36,&h28 = Normal : &h36,&hA8 = Reverse
RLANDSCAPE = Poke Display &h36,&hE8 = Normal : &h36,&h68 = Reverse

Will be using this at some point in the future for sure, thanks for pointing it out  

Regards, Lyle.
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 1071
Posted: 12:40am 01 Dec 2026
Copy link to clipboard 
Print this post

My test setup is with a Pi-Pico 2040 linked to an ILI9488 running MMBasic 6.03. here is the code snippet I have tried:
Blit Read #1,10,270,450,30 'Read LCD memory for lowest line on screen
Blit Write #1,10,270,&B001 'Re-write the lowest line on screen mirrored
Blit Close #1              'Clear Blit memory for new line written


I did wish to mirror the whole screen but unfortunately I dont have enough memory available. Any way the result of the code above is a white block instead of the yellow text.

any suggestions?
OA47
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 3474
Posted: 01:00am 01 Dec 2026
Copy link to clipboard 
Print this post

White = no data from the LCD.
LCD_DO (data out) needs to be connected to Pico MISO via a diode, and MISO connected to LCD_CS via a resistor. Other panels can be connected directly but the ILI9488 has a fault preventing direct connection.
  Quote  To connect MISO to an ILI9488 see the diagram:-
PicoMite User Manual -> Display Panels -> Example SPI LCD Panel Configuration

Other diodes can be used but must have a junction capacitance of at least 30pF. (or add a parallel cap.) Anode to LCD_DO, cathode to MISO.
The resistor can be up to 10kΩ, if there are no pullups on the SPI lines. Some panels have 4k7 pullups on the SD card SPI pins. For those panels use 1k8.

If there is no room on your PCB they can be added to the top side of the LCD header pins as MISO also goes to T_DO (touch data out)
.
Edited 2026-12-01 14:20 by phil99
 
mozzie
Guru

Joined: 15/06/2020
Location: Australia
Posts: 530
Posted: 04:27am 01 Dec 2026
Copy link to clipboard 
Print this post

G'day OA47,
If you need to mirror the whole screen permanently then Ville56's suggestion would probably be the easiest route.

After poking the value to the display you can write to it as normal and it will display the text reversed, you only need to do this once at the start of your program.

See posts above for tested POKE values.

Regards, Lyle.
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 1071
Posted: 04:49am 01 Dec 2026
Copy link to clipboard 
Print this post

Thanks Gerald & Lyle that poke display works a treat.

OA47
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 3474
Posted: 05:13am 01 Dec 2026
Copy link to clipboard 
Print this post

A code box has fixed width font, but removes the first space of lines that start with spaces. To even it up make all lines start with a space.
poke display &h36, &b10101000
                     ^^^ ^------ 1=IPS, 0=TFT
                     |||-------- 1=Landscape, 0=Portrait
                     ||--------- 1=invert along short side
                     |---------- 1=invert along long side
 
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 2026