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

📄 text8.lst

📁 51单片计算机中的定时器程序,在keil工程中编译
💻 LST
字号:
C51 COMPILER V7.08   TEXT8                                                                 05/08/2009 16:14:01 PAGE 1   


C51 COMPILER V7.08, COMPILATION OF MODULE TEXT8
OBJECT MODULE PLACED IN Text8.OBJ
COMPILER INVOKED BY: D:\学习软件\keil51\C51\BIN\C51.EXE Text8.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include<reg51.h>
   2          #include<intrins.h>
   3          sbit dula=P2^6;
   4          sbit wela=P2^7;
   5          #define uint unsigned int
   6          char code table[]={                     //之所以用code是因为编译的时候数组放在程序存储器种校?
   7          0x3f,0x06,0x5b,0x4f,
   8          0x66,0x6d,0x7d,0x07,
   9          0x7f,0x6f,0x77,0x7c,
  10          0x39,0x5e,0x79,0x71,0x76,0x79,0x38,};
  11          char code wsle[]={0xff,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};   
  12          uint led,temp,seg,num=432;
  13          void init()
  14          {
  15   1              TMOD=0x11;
  16   1              TH0=(65536-50000)/256;
  17   1          TL0=(65536-50000)%256;
  18   1              TH1=(65536-50000)/256;
  19   1          TL1=(65536-50000)%256;
  20   1              EA=1;
  21   1              ET0=1;
  22   1              ET1=1;
  23   1              TR0=1;
  24   1              TR1=1;
  25   1              temp=0xfe;
  26   1      }
  27          void delay(uint b)
  28          {
  29   1              int a;
  30   1              for(a=0;a<b;a++);
  31   1      }
  32          void display(uint i,uint j)
  33          {
  34   1              dula=1;
  35   1              P0=table[j];
  36   1              dula=0;
  37   1              P0=0xff;    //消隐
  38   1              wela=1;
  39   1              P0=wsle[i];
  40   1              wela=0;
  41   1      
  42   1      }
  43          int main()
  44          {       
  45   1              uint temp1,temp2;
  46   1              init();
  47   1              while(1)
  48   1              {       
  49   2                      if(num==398)
  50   2                      {
  51   3                              TR1=0;
  52   3                              if((led==10)&&(temp2<6))
  53   3                              {       
  54   4                                      P1=~P1;
  55   4                                      led=0;
C51 COMPILER V7.08   TEXT8                                                                 05/08/2009 16:14:01 PAGE 2   

  56   4                                      temp2++;
  57   4              
  58   4                              }
  59   3                              if(temp2>=6)
  60   3                              {
  61   4                                      TR0=0;
  62   4                                      display(6,16);
  63   4                                      delay(100);
  64   4                                      display(5,17);
  65   4                                      delay(100);
  66   4                                      display(4,18);
  67   4                                      delay(100);
  68   4                                      display(3,18);
  69   4                                      delay(100);
  70   4                                      display(2,0);
  71   4                                      delay(100);
  72   4                              }
  73   3      
  74   3                      }
  75   2                       if((led==10)&&(num!=398))
  76   2                      {
  77   3                              P1=temp;
  78   3                              temp=_crol_(temp,1);
  79   3                              led=0;
  80   3                      }
  81   2                       if(TR0!=0)
  82   2                      {
  83   3                              temp1=num;
  84   3                              display(3,temp1/100);//秒表
  85   3                              delay(10);
  86   3                              temp1=temp1%100;
  87   3                              display(2,temp1/10);
  88   3                              delay(10);
  89   3                              display(1,temp1%10);
  90   3                              delay(10);
  91   3                              display(4,5);
  92   3                              delay(10);
  93   3                              display(5,6);
  94   3                              delay(10);
  95   3                              display(6,7);
  96   3                              delay(10);
  97   3                      }
  98   2              }
  99   1      }
 100          void timer0() interrupt 1
 101          {
 102   1              TH0=(65536-50000)/256;
 103   1          TL0=(65536-50000)%256;
 104   1              led++;
 105   1              
 106   1      }
 107          void timer1() interrupt 3
 108          {
 109   1              TH1=(65536-50000)/256;
 110   1          TL1=(65536-50000)%256;
 111   1              seg++;
 112   1              if(seg==2)
 113   1              {
 114   2                      num--;
 115   2                      seg=0;
 116   2              }
 117   1              if(num==398)
C51 COMPILER V7.08   TEXT8                                                                 05/08/2009 16:14:01 PAGE 3   

 118   1              {
 119   2                      P1=0xff;
 120   2              }
 121   1      
 122   1      
 123   1      }


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