找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 3508|回复: 1
打印 上一主题 下一主题
收起左侧

160*128LCD图文显示仿真带单片机源码

[复制链接]
跳转到指定楼层
楼主
仿真原理图如下(proteus仿真工程文件可到本帖附件中下载)


  1. #include <LCD_160128.h>
  2. #include <stdio.h>
  3. extern void cls();
  4. extern uchar LCD_Initialise();
  5. extern uchar LCD_Write_Command(uchar cmd);
  6. extern uchar LCD_Write_Command_P2(uchar cmd,uchar para1,uchar para2);
  7. extern uchar LCD_Write_Data(uchar dat);
  8. extern void Set_LCD_POS(uchar row,uchar col);
  9. extern void Line(uchar x1,uchar y1,uchar x2,uchar y2,bit Mode);
  10. extern uchar Display_Str_at_xy(uchar x,uchar y,char *fmt);

  11. extern uchar code LCD_WIDTH;
  12. extern uchar code LCD_HEIGHT;
  13. sbit S1 = P1^0;
  14. sbit S2 = P1^1;
  15. sbit S3 = P1^2;
  16. sbit S4 = P1^3;

  17. uchar code ImageX[]=
  18. {
  19.          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  20.         0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  21. };

  22. uchar Current_Operation = 0;
  23. uchar Statistics_Data[]={20,70,80,40,90,65,30};

  24. void Draw_Bar_Graph(uchar d[])
  25. {
  26.          uchar i,h;
  27.         Line(4,2,4,100,1);
  28.         Line(4,100,158,100,1);
  29.         Line(4,2,1,10,1);
  30.         Line(4,2,7,10,1);
  31.         Line(158,100,152,97,1);
  32.         Line(158,100,152,103,1);
  33.         for(i=0;i<7;i++)
  34.         {
  35.                  h=100-d[i];
  36.                 Line(10+i*20,h,10+i*20,100,1);
  37.                 Line(10+i*20,h,10+i*20+15,h,1);
  38.                 Line(10+i*20+15,h,10+i*20+15,100,1);
  39.         }
  40. }

  41. void main()
  42. {
  43.          uchar i,j,m,c=0;uint k,x;
  44.         LCD_Initialise();
  45.         Set_LCD_POS(0,0);
  46.         cls();
  47.         while(1)
  48.         {
  49.                  if(S1==0) Current_Operation = 1;
  50.                 if(S2==0) Current_Operation = 2;
  51.                 if(S3==0) Current_Operation = 3;
  52.                 if(S4==0) Current_Operation = 4;
  53.                 if(c==Current_Operation) goto delayx;
  54.                 c=Current_Operation;
  55.                 switch(Current_Operation)
  56.                 {
  57.                          case 1:
  58.                         case 2:
  59.                                         LCD_Write_Command_P2(LC_GRH_STP,0x00,0x00);
  60.                                         for(i=0;i<LCD_HEIGHT;i++)
  61.                                         {
  62.                                                  Set_LCD_POS(i,0);
  63.                                                 LCD_Write_Command(LC_AUT_WR);
  64.                                                 for(j=0;j<LCD_WIDTH;j++)
  65.                                                 {
  66.                                                          m=ImageX[i*LCD_WIDTH+j];
  67.                                                         if(S2==0) m=~m;
  68.                                                         LCD_Write_Data(m);
  69.                                                 }
  70.                                                 LCD_Write_Command(LC_AUT_OVR);
  71.                                         }
  72.                                         break;
  73.                         case 3:
  74.                                         k=0;
  75.                                         while(k!=LCD_WIDTH*LCD_HEIGHT)
  76.                                         {
  77.                                                  LCD_Write_Command_P2(LC_GRH_STP,k%256,k/256);
  78.                                                 for(x=0;x<5000;x++);
  79.                                                 k+=LCD_WIDTH;
  80.                                         }
  81.                                         break;
  82.                         case 4:
  83.                                         LCD_Write_Command_P2(LC_GRH_STP,0x00,0x00);
  84. ……………………

  85. …………限于本文篇幅 余下代码请从51黑下载附件…………
复制代码

所有资料51hei提供下载:
160128LCD图文显示.zip (51.01 KB, 下载次数: 34)


评分

参与人数 1黑币 +50 收起 理由
admin + 50 共享资料的黑币奖励!

查看全部评分

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

沙发
ID:328200 发表于 2018-5-25 17:54 | 只看该作者
uchar code ImageX[]=
我需要图像代码,可程序中没有啊?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表