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

📄 main.lst

📁 此程序用于恒温箱控制
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.07   MAIN                                                                  06/10/2005 08:13:56 PAGE 1   


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

stmt level    source

   1           
   2          #include <stdarg.h>///add,03-8-22,自定义printf
   3          #include "main.h"
   4          #include "x5045.h"   
   5          #include "i2c.h"      
   6                    
   7          void                    T0_int();
   8          void                    init_CPU(); 
   9           
  10          void x9318(bit ud, uchar dat);
  11           
  12          void reset_5045();
  13          
  14           
  15          uchar  t50ms;
  16           
  17          uchar t1s1,t1s2;
  18          uint idata realtimetemp ;
  19           
  20          uint  pre_comparetemp;
  21          uchar  same_tempcha_times;
  22          
  23          uchar  adj_hot_times,Hot_times ,temp2=0,heat_value=0;
  24          idata uint readdata[3];
  25          idata uint settemp;
  26           bit heat_bit;
  27           
  28           
  29           
  30          void main()
  31           {
  32   1           
  33   1            uchar   readtemptimes=0 ,  i; 
  34   1                 
  35   1            uint comparetemp=0,max  ; 
  36   1              
  37   1      //      compairtemp=0;
  38   1              pre_comparetemp=0;
  39   1              same_tempcha_times=0;           
  40   1              adj_hot_times=7;
  41   1               
  42   1              P11=1;
  43   1              init_CPU();
  44   1              WRSR_25045();
  45   1              write_7416C(0x00);     
  46   1              REST_DOG();
  47   1              i=Byte_Read(0,10);
  48   1              if(i!=10) reset_5045(); 
  49   1               settemp=172;             
  50   1                //write_7416T( 0,0x02,tem_value1 );
  51   1               //write_7416T( 0,0x03,tem_value1+6);              
  52   1                 P37=1;          
  53   1                 x9318(0,100);
  54   1                 x9318(1,8);
  55   1                 delay(5);                          
C51 COMPILER V7.07   MAIN                                                                  06/10/2005 08:13:56 PAGE 2   

  56   1             while(1)
  57   1               {          
  58   2                 REST_DOG();          
  59   2                if(t1s1>0 )
  60   2                 { 
  61   3                  t1s1=0;
  62   3                 readdata[readtemptimes]=read_7416(0x00); 
  63   3                  readtemptimes+=0x01;
  64   3                    
  65   3                     if(readtemptimes>0x02)                          
  66   3                      { 
  67   4                         readtemptimes=0;
  68   4                         max=readdata[0];
  69   4                         if(readdata[0]>readdata[1]) {readdata[0]=readdata[1];readdata[1]=max;}
  70   4                         else max=readdata[1];
  71   4                         if(max>readdata[2]) {readdata[1]=readdata[2];readdata[2]=max;}
  72   4                         //else max=readdata[2];
  73   4                         max=readdata[0];
  74   4                         if(readdata[0]>readdata[1]) {readdata[0]=readdata[1];readdata[1]=max;}
  75   4                          realtimetemp =readdata[1];                          
  76   4                        t1s2=0;
  77   4                        while(t1s2!=2){};
  78   4                         if(settemp>=realtimetemp )
  79   4                               {
  80   5                                comparetemp=settemp-realtimetemp ;
  81   5                                if(comparetemp>160)
  82   5                                      {Hot_times=70;}
  83   5                               
  84   5                                else if(comparetemp>=0x80)
  85   5                                       
  86   5                                           { 
  87   6                                        Hot_times=0x32;
  88   6                                      
  89   6                                      }
  90   5                                else if(comparetemp>=0x10)
  91   5                                      {
  92   6                                        if(comparetemp>=pre_comparetemp)
  93   6                                                  {
  94   7                                                    same_tempcha_times++; 
  95   7                                                   if(same_tempcha_times>=0x06)
  96   7                                                      {adj_hot_times++;same_tempcha_times=0;pre_comparetemp=comparetemp;}
  97   7                                                  }
  98   6                                        else  
  99   6                                                  {
 100   7                                                      pre_comparetemp=comparetemp;same_tempcha_times=0;
 101   7                                                  }
 102   6                                       comparetemp&=0x00000f0;                    
 103   6                                        switch(comparetemp)
 104   6                                        
 105   6                                                 {   
 106   7                                                       
 107   7                                                                              
 108   7                                                    case 0x70: {Hot_times=(adj_hot_times+10);};break;
 109   7                                                                              
 110   7                                                    case 0x60: {Hot_times=(adj_hot_times+9);};break;
 111   7                                                                              
 112   7                                                    case 0x50: {Hot_times=(adj_hot_times+8);};break;          
 113   7                                                                                                                      
 114   7                                                    case 0x40: {Hot_times=(adj_hot_times+7);};break;
 115   7                                                                              
 116   7                                                    case 0x30: {Hot_times=(adj_hot_times+6);};break;
 117   7                                                                              
C51 COMPILER V7.07   MAIN                                                                  06/10/2005 08:13:56 PAGE 3   

 118   7                                                    case 0x20: {Hot_times=(adj_hot_times+5);};break;
 119   7                                                                              
 120   7                                                   case 0x10:  {Hot_times=(adj_hot_times+4);};break;
 121   7                                                                              
 122   7                                                   default:_nop_();
 123   7                                                  }
 124   6                                       }                               
 125   5                                else if(comparetemp>=1)
 126   5                               
 127   5                                 {
 128   6                                       if(comparetemp>=pre_comparetemp)
 129   6                                                  {
 130   7                                                    same_tempcha_times++; 
 131   7                                                   if(same_tempcha_times>= 0x15)
 132   7                                                      {adj_hot_times++;same_tempcha_times=0;pre_comparetemp=comparetemp;}
 133   7                                                  }
 134   6                                        else  
 135   6                                                  {
 136   7                                                      pre_comparetemp=comparetemp;same_tempcha_times=0;
 137   7                                                  }
 138   6                                      if((comparetemp<=0xf)&&(comparetemp>10))
 139   6                                           {Hot_times=(adj_hot_times+3);}
 140   6                                       else    if((comparetemp<=10)&&(comparetemp>6))
 141   6                                           {Hot_times=(adj_hot_times+2);}
 142   6                                       else if((comparetemp<=6 )&&(comparetemp>3))
 143   6                                                    {Hot_times=adj_hot_times+1;}
 144   6                                      else Hot_times=(adj_hot_times);         
 145   6                               
 146   6                                  }
 147   5                                  else Hot_times=(adj_hot_times-1);      
 148   5                                   
 149   5                               }                                            
 150   4                           else  
 151   4                              {
 152   5                              if(Hot_times>7)
 153   5                               {      
 154   6                               comparetemp=realtimetemp-settemp;                        
 155   6                                if(comparetemp>0x70)

⌨️ 快捷键说明

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