Go Down

Topic: 7in LCD with Mega 2560 and CTE Shield (Read 1 time) previous topic - next topic

HazardsMind

Well then I am stumped. 

I'm tapping out.
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

thank you for all your help and with out ya help I could not have not made this far

thank you again for all your awesome help


-Mikey

ghlawrence2000

but if you look at the attach at the both of the SD (516MB and 2GB) sametime the screen are only showing black background...
Does he really mean that?? I think you got your hands full with this one Hazard!!  ;)  :smiley-razz:

Also, I would recommend using the SD formatting tool as recommended by Bill Greiman, then ONLY use true 8.3 compliant file names, hence avoiding this situation ....

Code: [Select]
IMG_4910.BMP
IMG_4911.BMP
_IMG_4~1.BMP
_IMG_4~2.BMP


For those of you using GENUINE versions of the CTE TFT shield, it IS JP8 to enable the SD slot on the shield!!!

Regards,

Graham

HazardsMind

Quote
Does he really mean that?? I think you got your hands full with this one Hazard!!  ;)  :smiley-razz:
He proved the screen does work and all he had to do was drop the images onto the SD card and he should have seen something. Perhaps his card is not formatted correctly thus producing things like _IMG_4~1.BMP _IMG_4~2.BMP.


Im done anyways. I know the library works because it can see his cards and read them, so now its something else on his end causing the issue.  
Good luck Graham.
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

ghlawrence2000

As a side note, I appreciate what you are trying to achieve here with your TFT_bitmap library, and different ways of achieving any given end result is the beauty of having many different people with many different combinations of hardware.

However....

Quote
Special library with special image converting software is a little too much for something so simple as an array of numbers.
I take your point, however the advantages in terms of speed of draw speak for themselves.

Running the Example and using the images included with TFT_Bitmap.
Arduino MEGA 212 seconds
Arduino DUE     56 seconds.

These timings are using the following sketch to be a fair comparison with the second sketch. No delay between drawing images. Each image drawn 1 after the other in the same sequence in both sketches.

Code: [Select]
include <UTFT.h>
#include <TFT_Bitmap.h>
#include <SD.h>
#include <SPI.h>

// Declare which fonts we will be using
extern uint8_t SmallFont[];
//myGLCD(RS,WR,CS,RST,ALE,mode);
UTFT myGLCD(CPLD, 38, 39, 40, 41);
//UTFT myGLCD(CPLD, 25, 26, 27, 28);

TFT_Bitmap myBMP(&myGLCD);

void setup()
{
  Serial.begin(115200);
  myGLCD.InitLCD(LANDSCAPE);
  myGLCD.clrScr();
  myGLCD.setFont(SmallFont);
  myGLCD.fillScr(0, 0, 0);
  myBMP.InitBMP();
  myBMP.searchDirectory();
  unsigned long mytime = millis();

  myBMP.makeBMP("clogo2.bmp", 0, 0);
  //  delay(1000);
  myBMP.makeBMP("img_4910.bmp", 0, 0);
  //  delay(1000);
  myBMP.makeBMP("img_4911.bmp", 0, 0);
  //  delay(1000);
  myBMP.makeBMP("pb.bmp", 0, 0);
  //  delay(1000);
  myBMP.makeBMP("rgb_led.bmp", 0, 0);
  //  delay(1000);
  myBMP.makeBMP("servo.bmp", 0, 0);
  //  delay(1000);
  myBMP.makeBMP("wallball.bmp", 0, 0);
  //  delay(1000);
  myBMP.makeBMP("calc.bmp", 0, 0);
  //  delay(1000);
  myBMP.makeBMP("clogo.bmp", 0, 0);
  //  delay(1000);
  Serial.print("Time Taken ");
  Serial.print((millis() - mytime));
  Serial.println(" milliseconds");
  Serial.println("End");
}

void loop()
{
}

Arduino MEGA 203523 milliseconds
Arduino DUE     47730 milliseconds.

Alternative approach:-

Then, utilizing UTFT_SdRaw (my library) with the images converted to .raw using hennings command line tool
Code: [Select]
ImgConv *.bmp /r
 took a matter of moments (20 seconds) so no big deal.

BUT those 20 seconds will probably be the most important 20 seconds of your project if you intend doing regular image rendering!!

These timings were produced from this sketch which emulates the previous one but using my library and converted raw images.

Code: [Select]
#include <SPI.h>
// SdFat lib from here :-
// https://github.com/greiman/SdFat/archive/master.zip
#include <SdFat.h>
#include <SdStream.h>
#include <UTFT.h>
#include <UTouch.h>
#include <UTFT_Buttons.h>
#include <UTFT_SdRaw.h>
extern uint8_t SmallFont[];
extern uint8_t BigFont[];

#define SD_CHIP_SELECT  53  // SD chip select pin
// file system object
SdFat sd;
// print stream
ArduinoOutStream cout(Serial);

// Initialize display
// ------------------
// Set the pins to the correct ones for your development board
// -----------------------------------------------------------
// Standard Arduino Mega/Due shield            : <display model>,38,39,40,41
// CTE TFT LCD/SD Shield for Arduino Due       : <display model>,25,26,27,28
//

UTFT myGLCD(CPLD, 38, 39, 40, 41);
//UTFT myGLCD(CPLD, 25, 26, 27, 28);

//UTFT myGLCD(CTE50, 38, 39, 40, 41);
//UTFT myGLCD(CTE50, 25, 26, 27, 28);

//UTFT myGLCD(CTE70, 38, 39, 40, 41);
//UTFT myGLCD(CTE70, 25, 26, 27, 28);


// Initialize touchscreen
// ----------------------
// Set the pins to the correct ones for your development board
// -----------------------------------------------------------
// Standard Arduino Mega/Due shield            :  6, 5, 4, 3, 2
// CTE TFT LCD/SD Shield for Arduino Due       :  6, 5, 4, 3, 2
// CTE TFT LCD/SD Shield for Arduino Due (JP10):  6, 5,32, 3, 2
//
UTouch  myTouch( 6, 5, 4, 3, 2);
//UTouch  myTouch( 6, 5, 32, 3, 2);

UTFT_SdRaw myFiles(&myGLCD);
UTFT_Buttons  myButtons(&myGLCD, &myTouch);

void setup()
{
  // Open serial communications and wait for port to open:
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for DUE & Leonardo only
  }
  Serial.println(F("Initialising SD card..."));
  bool mysd = 0;
  // see if the card is present and can be initialized:
  while (!mysd)
  {
    if (!sd.begin(SD_CHIP_SELECT, SPI_FULL_SPEED)) {
      Serial.println(F("Card failed, or not present"));
      Serial.println(F("Retrying...."));
    }
    else
    {
      mysd = 1;
      Serial.println(F("Card initialised."));
    }
  }
  Serial.println(F("Initialising LCD."));
  myGLCD.InitLCD(LANDSCAPE);
  myGLCD.clrScr();
  myGLCD.setFont(SmallFont);
  myGLCD.fillScr(0, 0, 0);
  unsigned long mytime = millis();
  byte buf = 2;
  myFiles.load(0, 0, 320, 128, "clogo2.raw", buf * 2 , 0);
  //  delay(1000);
  myFiles.load(0, 0, 800, 480, "img_4910.raw", buf , 0);
  //  delay(1000);
  myFiles.load(0, 0, 800, 480, "img_4911.raw", buf , 0);
  //  delay(1000);
  myFiles.load(0, 0,  64,  64, "pb.raw", buf * 2 , 0);
  //  delay(1000);
  myFiles.load(0, 0,  64,  64, "rgb_led.raw", buf * 2 , 0);
  //  delay(1000);
  myFiles.load(0, 0,  64,  64, "servo.raw", buf * 2 , 0);
  //  delay(1000);
  myFiles.load(0, 0,  64,  64, "wallball.raw", buf * 2 , 0);
  //  delay(1000);
  myFiles.load(0, 0,  64,  64, "calc.raw", buf * 2 , 0);
  //  delay(1000);
  myFiles.load(0, 0, 128, 320, "clogo.raw", buf * 2 , 0);
  //  delay(1000);

  Serial.print("Time Taken ");
  Serial.print((millis() - mytime));
  Serial.println(" milliseconds");
//  Serial.print((millis() - mytime) / 1000);
//  Serial.println(" seconds");

  Serial.println("End");
}

void loop()
{
}


Arduino MEGA  9448 ms   (203523/9448= 21.5X speed improvement)
Arduino   DUE  2298 ms   (  47730/2298= 20.7X speed improvement)


(This is NOT an advert for the DUE  :smiley-mr-green: )

Also, the image quality is IDENTICAL..... The baby pictures look like they are rendered 16 bit in terms of colour graduation in the skin tone..... The original source looks fine. Not sure if situation would improve if downsampled in a graphics program BEFORE displaying on arduino? (Yes they do look better if converted to 16 bit before sending to Arduino)

So in conclusion, two methods of achieving the same thing.

Regards,

Graham


Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy