📄 tft.lst
字号:
C51 COMPILER V7.02a TFT 12/22/2010 21:07:55 PAGE 1
C51 COMPILER V7.02a, 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
stmt level source
1
2 #include "tft.h"
3 unsigned char mode;
4 void ClearScreen(unsigned int x0,unsigned int xlong,unsigned int y0,unsigned int ylong,unsigned int bColor
-)
5 {
6 1 unsigned int i,j;
7 1 LCD_SetPos(x0,x0+xlong,y0,y0+ylong);//320x240
8 1 for (i=y0;i<ylong;i++)
9 1 {
10 2
11 2 for (j=x0;j<xlong;j++)
12 2 Write_Data_U16(bColor);
13 2
14 2 }
15 1 }
16
17 //////////////////////////////////////////////////////////////////////////////////////////////
18 #include "8X16.h"
19 void LCD_PutChar8x16(unsigned short x, unsigned short y, char c, unsigned int fColor, unsigned int bColor)
20 {
21 1 unsigned int i,j;
22 1 unsigned short x0,y0;
23 1 if(mode==0)
24 1 {x0=x;
25 2 y0=y;
26 2 for(i=0; i<16;i++)
27 2 {
28 3 unsigned char m=Font8x16[c*16+i];
29 3 for(j=0;j<8;j++)
30 3 {
31 4 if((m&0x80)==0x80)
32 4 {
33 5 LCD_SetPos(x0+j,x0+j,y0+i,y0+i);
34 5 Write_Data_U16(fColor);
35 5 }
36 4 m<<=1;
37 4 }
38 3 }
39 2 }
40 1 if(mode)
41 1 {
42 2 LCD_SetPos(x,x+8-1,y,y+16-1);
43 2 for(i=0; i<16;i++)
44 2 {
45 3 unsigned char m=Font8x16[c*16+i];
46 3 for(j=0;j<8;j++)
47 3 {
48 4 if((m&0x80)==0x80)
49 4 {
50 5 Write_Data_U16(fColor);
51 5 }
52 4 else
53 4 {
54 5 Write_Data_U16(bColor);
C51 COMPILER V7.02a TFT 12/22/2010 21:07:55 PAGE 2
55 5 }
56 4 m<<=1;
57 4 }
58 3 }
59 2 }
60 1 /*unsigned int i,j;
61 1 LCD_SetPos(x,x+8-1,y,y+16-1);
62 1 for(i=0; i<16;i++) {
63 1 unsigned char m=Font8x16[c*16+i];
64 1 for(j=0;j<8;j++) {
65 1 if((m&0x80)==0x80) {
66 1 Write_Data_U16(fColor);
67 1 }
68 1 else {
69 1 Write_Data_U16(bColor);
70 1 //LCD_SetPos(x+j,x+j,y+i,y+i);
71 1 }
72 1
73 1 m<<=1;
74 1 }
75 1 }
76 1 */
77 1 }
78
79
80 void LCD_PutChar(unsigned short x, unsigned short y, char c, unsigned int fColor, unsigned int bColor) {
81 1
82 1 LCD_PutChar8x16( x, y, c, fColor, bColor );
83 1 }
84
85
86 /*#include "GB1616.h" //16*16汉字字模
87
88 void PutGB1616(unsigned short x, unsigned short y, unsigned char c[2], unsigned int fColor,unsigned int b
-Color){
89 unsigned int i,j,k;
90
91 LCD_SetPos(x, x+16-1,y, y+16-1);
92
93 for (k=0;k<80;k++) { //64标示自建汉字库中的个数,循环查询内码
94 if ((codeGB_16[k].Index[0]==c[0])&&(codeGB_16[k].Index[1]==c[1])){
95 for(i=0;i<32;i++) {
96 unsigned short m=codeGB_16[k].Msk[i];
97 for(j=0;j<8;j++) {
98 if((m&0x80)==0x80) {
99 Write_Data_U16(fColor);
100 }
101 else {
102 Write_Data_U16(bColor);
103 }
104 m<<=1;
105 }
106 }
107 }
108 }
109 }
110
111 void PutGB3232(unsigned short x, unsigned short y, unsigned char c[2], unsigned int fColor,unsigned int b
-Color)
112 {
113 unsigned int i,j,k;
114
C51 COMPILER V7.02a TFT 12/22/2010 21:07:55 PAGE 3
115 LCD_SetPos(x, x+32-1,y, y+32-1);
116
117 for (k=0;k<50;k++) { //15标示自建汉字库中的个数,循环查询内码
118 if ((codeGB_32[k].Index[0]==c[0])&&(codeGB_32[k].Index[1]==c[1])){
119 for(i=0;i<128;i++) {
120 unsigned short m=codeGB_32[k].Msk[i];
121 for(j=0;j<8;j++) {
122 if((m&0x80)==0x80) {
123 Write_Data_U16(fColor);
124 }
125 else {
126 Write_Data_U16(bColor);
127 }
128 m<<=1;
129 }
130 }
131 }
132 }
133 }
134 */
135 void LCD_PutString(unsigned short x, unsigned short y, unsigned char *s, unsigned int fColor, unsigned int
- bColor) {
136 1 unsigned char l=0;
137 1 while(*s) {
138 2 if( *s < 0x80)
139 2 {
140 3 LCD_PutChar(x+l*8,y,*s,fColor,bColor);
141 3 s++;l++;
142 3 }
143 2 else
144 2 {
145 3 PutGB1616/*PutGB3232*/(x+l*8,y,(unsigned char*)s,fColor,bColor);
146 3 s+=2;l+=2;
147 3 }
148 2 }
149 1 }
150
151
152 //=======================================================//
153
154
155
156 void Write_Cmd_Data (unsigned char x,unsigned int y)
157 {
158 1 unsigned char m,n;
159 1 m=y>>8;
160 1 n=y;
161 1 Write_Cmd(0x00,x);
162 1 Write_Data(m,n);
163 1
164 1 }
165
166
167 void Write_Data_U16(unsigned int y)
168 {
169 1 unsigned char m,n;
170 1 m=y>>8;
171 1 n=y;
172 1 Write_Data(m,n);
173 1
174 1 }
175 //====================== 写命令 ==========================//
C51 COMPILER V7.02a TFT 12/22/2010 21:07:55 PAGE 4
176
177 void Write_Cmd(unsigned char DH,unsigned char DL)
178 {
179 1
180 1
181 1
182 1 CS=0;
183 1 RS=0;
184 1
185 1 P2=DH;
186 1 RW=0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -