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

📄 3.lst

📁 利用单片机的P32管脚进行测量频率,计时很精确
💻 LST
字号:
C51 COMPILER V8.02   3                                                                     08/15/2007 23:48:04 PAGE 1   


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

line level    source

   1          //void delay(int i)                          //延时
   2          //void wcmd(uchar c)                         //写控制字
   3          //void showchar(uchar pos,uchar c)           //显示单个字符(在pos位置上)
   4          //void display(uchar pos,uchar *dispbuf)     //显示字符串(在pos位置上,以`结束)
   5          //void load0()                               //显示初始化(每次显示前必用,否则结果失真)
   6          //void loadchar(uchar *str)                  //加载字符
   7          //void clr()                                 //清屏
   8          #include <REG51.H>
   9          #include <string.h>
  10          #define uint unsigned int
  11          #define uchar unsigned char
  12          
  13          extern  uint  LM331(void);
  14          uchar  temp[9];
  15          long int   result;
  16          uint   ppt=0;
  17          char code table[]={"THE RESULT IS\0"};
  18          void read(void);
  19          #include<1602.h>
  20          void   read(void)
  21          { long int  x;
  22   1        long float y;
  23   1        
  24   1        result=LM331()+ppt*65536;
  25   1        
  26   1        y=100.0/(result*2.0);
  27   1        //x=315003532;
  28   1        x=(long int)(y*10000);
  29   1        temp[0]=(uchar)(x/100000000);
  30   1        temp[1]=(uchar)((x-temp[0]*100000000)/10000000);
  31   1        temp[2]=(uchar)((x-temp[0]*100000000-temp[1]*10000000)/1000000); 
  32   1        temp[3]=(uchar)((x-temp[0]*100000000-temp[1]*10000000-temp[2]*1000000)/100000);
  33   1        temp[4]=(uchar)((x-temp[0]*100000000-temp[1]*10000000-temp[2]*1000000-temp[3]*100000)/10000);
  34   1        temp[5]=(uchar)((x-temp[0]*100000000-temp[1]*10000000-temp[2]*1000000-temp[3]*100000-temp[4]*10000)/1000
             -);
  35   1        temp[6]=(uchar)((x-temp[0]*100000000-temp[1]*10000000-temp[2]*1000000-temp[3]*100000-temp[4]*10000-temp[
             -5]*1000)/100); 
  36   1        temp[7]=(uchar)((x-temp[0]*100000000-temp[1]*10000000-temp[2]*1000000-temp[3]*100000-temp[4]*10000-temp[
             -5]*1000-temp[6]*100)/10); 
  37   1        temp[8]=(uchar)( x-temp[0]*100000000-temp[1]*10000000-temp[2]*1000000-temp[3]*100000-temp[4]*10000-temp[
             -5]*1000-temp[6]*100-temp[7]*10);
  38   1        clr();
  39   1        if(temp[0]!=0){load0();showchar(20,temp[0]+48);}else{;}
  40   1        if(temp[1]!=0){load0();showchar(21,temp[1]+48);}else{;}
  41   1        if(temp[2]!=0){load0();showchar(22,temp[2]+48);}else{;}
  42   1        if(temp[3]!=0){load0();showchar(23,temp[3]+48);}else{;}
  43   1        if(temp[4]!=0){load0();showchar(24,temp[4]+48);}else{;}
  44   1        if(temp[5]!=0){load0();showchar(25,temp[5]+48);}else{;}
  45   1        if(temp[6]!=0){load0();showchar(26,temp[6]+48);}else{;}
  46   1        if(temp[7]!=0){load0();showchar(27,temp[7]+48);}else{;}
  47   1        load0();showchar(28,temp[8]+48);
  48   1        ppt=0;
  49   1      
  50   1      }
  51          /*
C51 COMPILER V8.02   3                                                                     08/15/2007 23:48:04 PAGE 2   

  52          void   read(void)
  53          { uint  x;
  54            
  55            
  56            result=LM331();
  57            
  58            x=result*2;
  59            temp[0]=(uchar)(x/1000);
  60            temp[1]=(uchar)((x-temp[0]*1000)/100);
  61            temp[2]=(uchar)((x-temp[0]*1000-temp[1]*100)/10); 
  62            temp[3]=(uchar)(x-temp[0]*1000-temp[1]*100-temp[2]*10);
  63            clr();
  64            load0();showchar(20,temp[0]+48);
  65            load0();showchar(21,temp[1]+48);
  66            load0();showchar(22,temp[2]+48);
  67            load0();showchar(23,temp[3]+48);
  68          
  69          }
  70          */
  71          
  72          
  73          main()
  74          {
  75   1              
  76   1         while(1)
  77   1         {//jianpan();
  78   2         
  79   2         read();
  80   2          delay1s();
  81   2          }
  82   1      }void time1_int(void) interrupt 1
  83                
  84             { 
  85   1           ppt++;
  86   1               TH0=0X00;TL0=0X00;     
  87   1         }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   2036    ----
   CONSTANT SIZE    =     15    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     15      16
   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 + -