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

📄 gpt1.lst

📁 开发环境为keil166
💻 LST
📖 第 1 页 / 共 2 页
字号:
C166 COMPILER V6.04, GPT1                                                                  04/06/2009 22:15:29 PAGE 1   


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

 stmt lvl     source

    1         //****************************************************************************
    2         // @Module        General Purpose Timer Unit (GPT1)
    3         // @Filename      GPT1.C
    4         // @Project       can_configure.dav
    5         //----------------------------------------------------------------------------
    6         // @Controller    Infineon XC164CS-16F20
    7         //
    8         // @Compiler      Keil
    9         //
   10         // @Codegenerator 2.8
   11         //
   12         // @Description   This file contains functions that use the GPT1 module.
   13         //
   14         //----------------------------------------------------------------------------
   15         // @Date          2009-4-4 17:03:46
   16         //
   17         //****************************************************************************
   18         
   19         // USER CODE BEGIN (GPT1_General,1)
   20         //CAN屏蔽码(1与验证码相同 0通过) 验证码正确
   21         //CAN发送数据正常
   22         //串口通讯正常
   23         
   24         // USER CODE END
   25         
   26         
   27         
   28         //****************************************************************************
   29         // @Project Includes
   30         //****************************************************************************
   31         
   32         #include "MAIN.H"
   33         
   34         // USER CODE BEGIN (GPT1_General,2)
   35         
   36         // USER CODE END
   37         
   38         
   39         //****************************************************************************
   40         // @Macros
   41         //****************************************************************************
   42         
   43         // USER CODE BEGIN (GPT1_General,3)
   44         
   45         // USER CODE END
   46         
   47         
   48         //****************************************************************************
   49         // @Defines
   50         //****************************************************************************
   51         
   52         // USER CODE BEGIN (GPT1_General,4)
   53         
   54         // USER CODE END
   55         
C166 COMPILER V6.04, GPT1                                                                  04/06/2009 22:15:29 PAGE 2   

   56         
   57         //****************************************************************************
   58         // @Typedefs
   59         //****************************************************************************
   60         
   61         // USER CODE BEGIN (GPT1_General,5)
   62         
   63         // USER CODE END
   64         
   65         
   66         //****************************************************************************
   67         // @Imported Global Variables
   68         //****************************************************************************
   69         
   70         // USER CODE BEGIN (GPT1_General,6)
   71         
   72         // USER CODE END
   73         
   74         
   75         //****************************************************************************
   76         // @Global Variables
   77         //****************************************************************************
   78         
   79         // USER CODE BEGIN (GPT1_General,7)
   80         char id_select=0;
   81         unsigned char id0=0,id1=0; //110h的计数器和111h的计数器
   82         // USER CODE END
   83         
   84         
   85         //****************************************************************************
   86         // @External Prototypes
   87         //****************************************************************************
   88         
   89         // USER CODE BEGIN (GPT1_General,8)
   90         
   91         // USER CODE END
   92         
   93         
   94         //****************************************************************************
   95         // @Prototypes Of Local Functions
   96         //****************************************************************************
   97         
   98         // USER CODE BEGIN (GPT1_General,9)
   99         
  100         // USER CODE END
  101         
  102         
  103         //****************************************************************************
  104         // @Function      void GPT1_vInit(void) 
  105         //
  106         //----------------------------------------------------------------------------
  107         // @Description   This is the initialization function of the GPT1 function 
  108         //                library. It is assumed that the SFRs used by this library 
  109         //                are in its reset state. 
  110         //
  111         //----------------------------------------------------------------------------
  112         // @Returnvalue   None
  113         //
  114         //----------------------------------------------------------------------------
  115         // @Parameters    None
  116         //
  117         //----------------------------------------------------------------------------
C166 COMPILER V6.04, GPT1                                                                  04/06/2009 22:15:29 PAGE 3   

  118         // @Date          2009-4-4
  119         //
  120         //****************************************************************************
  121         
  122         // USER CODE BEGIN (Init,1)
  123         
  124         // USER CODE END
  125         
  126         void GPT1_vInit(void)
  127         {
  128  1        // USER CODE BEGIN (Init,2)
  129  1      
  130  1        // USER CODE END
  131  1      
  132  1        ///  -----------------------------------------------------------------------
  133  1        ///  Configuration of Timer Block Prescaler 1:
  134  1        ///  -----------------------------------------------------------------------
  135  1        ///  - prescaler for timer block 1 is 8
  136  1      
  137  1      
  138  1        ///  -----------------------------------------------------------------------
  139  1        ///  Configuration of the GPT1 Core Timer 3:
  140  1        ///  -----------------------------------------------------------------------
  141  1        ///  - timer 3 works in timer mode
  142  1        ///  - external up/down control is disabled
  143  1        ///  - prescaler factor is 32
  144  1        ///  - up/down control bit is reset
  145  1        ///  - alternate output function T3OUT (P3.3) is disabled
  146  1        ///  - timer 3 output toggle latch (T3OTL) is set to 0
  147  1      
  148  1        GPT12E_T3CON   =  0x0002;      // load timer 3 control register
  149  1        GPT12E_T3      =  0xB1E0;      // load timer 3 register
  150  1      
  151  1        ///  -----------------------------------------------------------------------
  152  1        ///  Configuration of the GPT1 Auxiliary Timer 2:
  153  1        ///  -----------------------------------------------------------------------
  154  1        ///  - timer 2 works in timer mode
  155  1        ///  - external up/down control is disabled
  156  1        ///  - prescaler factor is 32
  157  1        ///  - up/down control bit is reset
  158  1      
  159  1        GPT12E_T2CON   =  0x0002;      // load timer 2 control register
  160  1        GPT12E_T2      =  0xE796;      // load timer 2 register
  161  1      
  162  1        ///  -----------------------------------------------------------------------
  163  1        ///  Configuration of the GPT1 Auxiliary Timer 4:
  164  1        ///  -----------------------------------------------------------------------
  165  1        ///  - timer 4 works in timer mode
  166  1        ///  - external up/down control is disabled
  167  1        ///  - prescaler factor is 8
  168  1        ///  - up/down control bit is reset
  169  1        ///  - timer 4 run bit is reset
  170  1      
  171  1        GPT12E_T4CON   =  0x0000;      // load timer 4 control register
  172  1        GPT12E_T4      =  0x0000;      // load timer 4 register
  173  1      
  174  1        ///  -----------------------------------------------------------------------
  175  1        ///  Configuration of the used GPT1 Port Pins:
  176  1        ///  -----------------------------------------------------------------------
  177  1      
  178  1      
  179  1        ///  -----------------------------------------------------------------------
C166 COMPILER V6.04, GPT1                                                                  04/06/2009 22:15:29 PAGE 4   

  180  1        ///  Configuration of the used GPT1 Interrupts:
  181  1        ///  -----------------------------------------------------------------------
  182  1        ///  timer 2 service request node configuration:
  183  1        ///  - timer 2 interrupt priority level (ILVL) = 9
  184  1        ///  - timer 2 interrupt group level (GLVL) = 1
  185  1        ///  - timer 2 group priority extension (GPX) = 0
  186  1      
  187  1        GPT12E_T2IC    =  0x0065;     
  188  1      
  189  1        ///  timer 3 service request node configuration:
  190  1        ///  - timer 3 interrupt priority level (ILVL) = 11
  191  1        ///  - timer 3 interrupt group level (GLVL) = 1
  192  1        ///  - timer 3 group priority extension (GPX) = 0
  193  1      
  194  1        GPT12E_T3IC    =  0x006D;     
  195  1      
  196  1      
  197  1        // USER CODE BEGIN (GPT1_Function,3)
  198  1      
  199  1        // USER CODE END
  200  1      
  201  1        GPT12E_T2CON_T2R  =  1;        // set timer 2 run bit
  202  1      
  203  1        GPT12E_T3CON_T3R  =  1;        // set timer 3 run bit
  204  1      
  205  1      } //  End of function GPT1_vInit
  206         
  207         
  208         //****************************************************************************
  209         // @Function      void GPT1_viTmr3(void) 
  210         //
  211         //----------------------------------------------------------------------------
  212         // @Description   This is the interrupt service routine for the GPT1 timer 3. 
  213         //                It is called up in the case of over or underflow of the 
  214         //                timer 3 register.
  215         //                If the incremental interface mode is selected it is called 
  216         //                up if count edge or count direction was detected.
  217         //                
  218         //                Please note that you have to add application specific code 
  219         //                to this function.
  220         //
  221         //----------------------------------------------------------------------------
  222         // @Returnvalue   None
  223         //
  224         //----------------------------------------------------------------------------
  225         // @Parameters    None
  226         //
  227         //----------------------------------------------------------------------------
  228         // @Date          2009-4-4
  229         //
  230         //****************************************************************************
  231         
  232         // USER CODE BEGIN (Tmr3,1)     
  233          int velocity=0;        
  234         // USER CODE END
  235         
  236         void GPT1_viTmr3(void) interrupt T3INT
  237         {
  238  1        // USER CODE BEGIN (Tmr3,2)
  239  1       unsigned char data0=0,data1=0,data2=0,data3=0,
  240  1               data4=0,data5=0,data6=0,data7=0;
  241  1       unsigned char check=0,velocityTemp=0;
C166 COMPILER V6.04, GPT1                                                                  04/06/2009 22:15:29 PAGE 5   

  242  1       int velocity=0;
  243  1        // USER CODE END
  244  1      
  245  1      
  246  1        // USER CODE BEGIN (Tmr3,5)
  247  1        GPT12E_T3CON_T3R  =  0; 
  248  1      
  249  1        if (id_select == 0)
  250  1                {
  251  2                CAN_MSGARL1    =  0x0000;      // load arbitration register low
  252  2            CAN_MSGARH1    =  0x0440;      // load arbitration register high
  253  2                
  254  2                data1=0xfd;
  255  2                data2=0;
  256  2                data3=0;
  257  2                data4=0;

⌨️ 快捷键说明

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