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

📄 mainprog.lst

📁 单体电容测试仪源码程序 可测电压、有A/D转换等。
💻 LST
📖 第 1 页 / 共 5 页
字号:
 610   1                      ADC_filter(1);          //测量电压
 611   1                      Channel_Votage(ADC_result_intr,1);      //单位毫伏
 612   1                      start_votage=Votage;                    //充电起始电压
 613   1                      Votage_record=Votage;                           //电压记录
C51 COMPILER V8.06   MAINPROG                                                              02/13/2009 09:29:07 PAGE 11  

 614   1                      //清累计电荷量
 615   1                      charge=0;                       //充电总电荷
 616   1                      charge_record=0;        //充电电荷记录
 617   1                      ADC_counter=0;          //累加次数
 618   1                      printh(0x0d);printh(0x0a);
 619   1                      print("28VF: ");
 620   1                      print("V:");
 621   1                      disp_float_votage(Votage,2);            //显示当前电压
 622   1                      print("I:");
 623   1                      disp_float_votage(current,2);   //显示当前电流
 624   1                      print("Counter:");
 625   1                      disp_float_decimal(ADC_counter);                //显示累加次数
 626   1                      print("Q:");
 627   1                      disp_float_decimal(charge);             //显示累加电荷量
 628   1                      printh(0x0d);printh(0x0a);
 629   1                      Mesure_state=discharge_28V_cap_test;            //开始测量
 630   1                      disp_flag=1;
 631   1                  break;
 632   1              //28V电容放电电容测量
 633   1              case discharge_28V_cap_test:
 634   1                      if (flag_10ms_1==1) {
 635   1                              flag_10ms_1=0;  
 636   1                              ADC_filter(2);          //测量电流
 637   1                              charge+=ADC_result_intr;        //电荷量累加
 638   1                              ADC_counter++;          //累加次数
 639   1                              Channel_Votage(ADC_result_intr,2);      //单位毫伏
 640   1                              current=Votage/25;                              //当前电流
 641   1                              if ((disp_flag==1) && (flag_1s_1==1) ) {
 642   1                                      flag_1s_1=0;
 643   1                                      print(" I:");
 644   1                                      disp_float_votage(current,2);           //显示当前电流
 645   1                                      ADC_filter(1);                                  //测量电压
 646   1                                      print(" V:");
 647   1                                      Channel_Votage(ADC_result_intr,1);      //单位毫伏
 648   1                                      disp_float_votage(Votage,2);            //显示当前电压
 649   1                              }
 650   1                      }
 651   1                      ADC_filter(1);          //测量电压
 652   1                      Channel_Votage(ADC_result_intr,1);      //单位毫伏
 653   1                      Curent_Votage=Votage;                   //当前电压
 654   1                      //每达到1伏打印一次
 655   1                      if(((Votage/1000)<(Votage_record/1000))||(stop_flag==1)){       //打印电压
 656   1                              printh(0x0d);printh(0x0a);
 657   1                              print("28VF: ");
 658   1                              print("V:");
 659   1                              disp_float_votage(Curent_Votage,2);     //显示当前电压
 660   1                              print("I:");
 661   1                              disp_float_votage(current,2);                   //显示当前电流
 662   1                              print("Counter:");
 663   1                              disp_float_decimal(ADC_counter);        //显示累加次数
 664   1                              print("Q:");
 665   1                              disp_float_decimal(charge);                     //显示累加电荷量
 666   1                              print("ΔQ:");
 667   1                              disp_float_decimal(charge-charge_record);       //显示电荷量差
 668   1                              print("ΔC:");
 669   1                              Channel_Votage(charge-charge_record,2); //折合成电压,单位:毫伏
 670   1                              //disp_float_decimal(Votage);
 671   1                              Votage=Votage/25000;                                    //折合成电流(以25毫欧为采样电阻)
 672   1                              //disp_float_decimal(Votage);
 673   1                              Votage=Votage*1000/(Votage_record-Curent_Votage);       //折合成电容
 674   1                              disp_float_votage(Votage,2);                            //显示电容量
 675   1                              print("C:");
C51 COMPILER V8.06   MAINPROG                                                              02/13/2009 09:29:07 PAGE 12  

 676   1                              Channel_Votage(charge/1000,2);  //折合成电压,单位:毫伏
 677   1                              //disp_float_decimal(Votage);
 678   1                              Votage=Votage/25;                               //折合成电流(以25毫欧为采样电阻)
 679   1                              //disp_float_decimal(Votage);
 680   1                              Votage=Votage*1000/(start_votage-Curent_Votage);        //总电容
 681   1                              disp_float_votage(Votage,2);            //显示电容量
 682   1                              printh(0x0d);printh(0x0a);
 683   1      
 684   1                              charge_record=charge;                   //记录本次电荷累计数量
 685   1                              Votage_record=Curent_Votage;                    //记录当前电压
 686   1                      }
 687   1                      if (stop_flag==1)       {
 688   1                              stop_flag=0;
 689   1                              disp_flag=0;
 690   1                      }
 691   1                      break;
 692   1              //28V电容充电电容测量开始
 693   1              case charge_sigle_cap_test_start:
 694   1                      //测量起始电压
 695   1                      ADC_filter(3);          //测量电压
 696   1                      Channel_Votage(ADC_result_intr,3);      //单位毫伏
 697   1                      start_votage=Votage;                    //充电起始电压
 698   1                      Votage_record=Votage;                           //电压记录
 699   1                      //清累计电荷量
 700   1                      charge=0;                       //充电总电荷
 701   1                      charge_record=0;        //充电电荷记录
 702   1                      ADC_counter=0;          //累加次数
 703   1                      printh(0x0d);printh(0x0a);
 704   1                      print("1.2VC: ");
 705   1                      print("V:");
 706   1                      disp_float_votage(Votage,2);            //显示当前电压
 707   1                      print("I:");
 708   1                      disp_float_votage(current,2);   //显示当前电流
 709   1                      print("Counter:");
 710   1                      disp_float_decimal(ADC_counter);                //显示累加次数
 711   1                      print("Q:");
 712   1                      disp_float_decimal(charge);             //显示累加电荷量
 713   1                      printh(0x0d);printh(0x0a);
 714   1                      //进入测量状态
 715   1                      Mesure_state=charge_sigle_cap_test;             //开始测量
 716   1                      disp_flag=1;
 717   1                  break;
 718   1      
 719   1              //sigle电容充电电容测量
 720   1              case charge_sigle_cap_test:
 721   1                      if (flag_10ms_1==1) {
 722   1                              flag_10ms_1=0;  
 723   1                              ADC_filter(2);          //测量电流
 724   1                              charge+=ADC_result_intr;        //电荷量累加
 725   1                              ADC_counter++;          //累加次数
 726   1                              Channel_Votage(ADC_result_intr,2);      //单位毫伏
 727   1                              current=Votage/25;                              //当前电流
 728   1                              if ((disp_flag==1) && (flag_1s_1==1) ) {
 729   1                                      flag_1s_1=0;
 730   1                                      print(" I:");
 731   1                                      disp_float_votage(current,2);           //显示当前电流
 732   1                                      ADC_filter(3);                                  //测量电压
 733   1                                      print(" V:");
 734   1                                      Channel_Votage(ADC_result_intr,3);      //单位毫伏
 735   1                                      disp_float_votage(Votage,2);            //显示当前电压
 736   1                              }
 737   1                      }
C51 COMPILER V8.06   MAINPROG                                                              02/13/2009 09:29:07 PAGE 13  

 738   1                      ADC_filter(3);          //测量电压
 739   1                      Channel_Votage(ADC_result_intr,3);      //单位毫伏
 740   1                      Curent_Votage=Votage;                   //当前电压
 741   1                      //每达到0.1伏打印一次
 742   1                      if(((Votage/100)>(1+Votage_record/100))||(stop_flag==1)){       //打印电压
 743   1                              printh(0x0d);printh(0x0a);
 744   1                              print("1.2VC: ");
 745   1                              print("V:");
 746   1                              disp_float_votage(Votage,2);            //显示当前电压
 747   1                              print("I:");
 748   1                              disp_float_votage(current,2);           //显示当前电流
 749   1                              print("Counter:");
 750   1                              disp_float_decimal(ADC_counter);        //显示累加次数
 751   1                              print("Q:");
 752   1                              disp_float_decimal(charge);             //显示累加电荷量
 753   1                              print("ΔQ:");
 754   1                              disp_float_decimal(charge-charge_record);       //显示电荷量差
 755   1                              print("ΔC:");
 756   1                              Channel_Votage(charge-charge_record,2); //折合成电压,单位:毫伏
 757   1                              Votage=Votage/25000;                                    //折合成电流(以25毫欧为采样电阻)
 758   1                              Votage=Votage*10000/(Curent_Votage-Votage_record);      //折合成电容
 759   1                              //disp_float_decimal(Votage_record);
 760   1                              //disp_float_decimal(Curent_Votage);
 761   1                              disp_float_votage(Votage,2);                            //显示电容量
 762   1                              print("C:");
 763   1                              Channel_Votage(charge/1000,2);  //折合成电压,单位:毫伏
 764   1                              //disp_float_decimal(Votage);
 765   1                              Votage=Votage/25;                               //折合成电流(以25毫欧为采样电阻)
 766   1                              //disp_float_decimal(Votage);
 767   1                              Votage=Votage*10000/(Curent_Votage-start_votage);       //总电容
 768   1                              //disp_float_decimal(Curent_Votage);
 769   1                              //disp_float_decimal(start_votage);
 770   1                              disp_float_votage(Votage,2);            //显示电容量
 771   1                              printh(0x0d);printh(0x0a);
 772   1      
 773   1                              charge_record=charge;                   //记录本次电荷累计数量
 774   1                              Votage_record=Curent_Votage;                    //记录当前电压
 775   1                      }
 776   1                      if (stop_flag==1)       {
 777   1                              stop_flag=0;
 778   1                              disp_flag=0;
 779   1                      }
 780   1                      break;
 781   1              //sigle电容放电电容测量开始
 782   1              case discharge_sigle_cap_test_start:
 783   1                      //测量起始电压
 784   1                      ADC_filter(3);          //测量电压
 785   1                      Channel_Votage(ADC_result_intr,3);      //单位毫伏
 786   1                      start_votage=Votage;                    //充电起始电压
 787   1                      Votage_record=Votage;                           //电压记录
 788   1                      //清累计电荷量
 789   1                      charge=0;                       //充电总电荷
 790   1                      charge_record=0;        //充电电荷记录
 791   1                      ADC_counter=0;          //累加次数
 792   1      
 793   1                      printh(0x0d);printh(0x0a);
 794   1                      print("1.2VF: ");
 795   1                      print("V:");
 796   1                      disp_float_votage(Votage,2);            //显示当前电压
 797   1                      print("I:");
 798   1                      disp_float_votage(current,2);   //显示当前电流
 799   1                      print("Counter:");
C51 COMPILER V8.06   MAINPROG                                                              02/13/2009 09:29:07 PAGE 14  

 800   1                      disp_float_decimal(ADC_counter);                //显示累加次数
 801   1                      print("Q:");
 802   1                      disp_float_decimal(charge);             //显示累加电荷量
 803   1                      printh(0x0d);printh(0x0a);
 804   1                      Mesure_state=discharge_sigle_cap_test;          //开始测量
 805   1                      disp_flag=1;
 806   1                  break;
 807   1              //sigle电容放电电容测量
 808   1              case discharge_sigle_cap_test:
 809   1                      if (flag_10ms_1==1) {
 810   1                              flag_10ms_1=0;  
 811   1                              ADC_filter(2);          //测量电流
 812   1                              charge+=ADC_result_intr;        //电荷量累加
 813   1                              ADC_counter++;          //累加次数

⌨️ 快捷键说明

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