TFTLCD驱动模块说明SPI
- 格式:pdf
- 大小:148.98 KB
- 文档页数:8
TFTLCD显示原理及驱动介绍TFTLCD是一种液晶显示技术,全称为Thin Film Transistor Liquid Crystal Display,即薄膜晶体管液晶显示器。
它是目前应用最广泛的显示器件之一,被广泛应用在电子产品中,如手机、平板电脑、电视等。
TFTLCD显示屏是由数百万个像素点组成的,每个像素点又包含红、绿、蓝三个亚像素。
这些像素点由一层薄膜晶体管(TFT)驱动。
薄膜晶体管是一种微型晶体管,位于每个像素点的背后,用来控制液晶材料的偏振状态。
当电流通过薄膜晶体管时,液晶分子会受到电场的影响,从而改变偏振方向,使光线在通过液晶层时发生偏转,从而改变像素点的亮度和颜色。
TFTLCD显示屏需要配备驱动电路,用来控制TFT晶体管的电流,以控制液晶分子的偏振状态。
驱动电路通常由一个控制器和一组电荷泵组成。
控制器负责接收来自外部的指令,通过电荷泵为晶体管提供适当的电流。
电荷泵可以产生高电压和低电压,从而控制液晶分子的偏振状态。
控制器通过一组驱动信号,将指令传递给TFT晶体管,控制像素点的亮度和颜色。
TFTLCD驱动器是用来控制TFTLCD显示屏的硬件设备,通常与控制器紧密连接。
驱动器主要负责将控制器发送的信号转换为液晶的电流输出,实现对像素点的亮度和颜色的控制。
驱动器还负责控制像素点之间的互动,以实现高质量的图像显示。
1.扫描电路:负责控制像素点的扫描和刷新。
扫描电路会按照指定的频率扫描整个屏幕,并刷新像素点的亮度和颜色。
2.数据存储器:用于存储显示数据。
数据存储器可以暂时保存控制器发送的图像数据,以便在适当的时候进行处理和显示。
3.灰度调节电路:用于调节像素点的亮度。
通过调节像素点的电流输出,可以实现不同的亮度效果。
4.像素点驱动电路:负责控制像素点的偏振状态。
像素点驱动电路会根据控制器发送的指令,改变液晶分子的偏振方向,从而改变像素点的亮度和颜色。
5.控制线路:用于传输控制信号。
控制线路通常由一组电线组成,将控制器发送的信号传输到驱动器中,以控制整个显示过程。
1.8inch LCD ModuleUSER MANUALOVERVIEWThis product is 1.8inch resistive screen module with resolution 128x160. It has internal controller and uses SPI interface for communication. It has already basic functions: setting the point size, the line thickness, drawing circle, rectangle, and displaying English characters.We provide Raspberry Pi, STM32 and Arduino routines for this product.FEATURESDisplay type: TFTInterface: SPIDriver: ST7735SColors: 256KResolution: 128 x 160 (Pixel)Product size: 56.5 x 34(mm)Display size: 35.4(W) x 28.03(H)(mm)Pixel size: 0.219(W) x 0.219(H)(MM)Operating temperature: -30°C ~ 85°CINTERFACE DESCRIPTIONMarking Description3V3 3.3V powerGND groundDIN SPI data inputCLK SPI clockCS chip selectDC data/commandRST resetBL back lightPROGRAM ANALYSIS1.Working principles:ST7735S is 132 x 162 pixels LCD panel, but the product is 128 x 160 pixels LCD display.In the display there are two processes: the horizontal direction scanning – from the 2nd pixel, the vertical direction scanning – from the 1st pixel. So, you can see that positions of pixels in RAM correspond to their actual positions while displaying.The LCD supports 12-bit, 16-bit and 18-bit per pixel input formats. They correspond to RGB444, RGB565 and RGB666 color formats. This routine uses the RGB565 color format, which is commonly used.LCD uses 4-wired SPI communication interface, which can save a lot of GPIO ports and provides fast data transfer to LCD as well.munication protocolNote: there is a difference from traditional SPI. Here we only need display, so sine wires come from slave to host are hidden. The detailed information please refer to datasheet at page 58RESX: Reset. Pull-down while powering on the module. Generally set as 1IM2: data communication mode pin, which define usage of SPICSX: chip selection control pin. If CS=0 – the chip is selectedD/CX: data/command control pin, if DC=0 – command is written, otherwise – data are writtenSDA: transmitted RGB dataSCL: SPI clockThe SPI communication protocol of the data transmission uses control bits: clock phase (CPHA) and clock polarity (CPOL):The value of CPOL determines the level when the serial synchronous clock is in idle state. CPOL=0, that its idle level is 0.The value of CPHA determines the timing of the data bits relative to the clock pulses. CPHA=0, data is sampled at the first clock pulse edge.The combination of these two parameters provides 4 modes of SPI data transmission. The commonly used is SPI0 mode, it is that GPOL=0 and CPHA=0.From the figure above, SCLK begins to transfer data at the first falling edge. 8 bits data are transferred at one clock period. Use SPI0 mode, High bits transfer first, and LOW bits following. DEMO CODERaspberry Pi, STM32 and Arduino programs are provided, wherein Raspberry Pi provides BCM2835, WiringPi and python programs. It implements common graphical functions as drawing dot, line, rectangle, circle, setting their sizes and line with; filling arias, and displaying English characters of 5 common fonts and other display’s functions.Following instructions are offered for you convenienceRASPBERRY1.Hardware connection1.8inch LCD module Raspberry Pi3.3V 3.3VGND GNDDIN MOSI (PIN 19)CLK SCLK (PIN23)CS CE0 (PIN 8)DC GPIO.6 (PIN 22)RST GPIO.2 (PIN13)BL GPIO.5 (PIN18)2.Enable SPI function of the Raspberry Pisudo raspi-configSelect: Advanced Options -> SPI -> yesActivate SPI hardware driver.3.Installation of librariesFore detailed information about libraries installation, please refer to this page:https:///wiki/Libraries_Installation_for_RPiIt is description of WiringPi, bcm2835 and python libraries installation.ageBCM2835 and WiringPi program should be only copied into directory of Raspberry Pi ()by samba or directly copy to the SD card). The following code are compied directly to the user directory of Pi.4.1Usage of BCM2835Run ls command as you can see below:bin: contains “.o” files.We don’t need to change it generallyFonts: contains 5 commonly used fontsPic: contains pictures used for displaying. The resolution of pictures must be 128x128,otherwise they cannot be displayed properly. And the format of pictures must be BMP.Obj: contains object files, like main.c, LCD_Driver.c, DEV_Config.c, LCD_GUI.c and theirheader files.main.c: The mian function. What need to note is that even though there are LCD_ScanDir used to control the direction of scanning, you need not to change it. Because this module is designed for Raspberry Pi, and for compatibility, we don’t recommend you to change it.DEV_Config.c:Definations of Raspberry Pi’s pins and the communication mode.LCD_Driver.c: Drive code of LCD. Need not change generally.LCD_BMP.c: Reading and analyzing BMP files and display themMakefile: This file contains compilation rules. If there are some changes in code, please run make clean to clean all the dependency file and executable files. Then execute make to compile the whole project and generate new executable files.tftlcd_1in8: executable file, generated by command makeTo run the program, you just need to run this command on terminal: sudo ./tftlcd_1in8 4.2WiringPiInput ls command, now you can see following:T he folders is similar to BCM2835’s. The only differences are that:1.WiringPi oprates by read/write the device files of Linux OS. and the bcm2835 is libraryfunction of Raspberry Pi’s CPU, it operates registers directly. Thus, if you have usedbcm2835 libraries firstly, the usage of WiringPi code will be failed. In this case, you just need to reboot the system and try again.2.Due to the first difference, they underlying configuration are different. In DEV_Config.c,use wiringpiPi and the corresponding wiringPiSPI to provide underlay interfaces.The program executed by command sudo ./tftlcd_1in8 as well4.3PythonInput ls command, you can see that:LCD_1in8.py: Driver code of LCDLCD_Config.py: configuration of hardware underlaying interface.Executing program: sudo python LCD_1in8.pyNote: Some of the OS don’t have image libraries. In this case, you can run: sudo apt-get install python-imaging to install the image library.Image is an image processing library of python, represents any image by an image object.Thus, we can create a blank image by new, its size must be same as the display size of LCD.Then draw picture by Draw library, finally, transfer the image to the LCD. Here usingImage.load() too read RGB888 data of pixel, and convert to RGB565. Scanning every pixel then we could get the whole image for displaying. Its most important code is as below:5.Auto-runInitialize autorun in Raspberry Pi by configuring code of /etc/rc.local file:sudo vim /etc/rc.localBefore exit0 add:sudo python /home/pi/python/demo.py &Important: to place the program /home/pi/python/demo.py at the same director, you can input command pwd to get the path. And & character is necessary at the end of command line, otherwise probable need to reinstall the system (impossible terminate the process by pressing ctrl+c, impossible to login with pi user permission).STM32This demo uses XNUCLEO-F103RB developing board and is based on HAT library.1.Hardware connection1.8inch LCD XNUCLEO-F103RBVCC 3V3GND GNDDIN PA7CLK PA5CS PB6DC PA8RST PA9BL PC72.Expected resultProgram the demo into the development Board. Firstly the screen is refreshed completely, then a solid line, dashed line, open circle, solid circle, rectangle, solid torque are drawn and English characters are shown.ARDUINOUNO PLUS Arduino development board is used here.1.Hardware connection1.8inch LCD Arduino3.3V 3V3GND GNDDIN D11CLK D13CS D10DC D7RST D8BL D92.Due to small global memory 2Kb of UNO PLUS, the display can’t work in graphical mode,but the calling method is the same. Just because there is no enough memory, this demo is not provided.COMPATIBLE CODE PORTINGOffered demo is the commonly used programs, which are able to be ported. They can be used with two screens and the difference is only in initialization of them and their sizes.The usage method is defined by macros. In LCD_Driver.h or in LCD.h:#define LCD_1IN44#define LCD_1in8.As the name of the macros, they are used for 1.44inch and 1.8inch LCD separately. To use for one LCD, just need to comment other one.For example://#define LCD_1IN44#define LCD_1IN8Here we use it for 1.8inch LCD, so we comment the 1.44 macro. After saving, Run make clean to remove dependency files, and then run make to generate new executable files.。
3.2inch TFT Touch ShieldUser ManualOVERVIREThis is a 3.2inch resistive screen TFT LCD, 320x240 resolution, integrate controller on board. It uses SPI interface, can be used to display image, text or draw geometric figure with functions.STM32 and Arduino examples are provided for users.PARAMETERSLCD Type: TFTLCD Interface: SPILCD Controller: ILI9341Touch Screen Controller: XPT2046Touch Screen Type: ResistiveResolution: 320x240 (Pixel)Color Gradation Exponent: 65536INTERFACESymbol Arduino PIN STM32 PIN Description 5V 5V 5V 5V power inputGND GND GND GroundSCLK D13 PA5 SPI clockMISO D12 PA6 SPI data inputMOSI D11 PA7 SPI data outputLCD_CS D10 PB6 LCD chip selectLCD_BL D9 PC7 LCD back lightLCD_RST D8 PA9 LCD resetLCD_DC D7 PA8 LCD data/commandselectionHOW TO USEHARDWARE CONFIGURATION•If there is ICSP interface on Arduino board, set the SPI Config switch to ICSP position.(default)•If Arduino board has no ICSP interface, set the SPI Config switch to the position that SCLK\D13, MISO\D12, MOSI\D11EXAMPLESWe provide Arduino UNO examples and XNUCLEO-F103RB examples for this screen.ARDUINO EXAMPLES1.Download the examples: 3.2inch TFT Touch Shield code.7z, and copy the libraries which arein Arduino\lib folder of examples to the libraries folder which is under the installationdirectory of Arduino.2.Before running the LCD_ShowBMP code, copy the pictures which is in the PIC folder to SDcard.3.Open the LCD_ShowBMP project with Arduino IDE, download to Arduino board.4.The Touch code use four sets of calibration values, could support painting operation in fourdirections. There are five colors which could be chosen on the right. The size of paintbrush is9 by default. Users can also click the AD on screen to calibrate:Please use the stylus click the cross on the screen. The cross will always move until thescreen adjustment is completed.5.According to the prompt, click the red “+” one by one to finish the calibration.STM32 EXAMPLES1.Before running the code that display image. copy the pictures which is in the PIC folder toSD card. Then insert the LCD to NUCLEO or XNUCLEO board.2.Open the project with MDK, download to the NUCLEO or XNUCLEO development board.3.The LCD will first show some general functions: Draw dots, draw dotted line and full line,rectangle, filled rectangle, circle and filled circle. Every figure keeps for 3s. You can change the size of dot, the width of lines and the size of the circles.4.The Touch code use four sets of calibration values, could support painting operation in fourdirections. There are five colors which could be chosen on the right. The size of paintbrush is9 by default. Users can also click the AD on screen to calibrate:Please use the stylus click the cross on the screen. The cross will always move until thescreen adjustment is completed.5.According to the prompt, click the red “+” one by one to finish the calibration.Note:Image: 320x240, 24bit, bmp.SD card: FAT。
2.4寸TFT彩屏使用说明书彩屏驱动IC:ILI9325实验板:LY-51S实验板编写:侯瑞阳2013年01月一、彩屏模块简介屏幕尺寸:2.4寸TFT彩屏分辨率:320x240 262K色接口类型:8位数据接口,接口兼容12864液晶接口,①脚对齐电源类型:5V电源接口,板上有3.3V稳压芯片,不需要电平转换SD卡模式:SPI模式触摸IC:XPT2046图1-1 2.4寸TFT彩屏模块二、彩屏结构组成及原理TFT屏(Thin Film Transistor)是薄膜晶体管型液晶显示屏,它的每一个象素点都是由集成在其后的薄膜晶体管来驱动的,这样不仅提高了显示屏的响应速度,同时可以精确控制显示色阶,所以TFT液晶的色彩更逼真。
TFT屏主要的构成包括:背光源、导光板、偏光板、滤光板、玻璃基板、配向膜、液晶材料、薄膜晶体管等。
图2-1 彩屏的基本结构图2-2 TFT彩屏内部结构TFT液晶模块可以显示数字、中英文字符和图案。
彩色,图案分辨率较高。
由于TFT显示器成本日渐降低,并且人们越来越渴望拥有用户友好程度更高的图形界面,因此有越来越多的工程师把TFT显示器设计到他们的产品中去。
TFT模块尺寸指屏幕的对角线长度。
常用有:1.6、1.8、2.0、2.2、2.4 、2.6、2.8、3.0、3.2、3.4、3.6、4、4.3、5.7 、8.4 、10.4 、15 、17 、19 、21 英寸等。
屏幕高宽比小尺寸TFT模块一般是3:4,大尺寸的也有16:9的。
分辨率指水平像素和垂直像素的数量。
三、学习彩屏的准备知识1、什么是图形和图像图形:如一段直线,在单片机内存储时只需要存储起点X、Y坐标和终点X、Y 坐标,存储量极小,但在显示器上显示时,和图像的显示是一致的,也是通过像素点的组合来显示的。
图3-1 像素点组成图形图像:如一张人物照片,在单片机内存储时需要存储所有像素点的信息,存储量极大,在显示器上显示时,通过像素点的点阵组合来完成显示的图3-2 像素点组成图像2、什么是像素像素:图像的最小组成单位。
一、主旨:今天主要学习的是TFT的基本驱动原理和ASIC的功能介绍。
二、內容:TFT-LCD的面板构造主要分为背光板、下偏光板、液晶、滤光片、上偏光板组成。
每个液晶面板由一个个液晶单元构成,每个单元由TFT、SOURCE线、GATE线、液晶电容、存储电容构成。
TFT有5道光罩制程, 每道的具体制程为GE(Gate层电极)、SE(Gate层绝缘极、Channel、通道与电极之接触界面)、SD(Source/Drain电极)、CH(Contact hole)、PE(画素电极)。
TFT的基本物理特性⏹温度上升-载子飘移率(ufe)亦上升⏹温度上升-临限电压(Vth)下降⏹照光越強-光漏电流(Iph)越大⏹电压频率越高-闸源与电极电容(Cgd, Cgs)越小⏹a-Si:H的能隙为1.7eV(~800nm)⏹a-Si:H的介电常数为11.7⏹SiNx的介电常数为6.9-7.5(根据N的不同比例)TFT的基本驱动原理TFT元件的动作类似一个开关,液晶元件的作用类似一个电容,借开关的ON/OFF对电容存储的电压值进行更新/保持。
SW ON时信号写入(加入、记录)在液晶电容上,在以外时间SW OFF,可防止信号从液晶电容泄漏。
在必要時可将保持电容与液晶电容并联,以改善其保持特性。
信号传输格式主要有四种●Analog interface(类比讯号)—传统的界面,如CRT。
●Digital interface(数字讯号)—TTL/CMOS,最基本的数字信号,优点:最直接的信号,可直接测量;缺点:易受外界干扰,易向外界干扰,消耗功率大。
●LVDS : Low Voltage Differential Signaling(低压差分信号)— 6bits为4对,8bits为5对,摆幅为250、350、450mV,数据传输速度是7倍的CLK速度,使用这种方式可以减少功率消耗及减低EMI。
●RSDS : Reduced Swing Differential Signaling(低摆幅差分信号)—基于LVDS上,一对Data,RSDS的电压摆幅只有200mV,比LVDS更低,减小电源消耗和辐射,减小计算成分和基板的尺寸。