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

📄 dom12a_8253v1.lst

📁 64输入32输出单片机程序
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.06   DOM12A_8253V1                                                         08/22/2004 21:22:02 PAGE 1   


C51 COMPILER V7.06, COMPILATION OF MODULE DOM12A_8253V1
OBJECT MODULE PLACED IN DOM12A_8253V1.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE DOM12A_8253V1.C LARGE OPTIMIZE(7,SIZE) MODA2 DEBUG OBJECTEXTEND

stmt level    source

   1          //---------------------------------------------------------------------------
   2          //      Project Title : Armature resistance tester for stator.
   3          //        Project No. : 
   4          //       Project Ver. : 1.00
   5          //          File Name : DOM12A_8253V1.c
   6          //           Revision : 1.00
   7          //       Initial Date : 22-Oct,2002
   8          //        Modify Date : 09-Dec,2003
   9          //        Description : 
  10          //---------------------------------------------------------------------------
  11          #include <..\atmel\at89s53.h>
  12          #include <absacc.h>
  13          #include <stdio.h>
  14          #include <string.h>
  15          #include <dom12a.h>
  16          
  17          #define debug_uart
  18                  
  19          sbit    PIN_5            = P1^3;
  20          sbit    EXTOUT_EN        = P3^5;
  21          
  22          //------------------------------------------------------------
  23          extern uchar data keySTAGE[];
  24          extern uUART_protocol uart, uartIn;
  25          
  26          // extern func.
  27          extern void      Init_Sys_Timer(void);
  28          extern void      Enable_Timer(char timer_name, unsigned int timer_count);
  29          extern void      Disable_Timer(char timer_name);
  30          extern void      msDelay(unsigned int timer_count);
  31          extern uchar STimerStillCounting(uchar idxStimer);
  32          extern void  Mask_Key_Detect(uchar flagClear_nDisable, uchar keyMask);
  33          
  34          extern void _initial_disp (void);
  35          extern void _clear_disp (void);
  36          extern void _lcdCursor_FlashToggling (char stFlashing);
  37          extern void _lcdCursorGoto(char r, char c);
  38          
  39          extern uchar Menu_Operation(void);
  40          extern void  Get_sys_para(void);
  41          
  42          extern char _get_panelsw (char f);
  43          extern char _set_extoutp (char f, char s);
  44          extern char _get_extinp (char f);
  45          
  46          extern void _uart_initial (void);
  47          extern char _uart_command (unsigned char cmdcode);
  48          extern char _uart_reply (void);
  49          extern void Disable_Uart(void);
  50          
  51          extern uchar start_Fixture_control(uchar FCM);
  52          extern uchar Fixture_Sequence_Control(uchar flagPass, uchar FCM);
  53          
  54          unsigned char outbuf;
  55          unsigned char test_end;
C51 COMPILER V7.06   DOM12A_8253V1                                                         08/22/2004 21:22:02 PAGE 2   

  56          unsigned int  uns16b;
  57          unsigned long uns32b;
  58          struct  systempara syspara;
  59          
  60          unsigned char xdata eeprom _at_ 0x0000;
  61          //---------------------------------------------------------------------------
  62          
  63          //Functions prototype
  64          char   _initial_system (void);
  65          void   Error_Handler(uchar errorcode);
  66          void   _disp_screen(void);
  67          uchar  Display_Result(void);
  68          uchar  Armature_Resistance_Test(void);
  69          
  70          //global variables
  71          uint resis[24];
  72          
  73          //*********************************************************************
  74          void main (void)
  75          {
  76   1         uchar retcode, i;
  77   1         uchar flagPass;
  78   1      
  79   1          Init_Sys_Timer();
  80   1              msDelay(100);           //delay for 0.5s
  81   1      
  82   1              _initial_disp();
  83   1          msDelay(200);
  84   1              _lcdCursorGoto(0,0);
  85   1              _lcdCursor_FlashToggling (notFlashing);
  86   1          printf(" Johnson Electric Industrial Mfty. LTD.\n");
  87   1          printf("    DOM-12A Armature resistance tester\n\n");
  88   1          printf("    rev.: 1.0 1st release for product.");
  89   1      
  90   1              msDelay(150);           //15s
  91   1              _uart_initial();  
  92   1              _initial_system();
  93   1              msDelay(200);
  94   1          syspara.totalTested = 0;
  95   1              syspara.totalPassed = 0;
  96   1              syspara.totalFailed = 0;
  97   1      
  98   1              _set_extoutp(EXT_OUTP0,ON);             //Top pis
  99   1              _set_extoutp(EXT_OUTP0,OFF);    //Top pis
 100   1              _set_extoutp(EXT_OUTP1,ON);     //Top pis
 101   1              _set_extoutp(EXT_OUTP1,OFF);    //Top pis
 102   1      
 103   1              for (i=0; i<10; i++)
 104   1                      uartIn.sbuf[i] = 0;
 105   1          msDelay(200);
 106   1      
 107   1          Get_sys_para();
 108   1              //-------------------------------------------------------
 109   1              Enable_Timer(2, 1000);
 110   1              _lcdCursorGoto(3,0);
 111   1              printf("Setup total coils, start bar...\n");
 112   1      
 113   1          uart.st.uiParam2 = syspara.totalCoils;
 114   1              uart.st.uiParam1 = syspara.startBar;
 115   1          _uart_command(UART_CONFIG_SLOT);
 116   1      
 117   1              _lcdCursorGoto(3,0);
C51 COMPILER V7.06   DOM12A_8253V1                                                         08/22/2004 21:22:02 PAGE 3   

 118   1          while ( !_uart_reply() )
 119   1                      if ( !STimerStillCounting(2) )
 120   1                              break;
 121   1              if ( !STimerStillCounting(2) ) {    
 122   2                      printf("Uart error: cannot setup coil#\n");
 123   2                      _set_extoutp(BUZZER, ON);
 124   2                      Disable_Timer(2);
 125   2                      Disable_Uart();
 126   2                      msDelay(2000);  
 127   2              } else if ( uartIn.st.uiParam2 != syspara.totalCoils ||
 128   1                                      uartIn.st.uiParam1 != syspara.startBar ) {
 129   2                      printf("Uart error: incorrect data rx.\n");
 130   2                      _set_extoutp(BUZZER, ON);
 131   2                      Disable_Timer(2);
 132   2                      Disable_Uart();
 133   2                      msDelay(2000);  
 134   2              } // end if
 135   1          _lcdCursorGoto(3,0);
 136   1              printf("Completed!\n");
 137   1      
 138   1              msDelay(2000);
 139   1              _disp_screen();
 140   1              syspara.keylocking = _get_panelsw(LOCK_KEY);
 141   1              _lcdCursorGoto(0,27);
 142   1          if (syspara.keylocking) {
 143   2                      printf("LK");
 144   2                      Mask_Key_Detect(flagKeyDet_nDisable, mask_pbMENU );
 145   2              } else {
 146   2                      printf("UL");
 147   2                      Mask_Key_Detect(flagKeyDetClear, mask_pbMENU );
 148   2              } // end else
 149   1              //----------------------------------------------------------
 150   1              while (1) {
 151   2                      if ( _get_panelsw(LOCK_KEY) ) {  //being locked
 152   3                              if ( !syspara.keylocking) {
 153   4                                      Mask_Key_Detect(flagKeyDet_nDisable, mask_pbMENU );
 154   4                                      syspara.keylocking = True;
 155   4                                      _lcdCursorGoto(0,27);
 156   4                                      printf("LK");
 157   4                              } // end if
 158   3                      } else {        // no locking
 159   3                              if ( syspara.keylocking ) { // detect if keylock
 160   4                                      Mask_Key_Detect(flagKeyDetClear, mask_pbMENU );
 161   4                                      _lcdCursorGoto(0,27);
 162   4                                      printf("UL");
 163   4                                      syspara.keylocking = False;
 164   4                              } // end if
 165   3                              
 166   3                              //msDelay(200);
 167   3                  //_set_extoutp(FAIL_LAMP,OFF);
 168   3                  //_set_extoutp(BUZZER,OFF);
 169   3                  //_set_extoutp(EXT_OUTP0,OFF);
 170   3              } // end if
 171   2      
 172   2                      //--------------------------------------------------------
 173   2              if ( keySTAGE[pbTEST] == 4 || !_get_extinp(START_SW) ) {  
 174   3                              //Conduct resistance measurement & display result
 175   3                              keySTAGE[pbTEST] = 0; 
 176   3                              start_Fixture_control(syspara.FixtureCtrlMode);
 177   3                  _set_extoutp(FAIL_LAMP,OFF);
 178   3                  _set_extoutp(PASS_LAMP,OFF);
 179   3                  _set_extoutp(BUZZER,OFF);
C51 COMPILER V7.06   DOM12A_8253V1                                                         08/22/2004 21:22:02 PAGE 4   

 180   3                  
 181   3                              retcode = Armature_Resistance_Test();
 182   3                              if ( !retcode ) {
 183   4                                      flagPass = Display_Result();
 184   4                                      // control the sequence of fixture according to mode:x
 185   4                                      //_set_extoutp(EXT_OUTP0,OFF);
 186   4                                      if ( !flagPass )
 187   4                                              _set_extoutp(BUZZER,ON);
 188   4                                      Fixture_Sequence_Control(flagPass, syspara.FixtureCtrlMode);
 189   4                              } else {
 190   4                                      _set_extoutp(BUZZER,ON);
 191   4                                      Error_Handler( retcode);
 192   4                              } // end else   
 193   3      
 194   3                      _set_extoutp(BUZZER,OFF);
 195   3                              _lcdCursorGoto(3,22);
 196   3                              printf("F3:MENU    F4:TEST");
 197   3                              _lcdCursorGoto(0, 15);
 198   3                              printf("Stdy");
 199   3                              _lcdCursor_FlashToggling (notFlashing);
 200   3              } // end if
 201   2      
 202   2                      //------------------------------------------------------        
 203   2                      if ( !syspara.keylocking && keySTAGE[pbMENU] == 4 ) { // MENU Operation  
 204   3                              keySTAGE[pbMENU] = 0;
 205   3                              Mask_Key_Detect(flagKeyDetClear, mask_pbF1 | mask_pbF2 );
 206   3                  Menu_Operation();
 207   3                  test_end = FALSE;
 208   3                              Mask_Key_Detect(flagKeyDet_nDisable, mask_pbF1 | mask_pbF2 );
 209   3                      } // end if

⌨️ 快捷键说明

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