Interfacing colored LCD ILI9341 with 8-bit Microcontroller

For my current project, a compact sized multiband transceiver, I wanted to have a colored LCD module as display. On the web I found the ILI9341 LCD. This display has got up to >200000 different colors (depending on the respective mode you chose) and a resolution of 320×240 pixels. It can be driven in various parallel and serial (SPI) modes, therefore it is very versatile. Price for the LCD is about 10 US$ (11€).

First I developed code for a 4-line SPI interface. The display worked, but I found that it was much too slow. A lot of data has to be transferred because due to the higher resolution of the LCD I chose a 12×16 pixel font. That is very much for a small microcontroller (I am using an old ATMega128) clocked to 16 MHz via serial transmission

But I loved the colors and the luminance of the LCD. After a brief research I found that there is also a PCB available for parallel driving. This is sold as a “CP11003” display. The ATMega128 has plenty of ports and that made me think of driving it in parallel mode.

This display has 16 data connectors (DB0:DB15) of which 8 can be used for driving it in parallel mode. As common for parallel bus type LCDs these are the higher 8 bits of the data bus, thus DB8:DB15. DB0:DB7 are not used and therefore not connected.

As control lines there are “RS” (Data or command indicator), “WR” (write operation indicator),”RD” (read operation indicator) and “RES” (reset) are used for control.

CS (chip select) can be connected to GND when the LCD is the only device connected to the 8-bit bus.

ILI9341 LCD TFT display - 8bit parallel bus mode
ILI9341 LCD TFT display – 8bit parallel bus mode

Software development was easy using the GNU C compiler vor AVRs. (I still don’t use Arduino libraries! ;-)) The code can be found after this article.

Final hint: The module also has a touchscreen integrated but that is not in use here!

73 de Peter (DK7IH)

Code for ili9341_par_8bit

Author: Peter (DK7IH)

Radioamateur since 1987, constructor of radio hardware, software developer, science teacher in secondary education.

2 thoughts on “Interfacing colored LCD ILI9341 with 8-bit Microcontroller”

  1. How fast did you try running the SPI interface? Depending on the slave device, and the processor, clock speeds of several MHZ are possible (short wires!). Also, maybe you should consider switching to using an ARM Cortex processor. The Atmel/Microchip SAMD21 (Arm Cortex M0+) can run at 48mhz, the SAMD51 (ARM cortex M4) at 120 mhz. There are also the Teensy series boards with the 3.2, 3.5 and 3.6 versions running at 72, 120, and 180 MHZ respectively with Arm Cortex M4 processors, and the new Teensy 4.0 Arm Cortex M7 at 600 MHZ. The Teensy boards can also be over clocked to some extent with the 4.0 topping out at over 900 MHZ. Cortex M4 and M7 processors can do DSP work, they have specialized instructions added to speed this up. The ARM Cortex based Arduino like boards are no more expensive than their AVR counter parts, and if you want to go bare IC, you can use the Eclipse IDE to develop your C code, and a dirt cheap ($20) Jlink EDU Lite Jtag to program them. It’s also possible to use the Arduino Zero or even a Raspberry Pi running OpenOCD as a programmer.

    1. Hi there, I did not measure the SPI frequency on with a respective routine. All I can say is that the mircor runs on 16MHz and that there is not any delay in the routine so it performs with max. speed defined by the compiler for that function.

      And, sure, you are right it seems to switch to more powerful controlers. For the the next projects I have look to STM controllers but not sure which one I will use then. vy 73 de Peter

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.