LCD TFT 3.2" sainsmart with sainsmart uno shield - Mega issue

Hey, So I finally got the TFT working with my uno using the tft libs directly from the source rather than the outdated ones at sainsmart. My issue is that I am trying to use the shield with my mega so I can have some pins left over for sensors and what not. Keep in mind the shield is attaching to A0-A5 pins.

Here is the code I am using that IS WORKING with Uno, but not Mega

// UTFT_ViewFont 
// Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved
// web: http://www.RinkyDinkElectronics.com/
//
// This program is a demo of the included fonts.
//
// This demo was made for modules with a screen resolution 
// of 320x240 pixels.
//
// This program requires the UTFT library.
//

#include <UTFT.h>

// Declare which fonts we will be using
extern uint8_t SmallFont[];
extern uint8_t BigFont[];
extern uint8_t SevenSegNumFont[];

// Set the pins to the correct ones for your development shield
// ------------------------------------------------------------
// Arduino Uno / 2009:
// -------------------
// Standard Arduino Uno/2009 shield            : <display model>,A5,A4,A3,A2
// DisplayModule Arduino Uno TFT shield        : <display model>,A5,A4,A3,A2
//
// Arduino Mega:
// -------------------
// Standard Arduino Mega/Due shield            : <display model>,38,39,40,41
// CTE TFT LCD/SD Shield for Arduino Mega      : <display model>,38,39,40,41
//
// Remember to change the model parameter to suit your display module!
UTFT myGLCD(ITDB32S,19,18,17,16);

void setup()
{
  myGLCD.InitLCD();

  myGLCD.clrScr();
}

void loop()
{
  myGLCD.setColor(0, 255, 0);
  myGLCD.setBackColor(0, 0, 0);

  myGLCD.setFont(BigFont);
  myGLCD.print("Temperature:", LEFT, 10);
  myGLCD.print("Humidity:", LEFT, 100);
  while(1) {};
}

Think about it:

// DisplayModule Arduino Uno TFT shield        : <display model>,A5,A4,A3,A2
                                             UTFT myGLCD(ITDB32S,A5,A4,A3,A2);  //clearly identifies shield pins
                                             UTFT myGLCD(ITDB32S,19,18,17,16);  //this applies to the Uno

You are using a Shield. You want to specify the Analog pins.

The Analog#0…5 pins happen to map to Digital#14…19 on a Uno.
The Analog#0…5 pins happen to map to different Digital# pins on a Mega.

If you specify Analog# in the first place, it will match the Shield pins on any Arduino.

David.

I should have mentioned. I tried that with no result. I uploaded old code. So this code just gives me a blank screen:

// UTFT_ViewFont 
// Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved
// web: http://www.RinkyDinkElectronics.com/
//
// This program is a demo of the included fonts.
//
// This demo was made for modules with a screen resolution 
// of 320x240 pixels.
//
// This program requires the UTFT library.
//

#include <UTFT.h>

// Declare which fonts we will be using
extern uint8_t SmallFont[];
extern uint8_t BigFont[];
extern uint8_t SevenSegNumFont[];

// Set the pins to the correct ones for your development shield
// ------------------------------------------------------------
// Arduino Uno / 2009:
// -------------------
// Standard Arduino Uno/2009 shield            : <display model>,A5,A4,A3,A2
// DisplayModule Arduino Uno TFT shield        : <display model>,A5,A4,A3,A2
//
// Arduino Mega:
// -------------------
// Standard Arduino Mega/Due shield            : <display model>,38,39,40,41
// CTE TFT LCD/SD Shield for Arduino Mega      : <display model>,38,39,40,41
//
// Remember to change the model parameter to suit your display module!
UTFT myGLCD(ITDB32S,A5,A4,A3,A2);

void setup()
{
  myGLCD.InitLCD();

  myGLCD.clrScr();
}

void loop()
{
  myGLCD.setColor(0, 255, 0);
  myGLCD.setBackColor(0, 0, 0);

  myGLCD.setFont(BigFont);
  myGLCD.print("Temperature:", LEFT, 10);
  myGLCD.print("Humidity:", LEFT, 100);
  while(1) {};
}

The uno shield should work fine correct? Anyone have any ideas why it would work ok with uno but not mega?

Please post a link to the actual Display and actual Adapter shield. Please say whether you are using the official UTFT v2.8.2

Then you would get an accurate reply. Readers would waste less time.

David.

Sorry about that.

Display
Shield
I am using official UTFT v2.8.2 downloaded here UTFT - Rinky-Dink Electronics.

Your Display link shows a TFT_320QVT which has an SSD1289 controller. Nowadays, a TFT_320QVT_9341 is more common. With an ILI9341 controller.

Your Adapter link shows a Uno Shield with lots of jumpers for the 16-bit data bus. In consequence, you will not be able to use the SD Card or Touch Controller. There is no schematic. So I have no idea how the pins are mapped.

Looking at UTFT's HW_ATmega328p.h there is provision for 16-bit data bus spread over PORTD, PORTB, PORTC. Looking at UTFT's HW_ATmega1280.h there is only provision for a latched 16-bit data bus. (this file is what a MEGA2560 Arduino uses)

If you want to use your Display on a Mega, why not buy a proper Mega Adapter e.g. TFT Adapter for MEGA2560 This will let you have high speed TFT. As well as SD, Touch.

David.

Thanks for the reply. I just had these from an old project that I never finished so I was going to use it for a project that I am working on now. Don't really need the touch function. I'll look into the mega shield though.