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

📄 main.lst

📁 按键中断判断方式
💻 LST
字号:
C51 COMPILER V7.06   MAIN                                                                  10/18/2006 09:49:01 PAGE 1   


C51 COMPILER V7.06, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: C:\Program Files\Keil\C51\BIN\C51.EXE main.c BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          #include<reg52.h>
   2          unsigned char code table[]={0x3f,0x06,0x5b,0x4f,0x66, 
   3                                   0x6d,0x7d,0x07,0x7f,0x6f};
   4          unsigned char dispcount=0;       //计数
   5          sbit gewei=P1^3;               //个位选通定义
   6          sbit shiwei=P1^2;              //十位选通定义
   7          void Delay(unsigned int tc)     //延时程序
   8          {   
   9   1              while( tc != 0 )                        
  10   1               {
  11   2                      unsigned int i;                 
  12   2                      for(i=0; i<100; i++);   
  13   2                      tc--;                                   
  14   2               }
  15   1      }
  16          void ExtInt0() interrupt 0    //中断服务程序
  17                  {
  18   1               dispcount++;             //每按一次中断按键,计数加一
  19   1               if     (dispcount==100)     //计数范围0-99
  20   1                 {dispcount=0;}
  21   1              }
  22          void LED( )                  //LED显示函数
  23          {
  24   1        if(dispcount>=10)         //显示两位数
  25   1        {
  26   2         shiwei=0;
  27   2         P0=table[dispcount/10];
  28   2         Delay(8);
  29   2         shiwei=1;
  30   2         gewei=0;
  31   2         P0=table[dispcount%10];
  32   2         Delay(5);  
  33   2         gewei=1;
  34   2         }
  35   1         else                    //显示一位数
  36   1         {
  37   2         shiwei=1;
  38   2         gewei=0;
  39   2         P0=table[dispcount];
  40   2         Delay(8);
  41   2         }
  42   1      }
  43          void main()
  44          {   TCON=0x01;  //下降沿触发
  45   1               IE=0x81;   //开总中断和允许外部中断
  46   1               while(1)   //循环执行
  47   1               {
  48   2               LED();     //调用显示函数 
  49   2               }
  50   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    124    ----
   CONSTANT SIZE    =     10    ----
C51 COMPILER V7.06   MAIN                                                                  10/18/2006 09:49:01 PAGE 2   

   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      1       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 + -