Help me interpret this data sheet for an ILI9341 LCD

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi there,

 

Sorry if this is not in the correct forum, I wasn't quite sure where to put it. 

 

Basically I'm running into an issue where my LCD screen is loading images too slowly so I have been trying to make the drawing method more efficient. As it stands right now, it draws one pixel at a time - which is quite slow. I would like to send it much more data at once, say for an example an entire row of data from a BMP image. Below is the current drawing method - which works but is slow.

 

void TFT_SetXY(uint16_t poX, uint16_t poY) {
	TFT_SetCol(poX, poX);
	TFT_SetPage(poY, poY);
	TFT_SendCMD(0x2c);
}

void TFT_SetPixel(uint16_t poX, uint16_t poY,uint16_t color) {
	TFT_SetXY(poX, poY);
	TFT_SendData(~color);
}

However, if I am reading the data sheet correctly (see attached image), it seems to me like it says that you can simply send the 0x2C command once and then just keep sending color data and it will automatically increment forward to the next pixel, or am I reading it wrong? I'm referring to the part where it says that the "column register and page register incremented". Am I crazy or is the text here just very unclear?

My idea was to simply create a new function which loops through an array of colors to send to the LCD as follows:


void TFT_SetPixelRow(uint16_t startX, uint16_t startY,uint16_t* color) {
	TFT_SetXY(poX, poY);
	for(int i=0; i<header.imageSizeX;i++){
	    TFT_SendData(~color[i]);
	}
}

 

Attachment(s): 

1010001010111101110111

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Have you looked at ILI9341 support in the Arduino world? Two of the world's leading embedded developers Paul Stoffregen and Limor Fried have done work on ILI9341 so you can be pretty certain of quality code looking at either.

 

Paul: https://github.com/PaulStoffrege...

AdaFruit: https://github.com/adafruit/Adaf...

Last Edited: Fri. Jul 30, 2021 - 02:53 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

TFT displays have a start column and end column in one command and a start row and ending row in a second command.  There is a third command that determines in which direction the pixels will be auto-incremented {left-to-right:up-to-down vs.  right-to-left:down-to-up, etc...}.

 

The Adafruit TFT libraries are adapted from the Adafruit routines written for the Nokia 5110 graphics screen.   That screen had its pixels written in eight-bit columns moving from top to bottom and left to right.   The Adafruit font tables support this format.  Each pixel is written with three commands:  one to set the number of rows to one (one pixel in size for the writing area), one to set the number of columns to one pixel, and a data write of the one pixel's color data.

 

As you have noticed, the Adafruit font-writing code could be made much faster by setting a block area on the screen 5 pixels wide and 7 pixels high and then feeding each pixel to this block area while letting the TFT's auto-increment set the location of the new pixel on the screen.  But that would have meant rewriting all the font tables to go from left to right, followed by top-to-bottom, instead of the Nokia format of top-to-bottom, then left-to-right.  The modified Nokia routines seemed to work fast enough, so they stuck with the old format.

 

Experiment with the TFT settings.  You may get results for example of the letters formed correctly but tilted 90 degrees, or mirrored.  But the settings can always be reset to the originals without harm to the TFT.

Last Edited: Fri. Jul 30, 2021 - 06:22 PM