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

📄 lcd.lst

📁 热敏电阻
💻 LST
字号:
C51 COMPILER V8.08   LCD                                                                   03/13/2009 16:53:11 PAGE 1   


C51 COMPILER V8.08, COMPILATION OF MODULE LCD
OBJECT MODULE PLACED IN lcd.OBJ
COMPILER INVOKED BY: D:\Keil3\C51\BIN\C51.EXE lcd.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include<reg51.h>
   2          #define uchar unsigned char
   3          #define uint unsigned int
   4          //lcd管脚
   5          sbit Lcd_rs=P3^0;
   6          sbit Lcd_rw=P3^1;
   7          sbit Lcd_en=P3^3;
   8          
   9          
  10          
  11          void delay(uchar t)
  12          {
  13   1              uchar j;
  14   1              uint i;
  15   1              for(i=0;i<t;i++)
  16   1                      for(j=0;j<110;j++);
  17   1      }
  18          
  19          //lcd写命令函数
  20          void LCD_Write_Com(uchar com)
  21          {
  22   1              Lcd_rs = 0;
  23   1              Lcd_rw = 0;
  24   1              P2 = com;
  25   1              delay(5);
  26   1              Lcd_en = 1;
  27   1              delay(5);
  28   1              Lcd_en = 0;
  29   1      }
  30          //lcd写数据函数
  31          void LCD_Write_Data(uchar date)
  32          {
  33   1              Lcd_rs = 1;
  34   1              Lcd_rw = 0;
  35   1              P2 = date;
  36   1              delay(5);
  37   1              Lcd_en = 1;
  38   1              delay(5);
  39   1              Lcd_en = 0;
  40   1      }
  41          //==========================================================
  42          //输入函数:     x 横坐标;       s 纵坐标        0--->一行:1--->第二行
  43          //输出函数: address
  44          //说    明: 写地址函数
  45          //========================================================== 
  46          void LCD_Set_xy(uchar x,uchar s)
  47          {
  48   1              uchar address;
  49   1              if(s==0)
  50   1                      address=0x80+x;
  51   1              else
  52   1                      address=0x80+0x40+x;
  53   1              LCD_Write_Com(address);
  54   1      }
  55          //==========================================================
C51 COMPILER V8.08   LCD                                                                   03/13/2009 16:53:11 PAGE 2   

  56          //输入函数:     x 横坐标;       y 纵坐标        0--->一行:1--->第二行;date数据;
  57          //输出函数: 按地址写数据
  58          //说    明: 写数据函数
  59          //==========================================================
  60          void LCD_Write_add_data(uchar x,uchar y,uchar date)
  61          {
  62   1              LCD_Set_xy(x,y);
  63   1              LCD_Write_Data(date);
  64   1      }
  65          void LCD_init()
  66          {
  67   1              Lcd_en = 0;
  68   1              LCD_Write_Com( 0x38 );//显示模式设置
  69   1              LCD_Write_Com( 0x0e );//显示光标
  70   1              LCD_Write_Com( 0x01 );//清屏
  71   1              LCD_Write_Com( 0x80 );//数据指针设置
  72   1      }


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