📄 main.lst
字号:
183 4 }
184 3 else//要显示的是汉字
185 3 {
186 4 uchar m;//汉字库中汉字数
187 4 for(m= 0;m<22;m++)
188 4 {
189 5 if((hanz[m].id[0]==Str[i])&&(hanz[m].id[1]==Str[i+1]))
190 5 {
191 6 Show_C_R(x,(y-64),hanz[m].font);
192 6 }
193 5 }
194 4 y+=16;
195 4 i+=2;
196 4 }
197 3 }
198 2 else//左半屏显示
199 2 {
200 3 if((Str[i]>=0x21)&&(Str[i]<=0x7f))//要显示的是英文户或者是特殊符号
201 3 {
202 4 Show_E_L(x,y,(Str[i] - 0x21)*16+ASCIICD);
203 4 y+=8;
204 4 i++;
205 4 }
206 3 else//要显示的是汉字
207 3 {
208 4 uchar m;//汉字库中汉字数
209 4 for(m= 0;m<22;m++)
210 4 {
211 5 if((hanz[m].id[0]==Str[i])&&(hanz[m].id[1]==Str[i+1]))
212 5 {
213 6 Show_C_L(x,y,hanz[m].font);
214 6 }
215 5 }
216 4 y+=16;
217 4 i+=2;
218 4 }
219 3 }
220 2
221 2
222 2 }
223 1 }
224
225 /*************************************************
226 Function: ShowA_L
227 Description: 在左屏上输出单个ASCII码字符
228 Calls: 无
229 Input: x,y在屏上输出的坐标,p输出内容的地址指针
230 Output: 无
231 Return: 无
232 Others:
233 *************************************************/
234 void Show_E_L(uchar x,uchar y,uchar *p)
235 {
236 1 uchar i;
237 1 Set_Init_L(SetXadress(x));
238 1 Set_Init_L(SetYadress(y));
239 1 for(i=0;i<8;i++)
240 1 {
241 2 WR_Data_L(p[i]);
C51 COMPILER V8.02 MAIN 07/25/2008 12:17:39 PAGE 5
242 2 }
243 1 Set_Init_L(SetXadress(x+1));
244 1 Set_Init_L(SetYadress(y));
245 1 for(i=0;i<8;i++)
246 1 {
247 2 WR_Data_L(p[i+8]);
248 2 }
249 1 }
250
251 void Show_E_R(uchar x,uchar y,uchar *p)
252 {
253 1 uchar i;
254 1 Set_Init_R(SetXadress(x));
255 1 Set_Init_R(SetYadress(y));
256 1 for(i=0;i<8;i++)
257 1 {
258 2 WR_Data_R(p[i]);
259 2 }
260 1 Set_Init_R(SetXadress(x+1));
261 1 Set_Init_R(SetYadress(y));
262 1 for(i=0;i<8;i++)
263 1 {
264 2 WR_Data_R(p[i+8]);
265 2 }
266 1 }
267 /*************************************************
268 Function: PrintABC
269 Description: 输出字符串
270 Calls: 无
271 Input: x,y在屏上输出的坐标,p输出内容的地址指针
272 Output: 无
273 Return: 无
274 Others:
275 *************************************************/
276 void PrintABC(uchar x,uchar y,uchar *pAdre)
277 {
278 1 while(*pAdre!='\0')
279 1 {
280 2 if(y>63)
281 2 {
282 3 if(y>127)break;
283 3 Show_E_R(x,(y-64),(*pAdre - 0x21)*16+ASCIICD);
284 3 pAdre++;
285 3 y+=8;
286 3 }
287 2 else
288 2 {
289 3 Show_E_L(x,y,(*pAdre - 0x21)*16+ASCIICD);
290 3 pAdre++;
291 3 y+=8;
292 3 }
293 2 }
294 1 }
295
296 /*************************************************
297 Function: ClearScreen_L
298 Description: 左半屏清屏
299 Calls: 无
300 Input: 无
301 Output: 无
302 Return: 无
303 Others:
C51 COMPILER V8.02 MAIN 07/25/2008 12:17:39 PAGE 6
304 *************************************************/
305
306 void ClearScreen_L(void)
307 {
308 1 uchar x,y;
309 1 for(x=0;x<8;x++)
310 1 {
311 2 Set_Init_L(SetXadress(x));
312 2 Set_Init_L(SetYadress(0));
313 2 for(y=0;y<64;y++)
314 2 {
315 3 WR_Data_L(0x00);
316 3 }
317 2 }
318 1 }
319
320 void ClearScreen_R(void)
321 {
322 1 uchar x,y;
323 1 for(x=0;x<8;x++)
324 1 {
325 2 Set_Init_R(SetXadress(x));
326 2 Set_Init_R(SetYadress(0));
327 2 for(y=0;y<64;y++)
328 2 {
329 3 WR_Data_R(0x00);
330 3 }
331 2 }
332 1 }
333
334 void Lcd_Init()
335 {
336 1 LCDRESET();
337 1
338 1 Set_Init_L(DISP_ON );
339 1 ClearScreen_L();
340 1 Set_Init_L(Startline(0));
341 1
342 1 delay();
343 1
344 1 Set_Init_R(DISP_ON );
345 1 ClearScreen_R();
346 1 Set_Init_R(Startline(0));
347 1 }
348
349 void main ()
350 {
351 1 Lcd_Init();
352 1 PrintHanzi(0, 0,"欢迎使用系统");
353 1 Lcd_Print(2, 0,"hello!asd");
354 1 while(1)
355 1 {
356 2 }
357 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1297 ----
CONSTANT SIZE = 2192 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 38
C51 COMPILER V8.02 MAIN 07/25/2008 12:17:39 PAGE 7
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 + -