pic tft lcd interface free sample

The ST7789 TFT is a color display that uses SPI protocol. This display is an IPS display, it comes in different sizes (1.3″, 1.54″ …) but all of them should have the same resolution of 240×240 pixel.
The ST7789 TFT display works with 3.3V only (power supply and control lines). The display module is supplied with 3.3V that comes from the AMS1117 3V3 voltage regulator, this regulator steps down the 5V into 3.3V (supplies the display controller with regulated 3V3).
To connect the PIC18F46K22 with the display module, I used voltage divider for each line. This means there are 4 voltage dividers. Each voltage divider consists of 2.2k and 3.3k resistors, this drops the 5V into 3V which is sufficient.
If the display module has a CS pin (Chip Select) then it should be connected to the PIC18F46K22 microcontroller through another voltage divider (for example connecting it to pin RD2).
In this project SPI1 module is used with SCK1 on pin RC3 (#18) and SDO1 (MOSI) on pin RC5 (#24). SCK1 and SDO1 pins of the PIC18F46K22 MCU are respectively connected to SCL and SDA pins of the ST7789 display module.
The default connection setting of the mikroC ST7789 TFT library is hardware SPI1 module (SPI1 module must be initialized before initiating the display). Instead of hardware SPI1 module, software SPI or hardware SPI2 module can be used.
If TFT data pin (TFT_DIN) and clock pin (TFT_SCK) are defined in the main code (before #include “ST7789.c”) then the library will automatically use software SPI.
If the display module has a CS pin uncomment its related lines (#define TFT_CS and #define TFT_CS_DIR) and connect it to RD2 pin of the microcontroller through voltage divider.

The ST7789 TFT module contains a display controller with the same name: ST7789. It’s a color display that uses SPI interface protocol and requires 3, 4 or 5 control pins, it’s low cost and easy to use. This display is an IPS display, it comes in different sizes (1.3″, 1.54″ …) but all of them should have the same resolution of 240×240 pixel, this means it has 57600 pixels. This module works with 3.3V only and it doesn’t support 5V (not 5V tolerant).
As mentioned above, the ST7789 TFT display controller works with 3.3V only (power supply and control lines). The display module is supplied with 3.3V (between VCC and GND) which comes from the Arduino board.
The first library is a driver for the ST7789 TFT display which can be installed from Arduino IDE library manager (Sketch —> Include Library —> Manage Libraries …, in the search box write “st7789” and install the one from Adafruit).

In this Arduino touch screen tutorial we will learn how to use TFT LCD Touch Screen with Arduino. You can watch the following video or read the written tutorial below.
As an example I am using a 3.2” TFT Touch Screen in a combination with a TFT LCD Arduino Mega Shield. We need a shield because the TFT Touch screen works at 3.3V and the Arduino Mega outputs are 5 V. For the first example I have the HC-SR04 ultrasonic sensor, then for the second example an RGB LED with three resistors and a push button for the game example. Also I had to make a custom made pin header like this, by soldering pin headers and bend on of them so I could insert them in between the Arduino Board and the TFT Shield.
Here’s the circuit schematic. We will use the GND pin, the digital pins from 8 to 13, as well as the pin number 14. As the 5V pins are already used by the TFT Screen I will use the pin number 13 as VCC, by setting it right away high in the setup section of code.
I will use the UTFT and URTouch libraries made by Henning Karlsen. Here I would like to say thanks to him for the incredible work he has done. The libraries enable really easy use of the TFT Screens, and they work with many different TFT screens sizes, shields and controllers. You can download these libraries from his website, RinkyDinkElectronics.com and also find a lot of demo examples and detailed documentation of how to use them.
After we include the libraries we need to create UTFT and URTouch objects. The parameters of these objects depends on the model of the TFT Screen and Shield and these details can be also found in the documentation of the libraries.
So now I will explain how we can make the home screen of the program. With the setBackColor() function we need to set the background color of the text, black one in our case. Then we need to set the color to white, set the big font and using the print() function, we will print the string “Arduino TFT Tutorial” at the center of the screen and 10 pixels down the Y – Axis of the screen. Next we will set the color to red and draw the red line below the text. After that we need to set the color back to white, and print the two other strings, “by HowToMechatronics.com” using the small font and “Select Example” using the big font.

In this guide we’re going to show you how you can use the 1.8 TFT display with the Arduino. You’ll learn how to wire the display, write text, draw shapes and display images on the screen.
The 1.8 TFT is a colorful display with 128 x 160 color pixels. The display can load images from an SD card – it has an SD card slot at the back. The following figure shows the screen front and back view.
This module uses SPI communication – see the wiring below . To control the display we’ll use the TFT library, which is already included with Arduino IDE 1.0.5 and later.
The TFT display communicates with the Arduino via SPI communication, so you need to include the SPI library on your code. We also use the TFT library to write and draw on the display.
The 1.8 TFT display can load images from the SD card. To read from the SD card you use the SD library, already included in the Arduino IDE software. Follow the next steps to display an image on the display:
In this guide we’ve shown you how to use the 1.8 TFT display with the Arduino: display text, draw shapes and display images. You can easily add a nice visual interface to your projects using this display.
![]()
New functions have been added to draw smooth (antialiased) arcs, circles, and rounded rectangle outlines. New sketches are provided in the "Smooth Graphics" examples folder. Arcs can be drawn with or without anti-aliasing (which will then render faster). The arc ends can be straight or rounded. The arc drawing algorithm uses an optimised fixed point sqrt() function to improve performance on processors that do not have a hardware Floating Point Unit (e.g. RP2040). Here are two demo images, on the left smooth (anti-aliased) arcs with rounded ends, the image to the right is the same resolution (grabbed from the same 240x240 TFT) with the smoothing diasbled (no anti-aliasing):
An excellent new compatible library is available which can render TrueType fonts on a TFT screen (or into a sprite). This has been developed by takkaO, I have created a branch with some bug fixes here. The library provides access to compact font files, with fully scaleable anti-aliased glyphs. Left, middle and right justified text can also be printed to the screen. I have added TFT_eSPI specific examples to the OpenFontRender library and tested on RP2040 and ESP32 processors, the ESP8266 does not have sufficient RAM due to the glyph render complexity. Here is a demo screen where a single 12kbyte font file binary was used to render fully anti-aliased glyphs of gradually increasing size on a 320x480 TFT screen:
Smooth fonts can now be rendered direct to the TFT with very little flicker for quickly changing values. This is achieved by a line-by-line and block-by-block update of the glyph area without drawing pixels twice. This is a "breaking" change for some sketches because a new true/false parameter is needed to render the background. The default is false if the parameter is missing, Examples:
Users of PowerPoint experienced with running macros may be interested in the pptm sketch generator here, this converts graphics and tables drawn in PowerPoint slides into an Arduino sketch that renders the graphics on a 480x320 TFT. This is based on VB macros created by Kris Kasprzak here.
The RP2040 8 bit parallel interface uses the PIO. The PIO now manages the "setWindow" and "block fill" actions, releasing the processor for other tasks when areas of the screen are being filled with a colour. The PIO can optionally be used for SPI interface displays if #define RP2040_PIO_SPI is put in the setup file. Touch screens and pixel read operations are not supported when the PIO interface is used.
A feature rich Arduino IDE compatible graphics and fonts library for 32 bit processors. The library is targeted at 32 bit processors, it has been performance optimised for RP2040, STM32, ESP8266 and ESP32 types, other 32 bit processors may be used but will use the slower generic Arduino interface calls. The library can be loaded using the Arduino IDE"s Library Manager. Direct Memory Access (DMA) can be used with the ESP32, RP2040 and STM32 processors with SPI interface displays to improve rendering performance. DMA with a parallel interface (8 and 16 bit) is only supported with the RP2040.
The screen controller, interface pins and library configuration settings must be defined inside the library. They can NOT be defined in the Arduino sketch. See the User_Setup_Select.h file for details. This approach has significant advantages, it keeps the examples clean from long configuration options and once the setup is defined any example can be run without modification. PlatformIO users can define these settings on a per project basis within a platformio.ini file, see Docs folder in library.
Lots of example sketches are provided which demonstrate using the functions in the library. Due to the popularity of the library there are lots of online tutorials for TFT_eSPI that have been created by enthusiastic users.
For other (generic) processors only SPI interface displays are supported and the slower Arduino SPI library functions are used by the library. Higher clock speed processors such as used for the Teensy 3.x and 4.x boards will still provide a very good performance with the generic Arduino SPI functions.
Due to lack of GPIO pins the 8 bit parallel interface is NOT supported on the ESP8266. 8 bit parallel interface TFTs (e.g. UNO format mcufriend shields) can used with the STM32 Nucleo 64/144 range or the UNO format ESP32 (see below for ESP32).
Support for the XPT2046 touch screen controller is built into the library and can be used with SPI interface displays. Third party touch support libraries are also available when using a display parallel interface.
The library supports some TFT displays designed for the Raspberry Pi (RPi) that are based on a ILI9486 or ST7796 driver chip with a 480 x 320 pixel screen. The ILI9486 RPi display must be of the Waveshare design and use a 16 bit serial interface based on the 74HC04, 74HC4040 and 2 x 74HC4094 logic chips. Note that due to design variations between these displays not all RPi displays will work with this library, so purchasing a RPi display of these types solely for use with this library is NOT recommended.
Some displays permit the internal TFT screen RAM to be read, a few of the examples use this feature. The TFT_Screen_Capture example allows full screens to be captured and sent to a PC, this is handy to create program documentation.
The library includes a "Sprite" class, this enables flicker free updates of complex graphics. Direct writes to the TFT with graphics functions are still available, so existing sketches do not need to be changed.
The "Animated_dial" example shows how dials can be created using a rotated Sprite for the needle. To run this example the TFT interface must support reading from the screen RAM (not all do). The dial rim and scale is a jpeg image, created using a paint program.
The XPT2046 touch screen controller is supported for SPI based displays only. The SPI bus for the touch controller is shared with the TFT and only an additional chip select line is needed. This support will eventually be deprecated when a suitable touch screen library is available.
The library supports SPI overlap on the ESP8266 so the TFT screen can share MOSI, MISO and SCLK pins with the program FLASH, this frees up GPIO pins for other uses. Only one SPI device can be connected to the FLASH pins and the chips select for the TFT must be on pin D3 (GPIO0).
The library is based on the Adafruit GFX and Adafruit driver libraries and the aim is to retain compatibility. Significant additions have been made to the library to boost the speed for the different processors (it is typically 3 to 10 times faster) and to add new features. The new graphics functions include different size proportional fonts and formatting features. There are lots of example sketches to demonstrate the different features and included functions.
Configuration of the library font selections, pins used to interface with the TFT and other features is made by editing the User_Setup.h file in the library folder, or by selecting your own configuration in the "User_Setup_Selet,h" file. Fonts and features can easily be enabled/disabled by commenting out lines.
It would be possible to compress the vlw font files but the rendering performance to a TFT is still good when storing the font file(s) in SPIFFS, LittleFS or FLASH arrays.
Anti-aliased fonts can also be drawn over a gradient background with a callback to fetch the background colour of each pixel. This pixel colour can be set by the gradient algorithm or by reading back the TFT screen memory (if reading the display is supported).
Unfortunately the typical UNO/mcufriend TFT display board maps LCD_RD, LCD_CS and LCD_RST signals to the ESP32 analogue pins 35, 34 and 36 which are input only. To solve this I linked in the 3 spare pins IO15, IO33 and IO32 by adding wires to the bottom of the board as follows:
If you load a new copy of TFT_eSPI then it will overwrite your setups if they are kept within the TFT_eSPI folder. One way around this is to create a new folder in your Arduino library folder called "TFT_eSPI_Setups". You then place your custom setup.h files in there. After an upgrade simply edit the User_Setup_Select.h file to point to your custom setup file e.g.:

Smart TFT LCD display embeds LCD driver, controller and MCU, sets engineer free from tedious UI & touch screen programming. Using Smart TFT LCD module, our customers greatly reduce product"s time-to-market and BOM cost.
![]()
Levetop Semiconductor announced an new LQFP-100pin TFT display controller - LT268D, which support 8/16-bit parallel or SPI interface. It embedded an ARM M4 core with high capacity Flash and SRAM, and offers multiple sets of Uart interfaces that can be connected to such as blue tooth modules, WiFi modules, USB interfaces, SD cards, analog input AIN, PWM, and INT interrupts. The LT268D internal main frequency up to 150MHz, provides the QSPI Flash interface, can quickly read the images stored in the external SPI Flash, animation, word library and other information, with PC computer software, simulation software, directly into the computer product UI display interface development. Its support for serial panel instructions including picture display, GIF animation display, circular picture display, progress bar display, text string display, QR code generation, audio playback, and combined with the effects of touch functions and other instructions. LT268D can be used in a variety of small appliances, smart home appliances, handheld control equipment, industrial control boards, electronic devices, medical equipment, small testing equipment, small electric motorcycle, personal medical beauty, small testing equipment, charging equipment, water and electricity meters, smart speakers with screens and other products.
Levetop Semiconductor announced a TFT display controller LT268C that drives 8 or 16-bit parallel, and SPI serial port. It embedded an ARM M4 core with high capacity Flash and SRAM, and offers multiple sets of Uart interfaces that can be connected to such as blue tooth modules, WiFi modules, USB interfaces, SD cards, analog input AIN, PWM, and INT interrupts. The LT268C internal main frequency up to 150MHz, provides the QSPI Flash interface, can quickly read the images stored in the external SPI Flash, animation, word library and other information, with PC computer software, simulation software, directly into the computer product UI display interface development. Its support for serial screen instructions including picture display, GIF animation display, circular picture display, progress bar display, text string display, QR code generation, audio playback, and combined with the effects of touch functions and other instructions. LT268C can be used in a variety of small appliances, smart home appliances, handheld control equipment, industrial control boards, electronic devices, medical equipment, small testing equipment, small electric motorcycle, personal medical beauty, small testing equipment, charging equipment, water and electricity meters, smart speakers with screens and other products.
Levetop Semiconductor announced an new controller - LT7689 that combines the Cortex-M4 MCU and the 2D TFT graphics display accelerator. It has high-capacity flash and SRAM, provides multi-group SCI interface s which can be connected to such as as Bluetooth modules, WiFi modules, etc. Also provided secondary development to meet more TFT panel applications. The LT7689 supports serial panel instructions include more than 70 commands such as picture display, GIF animation display, loop chart display, power-on image display, progress bar display, text string display, QR code generation, audio playback, and combined with touch panel to achieve touch function. With the serial TFT panel development software and simulation tool of Levetop, can quickly complete the small and medium-sized TFT display scheme.
Levetop Semiconductor introduces ARM 9 CPU architecture"s serial panel controller - LT3688. It integrates video decoding, audio decoders, TFT LCD controller, and embedded the serial panel communication protocols of Levetop. With the Serial Panel Development Software can quickly realize the product with TFT display function. Suitable for product applications that require video and MP3 playback . The MCU program supports the serial panel communication protocol of most Levetop, including picture display, picture roll, picture-in-picture (PIP), GIF animation display, geometry, vector text display, QR code generation, etc.
Levetop Semiconductor announces a new Serial-Uart TFT controller with the Cortex-M4 core - LT268B. It has high-speed computing power, with 256KB Flash, 128KB SRAM, built-in RTC, and QR-Code QR code generation. If use Levetop"s Serial-Uart development tools, the system MCU can easily pass the contents of the TFT Panel to the Panel driver (Driver) with simple instructions. The LT268B supports an MCU interface TFT Panel with a display resolution of 480 x 320 (HVGA) and provides an SPI or 8-bit MCU interface. Basically this controller meets many small MCU interfaces TFT panel"s application.
Levetop Semiconductor continues to innovate and meet customer needs! Recently we launched Serial-Uart TFT Panel simulator - UI_Emulator. As long as the "UartTFT_Flash.bin" file is designed through Levetop"s Graphic UI Editor(UI_Editor.exe) or the Graphic Integration Compiler(UartTFT_Tool.exe), this simulator can show the same effect once download "UartTFT_Flash.bin" file. That means can be displayed and actually programming to SPI in the UI_Emulator software has the same display effect. To achieve convenient debugging and avoid frequent burning "UartTFT_Flash.bin" file for debugging and waste time.
The LT7688 is an high-performance Uart TFT panel controller. It combines Levetop Semiconductor"s 32bit MCU and TFT Graphics Accelerator - the core architecture of the LT768. LT7688 provides Uart serial communication, allowing the main MCU show pictures on the panel through with simple instructions. Its internal hardware provides graphics acceleration, PIP (Picture-in-Picture), geometry drawing and other features that increase TFT display efficiency and reduce the time it takes for remote MCUs to process graphics display. The display resolutions ranging from 320 x 240 (QVGA) to 1280 x 1024 (SXGA), supporting 16/18bits of the RGB interface.
The LT268 is a Uart panel controller designed for small MCU type TFT panel. Its internal use of Levtop Semiconductor"s 32bit MCU core architecture. The main function is to provide Uart serial communication so that the main MCU can easily show the pictures on the TFT panel through with simple instructions. The LT268 internal hardware and programs provide graphics processing capabilities that increase TFT display efficiency and reduce the time it takes for remote MCUs to process graphics displays.
Levetop Semiconductor uses its own 32-bit MCU - LT32U02 launched Touch capacitive screen IIC interface convert to USB scheme. The existing general capacitive screen touch chip is the use of IIC interface, can not be directly used in Windows or Linux and other computer host systems. Through the LT32U02 of hardware and software can be achieved IIC interface convert into a driver-free USB interface, directly on the general computer using touch screen.
Based on LT678 TFT Graphics acceleration controller and regular MCU, LeveTop launched Industrial Serial Port TFT Panel solution. This solution includes our UI_Editor and UartTFT_Tool which 2 types of integrated develop software. It enables the TFT panel manufacturer, project developer and the customer of the system end in the TFT screen industry to plan the hardware specifications effectively, achieve their own products display on the TFT screen and avoid sophisticated program development that deals with TFT display. We also provide development board, allowing customers to picture, font, GIF animation, music files and other integrated Bin file through the burner burning into SPI Flash. And then by the user with USB-to-RS232 adapter, through our simulation communication software (Uart_Debug.exe) from the PC or Notebook to verify the display effect of the TFT screen for pre-validation. And confirm whether the design is wrong or need to be modified.
LeveTop launched bluetooth BLE integrated chip - LT5928. It is an integrated chip with low cost and low power consumption, assembled by LeveTop"s 32–bits MCU and 2.4GHz bluebooth wireless transceiver. It"s work frequency is up to 72MHz. Also, the chip owns High speed embedded memory, including 64KB Flash Memory 、8KB SRAM、1KB Cache Memory、Full Speed USB 2.0 interface. In addition, various standard communication interfaces are provided,including SPI、I2C、SCI、ADC、analog comparator interface and so on. With good transceiver performance and receiving sensitivity, its lowest operating voltage can be 2.2V. It suitable for a wide range of electronic products transmitted by 2.4G bluetooth, such as Remote control, bracelet, health management, sports management, bluetooth mouse and other personal devices.
LT32U02、LT32A02 are two types of 32–bits MCU with high efficiency and low unit price launched by LeveTop Semiconductor. It contains a 32-bits Reduced instruction(RISC)core of high performance. It"s work frequency is up to 72MHz, and has high speed embedded memory, including 64KB Flash Memory 、8KB SRAM、1KB Cache Memory、Full Speed USB 2.0 (LT32U02) Interface. In addition, various standard communication interfaces are provided,including two SPI、an I2C、a SCI、8 channels Pulse Width Modulation(PWM)with high resolution, an 8 channels 12–bits ADC, 2 channels analog comparator and various channels GPIO interfaces.
LT2305 is an analog front-end capacitive multi-touch screen control chip launched by LevaTop Semiconductor. It adopts LeveTop Semiconductor "s patented touch sensing technology -TPWS( Touch prediction and window sampling) ,which has 4 parallel capacitors to digital converters, series connecting with interface by SPI. The internal registers of LT2305 was set by MCU, and then connected by multiple chips in parallel. Meanwhile, LT2305 can be matched with Graphics acceleration chip - LT768x, as a single touch controller to simplify TFT module design.
LeveTop semiconductor launched LT7680 - a high efficient graphics acceleration display chip of the world"s smallest QFN package. The display resolution it supports can be from 320*240 (QVGA)to 800*600(SVGA). It supports high speed SPI and I2C serial interfaces. In order to achieve multi-layers high resolution display effect, it has 64Mb build-in display memory. It extremely suitable for embedded systems with TFT-LCD display, such as home appliances, industrial control, electronic instruments, medical equipment, man-machine interface, industrial equipment, testing equipment, charging pile, multi-functional transaction machine, elevator indicator, ticket gate indicator and so on.
LeveTop Semiconductor launched a series of high efficient TFT-LCD graphics acceleration display chips called LT768X. It providing performances such as graphics acceleration, PIP (Picture in Picture) , geometric graphics drawing and so on. LT768x not only improve the TFT display efficiency, but also greatly reduce the time required for the MCU to process graphics display.
Ms.Josey
Ms.Josey