i am working on a project on my arduino mega2560. I want to show reading of the sensors on the TFT display, the problem is the text displayed on the screen is mirrored. Since i am very new to arduino i don't know how to fix the problem. I have check a few videos on youtube but nothing helped. I am using the example from the UTFT library arduino (AVR) => UTFT_DEMO_480x320
-
1Can you please provide a link to the library you used (for example to the corresponding github page)? I looked at the UTFT library, that I can find in my library manager, but that does not have any 480x320 demo, so I suspect, that you are using a different library. Also please show your code– chrislCommented Aug 7, 2020 at 12:28
-
rinkydinkelectronics.com/library.php?id=51– Nabeel Hussain ShahCommented Aug 7, 2020 at 13:10
3 Answers
The orientation of the display is controlled by the "Set Address Mode" command (0x36) at line 42 of the ILI9481 driver.
The current value is 0x0A
which is 00001010
in binary. According to the datasheet (8.2.25) bit 6 is "Column Address Order", and that is set to "Left to Right" currently.
Turning that bit on should reverse the column order for the display.
So changing those two lines of code to:
LCD_Write_COM(0x36);
LCD_Write_DATA(0x4A);
should have the desired effect.
-
i have tried this but still no luck its the same Commented Aug 7, 2020 at 13:23
-
There should be a change, even if it's a wrong change. So either the IDE caching the compiled code and not realizing that there's a change it needs to recompile for (probably, given the nature of that library), or it's not using the ILI9491 driver.– MajenkoCommented Aug 7, 2020 at 13:25
-
i have made changes as you suggested, also restarted the IDE i dont know why it isn't detecting any change, is there anything that i am missing? Commented Aug 7, 2020 at 13:33
-
Are you sure you changed it in the right file? There's lots of files all named the same in that library.– MajenkoCommented Aug 7, 2020 at 13:37
-
10x4A works, now the text is not mirrored Thanks a lot. Can you please update your answer above and change 0x08 to 0x4A so that i can mark it answered. Commented Aug 7, 2020 at 14:58
Had this same problem with everything mirrored/backward. Not sure you're still trying, but for any others with this issue, here's how I addressed it..
If using the UTFT library from RinkyDink electronics, open up their initlcd.h file. In the section for Memory Access Control (lines 85-86 in version I have), change the write to:
LCD_Write_DATA(0x08);
Bit 0 controls vertical flip, Bit 1 controls horizontal flip.
I had the problem of a mirrored display. none of the solutions above worked. I found that the Line in the source code had the wrong driver defined. change the line in the source code (file name "UTFT_Demo_480x320" line# 32 to this: UTFT myGLCD(CTE40, 38, 39, 40, 41); The new part is 'CTE40'. This works with the ILI9486. You can find all of the different chip numbers in the file "UTFT.h'