-
Download and install a fresh copy of UTFT v2.81
-
Run this sketch on your MEGA2560 for the three different controller models.
#include <UTFT.h>
// Declare which fonts we will be using
extern uint8_t BigFont[];
extern uint8_t SevenSegNumFont[];
UTFT myGLCD(ILI9481, 38, 39, 40, 41);
//UTFT myGLCD(ILI9486, 38, 39, 40, 41);
//UTFT myGLCD(R61581, 38, 39, 40, 41);
#define LCD_RD A0
void setup()
{
pinMode(LCD_RD, OUTPUT);
digitalWrite(LCD_RD, HIGH);
// myGLCD.InitLCD(LANDSCAPE);
myGLCD.InitLCD(PORTRAIT);
myGLCD.clrScr();
myGLCD.setFont(BigFont);
}
void WriteCmdParamN(uint16_t cmd, int8_t N, uint8_t *block)
{
cbi(myGLCD.P_CS, myGLCD.B_CS);
myGLCD.LCD_Write_COM(cmd);
while (N-- > 0) {
myGLCD.LCD_Write_DATA(*block++);
}
sbi(myGLCD.P_CS, myGLCD.B_CS);
}
char *msgs[] = {
"0: Flip Vert",
"1: Flip Horiz",
"2: Horiz refresh",
"3: RGB-BGR order",
"4: Vert refresh",
"5: Row Col Xchange",
"6: Column Order",
"7: Row Order",
};
void loop()
{
uint8_t initval = 0x0A; //what is in your initlcd.h for 0x36
int w = myGLCD.getDisplayXSize(), h = myGLCD.getDisplayYSize();
uint8_t i = 0, madctl;
for (i = 0; i < 8; i++) if (initval & (1<<i)) msgs[i][2] = '!';
for (i = 0; i < 2; i++) {
WriteCmdParamN(0x36, 1, &initval);
myGLCD.clrScr();
myGLCD.setColor(255, 255, 255); //WHITE
myGLCD.setFont(SevenSegNumFont);
myGLCD.print("4", 0, 0);
myGLCD.setFont(BigFont);
myGLCD.print(msgs[i], 0, h / 2);
delay(2000);
myGLCD.clrScr();
madctl = (1 << i) ^ initval;
WriteCmdParamN(0x36, 1, &madctl);
myGLCD.setColor(0, 0, 255);
myGLCD.setFont(SevenSegNumFont);
myGLCD.print("4", 0, 0);
myGLCD.setFont(BigFont);
myGLCD.print(msgs[i], 0, h / 2);
delay(5000);
}
}
- Report back with the results. i.e. write a table with result from each controller.
You should see a BLACK background with text in WHITE. The result of changing the bit in BLUE.
If the big number 4 changes place, you know that the Flip is working.
If your background is WHITE, or the text in RED, or MAGENTA, or YELLOW say so.
If you have trouble running the program, say so.
David.