Pages: [1]   Go Down
Author Topic: 2.4 tft lcd touch shield pin mapping for Arduino Mega 2560  (Read 1792 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have a iteadstudio 2.4 tft touch shield that currently works with my Arduino Uno R3 board.
I now want to get this shield working on the Arduino Mega 2560 R3 board.
first up this shield is a little old,
the manufactures does state that the board does work with the Arduino Mega
link http://imall.iteadstudio.com/development-platform/im120417012.html

this is the code from my sketch

#include <UTFT.h>
#include <UTouch.h>


// Uncomment the next two lines for the Arduino Mega

//This is my attemp in trying to initialize shield
UTFT        myGLCD(ITDB24E_8, A5,A4,A3,A2);   // Remember to change the model parameter to suit your display module!
UTouch      myTouch( A1, 10, A0, 8, 9); // original values 6,5,4,3,2);

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

void setup(void)
{
  /* Start Ethernet sheild */
  Ethernet.begin( mac,ip,subnet,gateway );
  delay( 100 );
 
  /* Initalize LCD screen */ 
  myGLCD.InitLCD( 1 );

  /* Clear LCD Screen */
  myGLCD.clrScr();
 
  //myGLCD.setColor(0, 255, 0);
  myGLCD.setBackColor( VGA_AQUA );
  myGLCD.setFont( BigFont );
 
  myTouch.InitTouch( 1 );
  myTouch.setPrecision(PREC_HI);
  drawLCD();
}

void loop(void)
{
 
 if( myTouch.dataAvailable() )
 {
   myTouch.read();
   x = myTouch.getX();
   y = myTouch.getY();
 
 
   if( ( y >= 15 ) && ( y <= 122 ) )
     {
       if( (x >= 2 ) && ( x <= 148 ) )
       {
         //waitForItTemp0(5,5,309,230);
         //backButtonTemp0();
       }
     }
   
   
}


* TftSheild6001.png (122.01 KB, 334x186 - viewed 66 times.)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you managed to make it work with Mega? I'm trying to make the same shield work with DUE ... but cannot so far smiley-sad
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The librairies (TFTLCD and UTFT) are made so the pins used for data (D0 to D7) are not at the same place.
UNO                    LCD
8.............................LCD_D0
9.............................LCD_D1
2.............................LCD_D2
3.............................LCD_D3
4.............................LCD_D4
5.............................LCD_D5
6.............................LCD_D6
7.............................LCD_D7

MEGA                    LCD
22.............................LCD_D0
23.............................LCD_D1
24.............................LCD_D2
25.............................LCD_D3
26.............................LCD_D4
27.............................LCD_D5
28.............................LCD_D6
29.............................LCD_D7

You can wire 1 by 1 each pins between the MEGA and LCD (that's what I have done ;-). You can also edit the library for changing the pins. On the 2nd option, it will be very slow, because on MEGA, the pins 2 t 9 are mapped on many different processor ports, your code will take much more time to execute.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

I connected the pins in Mega 2560 to the corresponding LCD pins and RS-38,WR-39,CS-40,RST-41. But it still did not work. The screen just blinks as I set the timer, but not any color or display that I had set for it.

Is there any changes I need to do to UTFT?

Thanks.

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The librairies (TFTLCD and UTFT) are made so the pins used for data (D0 to D7) are not at the same place.
UNO                    LCD
8.............................LCD_D0
9.............................LCD_D1
2.............................LCD_D2
3.............................LCD_D3
4.............................LCD_D4
5.............................LCD_D5
6.............................LCD_D6
7.............................LCD_D7

MEGA                    LCD
22.............................LCD_D0
23.............................LCD_D1
24.............................LCD_D2
25.............................LCD_D3
26.............................LCD_D4
27.............................LCD_D5
28.............................LCD_D6
29.............................LCD_D7

You can wire 1 by 1 each pins between the MEGA and LCD (that's what I have done ;-). You can also edit the library for changing the pins. On the 2nd option, it will be very slow, because on MEGA, the pins 2 t 9 are mapped on many different processor ports, your code will take much more time to execute.

So, for us complete noobs, which wires have to go where? Perhaps you could post a picture or a schematic? Also, which file would I have to edit if I go with the second option?
« Last Edit: July 24, 2014, 06:08:34 pm by bjonnfesk » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Check my thread here http://forum.arduino.cc/index.php?topic=257046.0 for the solution to the problem.

Hope that helps!
Logged

Pages: [1]   Go Up
Jump to: