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

📄 main.lst

📁 用键盘来输入电压或电流。实现恒流
💻 LST
字号:
C51 COMPILER V8.02   MAIN                                                                  04/24/2009 12:47:57 PAGE 1   


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

line level    source

   1          #include<head.h>
   2          #include<key44.c>
   3          #include<da5615.c>
   4          #include<Vad549.c>
   5          #include<Iad549.c>
   6          #include<LCD1602.c>
   7          #include<dis.c>
   8          #include<change.c>
   9          
  10          #define  genggaisz       10     //定义是否改变数值
  11          #define  hengya      13 //定义选择恒压键盘返回数
  12          #define  hengliu     14 //定义选择恒流键盘返回数
  13          #define  henggonglv  15 //定义选择恒流键盘返回数
  14          
  15          
  16          
  17          #define  dysdz       dianyashedingzhi   //电压设定值
  18          #define  dlsdz           dianliushedingzhi      //电流设定值
  19          #define  glsdz           donglvshedingzhi       //功率设定值
  20          #define  dv549       dudianya549                //读电压549
  21          #define  di549       dudianliu549               //读电流549
  22          #define  dybljs          dianyabianliangjisuan  //电压取回值计算
  23          #define  dlbljs          dianliubianliangjisuan //电流取回值计算
  24          
  25          #define  qhxh            qiuhuanxinhao          //用于功能之间的切换
  26          #define  nbxt            neibuxuantong          //用于控制循环                                  
  27          
  28          uint     dysdz,dlsdz,glsdz;
  29          uint     dv549,di549;
  30          uint     count=0;    //5615赋值变量初始化
  31          uint     dybljs=0;   //电压取回值计算初始化
  32          uint     dlbljs=0;   //电流取回值计算初始化
  33          uint     qhxh=1;         //初始化选通
  34          uint     nbxt=1;         //初始化选通
  35          /**************************************************
  36                        主函数延时
  37          **************************************************/
  38          void main_delay(uint i)
  39           { 
  40   1         while(i--);
  41   1       }      
  42          
  43          ////////////////// //主函数/////////////////////
  44           void main(void)    
  45          { 
  46   1        //uchar KeyBuff = 0; 
  47   1      
  48   1        initLCD();     //初始化液晶
  49   1        da5615(0);     //初始化5615
  50   1        LCDDisString(0,0,"work ready!"); 
  51   1        main_delay(60000);
  52   1        main_delay(60000);
  53   1        main_delay(60000);
  54   1        main_delay(60000);
  55   1        main_delay(60000);
C51 COMPILER V8.02   MAIN                                                                  04/24/2009 12:47:57 PAGE 2   

  56   1        main_delay(60000);
  57   1        writeByteLCD(1,0x01); //显示清屏
  58   1        
  59   1        while(1)            //进入功能工作循环区
  60   1        {
  61   2          //dis_v549( read_byte_from_549V()*100/51 );
  62   2              //dis_i549( read_byte_from_549I()*100/51 );
  63   2              
  64   2              LCDDisString(0,0,"please choose the funtion!");//提示选择所要的功能 
  65   2          main_delay(500);
  66   2          
  67   2       /*****************************选择恒压工作方式*********************************/
  68   2          if ( hengya == ScanKeyboard() )   
  69   2               { 
  70   3               writeByteLCD(1,0x01); //显示清屏 
  71   3               while(nbxt)
  72   3                 {    
  73   4                  LCDDisString(0,0,"Please press input");
  74   4                  main_delay(5000);
  75   4                  if(ScanKeyboard()==genggaisz)
  76   4                     {
  77   5                            dysdz=change_voltage();
  78   5                                if((dysdz<60)&&(dysdz>=50)) count=280;
  79   5                                if((dysdz<50)&&(dysdz>=40)) count=240;
  80   5                                if((dysdz<40)&&(dysdz>=30)) count=200;
  81   5                                if((dysdz<30)&&(dysdz>=20)) count=160;
  82   5                                if((dysdz<20)&&(dysdz>=10)) count=120;
  83   5                                if((dysdz<10)&&(dysdz>= 0)) count=80;
  84   5                            dysdz=dysdz*51;
  85   5                    writeByteLCD(1,0x01); //显示清屏
  86   5                        while(qhxh)
  87   5                          {di549=read_byte_from_549I();
  88   6                           dv549=read_byte_from_549V();
  89   6                           LCDDisString(0,1,"enactment:");
  90   6                           dis_voltage(dysdz/51);
  91   6                           LCDDisString(0,0,"Cur:");
  92   6                           dis_v549(dv549*10/51);
  93   6                           dis_i549(di549*100/51);
  94   6                                       //测试蜂鸣
  95   6                               if(di549*100/51>250)
  96   6                                       {
  97   7                                              P3 = 0x20;
  98   7                                       }
  99   6                                       else{P3 = 0xE7;}
 100   6                                       //蜂鸣
 101   6                       dybljs=(dv549*10);
 102   6                           if(dysdz==dybljs){;}
 103   6                       if(dysdz>dybljs) { if(count>1022)count=1022;count++;da5615(count);}
 104   6                       if(dysdz<dybljs) { if(count<1)   count=1;   count--;da5615(count);}
 105   6                           if((hengliu==ScanKeyboard())||(henggonglv==ScanKeyboard()))
 106   6                             {
 107   7                                  qhxh=0;
 108   7                                              nbxt=0;
 109   7                                  da5615(0);
 110   7                                  }
 111   6                           }
 112   5                           }
 113   4                     
 114   4                        }
 115   3                      qhxh=1;
 116   3                      nbxt=1;
 117   3                      writeByteLCD(1,0x01); //显示清屏 
C51 COMPILER V8.02   MAIN                                                                  04/24/2009 12:47:57 PAGE 3   

 118   3                }
 119   2      
 120   2      
 121   2       /*****************************选择恒流工作方式*******************************/
 122   2              if ( hengliu == ScanKeyboard() )   
 123   2              {
 124   3                writeByteLCD(1,0x01); //显示清屏 
 125   3                while(nbxt)
 126   3                 {    
 127   4                  LCDDisString(0,0,"Please press input ");
 128   4                  main_delay(5000);
 129   4                  if(ScanKeyboard()==genggaisz)
 130   4                     {
 131   5                            dlsdz=change_current(); //调用输入数值函数
 132   5                                
 133   5                                if((dlsdz<=500)&&(dlsdz>400)) count=250;
 134   5                                if((dlsdz<=400)&&(dlsdz>300)) count=200;
 135   5                                if((dlsdz<=300)&&(dlsdz>200)) count=200;
 136   5                                if((dlsdz<=200)&&(dlsdz>100)) count=150;
 137   5                                if((dlsdz<=100)&&(dlsdz>  0)) count=120;
 138   5                                //dlsdz=dlsdz*51;
 139   5                    writeByteLCD(1,0x01); //显示清屏
 140   5                        while(qhxh)
 141   5                          {
 142   6                                       di549=read_byte_from_549I();
 143   6                           dv549=read_byte_from_549V();
 144   6                           LCDDisString(0,1,"enactment:");
 145   6                           dis_current(dlsdz);
 146   6                           LCDDisString(0,0,"Cur:");
 147   6                           dis_v549(dv549*10/51);
 148   6                           dis_i549(di549*100/51);
 149   6                       dlbljs=(di549*100/51);
 150   6                           if(dlsdz==dlbljs){;}
 151   6                       if(dlsdz>dlbljs) { if(count>1022)count=1022;count++;da5615(count);}
 152   6                       if(dlsdz<dlbljs) { if(count<1)   count=1;   count--;da5615(count);}
 153   6                           if((hengya==ScanKeyboard())||(henggonglv==ScanKeyboard()))
 154   6                             {
 155   7                                  qhxh=0;
 156   7                                              nbxt=0;
 157   7                                  da5615(0);
 158   7                                  }
 159   6                           }
 160   5                           }
 161   4                     
 162   4                        }
 163   3                      qhxh=1;
 164   3                      nbxt=1;
 165   3                      writeByteLCD(1,0x01); //显示清屏 
 166   3                
 167   3              }
 168   2      
 169   2      /*****************************选择恒功率工作方式**********************************/
 170   2              if ( henggonglv == ScanKeyboard()) 
 171   2        {
 172   3                writeByteLCD(1,0x01); //显示清屏 
 173   3                while(nbxt)
 174   3                 {    
 175   4                  LCDDisString(0,0,"Pease Press input");
 176   4                  main_delay(5000);
 177   4                  if(ScanKeyboard()==genggaisz)
 178   4                     {
 179   5                            glsdz=change_voltage1(); //调用输入数值函数
C51 COMPILER V8.02   MAIN                                                                  04/24/2009 12:47:57 PAGE 4   

 180   5                                 
 181   5                                //if((glsdz<60)&&(glsdz>=50)) count=450;
 182   5                                //if((glsdz<50)&&(glsdz>=40)) count=350;
 183   5                                //if((glsdz<40)&&(glsdz>=30)) count=250;
 184   5                                if((glsdz<26)&&(glsdz>=20)) count=350;                 
 185   5                                if((glsdz<20)&&(glsdz>=10)) count=300;
 186   5                                if((glsdz<10)&&(glsdz>= 0)) count=250;
 187   5                                //dlsdz=dlsdz*51;
 188   5                    writeByteLCD(1,0x01); //显示清屏
 189   5                        while(qhxh)
 190   5                          {
 191   6                                       di549=read_byte_from_549I();
 192   6                           dv549=read_byte_from_549V();
 193   6                           LCDDisString(0,1,"enactment:");
 194   6                           dis_voltage1(glsdz);
 195   6                           //LCDDisString(0,0,"Cur:");
 196   6                            dis_v549(dv549*10/51);
 197   6                           dis_i549(di549*100/51);
 198   6                                        LCDDisString(3,0,"w");
 199   6                                                                                                                                      
 200   6                      dis_glbljs((dv549*10/51)*(di549*100/51)/1000);
 201   6                                       //glsdz=glsdz*1000;
 202   6                           if(glsdz*1000== (dv549*10/51)*( (di549*100/51))){;}
 203   6                       if(glsdz*1000>( (dv549*10/51))*( (di549*100/51))) { if(count>1022)count=1022;count++;da56
             -15(count);}
 204   6                       if(glsdz*1000<( (dv549*10/51))*( (di549*100/51))) { if(count<1)   count=1;   count--;da56
             -15(count);}
 205   6                           if((hengya==ScanKeyboard())||
 206   6                                       (henggonglv==ScanKeyboard()))
 207   6                             {
 208   7                                  qhxh=0;
 209   7                                              nbxt=0;
 210   7                                  da5615(0);
 211   7                                  }
 212   6                           }
 213   5                           }
 214   4                     
 215   4                        }
 216   3                      qhxh=1;
 217   3                      nbxt=1;
 218   3                      writeByteLCD(1,0x01); //显示清屏 
 219   3                
 220   3              }
 221   2               ;
 222   2              }
 223   1      
 224   1        
 225   1              
 226   1        }
 227           
 228           


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   3127    ----
   CONSTANT SIZE    =    239    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     52      39
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.

C51 COMPILER V8.02   MAIN                                                                  04/24/2009 12:47:57 PAGE 5   


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

⌨️ 快捷键说明

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