tft lcd display code mplab made in china

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).

The ST7789 display module shown in project circuit diagram has 7 pins: (from right to left): GND (ground), VCC, SCL (serial clock), SDA (serial data), RES (reset), DC (or D/C: data/command) and BLK (back light).

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.

To connect the Arduino to the display module, I used voltage divider for each line which 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.

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).

tft lcd display code mplab made in china

ILI9341 is a 262,144-color single-chip SOC driver for a-TFT liquid crystal display with resolution of 240RGBx320 dots, comprising a 720-channel source driver, a 320-channel gate driver, 172,800 bytes GRAM for graphic display data of 240RGBx320 dots, and power supply circuit. ILI9341 supports parallel 8-/9-/16-/18-bit data bus MCU interface, 6-/16-/18-bit data bus RGB interface and 3-/4-line serial peripheral interface (SPI). The moving picture area can be specified in internal GRAM by window address function. The specified window area can be updated selectively, so that moving picture can be displayed simultaneously independent of still picture area.

You can find ILI9341-based TFT displays in various sizes on eBay and Aliexpress. The one I chose for this tutorial is 2.2″ length along the diagonal, 240×320 pixels resolution, supports SPI interface, and can be purchased for less than $10.

Note that we will be using the hardware SPI module of the ESP8266 to drive the TFT LCD. The SPI communication pins are multiplexed with I/O pins D5 (SCK), D6 (MISO), and D7 (MOSI). The chip select (CS) and Data/Command (DC) signal lines are configurable through software.

For ILI9341-based TFT displays, there are some options for choosing the library for your application. The most common one is using Bodmer. We will use this library in this tutorial. So go ahead and download the

Configuration of the library font selections, pins used to interface with the TFT and other features is made by editting the User_Setup.h file in the library folder. Fonts and features can easily be disabled by commenting out lines.

Now you are all set to try out tons of really cool built-in examples that come with the library. The following output corresponds to the TFT_Pie_Chart example.

My favorite example is TFT terminal, which implements a simple “Arduino IDE Serial Monitor” like serial receive terminal for monitoring debugging messages from another Arduino or ESP8266 board.

tft lcd display code mplab made in china

Shenzhen SLS Industrial Co.,Ltd, established in 2016, is a professional LCD manufacturer and solution provider from China. Our products range includes TFT LCD, embedded graphics display, special strip display and industrial capacitive touch panel. In 2016, we started to design and produce LCD displays and capacitive touch panel, and developed our own brand PANASYS.

And In 2021, we now have 3 full-auto COG bonding line that can support produce LCD displays from 0.9’’ to 17.6’’. Also we have our independent developed intelligent displays series, FTDI Series, Industrial Linux Systems and HDMI Adapter Board Series.

tft lcd display code mplab made in china

Development Environment (IDE) and Studio includes a built-in GCC compiler. The powerful MPLAB Code Configurator and Atmel START code configuration tools generate factory-validated C-code, enabling quick design.

tft lcd display code mplab made in china

In recent time, China domestic companies like BOE have overtaken LCD manufacturers from Korea and Japan. For the first three quarters of 2020, China LCD companies shipped 97.01 million square meters TFT LCD. And China"s LCD display manufacturers expect to grab 70% global LCD panel shipments very soon.

BOE started LCD manufacturing in 1994, and has grown into the largest LCD manufacturers in the world. Who has the 1st generation 10.5 TFT LCD production line. BOE"s LCD products are widely used in areas like TV, monitor, mobile phone, laptop computer etc.

TianMa Microelectronics is a professional LCD and LCM manufacturer. The company owns generation 4.5 TFT LCD production lines, mainly focuses on making medium to small size LCD product. TianMa works on consult, design and manufacturing of LCD display. Its LCDs are used in medical, instrument, telecommunication and auto industries.

TCL CSOT (TCL China Star Optoelectronics Technology Co., Ltd), established in November, 2009. TCL has six LCD panel production lines commissioned, providing panels and modules for TV and mobile products. The products range from large, small & medium display panel and touch modules.

Everdisplay Optronics (Shanghai) Co.,Ltd.(EDO) is a company dedicated to production of small-to-medium AMOLED display and research of next generation technology. The company currently has generation 4.5 OLED line.

Established in 1996, Topway is a high-tech enterprise specializing in the design and manufacturing of industrial LCD module. Topway"s TFT LCD displays are known worldwide for their flexible use, reliable quality and reliable support. More than 20 years expertise coupled with longevity of LCD modules make Topway a trustworthy partner for decades. CMRC (market research institution belonged to Statistics China before) named Topway one of the top 10 LCD manufactures in China.

Founded in 2006, K&D Technology makes TFT-LCM, touch screen, finger print recognition and backlight. Its products are used in smart phone, tablet computer, laptop computer and so on.

The Company engages in the R&D, manufacturing, and sale of LCD panels. It offers LCD panels for notebook computers, desktop computer monitors, LCD TV sets, vehicle-mounted IPC, consumer electronics products, mobile devices, tablet PCs, desktop PCs, and industrial displays.

Founded in 2008,Yunnan OLiGHTEK Opto-Electronic Technology Co.,Ltd. dedicated themselves to developing high definition AMOLED (Active Matrix-Organic Light Emitting Diode) technology and micro-displays.

tft lcd display code mplab made in china

The Microchip PIC24 is a 16-bit microcontroller that integrates a high-performance graphics controller capable of driving QVGA (320x240) or WQVGA (up to 480x272) color LCD display touch panels that are controllerless, USB OTG modules, as well as a broad range of peripherals. Example hardware and software has been developed by Microchip to demonstrate the PIC24s graphics capability. The PIC24 used in the PIC24FJ256DA210 Development Board have sufficient internal RAM (96Kbytes) to support graphics with 8 BPP (bit per pixel) color depth and with an external RAM device up to 16 BPP is possible. With relatively minor source code revisions and a custom interface board, this project leverages the Microchip developed hardware and software to interface a Newhaven Display International 3.5" QVGA color LCD display touch panel to a PIC24.

Newhaven Display International offers a readily available 3.5" color LCD with touch screen, sans controller. A combination of a Microchip demonstration board, the Newhaven LCD, and a custom interface board constitute a complete display demonstration project.

The demonstration software shows the capabilities of the PIC24 driving (16 BPP color depth) a Newhaven Display International controllerless LCD graphics board. The start up splash screen is a bitmap image. The subsequent screens demonstrate the widgets of the Microchip Graphics Library to show various application screens that can be easily made with the library. Also, Microchip makes available a visual design tool to create your own graphical user interface screens for Microchip microcontrollers, the Graphics Display Designer (GDD).

DKSB1014B-ND is now available from Digi-Key, uniting display NHD-3.5-320240MF-ATXL#-T-1-ND with interface adapter board NHD-3.5-320240MF-PICADAPTER-ND.

The Microchip Libraries for Applications (MLA) includes a broad range of software libraries. Projects are provided that support many Microchip development and evaluation boards. The demonstration software referenced in this eewiki article leverages the “Multi-App” project files to drive the display and also support the USB Mass Storage Device class, allowing the viewing of stored graphic files from a Flash stick. Only one new and one revised file are required to successfully drive the Newhaven 3.5” QVGA display.

Complete project Multi-App_NHD_QVGA.zip (4.8 MB) includes a single project configuration and relevant source files that were provided in the original “Multi-App” folder (note: this is an MPLAB X project). The multiple project configurations and configuration files not necessary in this build have been removed to reduce the zip file size. Of course, these omitted files are available in the “Multi-App” folder that is included in the MLA download.

Several lines of code are added to the HardwareProfile.h file to support the Newhaven display. The code snippet below will include the header file that defines the use of the Newhaven display.

It is left to the reader to install and familiarize themselves with MPLAB X IDE, the XC16 compiler, and hardware connections from/to the PIC24 development kit.

Open MPLAB X IDE, connect the hardware to your computer, select “Open Project”. Assuming that the MLA is installed in its default location, navigate to folder “Microchip_solutions_v2013-06-15\Graphics\Multi-App_NHD_QVGA” and select project “MPLAB.X”. Open the project properties to verify hardware and software tool selection matches your installation. Make and Program device.

AN1368 “Developing Embedded Graphics Applications using PIC(r) Microcontrollers with Integrated Graphics Controller”. This application note delves into using PIC devices with an integrated graphics controller, but it also provides background information on basic color science, display terminology, display power sequencing, and resistive touch screens.

tft lcd display code mplab made in china

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.

As the code is a bit longer and for better understanding I will post the source code of the program in sections with description for each section. And at the end of this article I will post the complete source 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.

Ok next is the RGB LED Control example. If we press the second button, the drawLedControl() custom function will be called only once for drawing the graphic of that example and the setLedColor() custom function will be repeatedly called. In this function we use the touch screen to set the values of the 3 sliders from 0 to 255. With the if statements we confine the area of each slider and get the X value of the slider. So the values of the X coordinate of each slider are from 38 to 310 pixels and we need to map these values into values from 0 to 255 which will be used as a PWM signal for lighting up the LED. If you need more details how the RGB LED works you can check my particular tutorialfor that. The rest of the code in this custom function is for drawing the sliders. Back in the loop section we only have the back button which also turns off the LED when pressed.

In order the code to work and compile you will have to include an addition “.c” file in the same directory with the Arduino sketch. This file is for the third game example and it’s a bitmap of the bird. For more details how this part of the code work  you can check my particular tutorial. Here you can download that file: