Clock:how do I replace 2 buttons with 2x touch screen buttons?

I think I know where the issue lies:

      Serial.println("Pin");
      hour   = edit(5, 0, hour);
      Serial.println("Pin1");
      minute = edit(8, 0, minute);
      date   = edit(5, 1, date);
      month  = edit(8, 1, month);
      year   = edit(13, 1, year);

Am I correct if I say that edit(5,0,hour) is the location on the LCD? If so, how can I change that so the program knows what/where to flicker?

/*clock2B_changed
  Original:
  https://simple-circuit.com/arduino-ds3231-real-time-clock-button/
  25 Nov 2018
  edited for use with ADAFRUIT TFT ILI9431,8bit 240x320 & DUE
  2 x Touch screen buttons.
*/
#include  <Adafruit_GFX.h>
#include <Wire.h>
#include "Sodaq_DS3231.h"
#include  <SPI.h>
#include  <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;
#include <avr/dtostrf.h>
#include<TouchScreen.h>
#include<Fonts/FreeMonoBold9pt7b.h>

#define LCD_CS A3 // Chip Select goes to Analog 3
#define LCD_CD A2 // Command/Data goes to Analog 2
#define LCD_WR A1 // LCD Write goes to Analog 1
#define LCD_RD A0 // LCD Read goes to Analog 0
#define LCD_RESET RESET // Can alternately just connect to Arduino's reset pin

//T.S allignment
#define TS_MINX 40
#define TS_MINY 40
#define TS_MAXX 1000
#define TS_MAXY 1000
//Touch
#define YM 10
#define XM A4
#define YP A5
#define XP 11

//Color Definitons
#define BLACK     0x0000
#define BLUE      0x001F
#define GREY      0xCE79
#define LIGHTGREY 0xDEDB
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF
#define MINPRESSURE 100
#define MAXPRESSURE 1000
//                          (11, A5, A4, 10  ,RESISTANCE)
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 365);
int X, Y, Z;

int upButt;
int enterButt;

//define DS3231 address
//SDA=20  SCL=21 I2C Ard_DUE
#define DS3231_I2C_ADDRESS 0x68


void setup() {
  Serial.begin(9600);
  tft.reset();
  uint16_t identifier = tft.readID();
  tft.begin(identifier);
  tft.setRotation (1);
  tft.fillScreen(BLACK);
  Wire.begin();
  rtc.begin();
  Graphics();
  DS3231_display();
}

char Time[]     = "TIME:  :  :  ";
char Calendar[] = "DATE:  /  /20  ";
byte i, second, minute, hour, date, month, year;

void DS3231_display() {
  // Convert BCD to decimal
  second = (second >> 4) * 10 + (second & 0x0F);
  minute = (minute >> 4) * 10 + (minute & 0x0F);
  hour   = (hour >> 4)   * 10 + (hour & 0x0F);
  date   = (date >> 4)   * 10 + (date & 0x0F);
  month  = (month >> 4)  * 10 + (month & 0x0F);
  year   = (year >> 4)   * 10 + (year & 0x0F);
  // End conversion
  Time[12]     = second % 10 + 48;
  Time[11]     = second / 10 + 48;
  Time[9]      = minute % 10 + 48;
  Time[8]      = minute / 10 + 48;
  Time[6]      = hour   % 10 + 48;
  Time[5]      = hour   / 10 + 48;
  Calendar[14] = year   % 10 + 48;
  Calendar[13] = year   / 10 + 48;
  Calendar[9]  = month  % 10 + 48;
  Calendar[8]  = month  / 10 + 48;
  Calendar[6]  = date   % 10 + 48;
  Calendar[5]  = date   / 10 + 48;
  tft.setTextColor(WHITE);            //Time & Calendar
  tft.setFont (&FreeMonoBold9pt7b);   //set new font
  tft.setTextSize(1);
  //L TOP W H  COLOR
  tft.fillRect(7, 2, 175, 20, BLACK); // erase prevTime
  tft.setCursor(15, 15);
  tft.fillRect(7, 75, 175, 20, BLACK); // erase old date
  tft.print(Time);                    // Display time
  tft.setCursor(15, 90);
  tft.print(Calendar);                // Display calendar
}  //end void


void blink_parameter() {

  TSPoint p = ts.getPoint();
  if (p.z > ts.pressureThreshhold) {

    X = 320 - map(p.y, TS_MAXX, TS_MINX, 0, 320 );
    Y = map(p.x, TS_MAXY, TS_MINY, 0, 240);
    Z = p.z;
    if (X > 88 && X < 163 && Y > 160 && Y < 190) {
    //upButtPin;
    Serial.println("upButtPin");
    byte j = 0;
      while (j < 10 ) {
        j++;
        delay(25);

      }
    }//if (enterButt
  }//if (p.z
}// end blink_parameter()

byte edit(byte x, byte y, byte parameter) {

  char text[3];
  while (X > 3 && X < 78 && Y > 160 && Y < 190);       // Wait until enterButtPin released
  while (true) {
    while (X > 88 && X < 163 && Y > 160 && Y < 190) {      // If upButtPin is pressed
      parameter++;
      if (i == 0 && parameter > 23)   // If hours > 23 ==> hours = 0
        parameter = 0;
      if (i == 1 && parameter > 59)   // If minutes > 59 ==> minutes = 0
        parameter = 0;
      if (i == 2 && parameter > 31)   // If date > 31 ==> date = 1
        parameter = 1;
      if (i == 3 && parameter > 12)   // If month > 12 ==> month = 1
        parameter = 1;
      if (i == 4 && parameter > 99)   // If year > 99 ==> year = 0
        parameter = 0;
      sprintf(text, "%02u", parameter);
      tft.setCursor(x, y);
      tft.print(text);
      delay(200);                 // Wait 200ms
    }
    tft.setCursor(x, y);
    tft.print("  ");              // Display two spaces
    blink_parameter();
    sprintf(text, "%02u", parameter);
    tft.setCursor(x, y);
    tft.print(text);
    blink_parameter();

    if (X > 3 && X < 78 && Y > 160 && Y < 190) {      // If button (enterButtPin) is pressed
      i++;                        // Increament 'i' for the next parameter
      return parameter;           // Return parameter value and exit
    }
  }
}//byte edit(byte

void loop() {

  TSPoint p = ts.getPoint();
  if (p.z > ts.pressureThreshhold) {

    X = 320 - map(p.y, TS_MAXX, TS_MINX, 0, 320 );
    Y = map(p.x, TS_MAXY, TS_MINY, 0, 240);
    Z = p.z;

    if (X > 3 && X < 78 && Y > 160 && Y < 190) {
      // If (enterButtPin) is released
      i = 0;
      Serial.println("Pin");
      hour   = edit(5, 0, hour);
      Serial.println("Pin1");
      minute = edit(8, 0, minute);
      date   = edit(5, 1, date);
      month  = edit(8, 1, month);
      year   = edit(13, 1, year);
      // Convert decimal to BCD
      minute = ((minute / 10) << 4) + (minute % 10);
      hour = ((hour / 10) << 4) + (hour % 10);
      date = ((date / 10) << 4) + (date % 10);
      month = ((month / 10) << 4) + (month % 10);
      year = ((year / 10) << 4) + (year % 10);
      // End conversion
      // Write data to DS3231 RTC
      Wire.beginTransmission(0x68);  // Start I2C protocol with DS3231 address
      Wire.write(0);                 // Send register address
      Wire.write(0);                 // Reset sesonds and start oscillator
      Wire.write(minute);            // Write minute
      Wire.write(hour);              // Write hour
      Wire.write(1);                 // Write day (not used)
      Wire.write(date);              // Write date
      Wire.write(month);             // Write month
      Wire.write(year);              // Write year
      Wire.endTransmission();        // Stop transmission and release the I2C bus
      delay(200);                    // Wait 200ms
    }//end (!enterButton

    Wire.beginTransmission(0x68);    // Start I2C protocol with DS3231 address
    Wire.write(0);                   // Send register address
    Wire.endTransmission(false);     // I2C restart
    Wire.requestFrom(0x68, 7);       // Request 7 bytes from DS3231 and
    //release I2C bus at end of reading
    second = Wire.read();            // Read seconds from register 0
    minute = Wire.read();            // Read minuts from register 1
    hour   = Wire.read();            // Read hour from register 2
    Wire.read();                     // Read day from register 3 (not used)
    date   = Wire.read();            // Read date from register 4
    month  = Wire.read();            // Read month from register 5
    year   = Wire.read();            // Read year from register 6
    DS3231_display();                // Diaplay time & calendar
    delay(50);                       // Wait 50ms
  }//
}//end loop

void Graphics()
{
  tft.setFont(&FreeMonoBold9pt7b);  //set new font
  tft.setTextColor(WHITE);
  tft.setTextSize(1);
  tft.drawRect(3, 170, 75, 35, WHITE); //enterButtPin
  tft.setCursor(10, 195);
  tft.print("Enter");
  tft.drawRect(88, 170, 75, 35, WHITE); //upButtPin
  tft.setCursor(115, 195);
  tft.print("Up");
}

With the above version I get Serial.println("Pin"); to print. Thanks in advance

Oh that is great, I have to tell you that reading your code is not so easy. probably not just for me. Making smaller function where for instance all calls to 'wire' are done and where the increase of the clock variables are done, which can be called from the main loop or the button press loop would create better overview. in the end your loop() function may not be much more then just 5-10 lines
Also declaring all global variables before Setup() {} at the start of the program helps, for "me" to read it. atm all i can do is pick out any obvious mistakes.

/*clock2B_changed
 * NOT WORKING YET
  Original:
  https://simple-circuit.com/arduino-ds3231-real-time-clock-button/
  25 Nov 2018
  edited for use with ADAFRUIT 2.8" TFT ILI9431,8bit 240x320 & DUE
  2 x Touch screen buttons.
*/
#include  <Adafruit_GFX.h>
#include <Wire.h>
#include "Sodaq_DS3231.h"
#include  <SPI.h>
#include  <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;
#include <avr/dtostrf.h>
#include<TouchScreen.h>
//#include<Fonts/FreeMonoBold9pt7b.h>

#define LCD_CS A3 // Chip Select goes to Analog 3
#define LCD_CD A2 // Command/Data goes to Analog 2
#define LCD_WR A1 // LCD Write goes to Analog 1
#define LCD_RD A0 // LCD Read goes to Analog 0
#define LCD_RESET RESET // Can alternately just connect to Arduino's reset pin

//T.S allignment
#define TS_MINX 40
#define TS_MINY 40
#define TS_MAXX 1000
#define TS_MAXY 1000
//Touch
#define YM 10
#define XM A4
#define YP A5
#define XP 11

//Color Definitons
#define BLACK     0x0000
#define BLUE      0x001F
#define GREY      0xCE79
#define LIGHTGREY 0xDEDB
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF
#define MINPRESSURE 100
#define MAXPRESSURE 1000
//                          (11, A5, A4, 10  ,RESISTANCE)
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 365);
int X, Y, Z;

int upButt;
int enterButt;

//define DS3231 address
//SDA=20  SCL=21 I2C Ard_DUE
#define DS3231_I2C_ADDRESS 0x68


void setup() {
  Serial.begin(9600);
  tft.reset();
  uint16_t identifier = tft.readID();
  tft.begin(identifier);
  tft.setRotation (1);
  tft.fillScreen(BLACK);
  Wire.begin();
  rtc.begin();
  Graphics();
  DS3231_display();
}

char Time[]     = "TIME:  :  :  ";
char Calendar[] = "DATE:  /  /20  ";
byte i, second, minute, hour, date, month, year;

void DS3231_display() {
  // Convert BCD to decimal
  second = (second >> 4) * 10 + (second & 0x0F);
  minute = (minute >> 4) * 10 + (minute & 0x0F);
  hour   = (hour >> 4)   * 10 + (hour & 0x0F);
  date   = (date >> 4)   * 10 + (date & 0x0F);
  month  = (month >> 4)  * 10 + (month & 0x0F);
  year   = (year >> 4)   * 10 + (year & 0x0F);
  // End conversion
  Time[12]     = second % 10 + 48;
  Time[11]     = second / 10 + 48;
  Time[9]      = minute % 10 + 48;
  Time[8]      = minute / 10 + 48;
  Time[6]      = hour   % 10 + 48;
  Time[5]      = hour   / 10 + 48;
  Calendar[14] = year   % 10 + 48;
  Calendar[13] = year   / 10 + 48;
  Calendar[9]  = month  % 10 + 48;
  Calendar[8]  = month  / 10 + 48;
  Calendar[6]  = date   % 10 + 48;
  Calendar[5]  = date   / 10 + 48;
  tft.setTextColor(WHITE);            //Time & Calendar
  //tft.setFont (&FreeMonoBold9pt7b);   //set new font
  tft.setTextSize(2);
  //L TOP W H  COLOR
  tft.fillRect(7, 2, 175, 20, BLACK); // erase prevTime
  tft.setCursor(15, 15);
  tft.fillRect(7, 75, 175, 20, BLACK); // erase old date
  tft.print(Time);                    // Display time
  tft.setCursor(15, 90);
  tft.print(Calendar);                // Display calendar
}  //end void


void blink_parameter() {
Serial.println("upButtPin");
  TSPoint p = ts.getPoint();
  if (p.z > ts.pressureThreshhold) {

    X = 320 - map(p.y, TS_MAXX, TS_MINX, 0, 320 );
    Y = map(p.x, TS_MAXY, TS_MINY, 0, 240);
    Z = p.z;
    if (X > 88 && X < 163 && Y > 160 && Y < 190) {
    //upButtPin;
    
    byte j = 0;
      while (j < 10 ) {
        j++;
        delay(25);

      }
    }//if (enterButt
  }//if (p.z
}// end blink_parameter()

byte edit(byte x, byte y, byte parameter) {

  char text[3];
  while (X > 3 && X < 78 && Y > 160 && Y < 190);       // Wait until enterButtPin released
  while (true) {
    while (X > 88 && X < 163 && Y > 160 && Y < 190) {      // If upButtPin is pressed
      parameter++;
      if (i == 0 && parameter > 23)   // If hours > 23 ==> hours = 0
        parameter = 0;
      if (i == 1 && parameter > 59)   // If minutes > 59 ==> minutes = 0
        parameter = 0;
      if (i == 2 && parameter > 31)   // If date > 31 ==> date = 1
        parameter = 1;
      if (i == 3 && parameter > 12)   // If month > 12 ==> month = 1
        parameter = 1;
      if (i == 4 && parameter > 99)   // If year > 99 ==> year = 0
        parameter = 0;
      sprintf(text, "%02u", parameter);
      tft.setCursor(x, y);
      tft.print(text);
      delay(200);                 // Wait 200ms
    }
    tft.setCursor(x, y);
    tft.print("  ");              // Display two spaces
    blink_parameter();
    sprintf(text, "%02u", parameter);
    tft.setCursor(x, y);
    tft.print(text);
    blink_parameter();

    if (X > 3 && X < 78 && Y > 160 && Y < 190) {      // If button (enterButtPin) is pressed
      i++;                        // Increament 'i' for the next parameter
      return parameter;           // Return parameter value and exit
    }
  }
}//byte edit(byte

void loop() {

  TSPoint p = ts.getPoint();
  if (p.z > ts.pressureThreshhold) {

    X = 320 - map(p.y, TS_MAXX, TS_MINX, 0, 320 );
    Y = map(p.x, TS_MAXY, TS_MINY, 0, 240);
    Z = p.z;

    if (X > 3 && X < 78 && Y > 160 && Y < 190) {
      // If (enterButtPin) is released
      i = 0;
      Serial.println("Pin");
      hour   = edit(75,15, hour);
      Serial.println("Pin1");
      minute = edit(111, 15, minute);
      date   = edit(75, 90, date);
      month  = edit(111, 90, month);
     
      year   = edit(160, 90, year);//not correct yet
      // Convert decimal to BCD
      minute = ((minute / 10) << 4) + (minute % 10);
      hour = ((hour / 10) << 4) + (hour % 10);
      date = ((date / 10) << 4) + (date % 10);
      month = ((month / 10) << 4) + (month % 10);
      year = ((year / 10) << 4) + (year % 10);
      // End conversion
      // Write data to DS3231 RTC
      Wire.beginTransmission(0x68);  // Start I2C protocol with DS3231 address
      Wire.write(0);                 // Send register address
      Wire.write(0);                 // Reset sesonds and start oscillator
      Wire.write(minute);            // Write minute
      Wire.write(hour);              // Write hour
      Wire.write(1);                 // Write day (not used)
      Wire.write(date);              // Write date
      Wire.write(month);             // Write month
      Wire.write(year);              // Write year
      Wire.endTransmission();        // Stop transmission and release the I2C bus
      delay(200);                    // Wait 200ms
    }//end (!enterButton

    Wire.beginTransmission(0x68);    // Start I2C protocol with DS3231 address
    Wire.write(0);                   // Send register address
    Wire.endTransmission(false);     // I2C restart
    Wire.requestFrom(0x68, 7);       // Request 7 bytes from DS3231 and
    //release I2C bus at end of reading
    second = Wire.read();            // Read seconds from register 0
    minute = Wire.read();            // Read minuts from register 1
    hour   = Wire.read();            // Read hour from register 2
    Wire.read();                     // Read day from register 3 (not used)
    date   = Wire.read();            // Read date from register 4
    month  = Wire.read();            // Read month from register 5
    year   = Wire.read();            // Read year from register 6
    DS3231_display();                // Diaplay time & calendar
    delay(50);                       // Wait 50ms
  }//
}//end loop

void Graphics()
{
  //tft.setFont(&FreeMonoBold9pt7b);  //set new font
  tft.setTextColor(WHITE);
  tft.setTextSize(2);
  tft.drawRect(3, 170, 75, 35, WHITE); //enterButtPin
  tft.setCursor(10, 185);
  tft.print("Enter");
  tft.drawRect(88, 170, 75, 35, WHITE); //upButtPin
  tft.setCursor(115, 185);
  tft.print("Up");
}

I changed the co-ordinates to suit the TFT. No luck. It is still not selecting the void blink_parameter()

That it doesn't work is not a big surprise. That you can't work out why is for a big part due to 'mess' in your program. That people don't really want to solve your problem i get, but since i started i should continue, so i put your code in my IDE, tried to compile, had to comment a few things out, but then it compiled, and then i started to see if i could figure out what was going on. For this i moved a few things around, i moved the loop() further up just below setup() moved the second set of global variables with the others at the start (before setup() ) created 2 functions to move all the code related to changing the variables and the communication with timer into them. Then i was left with this :

/*clock2B_changed
 * NOT WORKING YET
  Original:
  https://simple-circuit.com/arduino-ds3231-real-time-clock-button/
  25 Nov 2018
  edited for use with ADAFRUIT 2.8" TFT ILI9431,8bit 240x320 & DUE
  2 x Touch screen buttons.
*/
#include  <Adafruit_GFX.h>
#include <Wire.h>
//#include "Sodaq_DS3231.h"
#include  <SPI.h>
#include  <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;
//#include <avr/dtostrf.h>
#include<TouchScreen.h>
//#include<Fonts/FreeMonoBold9pt7b.h>

#define LCD_CS A3 // Chip Select goes to Analog 3
#define LCD_CD A2 // Command/Data goes to Analog 2
#define LCD_WR A1 // LCD Write goes to Analog 1
#define LCD_RD A0 // LCD Read goes to Analog 0
#define LCD_RESET RESET // Can alternately just connect to Arduino's reset pin

//T.S allignment
#define TS_MINX 40
#define TS_MINY 40
#define TS_MAXX 1000
#define TS_MAXY 1000
//Touch
#define YM 10
#define XM A4
#define YP A5
#define XP 11

//Color Definitons
#define BLACK     0x0000
#define BLUE      0x001F
#define GREY      0xCE79
#define LIGHTGREY 0xDEDB
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF
#define MINPRESSURE 100
#define MAXPRESSURE 1000
//                          (11, A5, A4, 10  ,RESISTANCE)
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 365);
int X, Y, Z;

int upButt;
int enterButt;

char Time[]     = "TIME:  :  :  ";
char Calendar[] = "DATE:  /  /20  ";
byte i, second, minute, hour, date, month, year;

//define DS3231 address
//SDA=20  SCL=21 I2C Ard_DUE
#define DS3231_I2C_ADDRESS 0x68


void setup() {
  Serial.begin(9600);
  tft.reset();
  uint16_t identifier = tft.readID();
  tft.begin(identifier);
  tft.setRotation (1);
  tft.fillScreen(BLACK);
  Wire.begin();
  //rtc.begin();
  Graphics();
  DS3231_display();
}


void loop() {

  TSPoint p = ts.getPoint();
  if (p.z > ts.pressureThreshhold) {

    X = 320 - map(p.y, TS_MAXX, TS_MINX, 0, 320 );
    Y = map(p.x, TS_MAXY, TS_MINY, 0, 240);
    Z = p.z;

    if (X > 3 && X < 78 && Y > 160 && Y < 190) NotEnterButton();

    DScomm();
    
    delay(50);                       // Wait 50ms
  }//
}//end loop



void DS3231_display() {
  // Convert BCD to decimal
  second = (second >> 4) * 10 + (second & 0x0F);
  minute = (minute >> 4) * 10 + (minute & 0x0F);
  hour   = (hour >> 4)   * 10 + (hour & 0x0F);
  date   = (date >> 4)   * 10 + (date & 0x0F);
  month  = (month >> 4)  * 10 + (month & 0x0F);
  year   = (year >> 4)   * 10 + (year & 0x0F);
  // End conversion
  Time[12]     = second % 10 + 48;
  Time[11]     = second / 10 + 48;
  Time[9]      = minute % 10 + 48;
  Time[8]      = minute / 10 + 48;
  Time[6]      = hour   % 10 + 48;
  Time[5]      = hour   / 10 + 48;
  Calendar[14] = year   % 10 + 48;
  Calendar[13] = year   / 10 + 48;
  Calendar[9]  = month  % 10 + 48;
  Calendar[8]  = month  / 10 + 48;
  Calendar[6]  = date   % 10 + 48;
  Calendar[5]  = date   / 10 + 48;
  tft.setTextColor(WHITE);            //Time & Calendar
  //tft.setFont (&FreeMonoBold9pt7b);   //set new font
  tft.setTextSize(2);
  //L TOP W H  COLOR
  tft.fillRect(7, 2, 175, 20, BLACK); // erase prevTime
  tft.setCursor(15, 15);
  tft.fillRect(7, 75, 175, 20, BLACK); // erase old date
  tft.print(Time);                    // Display time
  tft.setCursor(15, 90);
  tft.print(Calendar);                // Display calendar
}  //end void


void blink_parameter() {
Serial.println("upButtPin");
  TSPoint p = ts.getPoint();
  if (p.z > ts.pressureThreshhold) {

    X = 320 - map(p.y, TS_MAXX, TS_MINX, 0, 320 );
    Y = map(p.x, TS_MAXY, TS_MINY, 0, 240);
    Z = p.z;
    if (X > 88 && X < 163 && Y > 160 && Y < 190) {
    //upButtPin;
    
    byte j = 0;
      while (j < 10 ) {
        j++;
        delay(25);

      }
    }//if (enterButt
  }//if (p.z
}// end blink_parameter()

byte edit(byte x, byte y, byte parameter) {

  char text[3];
  while (X > 3 && X < 78 && Y > 160 && Y < 190);       // Wait until enterButtPin released
  while (true) {
    while (X > 88 && X < 163 && Y > 160 && Y < 190) {      // If upButtPin is pressed
      parameter++;
      if (i == 0 && parameter > 23)   // If hours > 23 ==> hours = 0
        parameter = 0;
      if (i == 1 && parameter > 59)   // If minutes > 59 ==> minutes = 0
        parameter = 0;
      if (i == 2 && parameter > 31)   // If date > 31 ==> date = 1
        parameter = 1;
      if (i == 3 && parameter > 12)   // If month > 12 ==> month = 1
        parameter = 1;
      if (i == 4 && parameter > 99)   // If year > 99 ==> year = 0
        parameter = 0;
      sprintf(text, "%02u", parameter);
      tft.setCursor(x, y);
      tft.print(text);
      delay(200);                 // Wait 200ms
    }
    tft.setCursor(x, y);
    tft.print("  ");              // Display two spaces
    blink_parameter();
    sprintf(text, "%02u", parameter);
    tft.setCursor(x, y);
    tft.print(text);
    blink_parameter();

    if (X > 3 && X < 78 && Y > 160 && Y < 190) {      // If button (enterButtPin) is pressed
      i++;                        // Increament 'i' for the next parameter
      return parameter;           // Return parameter value and exit
    }
  }
}//byte edit(byte



void Graphics()
{
  //tft.setFont(&FreeMonoBold9pt7b);  //set new font
  tft.setTextColor(WHITE);
  tft.setTextSize(2);
  tft.drawRect(3, 170, 75, 35, WHITE); //enterButtPin
  tft.setCursor(10, 185);
  tft.print("Enter");
  tft.drawRect(88, 170, 75, 35, WHITE); //upButtPin
  tft.setCursor(115, 185);
  tft.print("Up");
}

void NotEnterButton() {
      // If (enterButtPin) is released
      i = 0;
      Serial.println("Pin");
      hour   = edit(75,15, hour);
      Serial.println("Pin1");
      minute = edit(111, 15, minute);
      date   = edit(75, 90, date);
      month  = edit(111, 90, month);
     
      year   = edit(160, 90, year);//not correct yet
      // Convert decimal to BCD
      minute = ((minute / 10) << 4) + (minute % 10);
      hour = ((hour / 10) << 4) + (hour % 10);
      date = ((date / 10) << 4) + (date % 10);
      month = ((month / 10) << 4) + (month % 10);
      year = ((year / 10) << 4) + (year % 10);
      // End conversion
      // Write data to DS3231 RTC
      Wire.beginTransmission(0x68);  // Start I2C protocol with DS3231 address
      Wire.write(0);                 // Send register address
      Wire.write(0);                 // Reset sesonds and start oscillator
      Wire.write(minute);            // Write minute
      Wire.write(hour);              // Write hour
      Wire.write(1);                 // Write day (not used)
      Wire.write(date);              // Write date
      Wire.write(month);             // Write month
      Wire.write(year);              // Write year
      Wire.endTransmission();        // Stop transmission and release the I2C bus
      delay(200);                    // Wait 200ms
    }//end (!enterButton

void DScomm() {
  Wire.beginTransmission(0x68);    // Start I2C protocol with DS3231 address
    Wire.write(0);                   // Send register address
    Wire.endTransmission(false);     // I2C restart
    Wire.requestFrom(0x68, 7);       // Request 7 bytes from DS3231 and
    //release I2C bus at end of reading
    second = Wire.read();            // Read seconds from register 0
    minute = Wire.read();            // Read minuts from register 1
    hour   = Wire.read();            // Read hour from register 2
    Wire.read();                     // Read day from register 3 (not used)
    date   = Wire.read();            // Read date from register 4
    month  = Wire.read();            // Read month from register 5
    year   = Wire.read();            // Read year from register 6
    DS3231_display();                // Diaplay time & calendar
}

When i looked at the loop() i realized that this would probably not work. And that the programming style was not what i would want to teach anyone, so i decided to start over a little. (sorry) I removed all functions not directly related to the TFT-Touchscreen, removed any libraries i wasn't going to be using.
Copied the checkUpButt() function i posted earlier, altered it to be a universal button checker, and created a waitRelease() function that checks an x amount of times whether the button has actually been release (on my shields i have been getting a lot of false negatives which causes the buttons to be double pressed) Also since i never trusted the map function of the touchscreen for starters i let nearly the whole screen be a button (and have the coordinates for your button be part of a sub-button for testing.) so then i came to this:

#include  <Adafruit_GFX.h>
#include  <SPI.h>
#include  <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;
#include<TouchScreen.h>


#define LCD_CS A3 // Chip Select goes to Analog 3
#define LCD_CD A2 // Command/Data goes to Analog 2
#define LCD_WR A1 // LCD Write goes to Analog 1
#define LCD_RD A0 // LCD Read goes to Analog 0
#define LCD_RESET RESET // Can alternately just connect to Arduino's reset pin

//T.S allignment
#define TS_MINX 40
#define TS_MINY 40
#define TS_MAXX 1000
#define TS_MAXY 1000
//Touch
#define YM 10
#define XM A4
#define YP A5
#define XP 11

//Color Definitons
#define BLACK     0x0000
#define BLUE      0x001F
#define GREY      0xCE79
#define LIGHTGREY 0xDEDB
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF
#define MINPRESSURE 100
#define MAXPRESSURE 1000
//                          (11, A5, A4, 10  ,RESISTANCE)
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 365);

void setup() {
  Serial.begin(9600);
  tft.reset();
  uint16_t identifier = tft.readID();
  tft.begin(identifier);
  tft.setRotation (1);
  tft.fillScreen(BLACK);
  Graphics();
}


void loop() {

  if (checkButton(0,240,0,240,"The Screen",true)) { // will be executed if you pressed anywhere pressed    
    Serial.println("Somewhere You Pressed");
      if (checkButton(88,163,160,190,"Upbutton",true)) { // will be executed once the button is pressed 
        Serial.println("The Button is Pressed");
        waitReleaseButton(88,163,160,190,50);
        Serial.println("And now it has been released");
      }
    waitReleaseButton(0,240,0,240,50);
    Serial.println("And now it has been released");
  }
  delay(10);
}//end loop

void waitReleaseButton(int16_t x1, int16_t x2, int16_t y1, int16_t y2,uint8_t cycles) {
  uint8_t i=0;  // set a counter
  while (i<cycles) { // check the cycles
    if (!checkButton(x1,x2,y1,y2,"",false)) i++;  // if not pressed up the counter
    else i=0; // otherwise reset the counter
    delay (1); // the whole thing will take 50ms minimum
  }
}

bool checkButton(int16_t x1, int16_t x2, int16_t y1, int16_t y2,const String msg, bool serpr ) {
  TSPoint p = ts.getPoint();
  if (p.z > ts.pressureThreshhold) {
      int16_t X = 320 - map(p.y, TS_MAXX, TS_MINX, 0, 320 );
      int16_t Y = map(p.x, TS_MAXY, TS_MINY, 0, 240);
      int16_t Z = p.z;

      if (X > x1 && X < x2 && Y > y1 && Y < y2)
      {
        if (serpr) {
          Serial.print("X=");
          Serial.print(X,DEC);
          Serial.print(" Y=");
          Serial.print(Y,DEC);
          Serial.print(" ");
          Serial.println(msg);
        }        
        return true;  
      }
    return false;
  }
}

void Graphics()
{
  //tft.setFont(&FreeMonoBold9pt7b);  //set new font
  tft.setTextColor(WHITE);
  tft.setTextSize(2);
  tft.drawRect(3, 170, 75, 35, WHITE); //enterButtPin
  tft.setCursor(10, 185);
  tft.print("Enter");
  tft.drawRect(88, 170, 75, 35, WHITE); //upButtPin
  tft.setCursor(115, 185);
  tft.print("Up");
}

Now please test this, i know it compiles, but i haven't tested it on my shield as such (although i am fairly certain it should work) There are other things to do today, and read the code and ask (preferably smart) questions about how the code works. If it really doesn't work let me know and i'll upload it onto 1 of my shields. Actually this should be in a different part of the forum, specifically about the touchscreens since there is your issue, but for now it's here. btw that 9000 character limit can be annoying when you "really" want to help someone.

This is like a mayor change to what I posted. When I test this on my ILI9341 the buttons are "pressed" even before I press them- if that makes sense.
ie--the Serial.println prints the first 2 values without any touches to the screen.

The reason why

 if (p.z > ts.pressureThreshhold) {

    X = 320 - map(p.y, TS_MAXX, TS_MINX, 0, 320 );
    Y = map(p.x, TS_MAXY, TS_MINY, 0, 240);
    Z = p.z;
[code]

this is used is to eliminate false touch readings- Z=p.z. 

The sketch Im using is not as difficult as it seems. If you follow the code as its executed then it all makes sense.

Press enterButt- brings the code to this [code] hour   = edit(75, 15, hour);{code]

'edit' is then executed [code] byte edit(byte x, byte y, byte parameter) [code] and the parameter specified in 'edit' ie-hour, with the co ordinates ie 75,15, should  'blink.

The program waits for the upButt to be pressed. It adds 1 for each UpButt press until the enterBut is pressed. This will cause it to move to the next parameter [code] minute = edit(111, 15, minute);[code]

The issue at this stage is that it does not recognize the co-ordinates for the 'edit' function. If I can get this part fixed the program will work properly.

Thanks for the help though.

Ah yeah, now i remember the MCUfriend library is really weird, Ok i'll have to test the code, where is your touch-threshold defined ?

So i got it, my pins are slightly different then yours and i had forgotten how 'strange' the MCUfriend library, first of all there are some variables that need to be global but are not part of the constructor then the TSpoint needs to be global and on my tft i need to reset the pins of the the touchscreen, probably because they are shared. anyway this does actually work, though my screen is not properly calibrate in this sketch, in other words, it responds, but not quite to the area of the button. I have a few of these screens i i made a calibrating program that finds where the edges (ts_minx, ts_miny ts_maxx and ts_maxy) actually are (with me they are not at 40 & 1000), and stores that on the eeprom and then another sketch can use those values and then it does line up. You could do this manually by adjusting those vales in the #define

#include  <Adafruit_GFX.h>
#include  <SPI.h>
#include  <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;
#include<TouchScreen.h>


#define LCD_CS A3 // Chip Select goes to Analog 3
#define LCD_CD A2 // Command/Data goes to Analog 2
#define LCD_WR A1 // LCD Write goes to Analog 1
#define LCD_RD A0 // LCD Read goes to Analog 0
#define LCD_RESET RESET // Can alternately just connect to Arduino's reset pin

//T.S allignment
#define TS_MINX 40
#define TS_MINY 40
#define TS_MAXX 1000
#define TS_MAXY 1000
//my pins
/*#define YM 7
#define XM A2
#define YP A1
#define XP 6*/

//your pins
#define YM 10
#define XM A4
#define YP A5
#define XP 11

//Color Definitons
#define BLACK     0x0000
#define BLUE      0x001F
#define GREY      0xCE79
#define LIGHTGREY 0xDEDB
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF
#define MINPRESSURE 100
#define MAXPRESSURE 1000
#define SWAP(a, b) {uint16_t tmp = a; a = b; b = tmp;}

//                          (11, A5, A4, 10  ,RESISTANCE)
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 365);
int X, Y, Z;
TSPoint tp;

void setup() {
  Serial.begin(9600);
  tft.reset();
  uint16_t identifier = tft.readID();
  tft.begin(identifier);
  tft.setRotation (1);
  tft.fillScreen(BLACK);
  Graphics();
}


void loop() {
  if (checkButton(88,163,160,190,"Upbutton",true)) { // will be executed once the button is pressed         
    checkRelease(50);
  }
}//end loop


bool checkButton(int16_t x1, int16_t x2, int16_t y1, int16_t y2,const String msg, bool serpr ) {
  tp = ts.getPoint();
  ResetPins();
  if (tp.z < MINPRESSURE || tp.z > MAXPRESSURE) return false; // no press within range
  
  X = 320 - map(tp.y, TS_MAXX, TS_MINX, 0, 320 );
  Y = map(tp.x, TS_MAXY, TS_MINY, 0, 240);
  
  if (X > x1 && X < x2 && Y > y1 && Y < y2) {
    if (serpr) {  // serial feedback
      Serial.print("X=");
      Serial.print(X,DEC);
      Serial.print(" Y=");
      Serial.print(Y,DEC);
      Serial.print(" ");
      Serial.println(msg);
    }        
    return true;  // the button has been pressed
  }
return false;  
}

void Graphics()
{
  //tft.setFont(&FreeMonoBold9pt7b);  //set new font
  tft.setTextColor(WHITE);
  tft.setTextSize(2);
  tft.drawRect(3, 170, 75, 35, WHITE); //enterButtPin
  tft.setCursor(10, 185);
  tft.print("Enter");
  tft.drawRect(88, 170, 75, 35, WHITE); //upButtPin
  tft.setCursor(115, 185);
  tft.print("Up");
}

void ResetPins(){
  pinMode(XM, OUTPUT);  // reset the pins after use.
  pinMode(YP, OUTPUT);
  pinMode(XP, OUTPUT);
  pinMode(YM, OUTPUT);
}

void checkRelease(uint16_t cycles) {
  uint8_t prs=0;
  while (prs<cycles) {
    tp = ts.getPoint();
    ResetPins();
    if (tp.z > MINPRESSURE && tp.z < MAXPRESSURE) prs=0 ;
    delay(1);
    prs++;
  }
}

I don't know if your ts-screen is also giving false negatives, experiment with the value of checkRelease() all my screens are slightly different. I know your program is not to complex, but it well your most recent post is about as chaotic as your code was.

I have managed to get the 'edit' select for the 'enterBut' to select the parameter. The 'upButt' however does not add a value too the selected parameter (if i==….) Instead this button also select the next parameter. The "blink" is also not working as of yet.

/*clock2B_changed
   NOT WORKING YET
  Original:
  https://simple-circuit.com/arduino-ds3231-real-time-clock-button/
  25 Nov 2018
  edited for use with ADAFRUIT 2.8" TFT ILI9431,8bit 240x320 & DUE
  2 x Touch screen buttons. (enter & up)
*/
#include  <Adafruit_GFX.h>
#include <Wire.h>
#include "Sodaq_DS3231.h"
#include  <SPI.h>
#include  <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;
#include <avr/dtostrf.h>
#include<TouchScreen.h>

#define LCD_CS A3 
#define LCD_CD A2 
#define LCD_WR A1 
#define LCD_RD A0 
#define LCD_RESET RESET 

//T.S allignment
#define TS_MINX 40
#define TS_MINY 40
#define TS_MAXX 1000
#define TS_MAXY 1000
//Touch
#define YM 10
#define XM A4
#define YP A5
#define XP 11

//Color Definitons
#define BLACK     0x0000
#define BLUE      0x001F
#define GREY      0xCE79
#define LIGHTGREY 0xDEDB
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF
#define MINPRESSURE 100
#define MAXPRESSURE 1000
//                          (11, A5, A4, 10  ,RESISTANCE)
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 365);
int X, Y, Z;
int upButt;
int enterButt;
char Time[]     = "TIME:  :  :  ";
char Calendar[] = "DATE:  /  /20  ";
byte i, second, minute, hour, date, month, year;

//define DS3231 address
//SDA=20  SCL=21 I2C Ard_DUE
#define DS3231_I2C_ADDRESS 0x68


void setup() {
  Serial.begin(9600);
  tft.reset();
  uint16_t identifier = tft.readID();
  tft.begin(identifier);
  tft.setRotation (1);
  tft.fillScreen(BLACK);
  Wire.begin();
  rtc.begin();
  Graphics();
  DS3231_display();
}


void DS3231_display() {

  // Convert BCD to decimal
  second = (second >> 4) * 10 + (second & 0x0F);
  minute = (minute >> 4) * 10 + (minute & 0x0F);
  hour   = (hour >> 4)   * 10 + (hour & 0x0F);
  date   = (date >> 4)   * 10 + (date & 0x0F);
  month  = (month >> 4)  * 10 + (month & 0x0F);
  year   = (year >> 4)   * 10 + (year & 0x0F);
  // End conversion
  Time[12]     = second % 10 + 48;
  Time[11]     = second / 10 + 48;
  Time[9]      = minute % 10 + 48;
  Time[8]      = minute / 10 + 48;
  Time[6]      = hour   % 10 + 48;
  Time[5]      = hour   / 10 + 48;
  Calendar[14] = year   % 10 + 48;
  Calendar[13] = year   / 10 + 48;
  Calendar[9]  = month  % 10 + 48;
  Calendar[8]  = month  / 10 + 48;
  Calendar[6]  = date   % 10 + 48;
  Calendar[5]  = date   / 10 + 48;
  tft.setTextColor(WHITE);            //Time & Calendar
  tft.setTextSize(3);
  //L TOP W H  COLOR
  tft.fillRect(100,14, 160, 25, RED); // erase prevTime
  tft.setCursor(15, 15);
  tft.fillRect(102, 89, 185, 25, RED); // erase old date
  tft.print(Time);                    // Display time
  tft.setCursor(15, 90);
  tft.print(Calendar);                // Display calendar
}  //end void


void blink_parameter() {
  tft.setTextColor(GREEN);
  byte j = 0;
  while (j < 10 && ( 3 , 78 , 160 , 190, true) && ( 88 , 163 , 160 , 190, true) ) {
    j++;
  }
  delay(25);
}


byte edit(byte x, byte y, byte parameter) {

  char text[3];
  while ( 3 , 78 , 160 , 190,true) {     // Works corectly
   
    TSPoint p = ts.getPoint();
    if (p.z > ts.pressureThreshhold) {
      X = 320 - map(p.y, TS_MAXX, TS_MINX, 0, 320 );
      Y = map(p.x, TS_MAXY, TS_MINY, 0, 240);
      Z = p.z;
      
      //upButtPin;
      if ( 88 , 163 , 160 , 190,true) { //NOT adding a value to parameter
        
        parameter++;
        if (i == 0 && parameter > 23)   // If hours > 23 ==> hours = 0
          parameter = 0;
         if (i == 1 && parameter > 59)   // If minutes > 59 ==> minutes = 0
          parameter = 0;
         if (i == 2 && parameter > 31)   // If date > 31 ==> date = 1
          parameter = 1;
        if (i == 3 && parameter > 12)   // If month > 12 ==> month = 1
          parameter = 1;
        if (i == 4 && parameter > 99)   // If year > 99 ==> year = 0
          parameter = 0;

        sprintf(text, "%02u", parameter);
        tft.setCursor(x, y);
        tft.print(text);
        delay(200);                 // Wait 200ms
      }
      else ( 88 , 163 , 160 , 190,false);
      
      tft.setCursor(x, y);
      tft.print("  ");      // NOT working. Should Display two spaces
      blink_parameter();
      sprintf(text, "%02u", parameter);
      tft.setCursor(x, y);
      tft.print(text);
      blink_parameter();

      if (3 , 78 , 160 , 190,true) {      // If button (enterButtPin) is pressed
        i++;                        // Increament 'i' for the next parameter
        return parameter;           // Return parameter value and exit
      }
    }//if (p.z
  }//while(3,78
}//byte edit(byte

void loop() {

  TSPoint p = ts.getPoint();
  if (p.z > ts.pressureThreshhold) {

    X = 320 - map(p.y, TS_MAXX, TS_MINX, 0, 320 );
    Y = map(p.x, TS_MAXY, TS_MINY, 0, 240);
    Z = p.z;
    //enterButt
    if (3 , 78 , 160 , 190,true) {
      i = 0;
      hour   = edit(105, 15, hour);
      minute = edit(160, 15, minute);
      date   = edit(105, 90, date);
      month  = edit(159, 90, month);
      year   = edit(249, 90, year);

      // Convert decimal to BCD
      minute = ((minute / 10) << 4) + (minute % 10);
      hour = ((hour / 10) << 4) + (hour % 10);
      date = ((date / 10) << 4) + (date % 10);
      month = ((month / 10) << 4) + (month % 10);
      year = ((year / 10) << 4) + (year % 10);
      // End conversion
      // Write data to DS3231 RTC
      Wire.beginTransmission(0x68);  // Start I2C protocol with DS3231 address
      Wire.write(0);                 // Send register address
      Wire.write(0);                 // Reset sesonds and start oscillator
      Wire.write(minute);            // Write minute
      Wire.write(hour);              // Write hour
      Wire.write(1);                 // Write day (not used)
      Wire.write(date);              // Write date
      Wire.write(month);             // Write month
      Wire.write(year);              // Write year
      Wire.endTransmission();        // Stop transmission and release the I2C bus
      delay(200);                    // Wait 200ms
    }//end (!enterButt
    
    else (3 , 78 , 160 , 190,false);//enterButt

    Wire.beginTransmission(0x68);    // Start I2C protocol with DS3231 address
    Wire.write(0);                   // Send register address
    Wire.endTransmission(false);     // I2C restart
    Wire.requestFrom(0x68, 7);       // Request 7 bytes from DS3231 and
    //release I2C bus at end of reading
    second = Wire.read();            // Read seconds from register 0
    minute = Wire.read();            // Read minuts from register 1
    hour   = Wire.read();            // Read hour from register 2
    Wire.read();                     // Read day from register 3 (not used)
    date   = Wire.read();            // Read date from register 4
    month  = Wire.read();            // Read month from register 5
    year   = Wire.read();            // Read year from register 6
    DS3231_display();                // Diaplay time & calendar
    delay(50);                       // Wait 50ms
  }//
}//end loop

void Graphics()
{
  //tft.setFont(&FreeMonoBold9pt7b);  //set new font
  tft.setTextColor(WHITE);
  tft.setTextSize(2);
  tft.drawRect(3, 170, 75, 35, WHITE); //enterButtPin
  tft.setCursor(10, 185);
  tft.print("Enter");
  tft.drawRect(88, 170, 75, 35, WHITE); //upButtPin
  tft.setCursor(115, 185);
  tft.print("Up");
}