欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 4267|回復: 1
打印 上一主題 下一主題
收起左側

1602字符液晶自動水平和垂直滾動演示程序加仿真

[復制鏈接]
跳轉到指定樓層
樓主
在單片機的控制下能實現自動水平滾動與自動垂直滾動,并且帶有暫停開始按鈕
仿真原理圖如下(proteus仿真工程文件可到本帖附件中下載)


單片機源程序如下:
  1. /***************   writer:shopping.w   ******************/
  2. #include <reg52.h>
  3. #include <string.h>
  4. #define uchar unsigned char
  5. #define uint unsigned int
  6. void Initialize_LCD();
  7. void ShowString(uchar,uchar,uchar *);
  8. sbit K1 = P3^0;
  9. sbit K2 = P3^1;
  10. sbit K3 = P3^2;

  11. uchar code Prompt[]="PRESS K1--K4 TO START DEMO PROG";
  12. uchar const Line_Count = 6;
  13. uchar code Msg[][80]=
  14. {
  15.          "Many CAD users dismiss",
  16.         "process of creating PCB",
  17.         "of view.with PCB layout",
  18.         "placement and track routing,",
  19.         "can often be the most time",
  20.         "And if you use circuit simulation",
  21.         "you are going to spend even more"
  22. };
  23. uchar Disp_Buffer[32];
  24. void Delayxms(uint ms)
  25. {
  26.          uchar i;
  27.         while(ms--)
  28.         {
  29.                  for(i=0;i<120;i++);
  30.         }
  31. }

  32. void V_Scroll_Display()
  33. {
  34.          uchar i,j,k = 0;
  35.         uchar *p = Msg[0];
  36.         uchar *q = Msg[Line_Count] + strlen(Msg[Line_Count]);
  37.         while(p<q)
  38.         {
  39.                  for(i=0;(i<16)&&(p<q);i++)
  40.                 {
  41.                          if(((i==0)||(i==15))&& *p == ' ')
  42.                                 p++;
  43.                         if(*p != '\0')
  44.                         {
  45.                                  Disp_Buffer[i] = *p++;
  46.                         }
  47.                         else
  48.                         {
  49.                                  if(++k>Line_Count)
  50.                                         break;
  51.                                 p = Msg[k];
  52.                                 Disp_Buffer[i] = *p++;
  53.                         }
  54.                 }
  55.                 for(j=i;j<16;j++)
  56.                         Disp_Buffer[j]=' ';
  57.                 while(F0)
  58.                         Delayxms(5);
  59.                 ShowString(0,0,"      ");
  60.                 Delayxms(150);
  61.                 while(F0)
  62.                         Delayxms(5);
  63.                 ShowString(0,1,Disp_Buffer);
  64.                 Delayxms(150);
  65.                 while(F0)
  66.                         Delayxms(5);
  67.                 ShowString(0,0,Disp_Buffer);
  68.                 ShowString(0,1,"      ");
  69.                 Delayxms(150);        
  70.         }
  71.         ShowString(0,0,"         ");
  72.         ShowString(0,1,"         ");
  73. }

  74. void H_Scroll_Display()
  75. {
  76.         uchar m,n,t = 0,L=0;
  77.         uchar *p = Msg[0];
  78.         uchar *q = Msg[Line_Count] + strlen(Msg[Line_Count]);
  79.         for(m=0;m<16;m++)
  80.                         Disp_Buffer[m]=' ';        
  81.         while(p<q)
  82.         {
  83.                  if((m=16||m==31)&& *p == ' ')
  84.                         p++;
  85.                 for(m=16;m<32&&p<q;m++)
  86.                 {
  87.                          if(*p != '\0')
  88.                         {
  89.                                 Disp_Buffer[m] = *p++;         
  90.                         }
  91.                         else
  92.                         {
  93.                                  if(++t>Line_Count)
  94.                                         break;
  95.                                 p = Msg[t];
  96.                                 Disp_Buffer[m] = *p++;
  97.                         }
  98.                 }
  99.                 for(n=m;n<32;n++)
  100.                         Disp_Buffer[n]=' ';
  101.                 for(m=0;m<=16;m++)
  102.                 {
  103.                          while(F0)
  104.                                  Delayxms(5);
  105.                            ShowString(0,L,Disp_Buffer+1);
  106.                            while(F0)
  107.                                  Delayxms(5);
  108.                         Delayxms(20);
  109.                 }
  110.                 L = (L==0)? 1:0;
  111.                 Delayxms(200);
  112.         }
  113.         if(L==1)
  114.                 ShowString(0,1,"      ");        
  115. }

  116. void EX_INT0() interrupt 0
  117. {
  118.          F0 = !F0;
  119. }

  120. void main()
  121. {
  122.          uint Count = 0;
  123.         IE = 0x81;
  124.         IT0 = 1;
  125. ……………………

  126. …………限于本文篇幅 余下代碼請從51黑下載附件…………
復制代碼

所有資料51hei提供下載:
60 1602字符液晶滾動演示程序.zip (63.09 KB, 下載次數: 33)


評分

參與人數 1黑幣 +5 收起 理由
yinkun230 + 5 淡定

查看全部評分

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復

使用道具 舉報

沙發
ID:523060 發表于 2019-5-4 19:02 | 只看該作者
很好,解決了我很大問題
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表