7.0" TFT module CPLD SDRAM arduino DUE MEGA2560 MS070SD

Now working with touch :slight_smile: when i have time ill fix up the touch part i like the way you done it

#include <SPIflash.h>
#include <UTFT.h>
#include <UTFT_SPIflash.h>
#include <UTouch.h>
UTFT myGLCD(CPLD,25,26,27,28);
UTouch  myTouch( 6, 5, 4, 3, 2); 
int x, y;
char stCurrent[20]="";
int stCurrentLen=0;
char stLast[20]="";
SPIflash      myFlash(52);

UTFT_SPIflash myFiles(&myGLCD, &myFlash);

extern uint8_t SmallFont[];
extern uint8_t BigFont[];
extern uint8_t SevenSegNumFont[];

uint8_t  fileid;
uint16_t filetype;

int homepage = 0;
//////////////////////////////////////////////////////////////////////////////////////////
void setup()
{
  myGLCD.InitLCD();
  myGLCD.clrScr();
  myTouch.InitTouch();
  myGLCD.setColor(255,255,255);
  myGLCD.setFont(SmallFont);
  myFlash.begin();

  if (myFlash.ID_device==0)
  {
    myGLCD.print("Unknown flash device!", 0, 0);
    while (true) {};
  }
setup0();
}
//////////////////////////////////////////////////////////////////////////////////////////
void setup0()
{
  myGLCD.setWritePage(0);
  myGLCD.fillScr(VGA_BLACK);
  myGLCD.setColor(VGA_WHITE);
  myGLCD.setFont(BigFont);
  myGLCD.print("7 TFT TOUCH SCREEN", CENTER, 0);
  myGLCD.print("CPLD PAGESWITCHING", CENTER, 16);
  myGLCD.print("SPI FLASH W25Q64FV 64Mbit", CENTER, 32);
  myGLCD.print("PROCESSOR: SAM3X8E ARM CORTEX-M3 CPU", CENTER, 48);
  myGLCD.print("INITIALIIZING PROGRAM", CENTER, 80);
  myGLCD.print("LOADING PLEASE WAIT", CENTER, 96);
  myGLCD.setDisplayPage(0);
  /////////////////////////////////////////////////
  myGLCD.setWritePage(1);
  myFiles.loadBitmap(0, 0, 0);
  myGLCD.setWritePage(2);
  myFiles.loadBitmap(1, 0, 0);
  myGLCD.setWritePage(3);
  myFiles.loadBitmap(2, 0, 0);
  myGLCD.setWritePage(4);
  myFiles.loadBitmap(3, 0, 0);
  myGLCD.setWritePage(5);
  myFiles.loadBitmap(4, 0, 0);
  myGLCD.setWritePage(6);
  myFiles.loadBitmap(5, 0, 0);
  myGLCD.setWritePage(7);
  myFiles.loadBitmap(6, 0, 0);
}
//////////////////////////////////////////////////////////////////////////////////////////
void loop()
{
  if (homepage == 0) {
    home();
    homepage = 1;
    delay(2000);
    image1();
    myGLCD.setWritePage(0);
    myFiles.loadBitmap(7, 0, 0);
 }

if (myTouch.dataAvailable())
    {
      myTouch.read();
      x=myTouch.getX();
      y=myTouch.getY();
      
      if ((y>=15) && (y<=74))  // HOME
        {
        if ((x>=582) && (x<=641)) 
        { 
          //////////////////////////////////////////////////////////////////////
          image1();
          delay(500);
          //////////////////////////////////////////////////////////////////////
          }
        }
      if ((y>=15) && (y<=74))  // SETUP
        {
        if ((x>=654) && (x<=712)) 
        { 
          //////////////////////////////////////////////////////////////////////
          image2();
          delay(500);
          //////////////////////////////////////////////////////////////////////
          }
        }
      if ((y>=15) && (y<=74))  // GRASS
        {
        if ((x>=725) && (x<=784)) 
        { 
          //////////////////////////////////////////////////////////////////////
          image3();
          delay(500);
          //////////////////////////////////////////////////////////////////////
          }
        }
      if ((y>=189) && (y<=248))  // 1
        {
        if ((x>=14) && (x<=73)) 
        { 
          //////////////////////////////////////////////////////////////////////
          image4();
          delay(500);
          //////////////////////////////////////////////////////////////////////
          }
        }
      if ((y>=262) && (y<=321))  // 2
        {
        if ((x>=14) && (x<=73)) 
        { 
          //////////////////////////////////////////////////////////////////////
          image5();
          delay(500);
          //////////////////////////////////////////////////////////////////////
          }
        }
      if ((y>=334) && (y<=393))  // 3
        {
        if ((x>=14) && (x<=73)) 
        { 
          //////////////////////////////////////////////////////////////////////
          image6();
          delay(500);
          //////////////////////////////////////////////////////////////////////
          }
        }
      if ((y>=406) && (y<=464))  // 4
        {
        if ((x>=14) && (x<=73)) 
        { 
          //////////////////////////////////////////////////////////////////////
          image7();
          delay(500);
          //////////////////////////////////////////////////////////////////////
          }
        }
    }
}
//////////////////////////////////////////////////////////////////////////////////////////
void home()
{
 myGLCD.setDisplayPage(1);
}
void image1()
{
 myGLCD.setDisplayPage(2);
}
void image2()
{
 myGLCD.setDisplayPage(3);
}
void image3()
{
 myGLCD.setDisplayPage(4);
}
void image4()
{
 myGLCD.setDisplayPage(5);
}
void image5()
{
 myGLCD.setDisplayPage(6);
}
void image6()
{
 myGLCD.setDisplayPage(7);
}
void image7()
{
 myGLCD.setDisplayPage(0);
}
//////////////////////////////////////////////////////////////////////////////////////////

When i have time i will design a new control PCB for this 7" display just as i done with the 3.2"

http://forum.arduino.cc/index.php?topic=207393.0

You appreciate my help so much, it didn't earn a single karma point? :disappointed_relieved:

Graham

ops sorry have done :slight_smile:

Appreciate it, thanks.

Graham

Hi i have a few questions i have the W25Q64FV, which is a 64Mbit SPI Serial Flash and its working but once i put images on there i haven't got space for icons so i have ordered W25Q128FVSG 128M-bit serial flash memory so that should be lots of space.
The other is about the 8-page video memory is there any way of having more than 8 pages? or is there a bigger chip to replace MD070SD for more memory. :slight_smile: hahaha
If using an SD card dose it work as fast as the Flash or is it slower?

First answer, 8 pages is the most, I asked that exact question!! :stuck_out_tongue:

I wrote an AWESOME library to draw images to UTFT from SD, and did I mention it is AWESOME?? :sunglasses: But funny you should ask, I didn't yet do comparative timings between SD and SPI-Flash, but seriously, even W25Q128 is not ENORMOUS....... 16MB is not lots.....

All of my time for the past 2 months has been to improve/expand the UTFT_CTE library to add additional functionality to the library but also to ADD Font IC ability to the CPLD display which Coldtears don't even offer.

I will do some comparative benchmarking between SPI and SD.

Don't hold your breath, it probably won't be this evening.

Regards,

Graham

Sounds very interesting. ... :slight_smile: have u posted the library can it be downloaded ? Would like to have a play with it. :slight_smile:
one way to have more pages is to have it load other pages in place of ones not being used in the background so u can have more then 8 only if u load pages to different menus... I did it with my code above I changed the load screen after I loading into the main code so infact I had 9 pages :slight_smile:

http://forum.arduino.cc/index.php?topic=273573.msg2184654#msg2184654

There you will see the kind of speeds you can expect from my library to draw from SD.

The library is called UTFT_SdRaw, and is now available on Github at GitHub - ghlawrence2000/UTFT_SdRaw: Hi speed image loading from SD/Serial for UTFT. UTFT_tinyFAT replacement.

General useage explanation here. 3.6" TFT LCD screen from eBay :-( - #76 by ghlawrence2000 - Displays - Arduino Forum

Any problems let me know and I will try to help you, there is a function in my library specifically for CPLD displays to load an image to any of the video pages.

As always, add karma if you appreciate my efforts :slight_smile:

Regards,

Graham