📄 tft.lst
字号:
C51 COMPILER V8.05a TFT 03/14/2009 18:41:31 PAGE 1
C51 COMPILER V8.05a, COMPILATION OF MODULE TFT
OBJECT MODULE PLACED IN tft.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE tft.c LARGE BROWSE DEBUG OBJECTEXTEND
line level source
1 #include "tft.h"
2 #include "stc_spi.h"
3 #include "myfun.h"
4
5 void TFT_Write_Dat(unsigned char dat)
6 {
7 1 TFT_CD=1;
8 1 TFT_CS=0;
9 1 spi_write(dat);
10 1 TFT_CS=1;
11 1 }
12
13 void TFT_Write_Dat_16(unsigned char datH,unsigned char datL)
14 {
15 1 TFT_Write_Dat(datH);
16 1 TFT_Write_Dat(datL);
17 1 }
18
19 void TFT_Write_Cmd(unsigned char cmd)
20 {
21 1 TFT_CD=0;
22 1 TFT_CS=0;
23 1 spi_write(cmd);
24 1 TFT_CS=1;
25 1 }
26
27 void TFT_init()
28 {
29 1 spi_init(4);
30 1
31 1 //TFT_CS=1;
32 1 //TFT_SCLK=0;
33 1 TFT_RST=1;
34 1 delay(100);
35 1 TFT_RST=0;
36 1 delay(5);
37 1 TFT_RST=1;
38 1 delay(100);
39 1
40 1 TFT_Write_Cmd(0x10);
41 1 TFT_Write_Dat_16(0x2f,0x8e);
42 1
43 1 TFT_Write_Cmd(0x11);
44 1 TFT_Write_Dat_16(0x00,0x0c);
45 1
46 1 TFT_Write_Cmd(0x07);
47 1 TFT_Write_Dat_16(0x00,0x21);
48 1
49 1 TFT_Write_Cmd(0x28);
50 1 TFT_Write_Dat_16(0x00,0x06);
51 1
52 1 TFT_Write_Cmd(0x28);
53 1 TFT_Write_Dat_16(0x00,0x05);
54 1
55 1 TFT_Write_Cmd(0x27);
C51 COMPILER V8.05a TFT 03/14/2009 18:41:31 PAGE 2
56 1 TFT_Write_Dat_16(0x05,0x7f);
57 1
58 1 TFT_Write_Cmd(0x29);
59 1 TFT_Write_Dat_16(0x89,0xa1);
60 1
61 1 TFT_Write_Cmd(0x00); //write index, 16bits, high 8 bits is 0x00
62 1 TFT_Write_Dat_16(0x00,0x01); //write instruction, 16bits
63 1 delay(100);
64 1
65 1 TFT_Write_Cmd(0x29);
66 1 TFT_Write_Dat_16(0x80,0xb0);
67 1 delay(30);
68 1
69 1 TFT_Write_Cmd(0x29);
70 1 TFT_Write_Dat_16(0xff,0xfe);
71 1
72 1 TFT_Write_Cmd(0x07);
73 1 TFT_Write_Dat_16(0x00,0x23);
74 1 delay(30);
75 1
76 1 TFT_Write_Cmd(0x07);
77 1 TFT_Write_Dat_16(0x00,0x33);
78 1
79 1 TFT_Write_Cmd(0x01);
80 1 TFT_Write_Dat_16(0x21,0x83);
81 1
82 1 TFT_Write_Cmd(0x2f);
83 1 TFT_Write_Dat_16(0xff,0xff);
84 1
85 1 TFT_Write_Cmd(0x2c);
86 1 TFT_Write_Dat_16(0x80,0x00);
87 1
88 1 TFT_Write_Cmd(0x03);
89 1 TFT_Write_Dat_16(0x68,0x30);
90 1
91 1 TFT_Write_Cmd(0x27);
92 1 TFT_Write_Dat_16(0x05,0x70);
93 1
94 1 TFT_Write_Cmd(0x02);
95 1 TFT_Write_Dat_16(0x03,0x00);
96 1
97 1 TFT_Write_Cmd(0x0b);
98 1 TFT_Write_Dat_16(0x58,0x0c);
99 1
100 1 TFT_Write_Cmd(0x12);
101 1 TFT_Write_Dat_16(0x06,0x09);
102 1
103 1 TFT_Write_Cmd(0x13);
104 1 TFT_Write_Dat_16(0x31,0x00);
105 1
106 1 TFT_Write_Cmd(0x2a);
107 1 TFT_Write_Dat_16(0x1d,0xd0);
108 1
109 1 TFT_Write_Cmd(0x2b);
110 1 TFT_Write_Dat_16(0x0a,0x90);
111 1
112 1 TFT_Write_Cmd(0x2d);
113 1 TFT_Write_Dat_16(0x31,0x0f);
114 1 delay(100);
115 1
116 1 TFT_Write_Cmd(0x45);
117 1 TFT_Write_Dat_16(0x83,0x00);
C51 COMPILER V8.05a TFT 03/14/2009 18:41:31 PAGE 3
118 1 TFT_Write_Cmd(0x44);
119 1 TFT_Write_Dat_16(0x83,0x00);
120 1
121 1 TFT_Write_Cmd(0x21);
122 1 TFT_Write_Dat_16(0x00,0x00);
123 1 TFT_Write_Cmd(0x1e);
124 1 TFT_Write_Dat_16(0x00,0xbf);
125 1
126 1 delay(1);
127 1 TFT_Write_Cmd(0x1e);
128 1 TFT_Write_Dat_16(0x00,0x00);
129 1 delay(100);
130 1 TFT_Write_Cmd(0x45);
131 1 TFT_Write_Dat_16(0x83,0x00);
132 1 TFT_Write_Cmd(0x44);
133 1 TFT_Write_Dat_16(0x83,0x00);
134 1 }
135
136 void TFT_Draw_Point(unsigned char x,unsigned char y,unsigned int color)
137 {
138 1 TFT_Write_Cmd(0x21);
139 1 TFT_Write_Dat_16(y,x);
140 1 TFT_Write_Cmd(0x22); //write data to GRB
141 1 TFT_Write_Dat((unsigned char)(color>>8));
142 1 TFT_Write_Dat((unsigned char)(color&0x00ff));
143 1 }
144
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 526 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- 5
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -