📄 9325tp.lst
字号:
C51 COMPILER V7.06 9325TP 12/29/2009 09:12:51 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE 9325TP
OBJECT MODULE PLACED IN 9325TP.OBJ
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE 9325TP.C BROWSE DEBUG OBJECTEXTEND
stmt level source
1
2 #include"reg52.h"
3
4 #define WINDOW_XADDR_START 0x0050 // Horizontal Start Address Set
5 #define WINDOW_XADDR_END 0x0051 // Horizontal End Address Set
6 #define WINDOW_YADDR_START 0x0052 // Vertical Start Address Set
7 #define WINDOW_YADDR_END 0x0053 // Vertical End Address Set
8 #define GRAM_XADDR 0x0020 // GRAM Horizontal Address Set
9 #define GRAM_YADDR 0x0021 // GRAM Vertical Address Set
10 #define GRAMWR 0x0022 // memory write
11
12 /* LCD color */
13 #define White 0xFFFF
14 #define Black 0x0000
15 #define Blue 0x001F
16 #define Blue2 0x051F
17 #define Red 0xF800
18 #define Magenta 0xF81F
19 #define Green 0x07E0
20 #define Cyan 0x7FFF
21 #define Yellow 0xFFE0
22
23 sbit CS=P2^2; //片选
24 sbit RES=P2^1; //复位
25 sbit RS=P2^4; //数据/命令选择
26 sbit RW=P2^5;
27 //数据口使用P0
28 //====================================================//
29
30 void main (void);
31 void ILI9325_Initial(void);
32 void show_colour_bar (void);
33 void Write_Cmd_Data(unsigned char x, unsigned int y);
34 void Write_Cmd(unsigned char DH,unsigned char DL);
35 void Write_Data(unsigned char DH,unsigned char DL);
36 void delayms(unsigned int tt);
37 void show_photo(void);
38 void Show_RGB (unsigned int x0,unsigned int x1,unsigned int y0,unsigned int y1,unsigned int Color);
39 unsigned char code pic[];
40 void Write_Data_U16(unsigned int y);
41 static void LCD_SetPos(unsigned int x0,unsigned int x1,unsigned int y0,unsigned int y1);
42 void ClearScreen(unsigned int bColor);
43 void LCD_PutChar8x16(unsigned short x, unsigned short y, char c, unsigned int fColor, unsigned int bColor)
-;
44 void LCD_PutChar(unsigned short x, unsigned short y, char c, unsigned int fColor, unsigned int bColor);
45 void LCD_PutString(unsigned short x, unsigned short y, char *s, unsigned int fColor, unsigned int bColor);
46
47 void LCD_PutChar8x8(unsigned short x, unsigned short y, char c, unsigned int fColor, unsigned int bColor);
48 void PutGB1616(unsigned short x, unsigned short y, unsigned char c[2], unsigned int fColor,unsigned int b
-Color);
49 void PutGB3232(unsigned short x, unsigned short y, unsigned char c[2], unsigned int fColor,unsigned int b
-Color);
50 //================================================//
51
52 void main(void)
C51 COMPILER V7.06 9325TP 12/29/2009 09:12:51 PAGE 2
53 {
54 1 CS=1;
55 1 delayms(5);
56 1 RES=0;
57 1 delayms(5);
58 1 RES=1;
59 1 delayms(5);
60 1 ILI9325_Initial();
61 1 while(1)
62 1 {
63 2
64 2
65 2
66 2 ClearScreen(0x00FF);
67 2
68 2 //show_colour_bar();
69 2
70 2
71 2 LCD_PutString(40,40,"www.doflye.net",Red,Blue); ///前景颜色和背景颜色,可以直接预定义,也
-可以直接填入16进制数字
72 2 LCD_PutString(40,60,"I LOVE MY JOB ",Blue2,Yellow);
73 2 LCD_PutString(10,80,"上海浩豚电子科技有限公司",Magenta,Green);
74 2 LCD_PutString(40,100,"专业技术支持论坛",0x07e0,0xf800);
75 2 LCD_PutString(40,120,"专业开发板工控板",0x001f,0xf800);
76 2 LCD_PutString(40,140,"1234567890",0x001f,0xf800);
77 2 LCD_PutString(0,160,"abcdefghijklmnopqistuvwxyz",0x001f,0xf800);
78 2 LCD_PutString(0,180,"`,./<>';:[]{}\|?)(-=+*&^%$",0x001f,0xf800);
79 2 PutGB3232(0,200,"我",Blue,Yellow); //写入32x32汉字
80 2 PutGB3232(40,200,"爱",Blue,Red);
81 2 PutGB3232(80,200,"单",Blue,Magenta);
82 2 PutGB3232(120,200,"片",Blue,Green);
83 2 PutGB3232(160,200,"机",Blue,Cyan);
84 2 // show_photo();
85 2
86 2 while(1);
87 2
88 2
89 2 }
90 1 }
91
92
93 void ClearScreen(unsigned int bColor)
94 {
95 1 unsigned int i,j;
96 1 LCD_SetPos(0,240,0,320);//320x240
97 1 for (i=0;i<320;i++)
98 1 {
99 2
100 2 for (j=0;j<240;j++)
101 2 Write_Data_U16(bColor);
102 2
103 2 }
104 1 }
105
106 /////////////////////////////////////////////////////////////
107 #include "8X16.h"
108 void LCD_PutChar8x16(unsigned short x, unsigned short y, char c, unsigned int fColor, unsigned int bColor)
109 {
110 1 unsigned int i,j;
111 1 LCD_SetPos(x,x+8-1,y,y+16-1);
112 1 for(i=0; i<16;i++) {
113 2 unsigned char m=Font8x16[c*16+i];
C51 COMPILER V7.06 9325TP 12/29/2009 09:12:51 PAGE 3
114 2 for(j=0;j<8;j++) {
115 3 if((m&0x80)==0x80) {
116 4 Write_Data_U16(fColor);
117 4 }
118 3 else {
119 4 Write_Data_U16(bColor);
120 4 }
121 3 m<<=1;
122 3 }
123 2 }
124 1 }
125
126
127 void LCD_PutChar(unsigned short x, unsigned short y, char c, unsigned int fColor, unsigned int bColor) {
128 1
129 1 LCD_PutChar8x16( x, y, c, fColor, bColor );
130 1 }
131
132
133 #include "GB1616.h" //16*16汉字字模
134
135 void PutGB1616(unsigned short x, unsigned short y, unsigned char c[2], unsigned int fColor,unsigned int b
-Color){
136 1 unsigned int i,j,k;
137 1
138 1 LCD_SetPos(x, x+16-1,y, y+16-1);
139 1
140 1 for (k=0;k<64;k++) { //64标示自建汉字库中的个数,循环查询内码
141 2 if ((codeGB_16[k].Index[0]==c[0])&&(codeGB_16[k].Index[1]==c[1])){
142 3 for(i=0;i<32;i++) {
143 4 unsigned short m=codeGB_16[k].Msk[i];
144 4 for(j=0;j<8;j++) {
145 5 if((m&0x80)==0x80) {
146 6 Write_Data_U16(fColor);
147 6 }
148 5 else {
149 6 Write_Data_U16(bColor);
150 6 }
151 5 m<<=1;
152 5 }
153 4 }
154 3 }
155 2 }
156 1 }
157
158 #include "GB3232.h" //32*32汉字字模
159
160 void PutGB3232(unsigned short x, unsigned short y, unsigned char c[2], unsigned int fColor,unsigned int b
-Color){
161 1 unsigned int i,j,k;
162 1
163 1 LCD_SetPos(x, x+32-1,y, y+32-1);
164 1
165 1 for (k=0;k<5;k++) { //5标示自建汉字库中的个数,循环查询内码
166 2 if ((codeGB_32[k].Index[0]==c[0])&&(codeGB_32[k].Index[1]==c[1])){
167 3 for(i=0;i<128;i++) {
168 4 unsigned short m=codeGB_32[k].Msk[i];
169 4 for(j=0;j<8;j++) {
170 5 if((m&0x80)==0x80) {
171 6 Write_Data_U16(fColor);
172 6 }
173 5 else {
C51 COMPILER V7.06 9325TP 12/29/2009 09:12:51 PAGE 4
174 6 Write_Data_U16(bColor);
175 6 }
176 5 m<<=1;
177 5 }
178 4 }
179 3 }
180 2 }
181 1 }
182
183 void LCD_PutString(unsigned short x, unsigned short y, unsigned char *s, unsigned int fColor, unsigned int
- bColor) {
184 1 unsigned char l=0;
185 1 while(*s) {
186 2 if( *s < 0x80)
187 2 {
188 3 LCD_PutChar(x+l*8,y,*s,fColor,bColor);
189 3 s++;l++;
190 3 }
191 2 else
192 2 {
193 3 PutGB1616(x+l*8,y,(unsigned char*)s,fColor,bColor);
194 3 s+=2;l+=2;
195 3 }
196 2 }
197 1 }
198 //==================== 显示R G B 顔色 ====================//
199
200
201
202 void Show_RGB (unsigned int x0,unsigned int x1,unsigned int y0,unsigned int y1,unsigned int Color)
203 {
204 1 unsigned int i,j;
205 1 //address_set();
206 1 LCD_SetPos(x0,x1,y0,y1);
207 1 for (i=y0;i<=y1;i++)
208 1 {
209 2 for (j=x0;j<=x1;j++)
210 2 Write_Data_U16(Color);
211 2
212 2 }
213 1
214 1
215 1 }
216
217 //====================== 显示彩条 ======================//
218 void show_colour_bar (void)
219
220 {
221 1 int V,H;
222 1 LCD_SetPos(0,240,0,320);//320x240
223 1
224 1 for(H=0;H<240;H++)
225 1 {
226 2 for(V=0;V<40;V++)
227 2 Write_Data(0xf8,0x00);
228 2 }
229 1
230 1 for(H=0;H<240;H++)
231 1 {
232 2 for(V=40;V<80;V++)
233 2 Write_Data(0x07,0xe0);
234 2 }
C51 COMPILER V7.06 9325TP 12/29/2009 09:12:51 PAGE 5
235 1
236 1 for(H=0;H<240;H++)
237 1 {
238 2 for(V=80;V<120;V++)
239 2 Write_Data(0x00,0x1f);
240 2 }
241 1
242 1 for(H=0;H<240;H++)
243 1 {
244 2 for(V=120;V<160;V++)
245 2 Write_Data(0xff,0xe0);
246 2 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -