2.2 serial spi tft lcd modul display made in china
Structure diagram product picture Shanghai Top Display Optoelectronics (TDO) dedicates to be the leader in Display module, intelligent display program and 3D printing optical engine program, which focus on the professional application market including Industry, Medical, Military, Mapping, charging pile, 3D printing, etc. In addition, we have applied more than 20 patents, including 3 invention patents and 3 software copyright patents, 15 patents in these were authorized. TDO has made a lot of achievements: the Award of The third China Innovation and Entrepreneurship Competition, Shanghai SME Innovation Fund Project, Minghang Industry-University-Research Collaboration, Mihang Patent demonstration project, etc.
TFT LCD module has always been one of the hot products in DIY industry and LCD is basically the necessary products during all projects, at the same time, serial port modules are also the popular ones, because it takes few IO and the usage is simple. This section of the 2.2 inch TFT LCD serial SPI integrated features of compact, SPI interface.
The LCD drive ic is ILI9341. It"s a 240 * 320 (resolution), 2.2 inch TFT LCD screen. The LCD has a wide viewing angle, the contrast is also very suitable.
Specifications:Resolution: 240x320Driver IC: ILI9341Input Voltage: 5V/3.3VSize 2.2 inch, It has PCB backplane with power IC, SD card socketLED Numbers 4 LEDs, Driver IC: ILI9341, Color Depth 262K/65KModule Size:67mm(length)*40mm(width)*4mm(thickness), Active Area: 47.5mm(Length)x36.5mm(Width)How to use it?1. use 5v to led pin, 3.3v to vcc and 1k / 1.5k resistor voltage dividers to get it to work. 1k resistor in series from Arduino to tft logic pin, 1.5k from tft pin to ground.2.#define TFT_DC 9#define TFT_CS 10#define TFT_MOSI 11#define TFT_CLK 13#define TFT_RST 12#define TFT_MISO 83.// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC//ILI9341 tft = ILI9341(TFT_CS, TFT_DC);4.// If using the breakout, change pins as desiredILI9341 tft = ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO).Serial monitor output:1-- ILI9341 Test!Display Power Mode: 0x94MADCTL Mode: 0x48Pixel Format:0x5ImageFormat: 0x80Self Diagnostic: 0xC0Benchmark Time (microseconds)2-- Screen fill 18159720Text 921664Lines 8537648Horiz/Vert Lines 1485756Rectangles (outline) 946520Rectangles (filled) 37689232Circles (filled) 5325780Circles (outline) 3725412Triangles (outline) 1944508Triangles (filled) 12525852Rounded rects (outline) 1782700Rounded rects (filled) 40989648
7 fonts and graphic engine embedded, touch screen and flash chip drivers embedded(if touch screen or 2 to 16MB flash chip installed), custom fonts can be downloaded to the module"s flash.
High level commands set (61 commands total) are easy to remember and understand, eg.: send 5 bytes: "CCabc" will draw a ratio=c pixels circle at coordinate (a,b) on the screen; 5 bytes "DNALL" will put the module to sleep mode(<0.1mA), and more...
TFT LCD module has always been one of the hot products in DIY industry and LCD is basically the necessary products during all projects, at the same time, serial port modules are also the popular ones, because it takes few IO and the usage is simple. This section of the 2.2 inch TFT LCD serial SPI integrated features of compact, SPI interface.
The LCD drive ic is ILI9341. It"s a 240 * 320 (resolution), 2.2 inch TFT LCD screen. The LCD has a wide viewing angle, the contrast is also very suitable.
As a 2inch IPS display module with a resolution of 240 * 320, it uses an SPI interface for communication. The LCD has an internal controller with basic functions, which can be used to draw points, lines, circles, and rectangles, and display English, Chinese as well as pictures.
The 2inch LCD uses the PH2.0 8PIN interface, which can be connected to the Raspberry Pi according to the above table: (Please connect according to the pin definition table. The color of the wiring in the picture is for reference only, and the actual color shall prevail.)
The LCD supports 12-bit, 16-bit, and 18-bit input color formats per pixel, namely RGB444, RGB565, and RGB666 three color formats, this demo uses RGB565 color format, which is also a commonly used RGB format.
For most LCD controllers, the communication mode of the controller can be configured, usually with an 8080 parallel interface, three-wire SPI, four-wire SPI, and other communication methods. This LCD uses a four-wire SPI communication interface, which can greatly save the GPIO port, and the communication speed will be faster.
Note: Different from the traditional SPI protocol, the data line from the slave to the master is hidden since the device only has display requirement.
CPOL determines the level of the serial synchronous clock at idle state. When CPOL = 0, the level is Low. However, CPOL has little effect to the transmission.
CPHA determines whether data is collected at the first clock edge or at the second clock edge of serial synchronous clock; when CPHL = 0, data is collected at the first clock edge.
Framebuffer uses a video output device to drive a video display device from a memory buffer containing complete frame data. Simply put, a memory area is used to store the display content, and the display content can be changed by changing the data in the memory.
If you need to draw pictures, or display Chinese and English characters, we provide some basic functions here about some graphics processing in the directory RaspberryPi\c\lib\GUI\GUI_Paint.c(.h).
Set points of the display position and color in the buffer: here is the core GUI function, processing points display position and color in the buffer.
The fill color of a certain window in the image buffer: the image buffer part of the window filled with a certain color, usually used to fresh the screen into blank, often used for time display, fresh the last second of the screen.
Display time: in the image buffer,use (Xstart Ystart) as the left vertex, display time,you can choose Ascii visual character font, font foreground color, font background color.;
2. The module_init() function is automatically called in the INIT () initializer on the LCD, but the module_exit() function needs to be called by itself
Python has an image library PIL official library link, it do not need to write code from the logical layer like C, can directly call to the image library for image processing. The following will take 1.54inch LCD as an example, we provide a brief description for the demo.
Note: Each character library contains different characters; If some characters cannot be displayed, it is recommended that you can refer to the encoding set ro used.