C51 COMPILER V9.52.0.0   MC_LED                                                            08/21/2018 12:02:28 PAGE 1   


C51 COMPILER V9.52.0.0, COMPILATION OF MODULE MC_LED
OBJECT MODULE PLACED IN .\obj\MC_Led.obj
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE User\Source\MC_Led.c LARGE OMF2 WARNINGLEVEL(0) OPTIMIZE(SIZE) BROWSE NOARE
                    -GS INCDIR(.\Library\Include;.\User\Include) DEBUG PRINT(.\obj\MC_Led.lst) TABS(2) OBJECT(.\obj\MC_Led.obj)

line level    source

   1          /* Includes ------------------------------------------------------------------*/
   2          #include <sys_conf.h>
   3          #include <MC_UserInterface_layer.h>   
   4          #include <MC_Led.h>
   5          
   6          
   7          /** @addtogroup FT68xx
   8            * @{
   9            */
  10          
  11          /* Private typedef -----------------------------------------------------------*/
  12          u8  gUserLEDCunter;           //LED闪烁次数  FAULT
  13          u16 gUserLEDmsCunter;        //LED闪烁次数
  14          u16 gUserNoOperationDelaynms; //No operation time delay
  15          
  16          /* Private define ------------------------------------------------------------*/
  17          #define LEDFAULTDIS_EN     (1)     //故障指示
  18          #define LEDONOFFDIS_EN     (0)     //ONOFF指示
  19          #define LEDCWCCWDIS_EN     (1)     //正反转显示
  20          #define LEDCELLDIS_EN      (0)     //电量显示
  21          #define LEDSHIFTDIS_EN     (0)     //档位显示
  22          
  23          /* Private macro -------------------------------------------------------------*/
  24          
  25          void LED_show(void);
  26          void Fault_Led(Error_TypeDef value); 
  27          /* Private functions ---------------------------------------------------------*/
  28          
  29          /*******************************************************************************
  30          * Function Name  : Fault_Led   P15 P17 P20
  31          * Description    : 
  32          * Input          : Ctl.SysError故障代码
  33          * Output         : None
  34          * Return         : None
  35          *******************************************************************************/
  36          void Fault_Led(Error_TypeDef value)
  37          {
  38   1        #if(LEDFAULTDIS_EN)
  39   1        u16 temp = 500;
  40   1        if(value != 0)   
  41   1        {
  42   2          if(gUserLEDmsCunter > temp)
  43   2          {
  44   3            if(gUserLEDCunter <= ((value<<1) - 1))  //一元操作符不加空格 3.6.6
  45   3            {
  46   4              if(gUserLEDmsCunter > (temp + 500))
  47   4              {
  48   5                gUserLEDmsCunter = temp;
  49   5                gUserLEDCunter++;
  50   5                FAULT_ONOFF;
  51   5              }       
  52   4            }
  53   3            else
  54   3            {
C51 COMPILER V9.52.0.0   MC_LED                                                            08/21/2018 12:02:28 PAGE 2   

  55   4              #if(0)
                      FAULT_ONOFF;                     //故障指示完成，输出固定信号
                      gUserLEDmsCunter = 0;
                      #else                              
  59   4              FAULT_OFF;
  60   4              if(gUserLEDmsCunter>temp+3000)  //故障指示完成，3秒后再次闪烁
  61   4              {
  62   5                gUserLEDmsCunter = 0;
  63   5                gUserLEDCunter = 0;
  64   5              } 
  65   4              #endif                   
  66   4            }             
  67   3          }
  68   2        }
  69   1        else
  70   1        {
  71   2          gUserLEDmsCunter = 0;
  72   2        }
  73   1        #endif
  74   1      }
  75          
  76          /*******************************************************************************
  77          * Function Name  : LED_show
  78          * Description    : 
  79          * Input          : 
  80          * Output         : None
  81          * Return         : None
  82          *******************************************************************************/
  83          void LED_show(void)
  84          {
  85   1        //照明指示
  86   1        #if(LAMP_EN) //扳手螺丝批，延时掉电程序
                if(Ctl.Tim.NoOperationDelaynms >= NOOPDELAYNMS)
                {
                  Ctl.Tim.NoOperationDelaynms = NOOPDELAYNMS;
                  Rom.ReadValue = Flash_GetAddress();     //读
                  Flash_ErasePageRom();                  //擦
                  Flash_KeyWriteValue((Rom.WriteValue));  //写
                  PDELAY_OFF;
                } 
                else
                {
                  PDELAY_ON;
                }
                #endif   
 100   1                                
 101   1        #if(LEDONOFFDIS_EN)
                if(Ctl.gStart == TRUE)
                {
                  LED1_ON;
                }
                else
                {
                  LED1_OFF;
                }
                #endif
 111   1      //正反转显示
 112   1        
 113   1        #if(LEDCWCCWDIS_EN)
 114   1        if (Ctl.SysError == NONE)
 115   1        {
 116   2          if(Ui.flg.FR == CW)
C51 COMPILER V9.52.0.0   MC_LED                                                            08/21/2018 12:02:28 PAGE 3   

 117   2          {
 118   3            LED2_OFF;
 119   3          }
 120   2          else if(Ui.flg.FR == CCW)
 121   2          {
 122   3            LED2_ON;
 123   3          }
 124   2        }
 125   1        #endif
 126   1      //电量显示
 127   1        #if(LEDCELLDIS_EN)
                if (Ctl.SysError == NONE)
                {
                  if(Drv.AdcMeas.Vdc > 18)
                  {
                    LED1_ON;
                    LED2_ON;
                    LED3_ON;
                  }
                  else if(Drv.AdcMeas.Vdc > 16.5)
                  {
                    LED1_ON;
                    LED2_ON;
                    LED3_OFF;
                  }
                  else if(Drv.AdcMeas.Vdc > 15)
                  {
                    LED1_ON;
                    LED2_OFF;
                    LED3_OFF;
                  }
                  else
                  {
                    LED1_OFF;
                    LED2_OFF;
                    LED3_OFF;
                  }
                }
                #endif 
 156   1      //档位显示
 157   1      
 158   1        #if(LEDSHIFTDIS_EN)
                switch(Ctl.spd.SpeedShift)
                {
                  case 1:
                  {
                    LED1_ON;
                    LED2_OFF;
                    LED3_OFF;
                  }
                    break;
                  case 2:
                  {
                    LED1_OFF;
                    LED2_ON;
                    LED3_OFF;
                  }
                    break;
                  case 3:
                  {
                    LED1_OFF;
                    LED2_OFF;
C51 COMPILER V9.52.0.0   MC_LED                                                            08/21/2018 12:02:28 PAGE 4   

                    LED3_ON;
                  }      
                    break;
                  
                  default:
                    break;
                }
                #endif
 187   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    135    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =      5    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
   EDATA SIZE       =   ----    ----
   HDATA SIZE       =   ----    ----
   XDATA CONST SIZE =   ----    ----
   FAR CONST SIZE   =   ----    ----
END OF MODULE INFORMATION.


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