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

📄 lcd.lst

📁 89c51的等精度频率计lcd1602显示
💻 LST
字号:
C51 COMPILER V7.09   LCD                                                                   07/03/2007 11:04:37 PAGE 1   


C51 COMPILER V7.09, COMPILATION OF MODULE LCD
OBJECT MODULE PLACED IN .\lcd.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE F:\lcd.c BROWSE DEBUG OBJECTEXTEND PRINT(.\lcd.lst) OBJECT(.\lcd.obj)

line level    source

   1          #include <reg51.h>
   2          #include "intrins.h"
   3          #define uchar unsigned char
   4          sbit rs=P3^0;
   5          sbit rw=P3^1;
   6          sbit e=P3^2;
   7          uchar lcd[10]={0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39};
   8          uchar code dis[]={"f="};
   9          
  10          void lcd_checkbusy();   //检查是否准备就绪
  11          void lcd_writedata(uchar);//写数据
  12          void lcd_writeinstruction(uchar);
  13          void lcd_writeposition(uchar);
  14          void lcd_initial();   //初始化
  15          void delay(uchar);
  16          void delaylcd();
  17          
  18          main()
  19          {unsigned char j=0,temp,f;
  20   1      uchar i=0;
  21   1      delay(200);
  22   1      
  23   1        P1=0xff;
  24   1        P0=0x01;
  25   1      TMOD=0x0D;
  26   1         EA=1;
  27   1         ET0=1;
  28   1         TR0=1;
  29   1        while(!P3^3)
  30   1        TR0=0;
  31   1        temp=TH0*256+TL0;
  32   1        while(temp<=500)
  33   1        { P1<<1;
*** WARNING C275 IN LINE 33 OF F:\LCD.C: expression with possibly no effect
  34   2          P0++;
  35   2          j++;
  36   2        }
  37   1        f=500000/temp*10^j;
  38   1      
  39   1      
  40   1      
  41   1      
  42   1      
  43   1      lcd_initial();
  44   1      
  45   1       lcd_writeposition(0x02);   
  46   1      while(dis[i]!='\0')
  47   1       {
  48   2        lcd_writedata(dis[i]);
  49   2        i++;
  50   2       }     
  51   1      
  52   1      do{
  53   2      lcd_writeposition(0x46);
  54   2      lcd_writedata(f/1000);
C51 COMPILER V7.09   LCD                                                                   07/03/2007 11:04:37 PAGE 2   

  55   2      delay(5);
  56   2      
  57   2      lcd_writeposition(0x47);
  58   2      lcd_writedata(f%1000/100);
  59   2      delay(5);
  60   2      
  61   2      lcd_writeposition(0x48);
  62   2      lcd_writedata(f%100/10);
  63   2      delay(5);
  64   2      
  65   2      lcd_writeposition(0x49);
  66   2      lcd_writedata(f%10);
  67   2      delay(5);
  68   2      }while(1);
  69   1      }
  70          
  71          /*************************************
  72                        初始化函数
  73          *************************************/
  74          
  75          void lcd_initial()
  76          {
  77   1      lcd_writeinstruction(0x38);
  78   1      delay(100);
  79   1      lcd_writeinstruction(0x38);
  80   1      delay(100);
  81   1      lcd_writeinstruction(0x38);
  82   1      delay(100);
  83   1      lcd_writeinstruction(0x06);
  84   1      delay(100);
  85   1      lcd_writeinstruction(0x0c);
  86   1      delay(100);
  87   1      lcd_writeinstruction(0x01);
  88   1      delay(100);
  89   1      }
  90          
  91          
  92          /*************************************
  93                        写数据函数
  94          *************************************/
  95          
  96          void lcd_writedata(uchar num)
  97          {
  98   1      e=0;
  99   1      rs=1;
 100   1      rw=0;
 101   1      _nop_();
 102   1      _nop_();
 103   1      P2=num;
 104   1      e=1;
 105   1      _nop_();
 106   1      _nop_();
 107   1      e=0;
 108   1      }
 109          
 110          /*************************************
 111          
 112          *************************************/
 113          
 114          void lcd_writeinstruction(uchar instruction)
 115          {
 116   1      e=0;
C51 COMPILER V7.09   LCD                                                                   07/03/2007 11:04:37 PAGE 3   

 117   1      rs=0;
 118   1      rw=0;
 119   1      _nop_();
 120   1      _nop_();
 121   1      P2=instruction;
 122   1      e=1;
 123   1      _nop_();
 124   1      _nop_();
 125   1      e=0;
 126   1      }
 127          
 128          /*************************************
 129          *************************************/
 130          void lcd_writeposition(uchar adress)
 131          {
 132   1      lcd_writeinstruction(adress|0x80);
 133   1      }
 134          
 135          
 136          
 137          void delay(uchar k)
 138          {
 139   1      uchar i;
 140   1      while(k--)
 141   1      {
 142   2      for(i=0;i<120;i++);
 143   2      }
 144   1      }
 145          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    355    ----
   CONSTANT SIZE    =      3    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     10       3
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  1 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -