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

📄 speed.lst

📁 51单片机的测速程序
💻 LST
字号:
C51 COMPILER V8.02   SPEED                                                                 07/29/2006 21:11:27 PAGE 1   


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

line level    source

   1          #include "reg51.h"
   2          sbit int0 =P3^2;
   3          sbit P2_4=P2^7;
   4          sbit P2_5=P2^6;
   5          sbit P2_6=P2^5;
   6          sbit P2_7=P2^4;
   7          unsigned long int j,k;
   8          unsigned char count; //脉冲数
   9          bit countflg; //计数开始标志位
  10          unsigned long int _1ms;//1ms
  11          unsigned long int time; //半周时间
  12          unsigned char time1;
  13          unsigned char time2;
  14          unsigned char time3;
  15          unsigned char time4;
  16          unsigned char codes[10]={        
  17                  0xC0,/*0*/
  18                          0xF9,/*1*/
  19                  0xA4,/*2*/
  20                  0xB0,/*3*/
  21                  0x99,/*4*/
  22                  0x92,/*5*/
  23                  0x82,/*6*/
  24                  0xF8,/*7*/
  25                  0x80,/*8*/
  26                  0x90,/*9*/};
  27          void exint (void) interrupt 0
  28          {
  29   1      EX0=0;
  30   1      if(countflg==0)
  31   1      {TR0=1;
  32   2      countflg=1;
  33   2      } 
  34   1      else
  35   1      {
  36   2      count++;
  37   2      if(count>=4)
  38   2      {
  39   3      _1ms=0;
  40   3      count=0;
  41   3      TL0=0x18;
  42   3      TH0=0xfc;
  43   3      }
  44   2      }
  45   1      EX0=1;
  46   1      }
  47          void delay10ms(void)
  48          {unsigned int a;
  49   1      for(a=0;a<1000;a++)
  50   1      {
  51   2      ;
  52   2      }
  53   1      
  54   1      }
  55          
C51 COMPILER V8.02   SPEED                                                                 07/29/2006 21:11:27 PAGE 2   

  56          void display(void)
  57          {P2_4=0;
  58   1      P0=codes[time1];
  59   1      delay10ms();
  60   1      P2_4=1;
  61   1      
  62   1      P2_5=0;
  63   1      P0=codes[time2];
  64   1      delay10ms();
  65   1      P2_5=1;
  66   1      
  67   1      P2_6=0;
  68   1      P0=codes[time3];
  69   1      delay10ms();
  70   1      P2_6=1;
  71   1      
  72   1      P2_7=0;
  73   1      P0=codes[time4];
  74   1      delay10ms();
  75   1      P2_7=1;
  76   1      }
  77          
  78          
  79          void timer0(void) interrupt 1
  80          {
  81   1      TR0=0;
  82   1      TL0=0x18;
  83   1      TH0=0xfc;
  84   1      _1ms++;
  85   1      TR0=1;
  86   1      }
  87          
  88          void main(void)
  89          {_1ms=0;
  90   1      count=0;
  91   1      countflg=0;
  92   1      IT0=1;
  93   1      EA=1;
  94   1      EX0=1;
  95   1      ET0=1;
  96   1      TMOD=0x1;
  97   1      TR0=0;
  98   1      TL0=0x18;
  99   1      TH0=0xfc;
 100   1      
 101   1      while(1)
 102   1      {
 103   2      
 104   2      /*time4=time%1000;
 105   2      time3=(time-1000*time4)%100;
 106   2      time2=(time-1000*time4-100*time3)%10;
 107   2      time1=time-1000*time4-100*time3-time2*10;*/
 108   2      
 109   2      
 110   2      if(count==2)
 111   2      {
 112   3      
 113   3      time=_1ms;
 114   3              time1=time%10;
 115   3              time/=10;
 116   3              time2=time%10;
 117   3              time/=10;
C51 COMPILER V8.02   SPEED                                                                 07/29/2006 21:11:27 PAGE 3   

 118   3              time3=time%10;
 119   3              time/=10;
 120   3              time4=time%10;
 121   3      count=0;_1ms=0; TL0=0x18;
 122   3      TH0=0xfc;
 123   3      }
 124   2      
 125   2      
 126   2       display();
 127   2      }
 128   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    366    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     31    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =      1    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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