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

📄 ex.lst

📁 AT89S51 红外程序 单片机学习板的程序 外部中断0程序
💻 LST
字号:
C51 COMPILER V8.02   EX                                                                    10/16/2008 11:34:30 PAGE 1   


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

line level    source

   1          //****************Copyright (c)*************
   2          //         成都麟鑫科技有限责任公司
   3          //         http://www.linxinpro.com
   4          //******************************************
   5          #include<reg51.h>
   6          #define uint unsigned int
   7          #define uchar unsigned char
   8          uchar code tab1[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};//0~9字形代码
   9          uint counter1=0,counter2=0,counter3=0,counter4=0;time=100; //计数器变量初始化
  10          sbit P1_0=P1^0;
  11          sbit P1_1=P1^1;
  12          sbit P1_2=P1^2; 
  13          sbit P1_3=P1^3;
  14          void delay(uint tx);//延时程序
  15          void show(uint tx1,uint tx2,uint tx3,uint tx4);
  16          void main()
  17          {
  18   1              P1_3=1;//初始化数码管控制位
  19   1              P1_2=1;
  20   1              P1_1=1;
  21   1              P1_0=1;
  22   1              EA=1;   //开中断
  23   1              IT0=1;  //外部中断0低电平触发
  24   1              EX0=1;  //外部中断0允许
  25   1              while(1)
  26   1                      show(counter1,counter2,counter3,counter4);
  27   1      }
  28          /*中断服务程序*/
  29          void interrupt0() interrupt 0 using 2
  30          {
  31   1              counter1++;
  32   1              if(counter1>9)
  33   1              { 
  34   2                      counter1=0;
  35   2                  counter2++;
  36   2              };
  37   1              if(counter2>9)
  38   1              {
  39   2                  counter2=0;
  40   2                      counter3++;
  41   2              };
  42   1              if(counter3>9)
  43   1              {
  44   2                      counter3=0;
  45   2                      counter4++;
  46   2              };
  47   1              if(counter4>9)
  48   1                      counter4=0;
  49   1      }
  50          /*延时子程序*/
  51          void delay(uint tx)
  52          {
  53   1              uint x=tx;
  54   1              do
  55   1                      x--;
C51 COMPILER V8.02   EX                                                                    10/16/2008 11:34:30 PAGE 2   

  56   1              while(x>1);
  57   1      }
  58          /*显示计数次数*/
  59          void show(uint tx1,uint tx2,uint tx3,uint tx4)
  60          {
  61   1              P2=tab1[tx1];
  62   1              P1_0=0;
  63   1              delay(time);
  64   1              P1_0=1;
  65   1              P2=tab1[tx2];
  66   1              P1_1=0;
  67   1              delay(time);
  68   1              P1_1=1;
  69   1              P2=tab1[tx3];
  70   1              P1_2=0;
  71   1              delay(time);
  72   1              P1_2=1;
  73   1              P2=tab1[tx4];
  74   1              P1_3=0;
  75   1              delay(time);
  76   1              P1_3=1;
  77   1      }


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