320×240 LCD Driver for ILI9341 Controller and XPT2046 Touch Screen

Share on facebook
Share on twitter
Share on linkedin
Share on email
Share on print
Table of Contents
Description

The driver from forum members Cluso99, Greg LaPolla, and Mike Roberts make it very easy to draw lines, blocks, circles, graphs, and text of any color, and an analog clock face on an ILI9341 (or similar) LCD, with selective area updates. The driver provides pixel-level control and two fonts. 

The ILI9341 (or ST7796S, ILI9163, and probably many others) are a multi-color single-chip controller for Liquid Crystal Displays (LCD) with a resolution of 128 x 128 (1.44″), 240 x 320 (2.2″, 2.4″, 2.8″, 3.2″), or 320 x 480 (3.5″, 4.0″). The ILI9341 supports a serial peripheral interface (SPI) with selective window area updates. The XPT2046 is an optional touch screen controller that uses a 4-wire resistive touch screen control system with a 12-bit 125 Khz A/D converter to detect the location of the touched screen and touch screen pressure.  

This driver supports both the ILI9341 and XPT2046. On eBay and Amazon you’ll find many ILI9341 240 x 320 displays in 2.4″ and 3.2″ sizes, without and without the XPT2046 driver chip. AliExpress is also a good source.  

The driver is self-documenting and very easy to use. It only requires you to choose the display resolution and whether or not the touch screen is present. Choose the display you are using by removing the comment marks from LCD_Graphics_Demo.spin2. 

Next, choose your I/O pins. The I/O pins are defined in the lower level object, LCD_ILI9341_XPT2046.spin2 (LCD_Graphics_Driver.spin2). 

Programming Language
Document Author
Source Code Author
Table of Contents
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments