Problem with new TFT display

I had a 7” TFT display which have failed. On it was written MD070SD. So I purchased a new 7” display very similary but not identical this one

https://www.aliexpress.com/item/1005006481553657.html?spm=a2g0o.order_list.order_list_main.5.6ac91802zOEPsS

My program running on a Arduino Due that did work with previous one does not do so now with the new TFT. The TFT just display a blank grey screen. I see that the program is running as expected. I use a library called UTFT. In my code I initialise the TFT with this code line

UTFT myGLCD(CTE70CPLD, 25, 26, 27, 28);

Do I need to change this and if so how ?

Is the #include file UTFT.h? If so, the comments in the code show compatibility...

For a full list of tested display modules and controllers, see the document UTFT_Supported_display_modules_&_controllers.pdf.

Pro-tip on your link... you only need the URL of the first HTM file, like this:

https://www.aliexpress.com/item/1005006481553657.html

The rest of the link data is for info collection.

Yes UTFT.h is in the code and I see a lot of modelnames. As I have understand my TFT use the controller SSD1963. I have tried all entries with for the controller SSD1963 for 7” listed in the sopported display modules doc. None worked

This list from your link says (to me) that your board lacks a driver chip (the SSD1963)... but the "buyer comment" says it works as shipped... i hope I am wrong.

One of the users on this site writes display drivers... "bap" with a line-drawn bust for an avitar is all I remember... not @PerryBebbington

Perhaps photo the electronics side and post it here?

I have got it to work now. I changed CTE70CPLD to CTE70 and noted that I must accidentally erased the code line that initialised the display.

Strange though before change to CTE70 I tried reading the x and y size of the display and that yielded the correct values.

very good.

Sorry. I neglected to say, "post your code" any time you start a topic. You might have seen the missing line then, and definitly others would have noticed.

Do you mean @bperrybap ?

1 Like

If you are refering to me,
my avatar is an image of an LCD bitmap that created and included in the openGLCD library.
I created it from a photo that my wife took many years ago.

– bill

1 Like

Yes! All I could remember was "bap"... thank you.

Yes. Nice img2cpp. "bust" is referring to "head and shoulders"

Only problem now is with black. When displaying a black screen it is instead middle gray. But black characters are displayed black

You should show your code and wiring.

I am using a shield where I fit the display into a connector. My code is long but here are the main parts

// Visual Micro is in vMicro>General>Tutorial Mode
// 
/*
    Name:       MegaDisplayStation.ino
    Created:	2019-05-25 14:19:55
    Author:     JanWork-PC\Jan Work
*/
#include <Arduino.h>
#include <MillisTimer.h>
#include <Wire.h>
#include <TimeLib.h>
#include <Time.h>
#include <UTFT.h>
#include <memorysaver.h>
#include <DS3231.h>
#include <stdio.h>
#include "UserFunctions.h"

#define	GrotW 32
#define GrotH 64
#define BigW  16
#define BigH  16

#define	Tinindx	 4
#define	Touindx 11
#define Barindx	17
#define Hygindx	22
#define Nedindx 25

tmElements_t	tm;									//Declare tmElements object to store time & date from DS3231
tmElements_t	systemstart;						//Time at system startup
tmElements_t	prevTime;							//Store last correctly read time

boolean sysstart = true;
boolean nightatsetup = false;						//Is it nighttime during setup
boolean	ValidData = false;
boolean	Frost = false;
boolean Datainit = false;							//Initial setting of sensor data
boolean	Error45 = false;							//Flag for encountered 45:15 time error from the clock
boolean Midnight = false;							//Flag for midnight 00:00-03:30
boolean Latenight = false;							//Flag for late night 03:30-09:00
boolean Morning = false;							//Flag for morning 09:00-24:00
boolean Noon = false;								//Flag for noon 09:00 - 11:45

static	float	previousT;							//Used to keep track of max min temperatures

enum DST											// Day Light Saving Time
{
	SNT,											//Svensk Normal Tid
	SST												//Svensk Sommar Tid
};

enum MaxMin
{
	none,outmax,outmin,inmax,inmin,all
};

boolean	Updated_Toutmax, Updated_Toutmin, Updated_Tmonthmin,Updated_Tinmax, Updated_Tinmin;

float	T_dayoutmax, T_dayoutmin, T_dayinmax, T_dayinmin;	//Max Min temperatures during 24h day
float	T_monthmin;											//Min outside temperature during month
float	T_outmax, T_outmin, T_inmax, T_inmin;
float	Tout, Tin,baro,hygro;

const char *monthName[12] =
{
	"Jan", "Feb", "Mar", "Apr", "Maj", "Jun",
	"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};

const char	*weekdayName[8] =
{
	"","Mandag ","Tisdag ","Onsdag ","Torsdag","Fredag ","Lordag ","Sondag "
};

const char *Readercode[4] =
{
	"OK","Exp","Chr","End"
};

byte	hour_now;									//Current hour
byte	timesaving;									//Is it SNT or SST
byte	maxminupdate = none;						//Which max or min value is updated initially none
char	tempI[5] = { '\0' };						//String for In temperature value as asci
char	tempO[6] = { '\0' };						//String for Out temperature value as asci (one extra char in case of T<-10 C
char	barostr[5] = { '\0' };
char	hygrotempstr[5] = { '\0' };					//String for hygrometer value in ascii
char	hygroRHstr[5] = { '\0' };					//String for hygrometer value in ascii
char	datastr[64] = { '\0' };						//Data packet from other unit
char	precvalue[4] = { '\0' };					//Analog v�rde fr�n regndetektor
int		Epos;
int		errcode;


static	float	previousTout;						//Used to keep track of max min temperatures
static	float	previousTin;						//Used to keep track of max min temperatures
uint8_t	hourMaxOut;
uint8_t	hourMaxIn;
uint8_t	hourMinOut;
uint8_t	hourMinIn;
uint8_t datemonthmin;								//Date for monthly min
uint8_t hourmonthmin;								//Hour for monthly min
uint8_t minmonthmin;								//Minutes for monthly min
uint8_t	minMaxOut;
uint8_t	minMaxIn;
uint8_t	minMinOut;
uint8_t	minMinIn;

void setup()
{
	Wire.begin();
	Serial.begin(9600);
	Serial2.begin(4800);
	delay(1000);
	Serial.println("NEW COMPILED");
	InitTFTDisplay();

	//SetClock();

	if (ReadClock())											//Read the current time & date (time of board startup) from DS3231 set current hour	
	{
		hour_now = tm.Hour;
		systemstart = tm;										//store the time of last system startup
		prevTime = tm;
	}
	else
	{
		Serial.println("Error ReadClock");
		Serial.println("Try writing clock again");
		setDS3231time(tm.Second, tm.Minute, tm.Hour, tm.Wday, tm.Day, tm.Month, tm.Year);
		ReadClock();
		hour_now = tm.Hour;
		systemstart = tm;										//store the time of last system startup
		prevTime = tm;
	}

	SetupTimePeriodFlags();

	if (tm.Hour >= 0x00 && tm.Hour <= 0x09 )					//Check if nighttime during setup
		nightatsetup = true;
	else
		nightatsetup = false;

	CheckDayLightSaving();

	Displaytimesaving(timesaving);
		
	DisplayStoredSystemStart();

	if (ReadMegaDataPacket())								//Read data for the first time
	{
		ValidData = true;
		ExtractData();
		ExtractDataFloat();
		InitMaxMin();
		Datainit = true;
		maxminupdate = all;
		DisplayDataSetup();
		Serial.println("Data rec in setup");
	}
	else
	{
		DisplayNoDataSetup();
		DisplayValuesLines();
		Serial.println(datastr);
	}	
	Serial.println("END of SETUP");
}

// Add the main program code into the continuous loop() function
void loop()
{
	if (ReadClock())										//Read the current time & date (time of board startup) from DS3231 set current hour
	{
		DisplayTime();
		if (tm.Hour > hour_now)								//Check if a new hour has started
			hour_now = tm.Hour;
	}
	else
	{
		Serial.println("Failed ReadClock in loop");
		DisplayFailedClockRead();
	}

	if (ReadMegaDataPacket())								//Has a valid data package been recieved ?
	{
		ValidData = true;
		DisplayDataLoop();
		ExtractData();
		ExtractDataFloat();
		if (Datainit)										//Has data been initialized during setup
			SetMaxMin();									//Then set current Max Min
		else
		{
			InitMaxMin();									//If not initialize Max Min the first time
			Datainit = true;								//Flag that data has been initialized for the first time
		}
		DisplayData();
		DisplayLastDataRecTime();
		DisplayMaxMin();
		//Serial.println(datastr);
	}
	else
	{
		ValidData = false;
		DisplayNoDataLoop();
		DisplayDataErrorCode();
		Serial.println(datastr);
	}
	
	HandleDayLightSaving();

	CheckTimePeriod();

	SetTimePeriod();
}

void	CheckTimePeriod()
{
	if (tm.Hour == 11 && tm.Minute == 0x00 && tm.Second <= 0x07 &&  Morning == false)
		Morning = true;
	if (tm.Hour == 0x09  && tm.Minute == 0x00 && tm.Second <= 0x07 && Noon == false)
		Noon == true;
	if (tm.Hour == 0x00 && tm.Minute == 0x00 && tm.Second <= 0x07 && Midnight == false)
		Midnight = true;
	if (tm.Hour == 0x03 && tm.Minute ==   30 && tm.Second <= 0x07 && Latenight == false)
		Latenight = true;
}

void	SetTimePeriod()
{
	if (Morning)
	{
		SetMorning(); Morning = false;
	}
	if (Noon)
	{
		SetNoon(); DisplayNoon(); Noon = false;
	}
	if (Midnight)
	{
		SetMidnight(); Midnight = false;
	}
	if (Latenight)
	{
		SetLatenight(); Latenight = false;
	}
}

void	SetMorning()
{
	Morning = false;
	SetDayMode();
	Displaytimesaving(timesaving);
	maxminupdate = all;
	DisplayMaxMinTimes();
}

void	SetNoon()
{
	Noon = false;
	SetNoonMode();
	Displaytimesaving(timesaving);
	maxminupdate = all;
	DisplayMaxMinTimes();
}

void	SetMidnight()
{
	Midnight = false;
	SetNightMode();
	Displaytimesaving(timesaving);
	if (ValidData)
	{
		SetNewMaxMin();
		maxminupdate = all;
		DisplayMaxMinTimes();
		DisplayDataLoop();
	}
	else
	{
		DisplayNoDataLoop();
		DisplayValuesLines();
	}

}

void	SetLatenight()
{
	Latenight = false;
	SetLateNightMode();
	Displaytimesaving(timesaving);
	if (ValidData)
	{
		DisplayMaxMinTimes();
		DisplayDataLoop();
	}
	else
	{
		DisplayNoDataLoop();
		DisplayValuesLines();
	}
}

void	SetupTimePeriodFlags()									//Run only during Setup
{
	if (tm.Hour >= 0x00 && tm.Hour <= 0x03) 					//Check if nighttime during setup
		Midnight = true;

	if (tm.Hour >= 0x04 && tm.Hour <= 0x09)
		Latenight = true;

	if (tm.Hour >= 0x09 && tm.Hour <= 11)
		Noon = true;

	if (tm.Hour > 11 && tm.Hour <= 24)
		Morning = true;
}

void	CheckDayLightSaving()
{
	if (tm.Month >= 10 || tm.Month <= 3)					//Is it October or November or December or January or February or Marsch?
	{
		if (tm.Month == 10 && tm.Wday == 7 && ((tm.Day + 7) > 31))			//Is time October and after last sunday in October
		{
			timesaving = SNT;								//Then normal time
		}
		else if (tm.Month == 10)
			timesaving = SST;

		if (tm.Month == 3 && tm.Wday == 7 && ((tm.Day + 7) > 31))			//Is it after last Sunday in Marsch
		{
			timesaving = SST;								//Then summertime
		}
		else if (tm.Month == 3)												//Is it Januari or Fenruary or Marsch ?
			timesaving = SNT;									//Then normal time
	}
	else
		timesaving = SST;									//Then it is April - September and thus Sommer time
}

boolean ExtractData()
{
	strncpy(tempI  , &datastr[Tinindx], 4);
	if (strcmp(tempI,"-0.1") == 0)
	{
		ValidData = false;
		DisplayInTempError();
	}
	strncpy(tempO  , &datastr[Touindx], 5);
	strncpy(barostr, &datastr[Barindx], 4);
	strncpy(hygroRHstr, &datastr[Hygindx], 2);
	strncpy(precvalue, &datastr[Epos-3], 3);	
}

void	SetMaxMin()								//Update current Max Min values
{
	if (Tout > T_outmax)						//Set max and min values
	{
		T_outmax = Tout; 
		hourMaxOut = tm.Hour; minMaxOut = tm.Minute;
		Updated_Toutmax = true;
		maxminupdate = outmax;
		DisplayMaxMinTimes();
	}
	else
		Updated_Toutmax = false;

	if (Tout < T_outmin)
	{
		T_outmin = Tout; hourMinOut = tm.Hour; minMinOut = tm.Minute;
		Updated_Toutmin = true;
		maxminupdate = outmin;
		DisplayOutMin();
	}
	else
		Updated_Toutmin = false;

	if (Tout < T_monthmin)
	{
		T_monthmin = Tout; datemonthmin = tm.Day; hourmonthmin = tm.Hour; minmonthmin = tm.Minute;
		DisplayMonthMin();
		DisplaymonthminTime();
	}
	else
		Updated_Tmonthmin = false;

	if (Tin > T_inmax)
	{
		T_inmax = Tin; hourMaxIn = tm.Hour; minMaxIn = tm.Minute;
		Updated_Tinmax = true;
		maxminupdate = inmax;
		DisplayMaxMinTimes();
	}
	else
		Updated_Tinmax = false;

	if (Tin < T_inmin)
	{
		T_inmin = Tin; hourMinIn = tm.Hour; minMinIn = tm.Minute;
		Updated_Tinmin = true;
		maxminupdate = inmin;
		DisplayMaxMinTimes();
	}
	else
		Updated_Tinmin = false;
}

void	InitMaxMin()
{
	T_outmax = T_outmin = T_monthmin = previousT = atof(tempO);			//Init Max Min temperatures to current temperatures	first time
	T_inmax = T_inmin = atof(tempI);
	hourMaxOut = tm.Hour; minMaxOut = tm.Minute;
	hourMinOut = tm.Hour; minMinOut = tm.Minute;
	hourMaxIn = tm.Hour; minMaxIn = tm.Minute;
	hourMinIn = tm.Hour; minMinIn = tm.Minute;
	maxminupdate = all;
	DisplayMaxMinTimes();
	T_monthmin = atof(tempO);
	datemonthmin = tm.Day; hourmonthmin = tm.Hour; minmonthmin = tm.Minute;
	DisplayMonthMin();
	DisplaymonthminTime();
}

void	SetNewMaxMin()					//Init Max Min at midnight
{
	T_dayoutmax = T_outmax;				//Set the max and min temperatures during the previous day
	T_dayoutmin = T_outmin;
	if (Isnewmonth)
		T_monthmin = T_outmin;
	T_dayinmax = T_inmax;
	T_dayinmin = T_inmin;
	ReadMegaDataPacket();				//Reset max min temperature to the current temperature
	if (Isnewmonth)
	{
		T_monthmin = atof(tempO);
		datemonthmin = tm.Day; hourmonthmin = tm.Hour; minmonthmin = tm.Minute;
		DisplaymonthminTime();
	}

	T_outmax = T_outmin = previousTout = atof(tempO);
	T_inmax = T_inmin = previousTin = atof(tempI);
	hourMaxOut = tm.Hour; minMaxOut = tm.Minute;
	hourMinOut = tm.Hour; minMinOut = tm.Minute;
	hourMaxIn = tm.Hour; minMaxIn = tm.Minute;
	hourMinIn = tm.Hour; minMinIn = tm.Minute;
	maxminupdate = all;
	DisplayMaxMinTimes();
}

void	HandleDayLightSaving()
{
	if (tm.Month == 10 && tm.Wday == 7 && ((tm.Day + 7) > 31) && tm.Hour == 3 && tm.Minute == 0 && tm.Second <= 7 && timesaving==SST)			//Adjust for daylight saving time
	{
		timesaving = SNT;
		tm.Hour -= 1;
		setDS3231time(tm.Second, tm.Minute, tm.Hour, tm.Wday, tm.Day, tm.Month, tm.Year);
		Displaytimesaving(timesaving);
	}
	if (tm.Month == 3 && tm.Wday == 7 && ((tm.Day + 7) > 31) && tm.Hour == 2 && tm.Minute == 0 && tm.Second <= 7 && timesaving==SNT)
	{
		timesaving = SST;
		tm.Hour += 1;
		setDS3231time(tm.Second, tm.Minute, tm.Hour, tm.Wday, tm.Day, tm.Month, tm.Year);
		Displaytimesaving(timesaving);
	}
}

void ExtractDataFloat()
{
	Tin = atof(tempI);
	Tout = atof(tempO);
	baro = atof(barostr);
	hygro = atof(hygroRHstr);
}


boolean IsMidnight()
{
	if ( (tm.Hour == 0x00 && tm.Minute == 0x00 && tm.Second <= 7) || nightatsetup)
	{
		if (nightatsetup)
			nightatsetup = false;
		return true;
	}
	else
		return false;
}

boolean IsLateNight()
{
	if (tm.Hour == 0x03	&& tm.Minute == 30 && tm.Second <= 7)
		return true;
	else
		return false;
}

boolean IsNoon()
{
	Serial.println("IsNoon");
	if (tm.Hour == 0x09 && tm.Minute == 0x00 && tm.Second <= 7)
		return true;
	else
		return false;
}

boolean IsMorning()
{
	if (tm.Hour == 11 && tm.Minute == 0x00 && tm.Second <= 7)
		return true;
	else
		return false;
}

boolean Isnewmonth()
{
	if (tm.Day == 0x01)
		return true;
	else
		return false;
}

and TFTDisplay.ino

extern uint8_t BigFont[];
extern uint8_t SevenSegmentFull[];
extern uint8_t Grotesk32x64[];

UTFT myGLCD(CTE70, 25, 26, 27, 28);

char	tempstr[6] = { '\0' };						//String for Max Min values

void	DisplayTime()								//Display RTC clock time hh:mm on TFT
{
	myGLCD.setFont(Grotesk32x64);
	myGLCD.printNumI(tm.Hour / 10, 0, 17);
	myGLCD.printNumI(tm.Hour % 10, 32, 17);
	myGLCD.print(":", 64, 17);
	myGLCD.printNumI(tm.Minute / 10, 3 * 32, 17);
	myGLCD.printNumI(tm.Minute % 10, 4 * 32, 17);

	myGLCD.print(weekdayName[tm.Wday], 6 * 32, 17);

	myGLCD.printNumI(tm.Day / 10, 14 * 32, 17);
	myGLCD.printNumI(tm.Day % 10, 15 * 32, 17);
	myGLCD.print(monthName[tm.Month-1], 17 * 32, 17);
	myGLCD.print("20", 21 * 32, 17);
	myGLCD.printNumI(tm.Year, 23 * 32, 17);
}

void	DisplayNoon()
{
	myGLCD.setFont(BigFont);
	myGLCD.print("NOON", 34 * BigW, 4 * GrotH + 5 * BigH);
}

void	DisplayFailedClockRead()
{
	myGLCD.setFont(BigFont);
	myGLCD.print("Failed clock read in loop", 38 * BigW, 3 * GrotH + 2 * BigH);
}

void DisplayHeaders()
{
	myGLCD.setFont(BigFont);
	myGLCD.print("Klockan", 0, 0);
	myGLCD.print("Veckodag", 6 * 32, 0);
	myGLCD.print("Datum", 14 * 32, 0);
	myGLCD.print("Termometrar", 0, 16 + 64 + 1);
	myGLCD.print("Max", 12 * GrotW, 16 + 64 + 1);
	myGLCD.print("Min", 19 * GrotW, 16 + 64 + 1);
	
	myGLCD.print("Systemstart ", 26 * BigW, 480 - 16);
	myGLCD.print("Senaste data ", 0, 480 - 16);
	myGLCD.print("Max och min temperaturer infoll",0 , 3 * GrotH + 2 * BigH);
	myGLCD.print("Max inomhus temperatur kl: ", 0, 3 * GrotH + 3 * BigH);
	myGLCD.print("Min inomhus temperatur kl: ", 0, 3 * GrotH + 4 * BigH);
	myGLCD.print("Max utomhus temperatur kl: ", 0, 3 * GrotH + 5 * BigH);
	myGLCD.print("Min utomhus temperatur kl: ", 0, 3 * GrotH + 6 * BigH);
	myGLCD.print("Ute manad lagsta", 34 * BigW , 3 * GrotH + 2 * BigH);
	myGLCD.print("Den ", 34 * BigW, 4 * GrotH + 3 * BigH);
	myGLCD.print("Barometer", 8 * GrotW, 4 * GrotH + 3 * BigH);
	myGLCD.print("Hygrometer", 0, 4 * GrotH + 3 * BigH);
	
	myGLCD.setFont(Grotesk32x64);
	myGLCD.print("Inne=", 0, 16 + 64 + 16);
	myGLCD.print("Ute =", 0, 16 + 2 * 64 + 16);
	myGLCD.print("Bar=", 8 * GrotW, 4 * GrotH + 4 * BigH);
	myGLCD.print("RH =", 0, 4 * GrotH + 4 * BigH);

}

void	Displaytimesaving(byte timesetting)
{
	myGLCD.setFont(BigFont);
	if		(timesetting == SNT)
			myGLCD.print("Normal Tid", 17 * 32, 0);
	else if (timesetting == SST)
			myGLCD.print("Sommar Tid", 17 * 32, 0);
	else
			myGLCD.print("FEL DST", 17 * 32, 0);
}

void	DisplayData()
{
	if (Tout < 0.0 && !Frost)
	{
		Frost = true;
		if (tm.Hour >= 0x00 && tm.Hour <= 0x09)
		{
			myGLCD.fillScr(0, 0, 68);
			myGLCD.setColor(228, 0, 0);					//Darker blue during night
			myGLCD.setBackColor(0, 0, 68);
		}
		else
		{
			myGLCD.fillScr(0, 0, 228);
			myGLCD.setColor(255, 255, 0);
			myGLCD.setBackColor(0, 0, 228);
		}
		DisplayHeaders();
		DisplayStoredSystemStart();
		DisplayLastDataRecTime();
		maxminupdate = all;
		DisplayMaxMinTimes();
		DisplayMonthMin();
		DisplaymonthminTime();
	}
	else if (Tout >= 0.0 && Frost)
	{
		Frost = false;
		if		( tm.Hour >= 0x00 && tm.Hour <= 0x09 )
				SetNightMode();
		else if (tm.Hour >= 0x09 && tm.Hour < 12)
				SetNoonMode();
		else 
				SetDayMode();
	}
	myGLCD.setFont(Grotesk32x64);
	if (ValidData)
	{
		myGLCD.print(tempI, 6 * GrotW, 16 + 64 + 16);
		myGLCD.print(tempO, 5 * GrotW, 16 + 2 * 64 + 16);
		myGLCD.print(barostr, 12 * GrotW , 4 * GrotH + 4 * BigH);
		myGLCD.print(hygroRHstr, 4 * GrotW, 4 * GrotH + 4 * BigH);
		DisplayMonthMin();
		DisplaymonthminTime();
	}
}

void	DisplayMaxMin()
{
	char	str[6] = { '\0}' };

	myGLCD.setFont(Grotesk32x64);
	dtostrf(T_inmax, 4, 1,str);
	myGLCD.print(str, 12 * GrotW, 1 * GrotH + 2 * BigH);
	dtostrf(T_inmin, 4, 1, str);
	myGLCD.print(str, 19 * GrotW, 1 * GrotH + 2 * BigH);
	dtostrf(T_outmax, 5, 1, str);								//5 vid fall T under 10 minus då behövs 5 tecken
	myGLCD.print(str, 11 * GrotW, 2 * GrotH + 2 * BigH);
	dtostrf(T_outmin, 5, 1, str);
	myGLCD.print(str, 18 * GrotW, 2 * GrotH + 2 * BigH);
	DisplayMonthMin();
}

void	DisplayMaxMinTimes()
{
	char	str[6] = { '\0}' };

	myGLCD.setFont(BigFont);

	switch (maxminupdate)
	{
	case inmax:
		DisplayInMax();
		break;
	case inmin:
		DisplayInMin();
		break;
	case outmax:
		DisplayOutMax();
		break;
	case outmin:
		DisplayOutMin();
		break;
	case all:
		DisplayInMax();
		DisplayInMin();
		DisplayOutMax();
		DisplayOutMin();
		break;
	default:
		Serial.println("Error inget fall av max min update i funktion");
	}
}

void DisplayMonthMin()
{
	char	str[6] = { '\0}' };

	myGLCD.setFont(Grotesk32x64);
	dtostrf(T_monthmin, 5, 1, str);
	myGLCD.print(str, 18 * GrotW, 3 * GrotH + 3 * BigH);
}

void DisplaymonthminTime()
{
	myGLCD.setFont(BigFont);
	myGLCD.printNumI(datemonthmin, 17 * GrotW + 4 * BigW, 4 * GrotH + 3 * BigH);
	myGLCD.printNumI(hourmonthmin / 10, 17 * GrotW + 7 * BigW, 4 * GrotH + 3 * BigH);
	myGLCD.printNumI(hourmonthmin % 10, 17 * GrotW + 8 * BigW, 4 * GrotH + 3 * BigH);
	myGLCD.print(":", 17 * GrotW + 9 * BigW, 4 * GrotH + 3 * BigH);
	myGLCD.printNumI(minmonthmin / 10, 17 * GrotW + 10 * BigW, 4 * GrotH + 3 * BigH);
	myGLCD.printNumI(minmonthmin % 10, 17 * GrotW + 11 * BigW, 4 * GrotH + 3 * BigH);
}

void DisplayInMax()
{
	myGLCD.printNumI(hourMaxIn / 10, 28 * BigW, 3 * GrotH + 3 * BigH);
	myGLCD.printNumI(hourMaxIn % 10, 29 * BigW, 3 * GrotH + 3 * BigH);
	myGLCD.print(":", 30 * BigW, 3 * GrotH + 3 * BigH);
	myGLCD.printNumI(minMaxIn / 10, 31 * BigW, 3 * GrotH + 3 * BigH);
	myGLCD.printNumI(minMaxIn % 10, 32 * BigW, 3 * GrotH + 3 * BigH);

}

void DisplayInMin()
{
	myGLCD.printNumI(hourMinIn / 10, 28* BigW, 3 * GrotH + 4 * BigH);
	myGLCD.printNumI(hourMinIn % 10, 29 * BigW, 3 * GrotH + 4 * BigH);
	myGLCD.print(":", 30 * BigW, 3 * GrotH + 4 * BigH);
	myGLCD.printNumI(minMinIn / 10, 31 * BigW, 3 * GrotH + 4 * BigH);
	myGLCD.printNumI(minMinIn % 10, 32 * BigW, 3 * GrotH + 4 * BigH);

}

void DisplayOutMax()
{
	myGLCD.printNumI(hourMaxOut / 10, 28 * BigW, 3 * GrotH + 5 * BigH);
	myGLCD.printNumI(hourMaxOut % 10, 29 * BigW, 3 * GrotH + 5 * BigH);
	myGLCD.print(":", 30 * BigW, 3 * GrotH + 5 * BigH);
	myGLCD.printNumI(minMaxOut / 10, 31 * BigW, 3 * GrotH + 5 * BigH);
	myGLCD.printNumI(minMaxOut % 10, 32 * BigW, 3 * GrotH + 5 * BigH);
}

void DisplayOutMin()
{
	myGLCD.setFont(BigFont);
	myGLCD.printNumI(hourMinOut / 10, 28 * BigW, 3 * GrotH + 6 * BigH);
	myGLCD.printNumI(hourMinOut % 10, 29 * BigW, 3 * GrotH + 6 * BigH);
	myGLCD.print(":", 30 * BigW, 3 * GrotH + 6 * BigH);
	myGLCD.printNumI(minMinOut / 10, 31 * BigW, 3 * GrotH + 6 * BigH);
	myGLCD.printNumI(minMinOut % 10, 32 * BigW, 3 * GrotH + 6 * BigH);
}

void	DisplayLastDataRecTime()
{
	myGLCD.setFont(BigFont);
	myGLCD.printNumI(tm.Day / 10, 13 * 16, 480 - 16);
	myGLCD.printNumI(tm.Day % 10, 14 * 16, 480 - 16);
	myGLCD.print("/", 15 * 16, 480 - 16);

	myGLCD.printNumI(tm.Month / 10, 16 * 16, 480 - 16);
	myGLCD.printNumI(tm.Month % 10, 17 * 16, 480 - 16);
	myGLCD.print(" ", 18 * 16, 480 - 16);
	myGLCD.printNumI(tm.Hour / 10, 19 * 16, 480 - 16);
	myGLCD.printNumI(tm.Hour % 10, 20 * 16, 480 - 16);
	myGLCD.print(":", 21 * 16, 480 - 16);
	myGLCD.printNumI(tm.Minute / 10, 22 * 16, 480 - 16);
	myGLCD.printNumI(tm.Minute % 10, 23 * 16, 480 - 16);
}

void DisplayStoredSystemStart()
{
	myGLCD.setFont(BigFont);
	myGLCD.printNumI(systemstart.Day / 10, 38 * BigW, 480 - 16);
	myGLCD.printNumI(systemstart.Day % 10, 39 * BigW, 480 - 16);
	myGLCD.print("/", 40 * BigW, 480 - 16);
	myGLCD.printNumI(systemstart.Month / 10, 41 * BigW, 480 - 16);
	myGLCD.printNumI(systemstart.Month % 10, 42 * BigW, 480 - 16);
	myGLCD.print(" ", 43 * BigW, 480 - 16);
	myGLCD.printNumI(systemstart.Hour / 10, 44 * BigW, 480 - 16);
	myGLCD.printNumI(systemstart.Hour % 10, 45 * BigW, 480 - 16);
	myGLCD.print(":", 46 * BigW, 480 - 16);
	myGLCD.printNumI(systemstart.Minute / 10, 47 * BigW, 480 - 16);
	myGLCD.printNumI(systemstart.Minute % 10, 48 * BigW, 480 - 16);
}

void DisplayPrevTime(uint8_t Second, uint8_t Minute, uint8_t Hour, uint8_t Wday, uint8_t Day, uint8_t Month, uint8_t Year)
{
	myGLCD.setFont(BigFont);
	myGLCD.print("Current reading time", 34 * BigW, 3 * GrotH + 2 * BigH);
	myGLCD.print("Time        =", 34 * BigW, 3 * GrotH + 3 * BigH);
	myGLCD.print("Week Day=", 34 * BigW, 3 * GrotH + 4 * BigH);
	myGLCD.print("Date    =", 34 * BigW, 3 * GrotH + 5 * BigH);
	myGLCD.print("Month   =", 34 * BigW, 3 * GrotH + 6 * BigH);
	myGLCD.print("Year    =", 34 * BigW, 3 * GrotH + 7 * BigH);

	myGLCD.printNumI(Hour / 10, 43 * BigW, 3 * GrotH + 3 * BigH);
	myGLCD.printNumI(Hour % 10, 44 * BigW, 3 * GrotH + 3 * BigH);
	myGLCD.print(":", 45 * BigW, 3 * GrotH + 3 * BigH);
	myGLCD.printNumI(Minute / 10,46 * BigW, 3 * GrotH + 3 * BigH);
	myGLCD.printNumI(Minute % 10,47 * BigW, 3 * GrotH + 3 * BigH);

	myGLCD.print(weekdayName[Wday], 43 * BigW, 3 * GrotH + 4 * BigH);

	myGLCD.printNumI(Day / 10, 43 * BigW, 3 * GrotH + 5 * BigH);
	myGLCD.printNumI(Day % 10, 44 * BigW, 3 * GrotH + 5 * BigH);
	myGLCD.print(monthName[Month - 1], 43 * BigW, 3 * GrotH + 6 * BigH);
	myGLCD.print("20", 43 * BigW, 3 * GrotH + 7 * BigH);
	myGLCD.printNumI(Year, 45 * BigW, 3 * GrotH + 7 * BigH);

}

void	SetDayMode()
{
	if (Frost)
	{
		myGLCD.fillScr(0, 0, 228);
		myGLCD.setColor(255, 255, 0);
		myGLCD.setBackColor(0, 0, 228);
	}
	else
	{
		myGLCD.fillScr(225, 225, 225);
		myGLCD.setColor(0, 0, 0);
		myGLCD.setBackColor(225, 225, 225);
	}
	DisplayHeaders();								//Display header text fields on TFT
	DisplayStoredSystemStart();
	DisplayLastDataRecTime();
	maxminupdate = all;
	DisplayMaxMinTimes();
}

void	SetNoonMode()
{
	if (Frost)
	{
		myGLCD.fillScr(0, 0, 238);
		myGLCD.setColor(0, 0, 0);
		myGLCD.setBackColor(0, 0, 238);
	}
	else
	{
		DisplayNoon();
		myGLCD.fillScr(128, 128, 128);
		myGLCD.setColor(0, 0, 0);
		myGLCD.setBackColor(128, 128, 128);
	}
	DisplayHeaders();								//Display header text fields on TFT
	DisplayStoredSystemStart();
	DisplayLastDataRecTime();
	maxminupdate = all;
	DisplayMaxMinTimes();
}

void	SetLateNightMode()
{
	hour_now = tm.Hour;

	if (Frost)
	{
		myGLCD.fillScr(0, 0, 64);
		myGLCD.setColor(168, 44, 0);				//Darker blue during night
		myGLCD.setBackColor(0, 0, 64);
	}
	else
	{
		myGLCD.fillScr(0, 0, 0);
		myGLCD.setColor(196, 0, 0);
		myGLCD.setBackColor(0, 0, 0);
	}
	DisplayHeaders();								//Display header text fields on TFT	
	DisplayStoredSystemStart();
	DisplayLastDataRecTime();
	DisplayMaxMinTimes();
}

void	SetNightMode()
{
	hour_now = tm.Hour;
	
	if (Frost)
	{
		myGLCD.fillScr(0, 0, 64);
		myGLCD.setColor(168, 168, 0);				//Darker blue during night
		myGLCD.setBackColor(0, 0, 64);
	}
	else
	{
		myGLCD.fillScr(0, 0, 0);
		myGLCD.setColor(148, 148, 0);
		myGLCD.setBackColor(0, 0, 0);
	}
	DisplayHeaders();								//Display header text fields on TFT	
	DisplayStoredSystemStart();
	DisplayLastDataRecTime();
	maxminupdate = all;
	DisplayMaxMinTimes();
}

void	SetCompilerTime()
{
	myGLCD.setFont(BigFont);

	myGLCD.print("Compiler Set", 26 * BigW, 480 - 32);
	myGLCD.printNumI(tm.Hour / 10, 44 * BigW, 480 - 32);
	myGLCD.printNumI(tm.Hour % 10, 45 * BigW, 480 - 32);
	myGLCD.print(":", 46 * BigW, 480 - 32);
	myGLCD.printNumI(tm.Minute / 10, 47 * BigW, 480 - 32);
	myGLCD.printNumI(tm.Minute % 10, 48 * BigW, 480 - 32);
}

void	DisplayDataSetup()
{
	myGLCD.setFont(BigFont);

	myGLCD.print("Valid Data during Setup", 26 * BigW, 480 - 32);
}

void	DisplayDataLoop()
{
	myGLCD.setFont(Grotesk32x64);

	myGLCD.print("Valid Data in loop", 0, 4 * GrotH + 8 * BigH);
}

void	DisplayNoDataLoop()
{
	myGLCD.setFont(Grotesk32x64);

	myGLCD.print("Error dataread    ", 0, 4 * GrotH + 8 * BigH);
	DisplayDataErrorCode();
}

void	DisplayDataErrorCode()
{
	myGLCD.setFont(BigFont);
	Serial.print("errcode=");
	Serial.println(errcode);
	myGLCD.print(Readercode[errcode], 0, 5 * GrotH + 8 * BigH);
	DisplayFailedstring();
}

void	DisplayFailedstring()
{
	myGLCD.print("                                                                          ", 5, 5 * GrotH + 8 * BigH);		//Clear old string
	myGLCD.print(datastr, 5 , 5 * GrotH + 8 * BigH);

	Serial.print("Failed str=");
	for (int i = 0; i < 36; i++)
	{
		Serial.print(datastr[i]);
	}
	Serial.println();
}

void	DisplayInTempError()
{
		myGLCD.setFont(Grotesk32x64);
		myGLCD.print("ERR", 12 * GrotW, 1 * GrotH + 2 * BigH);
}

void	DisplayClock45Error()
{
		myGLCD.setFont(BigFont);
		myGLCD.print("Error Clock 45          ", 36 * BigW, 480 - 5 * BigH);
}

void	DisplayCorrected45Error()
{
	myGLCD.setFont(BigFont);
	myGLCD.print("Clock Error Corrected", 36 * BigW, 480 - 5 * BigH);
}

void	DisplayNoDataSetup()
{
	myGLCD.setFont(BigFont);

	myGLCD.print("No Data Setup", 37 * BigW, 480 - 48);
	DisplayDataErrorCode();
}

void	DisplayValuesLines()
{
	myGLCD.setFont(Grotesk32x64);
	myGLCD.print(" -- ", 6 * GrotW, 16 + 64 + 16);
	myGLCD.print(" -- ", 5 * GrotW, 16 + 2 * 64 + 16);
	myGLCD.print("---", 12 * GrotW, 4 * GrotH + 4 * BigH);
	myGLCD.print("--", 4 * GrotW, 4 * GrotH + 4 * BigH);
}

void	InitTFTDisplay()
{
	myGLCD.InitLCD(LANDSCAPE);
	myGLCD.clrScr();
	myGLCD.fillScr(255, 255, 255);
	myGLCD.setBackColor(255, 255, 255);
	myGLCD.setColor(0, 0, 0);
}

Does the pinout of the old tft match the pinout of the new tft?

Yes

How is a black background called? Maybe the name color was re-defined or the background color was redefined.

I didn’t used name but numbers all three (R,G,B) zero

If you have black text, you do not want black background.

Background color is set to gray in setNoonMode() [edit] so I am guessing your program thinks it is noon for the duration of the gray screen [/edit]

I don’t have black text when the background is black.

And it’s actually the opposite my program does not think it is noon anytime even when it is supposed to be. I am trying to figure out what is the problem.

The background color in the setNoonMode() is the only place in your sketch "gray" is used (myGLCD.setBackColor(128, 128, 128);). Try putting primary colors in all the setBackColor() calls to find where the program gets the background color, and force the clock to show each background change.

Did you see text on this screen, or just the gray background? Try other pins (on the board and in the programs). Did you try another Due?

I have tried this code which results in the grey screen

myGLCD.fillScr(0, 0, 0);
myGLCD.setBackColor(0, 0, 0);