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

📄 borad.lst

📁 自动检测电容值
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V8.02   BORAD                                                                 05/08/2007 16:23:35 PAGE 1   


C51 COMPILER V8.02, COMPILATION OF MODULE BORAD
OBJECT MODULE PLACED IN BORAD.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE BORAD.c ROM(COMPACT) BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include <reg52.h>
   2          #include <setjmp.h>
   3          #include <serial.h>
   4          #include <intrins.h>
   5          #include <stdio.h> 
   6          #define CYCLE (-10000)
   7          
   8          //InterrupT
   9          #define INT0INT 0
  10          #define TIMER0INT 1
  11          #define INT1INT 2
  12          #define TIMER1INT 3
  13          #define COMINT 4
  14          #define TIMER2INT 5
  15          
  16          sbit SW952D=P0^0;
  17          sbit SW951D=P0^1;
  18          sbit LED951D=P0^2;
  19          sbit LED952D=P0^3;
  20          sbit LED953D=P0^4;
  21          sbit LED954D=P0^5;
  22          sbit LED955D=P0^6;
  23          sbit LED956D=P0^7;
  24          
  25          sbit SW952T=P1^0;       //hi
  26          sbit SW951T=P1^1;       //hi
  27          sbit LED951T=P1^2;      //lo
  28          sbit LED952T=P1^3;      //lo
  29          sbit LED953T=P1^4;      //lo
  30          sbit LED954T=P1^5;      //lo
  31          sbit LED955T=P1^6;      //lo
  32          sbit LED956T=P1^7;      //lo
  33          
  34          sbit OkLed=P2^4;
  35          sbit NgLed=P2^5;
  36          sbit Bell=P3^7;
  37          
  38          bit Start=0,Next=0,Stop=0;
  39          char CurrentX=0,CurrentY=0;
  40          char INPORT;
  41          int td;
  42          code char TestBit[]={0,2,1,4,8,16,32,64,128};
  43          //code char Name[8][]={"S1";"S2";"L1";"L2";"L3";"L4";"L5";"L6"};
  44          unsigned char code Name[][6]={"     ","SW951","SW952","LD951","LD952","LD953","LD954","LD955","LD956"};
  45          jmp_buf env;
  46          
  47          void Initial(void);
  48          void delay10ms(int);
  49          void LcdPrint(char *);
  50          void LcdClear(void);
  51          bit keyWait(bit);
  52          bit StartCheck(void);
  53          void main(void)
  54          {
  55   1              char ErrNo=0;
C51 COMPILER V8.02   BORAD                                                                 05/08/2007 16:23:35 PAGE 2   

  56   1              char Pin[9];
  57   1              auto unsigned char ii,jj,d,dm,db;
  58   1              bit StartShow=1;
  59   1              bit ok;
  60   1      //      bit Round;
  61   1              EA=0;
  62   1              P0=0;
  63   1              OkLed=0;
  64   1              NgLed=0;
  65   1              Bell=0;
  66   1              SP=0x5f;
  67   1              init_lcd ();
  68   1              /*------------------主程序--------------------*/
  69   1      /*      while (1)
  70   1              {
  71   1                      lat_disp (0x00,0x00);
  72   1                      chn_disp (tab1);
  73   1                      con_disp (0xff,0xff,0x8c,0x80,2,16);
  74   1                      delay1 (2000);
  75   1                      clrram();
  76   1                      lat_disp (0xcc,0xcc);
  77   1                      delay1 (2000);
  78   1                      lat_disp (0x00,0x00);
  79   1                      chn_disp1 (tab31);
  80   1                      img_disp1 (tab32);
  81   1                      delay1 (2000);
  82   1                      clrram();
  83   1                      lat_disp (0xff,0x00);
  84   1                      delay1 (2000);
  85   1                      img_disp (tab5);
  86   1                      delay1 (2000);
  87   1              }*/
  88   1      //      LcdPrint(tab1[0]);
  89   1      //      while(1)
  90   1              Initial();
  91   1              P0=0;
  92   1              P2=0xe0;
  93   1              LcdClear();
  94   1      //      LcdPrint("\n");
  95   1              LcdPrint("R1=10.2M\n");
  96   1              LcdPrint("R3=10.2M\n");
  97   1              LcdPrint("R2=10.2M\n");
  98   1              LcdPrint("R4=10.2M\n");
  99   1              LcdPrint("C1=1000P\n");
 100   1              LcdPrint("C2=1003P\n");
 101   1              printf("R1=10.2M\n");
 102   1              printf("R2=10.2M\n");
 103   1              printf("R3=10.2M\n");
 104   1              printf("R4=10.2M\n");
 105   1              printf("C1=1000P\n");
 106   1              printf("C2=1003P\n");
 107   1      //      LcdPrint("  按〈测试〉键\n");
 108   1      //      LcdPrint("开始测试\n");
 109   1      //      while(1);
 110   1              while(1);
 111   1              while(1)
 112   1              {
 113   2                      if(StartCheck()) Start=1;
 114   2                      if(setjmp(env)) Start=1;
 115   2                      if(Start)
 116   2                      {
 117   3                              OkLed=NgLed=Bell=1;
C51 COMPILER V8.02   BORAD                                                                 05/08/2007 16:23:35 PAGE 3   

 118   3                              Start=0;
 119   3      //                      LcdPrint("\n");
 120   3      //                      LcdPrint("\n");
 121   3                              LcdClear();
 122   3                              LcdPrint("测试中.");
 123   3                              P0=0;
 124   3                              delay10ms(500);
 125   3                              if(Pin[0]=P1^0xfc) ok=0;else ok=1;
 126   3                              for(ii=8;ii>=1;ii--)
 127   3                              {
 128   4                                      LcdPrint(".");
 129   4                                      d=TestBit[ii];
 130   4                                      P0=d;
 131   4                                      delay10ms(ii>=3?80:120);
 132   4                                      if((Pin[ii]=P1^0xfc)!=d) ok=0;
 133   4                                      delay10ms(ii>=3?20:30);
 134   4                                      P0=0;
 135   4                              }
 136   3      //                      P0=0;
 137   3                              //Error analyse
 138   3      
 139   3      //                      Pin[0]=0xff;
 140   3      //                      Pin[2]=0xbc;
 141   3      //                      ok=1;
 142   3                              LcdClear();
 143   3                              if(ok)
 144   3                              {
 145   4                                      OkLed=0;
 146   4                                      NgLed=1;
 147   4                                      LcdPrint("**测试通过**\n");
 148   4                                      LcdPrint("\n");
 149   4                                      Bell=0;delay10ms(300);
 150   4                                      Bell=1;
 151   4                              }
 152   3                              else
 153   3                              {
 154   4                                      OkLed=1;
 155   4                                      NgLed=0;
 156   4                                      Bell=0;delay10ms(60);
 157   4                                      Bell=1;delay10ms(100);
 158   4                                      Bell=0;delay10ms(60);
 159   4                                      Bell=1;
 160   4                              }
 161   3                              do
 162   3                              {
 163   4                                      if(!ok)
 164   4                                      {
 165   5                                              for(ii=1;ii<=8;ii++)
 166   5                                              {
 167   6                                                      db=TestBit[ii];
 168   6                                                      if(Pin[0]&db) {LcdPrint(Name[ii]);LcdPrint(" ");LcdPrint("与电源短路\n");}
 169   6                                                      if((dm=Pin[ii])!=db)
 170   6                                                      {
 171   7                                                              if(dm)
 172   7                                                              {
 173   8                                                                      for(jj=ii+1;jj<=8;jj++)
 174   8                                                                      {
 175   9                                                                              d=TestBit[jj];
 176   9                                                                              if(dm&d)
 177   9                                                                              {
 178  10                                                                                      
 179  10                                                                                      LcdPrint(Name[ii]);
C51 COMPILER V8.02   BORAD                                                                 05/08/2007 16:23:35 PAGE 4   

 180  10                                                                                      LcdPrint("/");
 181  10                                                                                      LcdPrint(Name[jj]);
 182  10                                                                                      LcdPrint(" ");
 183  10                                                                                              LcdPrint(dm&db?"短路\n":"误配\n");
 184  10                                                                              }
 185   9                                                                      }
 186   8                                                              }
 187   7                                                              else
 188   7                                                              {
 189   8                                                                      LcdPrint(Name[ii]);
 190   8                                                                      LcdPrint(" ");
 191   8                                                                      LcdPrint("失效\n");
 192   8                                                              }
 193   7                                                      }
 194   6                                              }
 195   5                                      }
 196   4                                      if(!ok)
 197   4                                      {
 198   5                                              while(keyWait(1));
 199   5                                              Next=0;Stop=0;
 200   5                                              LcdClear();
 201   5                                              LcdPrint("  按〈下一页〉键\n查看第一页错误\n");
 202   5                                      }
 203   4                                      LcdPrint("  按〈测试〉键\n");
 204   4                                      LcdPrint("测试下一个样品\n");
 205   4                                      if(ok) while(keyWait(0));
 206   4      /*                              else
 207   4                                      {
 208   4                                              keyWait(1);
 209   4                                      }*/
 210   4                              }while(1);
 211   3                      }
 212   2              }
 213   1              return;
 214   1      }
 215          void Initial(void)
 216          {
 217   1              P0=0;
 218   1              P1=P2=P3=0xff;
 219   1              INPORT=0XFF;
 220   1              TMOD=0X11;
 221   1              TR0=1;
 222   1              EX0=0;
 223   1              ET0=1;
 224   1              EA=1;
 225   1              TL0=CYCLE % 256;
 226   1              TH0=CYCLE/256;
 227   1      }
 228          void PowerOff (void) interrupt INT0INT
 229          {
 230   1              return;
 231   1      }
 232          void Time10ms (void) interrupt TIMER0INT
 233          {
 234   1      //      #define FLASHTIME 60
 235   1      //      static unsigned char ft=FLASHTIME;
 236   1              static char InP1=0,InP2=0;
 237   1              char InP,InP3;
 238   1              TL0=CYCLE % 256;
 239   1              TH0=CYCLE/256;
 240   1      
 241   1              InP=INPORT^P2;
C51 COMPILER V8.02   BORAD                                                                 05/08/2007 16:23:35 PAGE 5   

 242   1              InP3=InP&InP2;                  //count 3
 243   1              InP2=InP&InP1&(~InP3);
 244   1              InP1=InP&(~InP3);
 245   1              InP^=INPORT;                    //InP=PP1
 246   1              InP&=InP3;
 247   1              INPORT&=~InP3;
 248   1              INPORT|=InP;
 249   1      
 250   1              Next=Stop=!(INPORT&0x40);
 251   1              Start=!(INPORT&0x80);   
 252   1              if(td) td--;    
 253   1              return;
 254   1      }
 255          void LcdClear(void)
 256          {
 257   1              init_lcd();
 258   1              CurrentX=CurrentY=0;
 259   1      }
 260          void LcdPrint(char * DisBuf)
 261          {
 262   1              code unsigned char Line[]={0x80,0x90,0x88,0x98}; 
 263   1              char kk=0;
 264   1              wr_lcd(comm,0x30);
 265   1              while(DisBuf[kk])
 266   1              {
 267   2                      if(DisBuf[kk]=='\n'||CurrentX>=16)
 268   2                      {
 269   3                              CurrentX=0;
 270   3                              CurrentY++;
 271   3                              if(CurrentY<4) wr_lcd(comm,Line[CurrentY]);
 272   3                      }
 273   2                      else
 274   2                      {
 275   3                              if(CurrentY>=4)
 276   3                              {
 277   4                                      if(!NgLed)
 278   4                                      {
 279   5                                              while(keyWait(1));
 280   5      //                                      Next=0;Stop=0;
 281   5                                              LcdClear();
 282   5                                      }
 283   4                              }
 284   3                              wr_lcd(dat,DisBuf[kk]);
 285   3                              CurrentX++;
 286   3                      }
 287   2                      kk++;
 288   2              }
 289   1              return;
 290   1      }
 291          bit StartCheck(void)
 292          {
 293   1              static unsigned char cn=0;
 294   1              bit NowInst=0;
 295   1              static bit CurInst=0;
 296   1              char pt;
 297   1              P0=0xfc;
 298   1              delay10ms(10);
 299   1              if((pt=P1&0xfc)^0xfc)
 300   1              {
 301   2                      P0=0;

⌨️ 快捷键说明

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