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

📄 dom12a_8253v1.lst

📁 64输入32输出单片机程序
💻 LST
📖 第 1 页 / 共 2 页
字号:
 210   2      
 211   2              } // end while
 212   1      }
 213          
 214          //****************************************************************
 215          uchar Display_Result(void)
 216          {
 217   1        uchar i;
 218   1        uchar flagPass = True;
 219   1        uint  res;
 220   1        unsigned long average = 0;
 221   1        uint  max, min;
 222   1      
 223   1        _lcdCursor_FlashToggling (notFlashing);       
 224   1        max = 0; min = 65000;
 225   1        for(i=0; i< syspara.totalCoils; i++) { 
 226   2                      res = resis[i];
 227   2              if ( res > syspara.UL || res < syspara.LL )
 228   2                              flagPass = False;
 229   2                      average += (unsigned long) res;
 230   2                      if ( res > max )
 231   2                              max = res;
 232   2                      if ( res < min )
 233   2                              min = res;
 234   2        } // end for
 235   1      
 236   1        syspara.max = max; syspara.min = min;
 237   1        syspara.average = (uint) (average / syspara.totalCoils);
 238   1        _lcdCursorGoto(0, 35);
 239   1        printf("%5u", ++syspara.totalTested);
 240   1        _lcdCursorGoto(1, 11);
 241   1        if ( flagPass ) {  
C51 COMPILER V7.06   DOM12A_8253V1                                                         08/22/2004 21:22:02 PAGE 5   

 242   2               printf("Passed   ");
 243   2               _lcdCursorGoto(1, 35);
 244   2               printf("%5u", ++syspara.totalPassed);
 245   2            _set_extoutp(PASS_LAMP,ON);//cdf
 246   2      
 247   2        } else {
 248   2               printf("Failed!  ");
 249   2               _lcdCursorGoto(2, 35);
 250   2               printf("%5u", ++syspara.totalFailed);
 251   2               _set_extoutp(BUZZER,ON); 
 252   2           _set_extoutp(FAIL_LAMP,ON);//cdf
 253   2               flagPass = False;
 254   2        } // end if
 255   1        _lcdCursorGoto(3, 0);
 256   1        printf("Avg:%3u.%02u      ", syspara.average / 100, syspara.average %100);
 257   1        _lcdCursorGoto(2, 0);
 258   1        printf("max:%3u.%02u, ", max / 100, max %100);
 259   1        printf("min:%3u.%02u      ", min / 100, min %100);
 260   1        return ( flagPass );
 261   1      } // end func.
 262          
 263          //---------------------------------------------------------------------------
 264          char _initial_system (void)
 265          {       
 266   1        unsigned int xdata *ptr;
 267   1        unsigned int i;
 268   1        uchar flagTimeOut = False;
 269   1      
 270   1        for (i = 0x9000; i != 0; i++) {       
 271   2                      ptr = i;
 272   2              *ptr = 0x00;
 273   2        } // end for
 274   1      
 275   1        msDelay(500);
 276   1        Out_Port = 0;
 277   1          EXTOUT_EN = 0;
 278   1          _set_extoutp(PASS_LAMP,OFF);
 279   1          _set_extoutp(FAIL_LAMP,OFF);
 280   1          _set_extoutp(BUZZER,OFF);
 281   1          _lcdCursorGoto(3, 0);
 282   1              printf("Uart commu. test...     \n");
 283   1              msDelay(500);
 284   1          //----------------------------------------------------------
 285   1              msDelay(100);
 286   1              Enable_Timer(2, 1000);
 287   1              for (i=0; i<10; i++) {
 288   2                      uart.sbuf[i] = i;
 289   2                      uartIn.sbuf[i] = 0;
 290   2              } // end for
 291   1              _uart_command(UART_TEST);
 292   1          
 293   1              while ( !_uart_reply() )
 294   1                      if ( !STimerStillCounting(2) ) {
 295   2                              flagTimeOut = True;
 296   2                              break;
 297   2                      } // end if             
 298   1              if ( flagTimeOut ) {
 299   2                      Disable_Timer(2);
 300   2                      Disable_Uart();
 301   2                      Error_Handler(0x04);
 302   2                      _set_extoutp(BUZZER,ON);
 303   2                      msDelay(3000);
C51 COMPILER V7.06   DOM12A_8253V1                                                         08/22/2004 21:22:02 PAGE 6   

 304   2          } // end if
 305   1      
 306   1          _set_extoutp(PASS_LAMP,OFF);
 307   1          _set_extoutp(FAIL_LAMP,OFF);
 308   1          _set_extoutp(BUZZER,OFF);
 309   1             
 310   1          if (uartIn.sbuf[0] == 'O' && uartIn.sbuf[1] == 'K') {
 311   2                      _lcdCursorGoto(3, 19);
 312   2                      printf("Pass!");
 313   2          } else {
 314   2                      Error_Handler(0x01);
 315   2                      Disable_Uart();
 316   2              _set_extoutp(PASS_LAMP,OFF);
 317   2              _set_extoutp(FAIL_LAMP,ON);
 318   2              _set_extoutp(BUZZER,ON);
 319   2              msDelay(3000);
 320   2          } // end else
 321   1              return TRUE;
 322   1      }
 323          
 324          //---------------------------------------------------------------------------
 325          void _disp_screen(void)
 326          {
 327   1        Mask_Key_Detect(flagKeyDetClear,   mask_pbTEST | mask_pbMENU);
 328   1        Mask_Key_Detect(flagKeyDet_nDisable, mask_pbF1 | mask_pbF2);
 329   1        _clear_disp();
 330   1        _lcdCursor_FlashToggling (notFlashing);
 331   1        _lcdCursorGoto(0,0);
 332   1        printf("Model:DOM-12A");
 333   1        _lcdCursorGoto(0,15);
 334   1        printf("Stdy");
 335   1      
 336   1        _lcdCursorGoto(0,21);
 337   1        printf("Mode%u", syspara.FixtureCtrlMode);
 338   1        _lcdCursorGoto(0,30);
 339   1        printf("Ttl :%5u", syspara.totalTested);
 340   1        _lcdCursorGoto(1,30);
 341   1        printf("Pass:%5u", syspara.totalPassed);
 342   1        _lcdCursorGoto(2,30);
 343   1        printf("Fail:%5u", syspara.totalFailed);
 344   1        
 345   1        _lcdCursorGoto(3,22);
 346   1        printf("F3:MENU    F4:TEST");
 347   1      } // end func.
 348          
 349          //**********************************************************************
 350          void Error_Handler(uchar errorcode)
 351          {
 352   1        _lcdCursorGoto(2,0);
 353   1        switch(errorcode) {
 354   2              case 0x01:printf("Err0x01:Uart send timeout!");
 355   2                                break;
 356   2              case 0x02:printf("Err0x02:Uart wrong commu.!");
 357   2                                break;
 358   2              case 0x04:printf("Err0x04:Uart init. timeout!");
 359   2                                break;
 360   2        } // end switch
 361   1      } // end func.
 362          
 363          //*********************************************************************
 364          uchar Armature_Resistance_Test(void)
 365          {
C51 COMPILER V7.06   DOM12A_8253V1                                                         08/22/2004 21:22:02 PAGE 7   

 366   1        uchar i, idxBar, flagTimeOut;
 367   1        uint  resistance;
 368   1      
 369   1        _lcdCursorGoto(0, 15);
 370   1        printf("Run ");
 371   1        _lcdCursorGoto(1, 0);
 372   1        printf("Testing...             ");
 373   1        _lcdCursor_FlashToggling (onFlashing);
 374   1                      
 375   1        idxBar = syspara.startBar;
 376   1        _lcdCursorGoto(2, 0);
 377   1        printf("Slot#                    ");
 378   1        _lcdCursorGoto(3, 0);
 379   1        printf("Res :                    ");
 380   1      
 381   1        for (i=0; i< syspara.totalCoils; i++) {
 382   2                      uart.st.uiParam1 = (uint) idxBar++;
 383   2                      _uart_command(UART_Bar2Bar_Test);
 384   2                      Enable_Timer(2, 1000); 
 385   2                      flagTimeOut = False; 
 386   2                      while ( !_uart_reply() )
 387   2                              if ( !STimerStillCounting(2) ) {
 388   3                                      flagTimeOut = True;
 389   3                                      break;
 390   3                              } // end if
 391   2      
 392   2                      if ( flagTimeOut ) {
 393   3                              Disable_Timer(2); 
 394   3                              Disable_Uart();
 395   3                              return ( 0x01);
 396   3                      } else {
 397   3                              resistance = uartIn.st.uiParam1;
 398   3                              //((unsigned char *)&resistance)[0] = uartIn.sbuf[0];
 399   3                              //((unsigned char *)&resistance)[1] = uartIn.sbuf[1];
 400   3                              resis[i] = resistance; // unit in 0.01 ohm
 401   3                              _lcdCursorGoto(2, 4);
 402   3                              printf("%2bu     ", idxBar);
 403   3                              _lcdCursorGoto(3, 4);
 404   3                              printf("%4u.%02u       ", resistance / 100, resistance % 100);
 405   3                      } // end else
 406   2                      msDelay(200);
 407   2              } // end for    
 408   1              Disable_Timer(2); 
 409   1              return (0);
 410   1      } // end func.
 411          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   2157    ----
   CONSTANT SIZE    =    606    ----
   XDATA SIZE       =     79      21
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   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 + -