|
Forum Index : Microcontroller and PC projects : LCD Mirror
| Author | Message | ||||
| OA47 Guru Joined: 11/04/2012 Location: AustraliaPosts: 1070 |
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: AustriaPosts: 693 |
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: NetherlandsPosts: 6318 |
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: AustraliaPosts: 3473 |
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: AustriaPosts: 693 |
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: AustraliaPosts: 529 |
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: AustriaPosts: 693 |
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: AustraliaPosts: 529 |
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: AustraliaPosts: 1070 |
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: AustraliaPosts: 3473 |
White = no data from the LCD. LCD_DO 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. 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. . Edited 2026-12-01 11:51 by phil99 |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |