📄 lcm12864.lst
字号:
332 /*------------------显示边框-------------------------------*/
333 void Frame()
334 {
335 1 unsigned char x,y;
336 1 lcdfill(0x00);
337 1 for(x=0;x<9;x+=8)
338 1 for(y=0;y<32;y++)
339 1 {
340 2 write_com(0x36);
341 2 write_com(y+0x80); //行地址
342 2 write_com(x+0x80); //列地址
343 2 write_com(0x30);
344 2 write_data(0x80);
345 2 write_data(0x00);
346 2
347 2 write_com(0x36);
348 2 write_com(y+0x80); //行地址
349 2 write_com(x+0x87); //列地址
350 2 write_com(0x30);
351 2 write_data(0x00);
352 2 write_data(0x01);
353 2
354 2 }
355 1 for(y=0;y<2;y++)
356 1 for(x=0;x<8;x++)
357 1 {
358 2 write_com(0x36);
359 2 write_com(y*31+0x80); //行地址
360 2 write_com(x+0x80+8*y); //列地址
361 2 write_com(0x30);
362 2 write_data(0xff);
363 2 write_data(0xff);
364 2 }
365 1 write_com(0x34);
C51 COMPILER V8.16 LCM12864 03/12/2009 04:10:13 PAGE 7
366 1 write_com(0x36);
367 1 }
368
369 /*------------------在第7列的位置加入两条竖线--------------------------*/
370 void shuxian()
371 {
372 1 unsigned char x,y;
373 1
374 1 for(x=0;x<9;x+=8)
375 1 for(y=0;y<32;y++)
376 1 {
377 2 write_com(0x36);
378 2 write_com(y+0x80); //行地址
379 2 write_com(x+0x86); //列地址
380 2 write_com(0x30);
381 2 write_data(0x00);
382 2 write_data(0x14);
383 2 };
384 1 }
385
386 /*------------------清屏命令--------------------------*/
387 void clrscreen()
388 {
389 1 write_com(0x01);
390 1 delay(10);
391 1 }
392
393 /*------------------唐诗《登鹳雀楼》--------------------------*/
394 void gushi_display()
395 {
396 1 write_com(0x30);
397 1 clrscreen();
398 1 write_com(0x80);
399 1 hzkdis("白日依山尽,");
400 1 write_com(0x90+FIRST_ADDR);
401 1 hzkdis("黄河入海流。");
402 1 write_com(0x88+FIRST_ADDR);
403 1 hzkdis("欲穷千里目,");
404 1 write_com(0x98+FIRST_ADDR);
405 1 hzkdis("更上一层楼。");
406 1 write_com(0xb3+FIRST_ADDR);
407 1 hzkdis("登鹳雀楼");
408 1 write_com(0xaa+FIRST_ADDR);
409 1 hzkdis("( 唐 )王之焕");
410 1 }
411
412 main()
413 {
414 1 unsigned char i;
415 1 P0 = 0;
416 1 while(1)
417 1 {
418 2 PSB=0;
419 2 delay(300);
420 2 PSB=1;
421 2 RW=0;
422 2 lcdreset(); //初始化LCD屏
423 2 CGRAM();
424 2 ceshi(); //显示测试字样
425 2 delay(2000);
426 2
427 2 clrgdram();
C51 COMPILER V8.16 LCM12864 03/12/2009 04:10:13 PAGE 8
428 2 clrscreen(); //清屏
429 2 Disp_Img(BMP); //调入一幅图画
430 2 delay(30000);
431 2
432 2 Disp_Img(BMP1); //调入一幅图画
433 2 delay(20000);
434 2
435 2 lcdfill(0xff); //显示全开
436 2 delay(2000);
437 2
438 2 Disp_H_Line(); //显示横条
439 2 delay(2000);
440 2
441 2 lcdfill(0xaa); //显示竖条
442 2 delay(2000);
443 2
444 2 Frame(); //显示边框
445 2 delay(2000);
446 2
447 2 gushi_display(); //显示唐诗
448 2 clrgdram();
449 2
450 2 write_com(0x87); //调用自定义的CGRAM的代码
451 2 write_data(0x00);
452 2 write_data(0x00);
453 2 delay(400);
454 2
455 2 shuxian(); //加入两条竖线
456 2 delay(8000);
457 2 write_com(0x30);
458 2 delay(2000);
459 2
460 2 gushi_display();
461 2 delay(6000);
462 2 for(i=0;i<8;i++) //字符循环左移
463 2 {
464 3 write_com(0x18);
465 3 delay(2000);}
466 2
467 2 gushi_display();
468 2 delay(6000);
469 2 write_com(0x36);
470 2 write_com(0x04); //第一行反白显示
471 2 delay(6000);
472 2 write_com(0x04); //第一行恢复正常
473 2 delay(6000);
474 2 write_com(0x05); //第二行反白显示
475 2 delay(6000);
476 2 write_com(0x05); //第二行恢复正常
477 2 delay(6000);
478 2
479 2 write_com(0x03); //垂直滚动屏幕的内容
480 2 write_com(0x60);
481 2 delay(6000);
482 2 }
483 1 }
484
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1116 ----
CONSTANT SIZE = 2219 ----
C51 COMPILER V8.16 LCM12864 03/12/2009 04:10:13 PAGE 9
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 17
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 + -