Error geting print on TFT screen

hi,
I am trying to print DHCP data on TFT 2.8" screen

I am getting error "testDHCP.ino:30:1: error: expected unqualified-id before 'if

Here is code:

#include <UTFT.h>
#include <EtherCard.h>
extern uint8_t BigFont[];
extern uint8_t SmallFont[];
UTFT    myGLCD(ILI9325D_16,38,39,40,41);
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };

byte Ethernet::buffer[500];

void setup () {
 myGLCD.InitLCD();
 myGLCD.clrScr();
 
 myGLCD.setFont(BigFont);
 myGLCD.print("Testing DHCP Server", CENTER, 2);
 
 myGLCD.setFont(SmallFont);
 myGLCD.print("MAC : ", 16, 2);
 myGLCD.print("74:69:69:2D:30:31",16, 30);
 myGLCD.setFont(BigFont);
 }

if (ether.begin(sizeof Ethernet::buffer, mymac,53) == 0);
      myGLCD.print(("NIC Failed", CENTER, 50);
else 
     myGLCD.print(("NIC Found", CENTER, 50);
endif
if (!ether.dhcpSetup())
 myGLCD.setFont(BigFont);
 myGLCD.print("DHCP failed", CENTER, 50);
 
 myGLCD.setFont(SmallFont);
 myGLCD.print("My IP: ", 32, 2);
 myGLCD.print(ether.myip,32, 30);
 myGLCD.print("Netmask: ", 42, 2);
 myGLCD.print(ether.netmask,42, 30);
 myGLCD.print("GW IP: ", 52, 2);
 myGLCD.print(ether.gwip,52, 30);
 myGLCD.print("DNS IP: ", 62, 2);
 myGLCD.print(ether.dnsip,62, 30);

}

void loop () {

}
endif

?

Thanks for reply
here is original code . I need help to get to print on TFT instead of Serial.

I am missing some thing for function f() in following line for TFT. how can i print to TFT ??

Serial.println(F(“Failed to access Ethernet controller”));

void setup () {
  Serial.begin(57600);
  Serial.println(F("\n[testDHCP]"));

  Serial.print("MAC: ");
  for (byte i = 0; i < 6; ++i) {
    Serial.print(mymac[i], HEX);
    if (i < 5)
      Serial.print(':');
  }
  Serial.println();
  
  if (ether.begin(sizeof Ethernet::buffer, mymac) == 0) 
    Serial.println(F("Failed to access Ethernet controller"));

  Serial.println(F("Setting up DHCP"));
  if (!ether.dhcpSetup())
    Serial.println(F("DHCP failed"));
  
  ether.printIp("My IP: ", ether.myip);
  ether.printIp("Netmask: ", ether.netmask);
  ether.printIp("GW IP: ", ether.gwip);
  ether.printIp("DNS IP: ", ether.dnsip);
}

void loop () {}

Thanks for reply

Did you get the point of what I posted ?

If you want help with your program then please post it all.

Thanks again .
Yes i understood what’s after Endif.
let me explain … here is original code to print DHCP test on serial …

if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
Serial.println(F(“Failed to access Ethernet controller”));

I want same test to print on TFT instead of serial. I Change it to…

if (ether.begin(sizeof Ethernet::buffer, mymac,53) == 0);
myGLCD.print((“NIC Failed”, CENTER, 50);

But its not right it gives me error…

testDHCP.ino:30:1: error: expected unqualified-id before 'if

I am not expert in programming, i just change according to other program.
Can you help me to print DHCP test on TFT,
Original serial out put of program mention in reply is as following

[testDHCP]
MAC: 74:69:69:2D:30:31
Setting up DHCP
My IP: 192.168.1.12
Netmask: 255.255.255.0
GW IP: 192.168.1.1
DNS IP: 192.168.1.1

Thanks in advance

HERE is original complete Code::

#include <EtherCard.h>

static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };

byte Ethernet::buffer[700];

void setup () {
  Serial.begin(57600);
  Serial.println(F("\n[testDHCP]"));

  Serial.print("MAC: ");
  for (byte i = 0; i < 6; ++i) {
    Serial.print(mymac[i], HEX);
    if (i < 5)
      Serial.print(':');
  }
  Serial.println();
  
  if (ether.begin(sizeof Ethernet::buffer, mymac) == 0) 
    Serial.println(F("Failed to access Ethernet controller"));

  Serial.println(F("Setting up DHCP"));
  if (!ether.dhcpSetup())
    Serial.println(F("DHCP failed"));
  
  ether.printIp("My IP: ", ether.myip);
  ether.printIp("Netmask: ", ether.netmask);
  ether.printIp("GW IP: ", ether.gwip);
  ether.printIp("DNS IP: ", ether.dnsip);
}

void loop () {}

Yes i understood what's after Endif.

It was not what is [u]after[/u] the endif that I was commenting on.

thanks i got it its now working…

issue is how to print IP address to TFT LCD

Serial command is …
ether.printIp("My IP: ", ether.myip); (Works Fine)

I write …

myGLCD.print("My IP: ", 32, 2);
myGLCD.print(ether.myip,32, 30);

ether.myip doesn’t work…

what i need to change???

I write …

myGLCD.print("My IP: ", 32, 2);
myGLCD.print(ether.myip,32, 30);

Does the "My IP: " text appear on the LCD ?

yes I can print "Myip :" but gives error on "ether.myip" . not taking with "." in middle

Here is error..

testDHCP.ino:45:33: error: invalid conversion from 'uint8_t* {aka unsigned char*}' to 'char*' [-fpermissive]

Thanks UKHeliBob figure it out IP saves in array, to print you have to print each array.. thanks though