TFT colors reversed. on 64bit vs 32bit systems

I have a single file containing the sample code (below) for this test located on a network disk.

The Ide (v 1.8.13 on both systems) is used to compile this code and upload it to the same Uno with a Kuman 3.5" TFT LCD Shield.

That is: the same code is uploaded to the same Uno and shield.

WHEN the Ide is run on a 64 bit system running WIN 10
the colors are what is expected (BLACK, WHITE, GREEN)

WHEN the Ide is run on a 32 bit system running WIN 10
the colors are reversed (WHITE, BLACK, MAGENTA?).
Inserting tft.invertDisplay(1) corrects the problem.

MY QUESTION: Why does the Ide produce different results???

#include <Adafruit_GFX.h>
#include <Adafruit_TFTLCD.h>
#include <MCUFRIEND_kbv.h>

MCUFRIEND_kbv tft;

#define  BLACK     0x0000
#define  GREEN     0x07E0
#define  WHITE     0xFFFF

uint16_t ID;

void  openTFT  ( void )
	 ID = tft.readID();
	 if ( ID == 0xD3 ) ID = 0x9481;
	 tft.begin ( ID );

	 tft.setRotation  ( 0 );
	 tft.setTextColor ( GREEN, BLACK );       // fg,bg
	 tft.setTextSize  ( 3 );
	 tft.fillScreen   ( BLACK );

int   writeTFT ( char *outstr, int col, int row )
	 tft.setCursor ( col, row ); tft.print ( outstr );

int clear_screen ( void )
	 tft.fillScreen ( BLACK );

int clear_screen_rev ( void )
	 tft.fillScreen ( WHITE );

void setup()

//   	 tft.invertDisplay(1); // uncomment if using win10 32bit system


void loop()
	 writeTFT ( "BLACK background", 0, 100  );

	 writeTFT ( "WHITE background", 0, 100  );

Please post a link to the actual display that you have bought. e.g. Ebay sale page.

Run the MCUFRIEND_kbv example program: graphictest_kbv.ino .
The "Adafruit Tests" screen will show the MCUFRIEND_kbv version and the controller ID.

Make sure that you have updated to the same version on W7 and W10 (via the IDE Library Manager)

Oh, there are errors in your pasted sketch.


This topic was automatically closed after 50 days. New replies are no longer allowed.