C51 COMPILER V9.52.0.0   HALL                                                              09/25/2018 17:39:39 PAGE 1   


C51 COMPILER V9.52.0.0, COMPILATION OF MODULE HALL
OBJECT MODULE PLACED IN .\Output\HALL.obj
COMPILER INVOKED BY: F:\keil\C51\BIN\C51.EXE ..\User\Source\Function\HALL.c LARGE OMF2 WARNINGLEVEL(0) BROWSE INCDIR(..\
                    -Library\FU68xx_Hardware_Driver\Include;..\User\Include) DEBUG PRINT(.\Listing\HALL.lst) OBJECT(.\Output\HALL.obj)

line level    source

   1          /**************************** (C) COPYRIGHT 2017 Fortiortech shenzhen *****************************
   2          * File Name          : AddFunction.c
   3          * Author             : Vina Peng,Fortiortech  Appliction Team
   4          * Version            : V1.0
   5          * Date               : 10-Apr-2017
   6          * Description        : This file contains MDU initial function used for Motor Control.
   7          ***************************************************************************************************
   8          * All Rights Reserved
   9          **************************************************************************************************/
  10          
  11          
  12          /* Includes -------------------------------------------------------------------------------------*/
  13          #include <FU68xx_2.h>
  14          #include <Myproject.h>
  15          
  16          
  17          //HALL 笴綴毀萇雄岊25僅
  18          //#define       HallDetaAngle                    _Q15(10.0/180.0)                                       // HALL閉ヶ+麼氪笴綴-褒  ccw60
  19          // 齊嫌睿毀萇雄岊憤俶眈肮   //5->1->3->2->6->4   0～->60～->120～->180～->240～->300～
  20          //int16 xdata Hall_Angle_Arr[6] = {_Q15(91.6/180.0),_Q15(211.6/180.0),_Q15(151.6/180.0),_Q15(331.6/180.0),
             -_Q15(31.6/180.0),_Q15(271.6/180.0)};  
  21          int16 xdata Hall_Angle_Arr[6] = {_Q15(60.0/180.0),_Q15(180.0/180.0),_Q15(120.0/180.0),_Q15(300.0/180.0),_Q
             -15(0.0/180.0),_Q15(240.0/180.0)};     
  22          
  23          extern  int Test2;
  24          extern  int tTest3;
  25          
  26                  
  27          /*---------------------------------------------------------------------------*/
  28          /* Name         :       uint8  HallCommutation(uint8 GivenFR_Status ,uint8 Hall_Status_Result )
  29          /* Input        :       GivenFR_Status 絞ヶ源砃ㄛHall_Status_Result絞ヶhall陓瘍
  30          /* Output       :       Hall_Status_Next 狟珨祭hall陓瘍
  31          /* Description: 
  32          /*---------------------------------------------------------------------------*/
  33          uint8  HallCommutation(uint8 GivenFR_Status ,uint8 Hall_Status_Result)
  34          {
  35   1              static uint8 Hall_Status_Next = 0;
  36   1              //CW  5->1->3->2->6->4
  37   1                      if(GivenFR_Status == CW)
  38   1                      {       
  39   2                                      switch(Hall_Status_Result)
  40   2                                      {
  41   3                                              case 1:
  42   3                                                      Hall_Status_Next = 3;
  43   3                                                      break;
  44   3                                              case 2:
  45   3                                                      Hall_Status_Next = 6;
  46   3                                                      break;
  47   3                                              case 3:
  48   3                                                      Hall_Status_Next = 2;
  49   3                                                      break;
  50   3                                              case 4:
  51   3                                                      Hall_Status_Next = 5;
  52   3                                                      break;
C51 COMPILER V9.52.0.0   HALL                                                              09/25/2018 17:39:39 PAGE 2   

  53   3                                              case 5:
  54   3                                                      Hall_Status_Next = 1;
  55   3                                                      break;
  56   3                                              case 6:
  57   3                                                      Hall_Status_Next = 4;
  58   3                                                      break;
  59   3                                              default:
  60   3                                                      break;
  61   3                                       }
  62   2                       }               
  63   1                      //CCW 5->4->6->2->3->1
  64   1                      if(GivenFR_Status == CCW)
  65   1                      {
  66   2                              switch(Hall_Status_Result)
  67   2                              {
  68   3                                      case 1:
  69   3                                        Hall_Status_Next = 5;
  70   3                                              break;
  71   3                                      case 2:
  72   3                                        Hall_Status_Next = 3;
  73   3                                              break;
  74   3                                      case 3:
  75   3                                        Hall_Status_Next = 1;
  76   3                                              break;
  77   3                                      case 4:
  78   3                                        Hall_Status_Next = 6;
  79   3                                              break;
  80   3                                      case 5:
  81   3                                        Hall_Status_Next = 4;
  82   3                                              break;
  83   3                                      case 6:
  84   3                                        Hall_Status_Next = 2;
  85   3                                              break;
  86   3                                      default:
  87   3                                              break;
  88   3                              }
  89   2                      }
  90   1                      return Hall_Status_Next;
  91   1      }
  92          
  93          
  94          void HallStatus_CaptureFilter(void)
  95          {
  96   1      
  97   1              mcHall.HallStatus_Filter2   = mcHall.HallStatus_Filter1;        
  98   1      
  99   1              #if (HallFilterlingEnable)
                      {
                              mcHall.HallStatus_Filter1 = HALLSignalDisposeFilter(mcHall.HallCommutationCount,mcHall.GivenFRStatus,HAL
             -LA,HALLB,HALLC);  
                      }
                      #else
 104   1              {
 105   2                      mcHall.HallStatus_Filter1 = HALLSignalDisposeWithoutFilter(mcHall.HallCommutationCount,mcHall.GivenFRSta
             -tus,HALLA,HALLB,HALLC);  
 106   2          }
 107   1              #endif
 108   1              
 109   1               if((mcHall.HallStatus_Filter1  == mcHall.HallStatus_Filter2) && (mcHall.HallStatus_Filter2 != 0))
 110   1               {
 111   2                       mcHall.HallStatus_Result = mcHall.HallStatus_Filter2;
 112   2               }
C51 COMPILER V9.52.0.0   HALL                                                              09/25/2018 17:39:39 PAGE 3   

 113   1         else if(mcHall.HallStatus_Filter2==0)
 114   1               {
 115   2                       mcHall.HallStatus_Result = mcHall.HallStatus_Filter1;
 116   2         }
 117   1      }
 118          
 119          void HallTimeCapture(void)
 120          {
 121   1              Hall_RTHESTEP_Capture();  //厒僅數呾摯褒厒僅揭燴 27us
 122   1                      
 123   1              Hall_THETA_Capture();       //褒僅揭燴 14.6us   
 124   1              
 125   1      }
 126          
 127          
 128          /*---------------------------------------------------------------------------*/
 129          /* Name         :       int16 ThetaDispose (uint8 Hall_Status_Result,uint8 GivenFR_Status,uint16 TempAngle_OffsetCW,int
             -16 TempAngle_OffsetCCW,int16 Angle_Compensate,int16 StartAngle_Offset)
 130          /* Input        :       
 131                                                          
 132          /* Output       :       
 133          /* Description: 
 134          /*---------------------------------------------------------------------------*/
 135          int16 ThetaDispose1 (uint8 Hall_Status_Result,uint8 GivenFR_Status,int16 TempAngle_OffsetCW,int16 TempAngl
             -e_OffsetCCW,int16 Angle_Compensate)
 136          {
 137   1               int16 Hall_Angle = 0;
 138   1              
 139   1               int16 TempHallAngle = 0;
 140   1              
 141   1              Hall_Angle            = Hall_Angle_Arr[Hall_Status_Result-1];
 142   1              
 143   1              if(GivenFR_Status == CW)
 144   1              {
 145   2                      TempHallAngle  = Hall_Angle + TempAngle_OffsetCW + Angle_Compensate ;
 146   2              }
 147   1              else if(GivenFR_Status == CCW)          
 148   1              {                                       
 149   2                      TempHallAngle = Hall_Angle + TempAngle_OffsetCCW - Angle_Compensate ;
 150   2                      
 151   2      //              TempHallAngle =((0 - TempHallAngle)+ Angle_Compensate);                                                                         
 152   2              }
 153   1              
 154   1              
 155   1              return TempHallAngle;
 156   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    322    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =     13       8
   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)
