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

📄 main.lst

📁 PMSM电机的磁场定向控制
💻 LST
📖 第 1 页 / 共 2 页
字号:
C166 COMPILER V6.04, MAIN                                                                  07/02/2007 15:03:29 PAGE 1   


C166 COMPILER V6.04, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN MAIN.OBJ
COMPILER INVOKED BY: C:\Keil\C166\BIN\C166.EXE MAIN.C MODV2 BROWSE MODV2 DEBUG

 stmt lvl     source

    1         //****************************************************************************
    2         // @Module        Project Settings
    3         // @Filename      MAIN.C
    4         // @Project       svm.dav
    5         //----------------------------------------------------------------------------
    6         // @Controller    Infineon XC167CI-16F40
    7         //
    8         // @Compiler      Keil
    9         //
   10         // @Codegenerator 2.1
   11         //
   12         // @Description   This file contains the project initialization function.
   13         //
   14         //----------------------------------------------------------------------------
   15         // @Date          19.12.2003 11:31:17
   16         //
   17         //****************************************************************************
   18         
   19         // USER CODE BEGIN (MAIN_General,1)
   20         
   21         // USER CODE END
   22         
   23         
   24         
   25         //****************************************************************************
   26         // @Project Includes
   27         //****************************************************************************
   28         
   29         #include "MAIN.H"
   30         
   31         // USER CODE BEGIN (MAIN_General,2)
   32         
   33         // USER CODE END
   34         
   35         
   36         //****************************************************************************
   37         // @Macros
   38         //****************************************************************************
   39         
   40         // USER CODE BEGIN (MAIN_General,3)
   41         
   42         // USER CODE END
   43         
   44         
   45         //****************************************************************************
   46         // @Defines
   47         //****************************************************************************
   48         
   49         // USER CODE BEGIN (MAIN_General,4)
   50         
   51         // USER CODE END
   52         
   53         
   54         //****************************************************************************
   55         // @Typedefs
C166 COMPILER V6.04, MAIN                                                                  07/02/2007 15:03:29 PAGE 2   

   56         //****************************************************************************
   57         
   58         // USER CODE BEGIN (MAIN_General,5)
   59         
   60         // USER CODE END
   61         
   62         
   63         //****************************************************************************
   64         // @Imported Global Variables
   65         //****************************************************************************
   66         
   67         // USER CODE BEGIN (MAIN_General,6)
   68         
   69         // USER CODE END
   70         
   71         
   72         //****************************************************************************
   73         // @Global Variables
   74         //****************************************************************************
   75         
   76         // USER CODE BEGIN (MAIN_General,7)
   77         char menu[]=
   78         "\r\n\n\n\n"
   79         "a...Start PWM\r\n"
   80         "b...Stop PWM\r\n"
   81         "d...Change rotating Direction \r\n"
   82         "e...Enable Driver\r\n"
   83         "r...Rotate IM\r\n"
   84         " \r\n";
   85         
   86         unsigned char comm_asc0_i = 0;
   87         unsigned char asc0_rece_buf[5];
   88         unsigned char comm_asc0_receCount = 0;
   89         
   90         bit on_flag=ON;
   91         bit rot_flag=OFF;
   92         bit dir_flag=ON;
   93         uchar select=0;
   94         
   95         int speed=0;
   96         
   97         volatile unsigned int idata adc_result[3];
   98         volatile unsigned int idata adc_dclink_res[2];
   99         // USER CODE END
  100         extern unsigned int ENC_OFFSET;
  101         
  102         //****************************************************************************
  103         // @External Prototypes
  104         //****************************************************************************
  105         
  106         // USER CODE BEGIN (MAIN_General,8)
  107         
  108         // USER CODE END
  109         
  110         
  111         //****************************************************************************
  112         // @Prototypes Of Local Functions
  113         //****************************************************************************
  114         
  115         // USER CODE BEGIN (MAIN_General,9)
  116         
  117         // USER CODE END
C166 COMPILER V6.04, MAIN                                                                  07/02/2007 15:03:29 PAGE 3   

  118         
  119         
  120         //****************************************************************************
  121         // @Function      void MAIN_vInit(void) 
  122         //
  123         //----------------------------------------------------------------------------
  124         // @Description   This function initializes the microcontroller.
  125         //
  126         //----------------------------------------------------------------------------
  127         // @Returnvalue   None
  128         //
  129         //----------------------------------------------------------------------------
  130         // @Parameters    None
  131         //
  132         //----------------------------------------------------------------------------
  133         // @Date          19.12.2003
  134         //
  135         //****************************************************************************
  136         
  137         // USER CODE BEGIN (Init,1)
  138         
  139         // USER CODE END
  140         
  141         void MAIN_vInit(void)
  142         {
  143  1        // USER CODE BEGIN (Init,2)
  144  1      
  145  1        // USER CODE END
  146  1      
  147  1        ///  -----------------------------------------------------------------------
  148  1        ///  Configuration of the System Clock:
  149  1        ///  -----------------------------------------------------------------------
  150  1        ///  - VCO clock used, input clock is connected
  151  1        ///  - input frequency is 8 MHz
  152  1        ///  - VCO output frequency 100 .. 150 MHz
  153  1        ///  - system clock is 40 MHz
  154  1      
  155  1        MAIN_vUnlockProtecReg();       // unlock write security
  156  1        PLLCON         =  0x7D12;      // load PLL control register
  157  1      
  158  1      
  159  1        //// -----------------------------------------------------------------------
  160  1        //// Begin of Important Settings for the Start-Up File
  161  1        //// -----------------------------------------------------------------------
  162  1        ///  All following settings must be set in the start-up file. You can use 
  163  1        ///  DAvE's project file (*.dpt) to include this register values into your 
  164  1        ///  compiler EDE.
  165  1      
  166  1          ///  ---------------------------------------------------------------------
  167  1          ///  Initialization of the CPUCON1 Register:
  168  1          ///  ---------------------------------------------------------------------
  169  1          ///  - space between two vectors is 2 words
  170  1          ///  - DISWDT executable until End of Init
  171  1          ///  - segmentation is enabled
  172  1          ///  - switch context is not interruptible
  173  1          ///  - branch prediction is enabled
  174  1          ///  - zero cycle jump function is enabled
  175  1      
  176  1          //// this register must be set in the start-up file
  177  1          //// CPUCON1  =  0x0003
  178  1      
  179  1          ///  ---------------------------------------------------------------------
C166 COMPILER V6.04, MAIN                                                                  07/02/2007 15:03:29 PAGE 4   

  180  1          ///  Initialization of the VECSEG Register:
  181  1          ///  ---------------------------------------------------------------------
  182  1          ///  - start from internal program memory
  183  1      
  184  1          //// this register must be set in the start-up file
  185  1          //// VECSEG  =  0x00C0
  186  1      
  187  1          ///  ---------------------------------------------------------------------
  188  1          ///  Initialization of the SYSCON0 Register:
  189  1          ///  ---------------------------------------------------------------------
  190  1      
  191  1          //// this register must be set in the start-up file
  192  1          //// SYSCON0  =  0x0000
  193  1      
  194  1          ///  ---------------------------------------------------------------------
  195  1          ///  Initialization of the SYSCON1 Register:
  196  1          ///  ---------------------------------------------------------------------
  197  1          ///  clock prescaler for system is fpll / 1
  198  1      
  199  1          //// this register must be set in the start-up file
  200  1          //// SYSCON1  =  0x0000
  201  1      
  202  1          ///  ---------------------------------------------------------------------
  203  1          ///  Initialization of the SYSCON3 Register:
  204  1          ///  ---------------------------------------------------------------------
  205  1      
  206  1          //// this register must be set in the start-up file
  207  1          //// SYSCON3  =  0x0000
  208  1      
  209  1          ///  ---------------------------------------------------------------------
  210  1          ///  Initialization of EBC
  211  1          ///  ---------------------------------------------------------------------
  212  1      
  213  1          //// this register must be set in the start-up file
  214  1          //// EBCMOD1  =  0x005F
  215  1      
  216  1          ///  EBC is disabled
  217  1        //// -----------------------------------------------------------------------
  218  1        //// End of Important Settings for the Start-Up File
  219  1        //// -----------------------------------------------------------------------
  220  1      
  221  1      
  222  1        //   -----------------------------------------------------------------------
  223  1        //   Initialization of the Peripherals:
  224  1        //   -----------------------------------------------------------------------
  225  1      
  226  1        //   initializes the Parallel Ports
  227  1        IO_vInit();
  228  1      
  229  1        //   initializes the Asynchronous/Synchronous Serial Interface (ASC0)
  230  1        ASC0_vInit();
  231  1      
  232  1        //   initializes the General Purpose Timer Unit (GPT1)
  233  1        GPT1_vInit();
  234  1      
  235  1        //   initializes the Capture / Compare Unit 1 (CAPCOM1)
  236  1        CC1_vInit();
  237  1      
  238  1        //   initializes the Analog / Digital Converter (ADC)
  239  1        ADC_vInit();
  240  1      
  241  1        //   initializes the Capture / Compare Unit 6 (CCU6)
C166 COMPILER V6.04, MAIN                                                                  07/02/2007 15:03:29 PAGE 5   

  242  1        CCU6_vInit();
  243  1      
  244  1        //   initializes the Interrupt Controller (INT)
  245  1        INT_vInit();
  246  1      
  247  1        // USER CODE BEGIN (Init,3)
  248  1      
  249  1        // USER CODE END
  250  1      
  251  1        //   globally enable interrupts
  252  1        PSW_IEN        =  1;          
  253  1      
  254  1      } //  End of function MAIN_vInit
  255         
  256         
  257         //****************************************************************************
  258         // @Function      void MAIN_vUnlockProtecReg(void) 
  259         //
  260         //----------------------------------------------------------------------------
  261         // @Description   This function makes it possible to write one protected 

⌨️ 快捷键说明

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