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

📄 lcd.lst

📁 这是一个课程设计---数字电压表基于MCS51和AD0809的源码
💻 LST
字号:
C51 COMPILER V8.09   LCD                                                                   07/08/2008 20:40:16 PAGE 1   


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

line level    source

   1          #include<reg51.h>
   2          #include"intrins.h"
   3          #define uchar unsigned char
   4          #define uint unsigned int
   5          #define nop _nop_()
   6          #define cycle 2000
   7          #define cycle1 200
   8          
   9          #define db0_db7 P1
  10          static const uchar code table[]={'v','o','l','t','a','g','e','='};
  11          static const uchar code str[]={"zhouxiao"};
  12          
  13          uint data volt[6]={0x30,'.',0x30,0x30,0x30,0x30};
  14          uchar xdata cs0809 _at_ 0xfeff;
  15          
  16          sbit RS=P2^1;
  17          sbit RW=P2^2;
  18          sbit E=P2^3;
  19          uint counti;
  20          uchar temp;
  21          unsigned char flag=0;
  22          void init();
  23          void write(uchar tempdata);
  24          void writeddr(uchar tempdata);
  25          void checkbusy();
  26          void delay(uint n);
  27          void display();
  28          void displaya();
  29          void main(void)
  30          {
  31   1      init();
  32   1      displaya();
  33   1      TMOD=0x11;
  34   1      TH0=(65536-cycle)/256;
  35   1      TL0=(65536-cycle)%256;
  36   1      TH1=(65536-cycle1)/256;
  37   1      TL1=(65536-cycle1)%256;
  38   1      TCON=0x55;
  39   1      IE=0x8a;
  40   1      IP=0x04;
  41   1      counti=0;
  42   1      while(1);
  43   1      display();
  44   1      }
  45          
  46          void display()
  47          {  uint a;
  48   1      write(0x8a);                    //显示位置
  49   1      for(a=0;a<6;a++)
  50   1      writeddr(volt[a]);              //显示数值
  51   1      }
  52          void displaya()
  53          {
  54   1      uint b;
  55   1      for(b=0;b<8;b++)
C51 COMPILER V8.09   LCD                                                                   07/08/2008 20:40:16 PAGE 2   

  56   1      writeddr(table[b]);
  57   1      display();                              //显示数值
  58   1      }
  59          
  60          void delay(uint n)
  61          {uint i;
  62   1      for(i=0;i<n;i++)
  63   1      {i=i;}
  64   1      }
  65          void init()
  66          {
  67   1      delay(500);
  68   1      write(0x38);//显示模式5*7
  69   1      write(0x01);//光标复位 
  70   1      write(0x06);//光标右移
  71   1      write(0x0C);
  72   1      }
  73          
  74          void write(uchar tempdata)
  75          {checkbusy();
  76   1      db0_db7=tempdata;
  77   1      E=1;
  78   1      nop;
  79   1      E=0;
  80   1      nop;
  81   1      
  82   1      }
  83          void writeddr(uchar tempdata)
  84          {        
  85   1      checkbusy();
  86   1      RS=1;
  87   1      E=1;
  88   1      db0_db7=tempdata;
  89   1      nop;
  90   1      E=0;
  91   1      nop;
  92   1      }
  93          void checkbusy()
  94          {
  95   1      uchar temp;
  96   1      RS=0; 
  97   1      RW=1;
  98   1      do
  99   1      {db0_db7=0xff;
 100   2      E=1;
 101   2      delay(50);
 102   2      nop;
 103   2      temp=db0_db7;
 104   2      E=0;
 105   2      }while((temp&0x80)==0x80);
 106   1      RW=0;
 107   1      }
 108          void service_int0() interrupt 1 using 2
 109          {
 110   1      static uchar s_counter;
 111   1      if(++s_counter>=8)
 112   1      {
 113   2      flag++;
 114   2              if(flag<=16)
 115   2              {
 116   3                      for(counti=0;counti<8;counti++)
 117   3                      {
C51 COMPILER V8.09   LCD                                                                   07/08/2008 20:40:16 PAGE 3   

 118   4                      write(0xc0+flag+counti);
 119   4                      writeddr(str[counti]);
 120   4                      temp=0xc0+flag+counti;
 121   4                      }
 122   3                      if(flag>=1)
 123   3                      {
 124   4                      write(0xc0+flag);
 125   4                      writeddr(0);
 126   4                      }
 127   3               }
 128   2              else
 129   2         {
 130   3         if(flag>=32) 
 131   3         for(counti=8;counti>=0;counti--)
 132   3                      {
 133   4                      write(0xc0+flag+counti-16);
 134   4                      writeddr(str[counti]);
 135   4                      }
 136   3              else  flag=0;
 137   3         }
 138   2      }
 139   1      TH0=(65536-cycle)/256;
 140   1      TL0=(65536-cycle)%256;
 141   1      }
 142          void service_int1() interrupt 3 using 3
 143          {uint vod; 
 144   1      P2=0xFE;
 145   1      P3=0xbf;
 146   1      P0=0;
 147   1      P3=0xff;
 148   1      //cs0809=0;
 149   1      IT1=1;
 150   1      EX1=1;
 151   1      TH1=(65536-cycle1)/256;
 152   1      TL1=(65536-cycle1)%256;
 153   1      }
*** WARNING C280 IN LINE 143 OF LCD.C: 'vod': unreferenced local variable
 154          void service_int2() interrupt 2 
 155          {uint vod;
 156   1      P2=0xFE;
 157   1      P3=0x7f;
 158   1      P0=0xff;
 159   1      vod=P0;
 160   1      P3=0xff;
 161   1      //vod=cs0809;
 162   1      vod*=196;
 163   1      volt[0]=((vod/10000)+0x30);
 164   1      volt[2]=(((vod%10000)/1000)+0x30);
 165   1      volt[3]=((vod%1000)/100+0x30);
 166   1      volt[4]=((vod%100)/10+0x30);
 167   1      volt[5]=((vod%10)+0x30);
 168   1      display();
 169   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    633    ----
   CONSTANT SIZE    =     17    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     17       8
   IDATA SIZE       =   ----    ----
C51 COMPILER V8.09   LCD                                                                   07/08/2008 20:40:16 PAGE 4   

   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 + -