Jump to content
RobG

(Universal) Color LCD graphics library (2)

Recommended Posts

I have ported a readRegister() function from ENERGIA.

 

At 16MHz SPI clock it gives incorrent results, altough RobG's wrinting functions work corretly at this speed (LCD displays as it should).

At 8MHz reading works correcty too.

unsigned char readRegister(unsigned char Addr, unsigned char xParameter)
{
	//ENERGIA
    //INT8U data=0;
    //sendCMD(0xd9);                                                      // ext command
    //WRITE_DATA(0x10+xParameter);                                        // 0x11 is the first Parameter
    //TFT_DC_LOW;
    //TFT_CS_LOW;
    //SPI.transfer(Addr);
    //TFT_DC_HIGH;
    //data = SPI.transfer(0);
    //TFT_CS_HIGH;
    //return data;

	unsigned char data = 0;
	writeCommand(0xd9);
	writeData(0x10+xParameter);
	LCD_DC_LO;
	LCD_SELECT;
	UCB0TXBUF = Addr;
	while (UCB0STAT & UCBUSY);
	LCD_DC_HI;
	UCB0TXBUF = 0;
	while (UCBxSTAT & UCBUSY);
	data = UCB0RXBUF;
	LCD_DESELECT;

	return data;
}

Reading ILI9341's register 0xD3 ("Read ID4") must be the value of "0x09341"

    for( i=0; i<3; i++ )
    {
        rx_data[i]=readRegister(0xd3,i+1);

    }

Share this post


Link to post
Share on other sites

Hi RobG. I wonder if you can help me. I have bought 2.2" TFT + touchscreen with ILI9225B. The ebay seller did not have any data sheet for it. With google I found some old thread in EEVBlog forum by some one called Tinkeringsteve. Futher investication in to the thread, revealed couple post by some one called RobG. Hmm... In one of his posts (reply #13) I found couple of pictures from his LCD screens and the one in the right side looks exactly as mine. Also Tinkeringsteves ebay links look exactly the same LCD as I appear to have.

 

So do you have any information about the screen? Datasheet? How do I connect it to the lauchpad to be used with your LCD library? Pinout? All and any information is verry mutch appriciated.

Thank you.

 

I attached couple images of the LCD if it is any help.

post-17164-0-88373900-1392231319_thumb.jpg

post-17164-0-05029200-1392231334_thumb.jpg

Share this post


Link to post
Share on other sites

@@Tieri,

 

you can use my ugl8 library (see first post) with your LCD, it's the same one I used in my v1 BP.

I have some PCBs left if you want.

Thank you for your swift responce. Found the schematics for your PCB in the thread. They helped a lot. I have now the confidence to hook up my display and try it out. The thing that was confusing me most was the SOMI line. But It seems I can leave it unconnected, as the display has no SOMI line. The pinout I had was refering the MOSI/SOMI line was combined.

 

No need for the PCB as this baby is goin straight to a project as I get the hang of it and your library.

 

Thanks again for your great work!

Share this post


Link to post
Share on other sites

Hi RobG,

your library looks really neat! I would like to try to it out. Finding an LCD locally would be a lot easier than having one shipped. Do you happen to know any phone models the 320x240 screens are used in? Can you tell me what is written on the back of the LCD?

 

Thanks! Looking forward to trying it.

Share this post


Link to post
Share on other sites

Updated my ugl16 library with few new functions:

u_int color = getPixel(x, y); //returns color of the pixel at x and y

getPixels(xStart, yStart, xEnd, yEnd, data); //returns color of the pixels from the defined area

To read registers:

readDataBegin(command);
u_char data = readData();
// repeat readData() if necessary
readDataEnd();

To read id:

u_int id = readID();

Share this post


Link to post
Share on other sites

Hey Rob,

 

I was just curious as to how difficult it would be to port this (or ugl 8) to be compatible with an SSD1289 display. The libraries I am currently using are not nearly as well commented (and are therefore much more difficult to code for).

Share this post


Link to post
Share on other sites

Nevermind. It would seem that porting is unnecessary. Although the datasheet for the item I purchased lists the LCD controller as an SSD1289.... a device teardown CLEARLY shows that it is using an ILI9341. Gotta love China stuff. The better question would be what exactly needs to be changed between a ILI9341 and an ILI9340?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...