当前位置:网站首页>TFTLCD display experiment of mini plate based on punctual atom stm32
TFTLCD display experiment of mini plate based on punctual atom stm32
2022-06-28 04:08:00 【Wanzhang light I】
This chapter will talk about TFTLCD Display experiments , Xiaobai sums up , If there is a mistake , Please give me your advice .
One 、TFTLCD brief introduction
1.TFT-LCD Thin film transistor liquid crystal display .TFT-LCD have : Good brightness 、 High contrast 、 Strong sense of hierarchy 、 Bright color and other characteristics . It's the most mainstream LCD Monitor . It is widely used in various electronic products .
Be careful : The module is 3.3V Powered by electricity , I won't support it 5V Of voltage MCU, If it is 5VMCU, The signal line must be connected in series 120 Ohm resistance is used .
2.2.8 " TFTLCD The schematic diagram of the module is as follows :

In the picture X-,Y-,Y+,X+ Should and XPT2046 Touch screen connection , The schematic diagram of touch screen is as follows :

The interfaces we may use are as follows :
1.CS:TFTLCD Piece of optional signal .
2.WR: towards TFTLCD Write data .
3.RD: from TFTLCD Reading data .
4.D[15:0]( Zero to fifteen means ):16 Bit bidirectional data line .
5.RST: Hard reset TFTLCD.
6.RS: command / Data signs (0, Read and write commands ;1, Read and write data ).
7.BL_CTR: Backlight control signal
8. Touch screen interface signal :T_MISO/T_MOSI/T_PEN/T_CS/T_CLK( These functions need to be determined , If not required, it is not necessary to set ).
3.TFTLCD Modular 8080 Read simultaneously / The process of writing :
1. First write... According to the need / The type of data read , Set up RS For the high ( data )/ low ( command ), And then pull down the selection , Choose ILI9341, And then we read the data , Or write the data set RD/WR For low , then :
(1) Reading data : stay RD The rising edge of , Read the data on the data line ;
(2) Writing data : stay WR The rising edge of , Write data to ILI9341 Inside .
4.TFTLCD The driving process of :

5.ILI9341 use RGB565 Format to store color data :

R5: There are five red ,G6: There are six green ,B5: There are five blue , Together it is RGB565 Format .
for example :0xf800 It is pure red .
6. Instruction Introduction :
(1)0xD3: It's a test LCD Models of tools , Because the model can be tested , Therefore, the portability of the code is enhanced .
(2)0x36: To store access control instructions , It can control the reading and writing direction of the memory , Realization GRAM Self increasing mode , Increase speed
(3)0x2A: From left to right , From top to bottom , Set up x Coordinates of .
(4)0x2B: From left to right , From top to bottom , Set up y Coordinates of .
(5)0x2C: Set the color data .
(6)0x2E: Read video memory , That is, the general color .
7. On hardware ,TFTLCD Module and MiniSTM32 Development board IO The oral correspondence is as follows :
LCD_LED Corresponding PC10;
LCD_CS Corresponding PC9;
LCD _RS Corresponding PC8;
LCD _WR Corresponding PC7;
LCD _RD Corresponding PC6;
LCD _D[17:1] Corresponding PB[15:0];
Two 、 software design
1. Let's first introduce a lcd An important structure of :
typedef struct
{
u16 width; //LCD Width
u16 height; //LCD Height
u16 id; //LCD ID
u8 dir; // Horizontal screen or vertical screen control :0, Vertical screen ;1, Horizontal screen .
u16 wramcmd; // Start writing gram Instructions
u16 setxcmd; // Set up x Coordinate command
u16 setycmd; // Set up y Coordinate command
}_lcd_dev;
//LCD Parameters
extern _lcd_dev lcddev; // management LCD Important parameter
2. Write data functions :
// Write data functions
#define LCD_WR_DATA(data){\
LCD_RS_SET;\
LCD_CS_CLR;\
DATAOUT(data);\
LCD_WR_CLR;\
LCD_WR_SET;\
LCD_CS_SET;\
}
3. Write register command function :
// Write register function
//data: Register values
void LCD_WR_REG(u16 data)
{
LCD_RS_CLR;// Write the address
LCD_CS_CLR;
DATAOUT(data);
LCD_WR_CLR;
LCD_WR_SET;
LCD_CS_SET;
}4. Read register data function :
// read LCD Register data
// Return value : The value read
u16 LCD_RD_DATA(void)
{
u16 t;
GPIOB->CRL=0X88888888; //PB0-7 Pull up input
GPIOB->CRH=0X88888888; //PB8-15 Pull up input
GPIOB->ODR=0X0000; // All output 0
LCD_RS_SET;
LCD_CS_CLR;
LCD_RD_CLR; // Reading data ( When reading registers , There is no need to read 2 Time )
if(lcddev.id==0X8989)delay_us(2);//FOR 8989, Time delay 2us
t=DATAIN;
LCD_RD_SET;
LCD_CS_SET;
GPIOB->CRL=0X33333333; //PB0-7 Pull up output
GPIOB->CRH=0X33333333; //PB8-15 Pull up output
GPIOB->ODR=0XFFFF; // All output high
return t;
} 5. LCD Register operation function
//LCD_Reg: Register number
//LCD_RegValue: Value to write
void LCD_WriteReg(u16 LCD_Reg,u16 LCD_RegValue)
{
LCD_WR_REG(LCD_Reg);
LCD_WR_DATA(LCD_RegValue);
}
// Read register
//LCD_Reg: Register number
// Return value : The value read
u16 LCD_ReadReg(u16 LCD_Reg)
{
LCD_WR_REG(LCD_Reg); // Write the register number to be read
return LCD_RD_DATA();
} 6. Set cursor function :
// Set cursor position
//Xpos: Abscissa
//Ypos: Ordinate
void LCD_SetCursor(u16 Xpos, u16 Ypos)
{
if(lcddev.id==0X9341||lcddev.id==0X5310)
{
LCD_WR_REG(lcddev.setxcmd);
LCD_WR_DATA(Xpos>>8);
LCD_WR_DATA(Xpos&0XFF);
LCD_WR_REG(lcddev.setycmd);
LCD_WR_DATA(Ypos>>8);
LCD_WR_DATA(Ypos&0XFF);
}else if(lcddev.id==0X6804)
{
if(lcddev.dir==1)Xpos=lcddev.width-1-Xpos;// Horizontal screen processing
LCD_WR_REG(lcddev.setxcmd);
LCD_WR_DATA(Xpos>>8);
LCD_WR_DATA(Xpos&0XFF);
LCD_WR_REG(lcddev.setycmd);
LCD_WR_DATA(Ypos>>8);
LCD_WR_DATA(Ypos&0XFF);
}else if(lcddev.id==0X5510)
{
LCD_WR_REG(lcddev.setxcmd);
LCD_WR_DATA(Xpos>>8);
LCD_WR_REG(lcddev.setxcmd+1);
LCD_WR_DATA(Xpos&0XFF);
LCD_WR_REG(lcddev.setycmd);
LCD_WR_DATA(Ypos>>8);
LCD_WR_REG(lcddev.setycmd+1);
LCD_WR_DATA(Ypos&0XFF);
}else
{
if(lcddev.dir==1)Xpos=lcddev.width-1-Xpos;// The horizontal screen is actually turning x,y coordinate
LCD_WriteReg(lcddev.setxcmd, Xpos);
LCD_WriteReg(lcddev.setycmd, Ypos);
}
}Due to too much actual code , Commentable QQ, I'll send you the source file , I am writing 51 and 32 Writing code , You can have a private chat .
边栏推荐
- How to write a software test report? Here comes the third party performance report template
- La norme européenne en 597 - 1 pour les meubles est - elle la même que les deux normes en 597 - 2 pour les ignifuges?
- 03 summary of various additions, updates and deletions of mongodb documents
- 等保2.0密码要求是什么?法律依据有哪些?
- Analyzing the comprehensive application ability of educational robot
- 软件测试报告怎么编写?第三方性能报告范文模板来了
- 第一个.net core MVC项目
- Pointer linked list
- 基于arm5718的Shell脚本参数传递的2种方法
- 光的粒子说(光电效应/康普顿效应)
猜你喜欢

Pycharm setting pseudo sublime color scheme

领歌leangoo敏捷看板工具新增导出卡片文档和粘贴共享脑图节点功能

Door level modeling - learning notes

Talking about cloud primitiveness, we have to talk about containers

Principle and Simulation of switching power supply buck circuit

Web APIs DOM event foundation dark horse programmer

PyCharm设置仿sublime配色方案

开关电源—Buck电路原理及其仿真

多项目开发入门,基础设计 类库项目使用

Analyzing the comprehensive application ability of educational robot
随机推荐
错排兼排列组合公式
applicationContext.getBeansOfType 获取一个接口下所有实现类 执行方法或者获取实现类对象等 操作应用场景学习总结
用一个栈实现另一个栈的排序
Arrangement of basic electrical knowledge (II)
leetcode - 329. 矩阵中的最长递增路径
Market competitiveness of robot programming education
Does the applet image component not display pictures?
English notes - cause and effect
Building log analysis system with elk (III) -- Security Authentication
Chapter 14 AC-DC power supply front stage circuit note I
Leetcode: monotonic stack structure (Advanced)
指针链表
几个重要的物理概念
【Linux】【Mysql】ERROR 1698 (28000): Access denied for user ‘root‘@‘localhost‘
A solution to the inefficiency of setting debug mode in developing flask framework with pychar
门级建模—学习笔记
GenICam GenTL 标准 ver1.5(2)
05 mongodb summary of various column operations
Unity C # e-learning (11) -- custom protocol generation tool
Conversion between decimal and BCD codes in C language