P2 Quick Byte: 320×240 LCD Driver for ILI9341 Controller and XPT2046 Touch Screen
![Ken Gracey](https://forums.parallax.com/uploads/userpics/937/nHX7GKXF8OR2S.jpg)
in Propeller 2
https://www.parallax.com/320x240-lcd-driver-for-ili9341-controller-and-xpt2046-touch-screen/
Nice work from @"Greg LaPolla" and @Cluso99. Of all the displays I've used, this provides the best value and ease of coding. The object doesn't need much explanation - the code pretty much explains how it works. The I/O pin constants are defined at the lower-level, in the driver.
Ken Gracey
Comments
Ken,![:) :)](https://forums.parallax.com/resources/emoji/smile.png)
Nice Quick Byte
I am not sure if you want some more Quick Bytes similar to this.
My display is a 4.0" 480x320 LCD and it uses the ST7796 controller chip which is similar/same as the ILI9341 and costs around $12-$15 on fleabay or aliexpress with the optional Touch Screen.
There are also 3.5" versions using ILI9488 for about $13.
I bought my 4.0" one here and I've just ordered a 3.5" one. They are out of stock on the 4.0" ones.
https://aliexpress.com/item/4001122632293.html?spm=a2g0o.store_home.productList_270037084.pic_2
Here are two links, one to the graphic and text example, and the other to a 60x40 text only terminal.
https://forums.parallax.com/discussion/172370/4-0in-tft-spi-480x320-lcd-st7796-driver#latest
https://forums.parallax.com/discussion/172924/multiport-serial-lcd-text-drivers-with-common-format-i-o-object-similar-to-jm-fullduplexserial/p1?new=1
Here is the graphic and text example for a 1.44" Color 128x128 LCD ILI9163 from fleabay for around $3 to $4.
https://forums.parallax.com/discussion/comment/1509348/#Comment_1509348
@Cluso99 ,
Does the driver work the same with the ST7796, without changes? I'm not 100% clear from the reply.
This is very useful information and I'll supplement the Quick Byte based on your reply. I'd like to keep these up to date and complete as possible. Adding additional details about where to source the displays will be useful to many customers. I don't pretend that we can get these in stock and sell them at a fair price, so we'll get people directly to them.
Thanks,
@"Ken Gracey" The driver I submitted was modified to work with the ili9341. You will most likely need to use Clusso99 driver for that one. Seems to me I had to change some of the registers from the original code. Most of those lcd chip controllers are all very close and just have some variations on the resolution and the control registers.
Aha, okay. In this case, I'd make a second Quick Byte and order one of the displays to try the code myself.
Greg, the driver you made is complete and easy to use. I really love the way that part of the display can be overwritten without updating the rest, too. This really improves the viewing. Thanks!
@"Ken Gracey" I bought one of the exact boards you have,(320x240) but with the touch screen. It worked with @Cluso99 's st7796 driver.
I was playing with buttons that look like they are pressed when you touch with the pen... check out the video.. The touchscreen makes it great for input as well as output...
@Cluso99 , I wrote some circle drawing routines using the cordic to see how they compared to your circle drawing method.
You may want to check them out. Also I made a small change in the driver to not wait after writing to the mailbox...
@mwroberts
Thanks for this. I'll check it out, together with garry's modified code.
@Ken,![;) ;)](https://forums.parallax.com/resources/emoji/wink.png)
Since you're interested, I'll look at the code differences, and get back to you. Been busy with other things
Did you note the LCD I use is 320x480 and not 320x240 ie double the pixels. There isn't a great deal of $ difference between them all. I've ordered a smaller 3.5" version (with another different driver IC) to try. Unfortunately it will take about 4 weeks or more to get here.