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

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 5064|回復: 0
收起左側

單片機lcd1602屏幕左移顯示程序

[復制鏈接]
ID:382962 發表于 2018-8-15 10:52 | 顯示全部樓層 |閱讀模式
電路原理圖如下:
QQ截圖20180815105225.png

單片機源程序如下:
  1. #include<reg51.h>
  2. #include<sting.h>
  3. #define        uchar unsigned char
  4. #define uint unsigned int

  5. sbit  RS=P2^0;
  6. sbit  RW=P2^1;
  7. sbit   E=P2^2;

  8. uchar tab1[]={"1433223        "};
  9. uchar tab2[]={"        1433223"};

  10. void delay(uint x)
  11. {
  12. uint i,j;
  13. for(i=0;i<x;i++)
  14.         for(j=0;j<110;j++);
  15. }
  16. void writecmd(uchar com)
  17. {
  18. E=0;
  19. RS=0;
  20. RW=0;
  21. P3=com;
  22. delay(2);
  23. E=1;  
  24. delay(2);
  25. E=0;
  26. }
  27. void writedata(uchar dat)
  28. {  
  29.   E=0;
  30.   RS=1;
  31.   RW=0;
  32.   P3=dat;
  33.   delay(2);
  34.   E=1;  
  35.   delay(2);
  36.   E=0;
  37. }
  38. void init(void)               
  39. {
  40. delay(15);
  41. writecmd(0x38);
  42. delay(5);
  43. writecmd(0x38);
  44. delay(5);
  45. writecmd(0x38);
  46. writecmd(0x38);
  47. writecmd(0x08);
  48. writecmd(0x01);
  49. writecmd(0x06);
  50. writecmd(0x0c);
  51. }
  52. void main()
  53. {  uchar j;
  54.   init();
  55.   writecmd(0x80);   
  56.   for(j=0;j<16;j++)  
  57.   {
  58.    writedata(tab1[j]);
  59.         delay(100);
  60.   }
  61.   writecmd(0x80+0x40);

  62.   for(j=0;j<16;j++)   
  63.   { writedata(tab2[j]);
  64.          delay(100);
  65.   }
  66.   while(1)
  67.   {
  68.   delay(200);
  69.    writecmd(0x18);
  70.    delay(200);
  71.   }   

  72. }

復制代碼


評分

參與人數 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎勵!

查看全部評分

回復

使用道具 舉報

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

本版積分規則

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

Powered by 單片機教程網

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