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

📄 counter3_1.lst

📁 //00-99按键计数器每按一次加一显示 //软件延时 //已经测试
💻 LST
字号:
C51 COMPILER V8.02   COUNTER3_1                                                            04/20/2009 15:18:22 PAGE 1   


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

line level    source

   1          //00-99按键计数器
   2          #include<reg51.h>
   3          #define uchar unsigned char
   4          sbit T138_A=P1^0;
   5          sbit T138_B=P1^1;
   6          sbit T138_C=P1^2;
   7          unsigned char code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x7
             -1,0x00};
   8          uchar count,temp,num;
   9          void Display(uchar num);
  10          void IO_int()
  11          {       
  12   1              count=0;
  13   1              temp=0;
  14   1      }
  15          void Delay(uchar i)
  16          {
  17   1              unsigned int j;
  18   1              for(;i>0;i--)
  19   1              {
  20   2                      for(j=0;j<110;j++);
  21   2              }
  22   1      }
  23          void main()
  24          {
  25   1              IO_int();
  26   1              while(1)
  27   1              {
  28   2              P0=0xfe;
  29   2              temp=P0;
  30   2              Delay(50);
  31   2              temp=P0;
  32   2              temp=temp&0xf0;
  33   2              if(temp!=0xf0)
  34   2              {
  35   3                      Delay(20);
  36   3                      temp=P0;
  37   3                      temp=temp&0xf0;
  38   3                      if(temp!=0xf0)
  39   3                      {       
  40   4                              switch(temp)
  41   4                              {
  42   5                                      case 0xe0:count++;
  43   5                              }
  44   4                      }
  45   3              }
  46   2                       if(count>59)
  47   2                       {
  48   3                       count=0;
  49   3                       }
  50   2                       Display(count);
  51   2              }
  52   1      }
  53          void Display(uchar num)
  54          {
C51 COMPILER V8.02   COUNTER3_1                                                            04/20/2009 15:18:22 PAGE 2   

  55   1              unsigned int shi,ge;
  56   1              shi=num/10;
  57   1              ge=num%10;
  58   1              T138_A=0;
  59   1              T138_B=1;
  60   1              T138_C=0;
  61   1              P2=table[shi];
  62   1              Delay(30);
  63   1              T138_A=1;
  64   1              T138_B=1;
  65   1              T138_C=0;
  66   1              P2=table[ge];
  67   1              Delay(10);
  68   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    153    ----
   CONSTANT SIZE    =     17    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      3       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 + -