Home > ARM Projects > 320×240 Color Display – ILI9919

320×240 Color Display – ILI9919

I finally got the display I bought on eBay to work. It took me a lot of hours as the man I’d bought the display from told me that the display controller was an ILI9320, so I started making code for the display like it was using an ILI9320 controller.

But as it didn’t work, I started debugging using my Raisonance RLink, and just when I looked at the Device variable – a variable which holds the controller number, and is loaded at the initialization process of the display, it showed me that it was an ILI9919 controller.

So I found the ILI9919 datasheet and started recoding using the new Command calls found in the datasheet… Finally it worked and showed some life :)

So right now I have a working ILI9919 code with SetPixel, Text, Circle, Rectangle, Fill and some working Touch Screen commands for the onboard ADS7843 touch screen controller.

Please take a look at this image to see the display in action:

ILI9919 seen from top

ILI9919 from top


ILI9919 Pringles example

The current GUI commands I’ve made is:
void Lcd_Text(u16 x, u16 y, u8 *str, u16 len,u16 Color, u16 bkColor);
void Lcd_Line(u16 x0, u16 y0, u16 x1, u16 y1,u16 color);
void Lcd_Circle(u16 cx,u16 cy,u16 r,u16 color,u8 fill);
void Lcd_Rectangle(u16 x0, u16 y0, u16 x1, u16 y1,u16 color,u8 fill); // Slower than Lcd_ColorBox
void Lcd_Square(u16 x0, u16 y0, u16 width, u16 color,u8 fill);
void Lcd_ClearCharBox(u16 x,u16 y,u16 color);
void Get320240PictureCode(u8* pBuffer,u32 BufferCounter,u32 BaseAddr);

void Lcd_FastRectangle(u16 x0, u16 y0, u16 x1, u16 y1,u16 color,u8 fill); // Faster than Lcd_Rectangle
void Lcd_FastSquare(u16 x0, u16 y0, u16 width, u16 color,u8 fill); // Faster than Lcd_Rectangle
void Lcd_FastClearCharBox(u16 x,u16 y,u16 color);

void DispPic320_240(const unsigned char *str);
void DispPic(u16 x0, u16 y0, const unsigned char *str);

DispPic320_240 and DispPic uses a byte array to show a image – the byte array is converted from a 24-bit .BMP (bitmap) file using a program I’ve made in Visual Basic .NET!

Categories: ARM Projects Tags: , , ,
  1. Frank
    January 30th, 2010 at 17:22 | #1

    Hi Thomas,

    I have the same LCD, and I have it all working but I am have a bit of a problem when displaying a picture.

    Can you please help me on this?
    What routine are you using to display the picture?

    Thanks
    Frank

  2. January 30th, 2010 at 17:37 | #2

    Hi Frank.
    Have you made your own library? If not, which library are you using?

    I’m using a mixed library – I’ve mixed something from the uC/OS LCD library and something from ST’s LCD library.
    This included the Pixel, Circle, Text, Square commands – and then I made my own picture display command!

    First I save the image file on my computer as a 24-bit BMP.
    Next I use a program I made in VB.NET to convert the BMP to a header file.
    Last I include the header file in the project, and run the picture display command when needed.

    Best regards
    Thomas Jespersen

  3. Frank
    January 30th, 2010 at 19:16 | #3

    I am using the same library.
    I have using the following 2 programs to convert the image to .h

    http://www.thaieasyelec.net/archives/Manual/bmp2h_conv%20v5.1.rar
    http://www.thaieasyelec.net/archives/Manual/IMG2HEX.rar

    This is my DrawPicture routine:

    void LCD_DrawPicture(u16 StartX,u16 StartY,u16 EndX,u16 EndY,const unsigned short *pic) {

    u32 i;
    LCD_SetWindows(StartX,StartY,EndX,EndY);
    LCD_SetCursor(StartX,StartY);

    Clr_Cs;

    LCD_WriteIndex(0×0022);
    Set_Rs;
    for (i=0;i<(EndX*EndY) ;i++)
    {
    LCD_WriteData(*pic++);
    Clr_nWr;Set_nWr;
    }

    Set_Cs;
    }

    Can you please check and verify if the above are working?
    Best regards,
    Frank

  4. January 30th, 2010 at 20:49 | #4

    It looks correct, but you can exclude the Set_Rs; just after the WriteIndex, as the WriteIndex sets the Rs pin high too!
    I’ve tried this code too, but the SetWindows command was the thing which was the problem for me!

    I’ve sent you an email with my DispPic code and my converter program – please try that and tell me if it works :)

  1. No trackbacks yet.