⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lcd.lst

📁 一块实用51开发板的原理图和所以基于keil c的源代码
💻 LST
字号:
C51 COMPILER V6.23a  LCD                                                                   02/19/2005 20:23:49 PAGE 1   


C51 COMPILER V6.23a, COMPILATION OF MODULE LCD
OBJECT MODULE PLACED IN LCD.OBJ
COMPILER INVOKED BY: C:\TOOLS\Keil\C51\BIN\C51.EXE LCD.C BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          /*实验名称:字符型LCD接口实验
   2            功能:在LCD上显示
   3                   AT89S51 DEMO
   4                  www.mcuprog.com
   5          */
   6          #include <reg51.h>
   7          sbit E=P3^5;
   8          sbit RW=P3^6;
   9          sbit RS=P3^7;   
  10          typedef unsigned char uchar;
  11          //-------------------------------------
  12          void Delay(unsigned int t)   // delay 40us
  13          {
  14   1       for(;t!=0;t--) ;
  15   1      }
  16          //=============================================
  17          void SendCommandByte(unsigned char ch)
  18          {
  19   1         RS=0;
  20   1         RW=0;
  21   1         P0=ch;
  22   1         E=1;
  23   1          Delay(1);
  24   1         E=0;
  25   1         Delay(100);  //delay 40us
  26   1      }
  27          //-------------------------------------------------------
  28          void SendDataByte(unsigned char ch)
  29          {  RS=1;
  30   1         RW=0;
  31   1         P0=ch;
  32   1         E=1;
  33   1             Delay(1);
  34   1         E=0;
  35   1         Delay(100); //delay 40us
  36   1      }
  37          //-------------------------------------------------
  38          void InitLcd()
  39          {SendCommandByte(0x30);
  40   1       SendCommandByte(0x30);
  41   1       SendCommandByte(0x30);
  42   1       SendCommandByte(0x38); //设置工作方式
  43   1       SendCommandByte(0x0c); //显示状态设置
  44   1       SendCommandByte(0x01); //清屏
  45   1       SendCommandByte(0x06); //输入方式设置
  46   1      }
  47          //=============================================
  48          void DisplayMsg1(uchar *p)
  49          { 
  50   1       unsigned char count;
  51   1       SendCommandByte(0x80);  //设置DDRAM地址
  52   1       for(count=0;count<16;count++)
  53   1          {SendDataByte(*p++);
  54   2              }
  55   1      } 
C51 COMPILER V6.23a  LCD                                                                   02/19/2005 20:23:49 PAGE 2   

  56          //=============================================
  57          void DisplayMsg2(uchar *p)
  58          { 
  59   1       unsigned char count;
  60   1       SendCommandByte(0xc0);  //设置DDRAM地址
  61   1       for(count=0;count<16;count++)
  62   1          {SendDataByte(*p++);
  63   2              }
  64   1      }
  65          //=============================================
  66          main()
  67          {char msg1[16]="  AT89S51 DEMO  ";
  68   1       char msg2[16]="www.mcuprog.com ";
  69   1       InitLcd();
  70   1       DisplayMsg1(msg1);
  71   1       DisplayMsg2(msg2);
  72   1       while(1);
  73   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    218    ----
   CONSTANT SIZE    =     32    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----      38
   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 + -