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

📄 temper.lst

📁 ds18b20温度传感器应用
💻 LST
字号:
C51 COMPILER V8.02   TEMPER                                                                09/01/2007 11:08:41 PAGE 1   


C51 COMPILER V8.02, COMPILATION OF MODULE TEMPER
OBJECT MODULE PLACED IN temper.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE temper.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include <AT89X52.H>
   2          
   3          unsigned char code dispbitcode[]={0xfe,0xfd,0xfb,0xf7,
   4                                            0xef,0xdf,0xbf,0x7f};
   5          unsigned char code dispcode[]={0x3f,0x06,0x5b,0x4f,0x66,
   6                                         0x6d,0x7d,0x07,0x7f,0x6f,0x00};
   7          unsigned char dispbuf[8]={10,10,10,10,10,10,0,0};
   8          unsigned char dispcount;
   9          unsigned char getdata;
  10          unsigned  int temp;
  11          unsigned char i;
  12          
  13          sbit ST=P3^0;
  14          sbit OE=P3^1;
  15          sbit EOC=P3^2;
  16          sbit CLK=P3^3;
  17          sbit LED1=P3^6;
  18          sbit LED2=P3^7;
  19          sbit SPK=P3^5;
  20          bit lowflag;
  21          bit highflag;
  22          unsigned int cnta;
  23          unsigned int cntb;
  24          bit alarmflag;
  25          
  26          
  27          void main(void)
  28          {
  29   1        ST=0;
  30   1        OE=0;
  31   1        TMOD=0x12;
  32   1        TH0=0x216;
  33   1        TL0=0x216;
  34   1        TH1=(65536-4000)/256;
  35   1        TL1=(65536-4000)%256;
  36   1        TR1=1;
  37   1        TR0=1;
  38   1        ET0=1;
  39   1        ET1=1;
  40   1        EA=1;
  41   1        ST=1;
  42   1        ST=0;
  43   1        while(1)
  44   1          {
  45   2            if((lowflag==1) &&(highflag==0))
  46   2              {
  47   3                LED1=0;
  48   3                LED2=1;
  49   3              }
  50   2              else if((highflag==1) && (lowflag==0))
  51   2                {
  52   3                  LED1=1;
  53   3                  LED2=0;
  54   3                }
  55   2                else
C51 COMPILER V8.02   TEMPER                                                                09/01/2007 11:08:41 PAGE 2   

  56   2                  {
  57   3                    LED1=1;
  58   3                    LED2=1;
  59   3                  }
  60   2                  
  61   2          }
  62   1      
  63   1      }
  64          
  65          void t0(void) interrupt 1 using 0
  66          {
  67   1        CLK=~CLK;
  68   1      }
  69          
  70          void t1(void) interrupt 3 using 0
  71          { 
  72   1        TH1=(65536-500)/256;
  73   1        TL1=(65536-500)%256;
  74   1        if(EOC==1)
  75   1               {
  76   2                 OE=1;
  77   2                 getdata=P0;
  78   2                 OE=0;
  79   2                 temp=getdata*25;
  80   2                 temp=temp/64; 
  81   2                         dispbuf[6]=temp/10;
  82   2                         dispbuf[7]=temp%10;
  83   2      
  84   2                 if(getdata<77)
  85   2                   {
  86   3                     lowflag=1;
  87   3                     highflag=0;
  88   3                   }
  89   2                   else if(getdata>153)
  90   2                     {
  91   3                       lowflag=0;
  92   3                       highflag=1;
  93   3                     }
  94   2                     else
  95   2                       {
  96   3                         lowflag=0;
  97   3                         highflag=0;
  98   3                       }
  99   2                 ST=1;
 100   2                 ST=0;
 101   2               } 
 102   1                        
 103   1        P2=0xff;
 104   1        P1=dispcode[dispbuf[dispcount]];
 105   1        P2=dispbitcode[dispcount];
 106   1        dispcount++;
 107   1        if(dispcount==8)
 108   1          {
 109   2            dispcount=0;
 110   2          }
 111   1        
 112   1        if((lowflag==1) && (highflag==0))
 113   1          {
 114   2            cnta++;
 115   2            if(cnta==800)
 116   2              {
 117   3                cnta=0;
C51 COMPILER V8.02   TEMPER                                                                09/01/2007 11:08:41 PAGE 3   

 118   3                alarmflag=~alarmflag;
 119   3              }
 120   2            if(alarmflag==1)
 121   2              {
 122   3                SPK=~SPK;
 123   3              }
 124   2          }
 125   1          else if((lowflag==0) && (highflag==1))
 126   1            {
 127   2            cntb++;
 128   2            if(cntb==400)
 129   2              {
 130   3                cntb=0;
 131   3                alarmflag=~alarmflag;
 132   3              }
 133   2            if(alarmflag==1)
 134   2              {
 135   3                SPK=~SPK;
 136   3              }        
 137   2            }
 138   1            else
 139   1              {
 140   2                alarmflag=0;
 141   2                cnta=0;
 142   2                cntb=0;
 143   2              }
 144   1      }
 145          
 146          
 147          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    310    ----
   CONSTANT SIZE    =     19    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     17    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =      3    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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