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

📄 main.lst

📁 本程序是针对Infineon公司的XC167CI处理器而编写的CAN网络程序。CAN(控制局域网)协议是一种广泛的应用于汽车电子的网络协议。本程序建立了三个CAN节点
💻 LST
📖 第 1 页 / 共 2 页
字号:
  177  1      
  178  1          //// this register must be set in the start-up file
  179  1          //// SYSCON1  =  0x0000
C166 COMPILER V6.04, MAIN                                                                  12/10/2006 20:50:28 PAGE 4   

  180  1      
  181  1          ///  ---------------------------------------------------------------------
  182  1          ///  Initialization of the SYSCON3 Register:
  183  1          ///  ---------------------------------------------------------------------
  184  1      
  185  1          //// this register must be set in the start-up file
  186  1          //// SYSCON3  =  0x0000
  187  1      
  188  1          ///  ---------------------------------------------------------------------
  189  1          ///  Initialization of EBC
  190  1          ///  ---------------------------------------------------------------------
  191  1      
  192  1          //// this register must be set in the start-up file
  193  1          //// EBCMOD1  =  0x007F
  194  1      
  195  1          ///  EBC is disabled
  196  1        //// -----------------------------------------------------------------------
  197  1        //// End of Important Settings for the Start-Up File
  198  1        //// -----------------------------------------------------------------------
  199  1      
  200  1      
  201  1        //   -----------------------------------------------------------------------
  202  1        //   Initialization of the Peripherals:
  203  1        //   -----------------------------------------------------------------------
  204  1      
  205  1        //   initializes the Parallel Ports
  206  1        IO_vInit();
  207  1      
  208  1        //   initializes the TwinCAN Module (CAN)
  209  1        CAN_vInit();
  210  1      
  211  1        // USER CODE BEGIN (Init,3)
  212  1      
  213  1        // USER CODE END
  214  1      
  215  1        //   globally enable interrupts
  216  1        PSW_IEN        =  1;          
  217  1      
  218  1      } //  End of function MAIN_vInit
  219         
  220         
  221         //****************************************************************************
  222         // @Function      void MAIN_vUnlockProtecReg(void) 
  223         //
  224         //----------------------------------------------------------------------------
  225         // @Description   This function makes it possible to write one protected 
  226         //                register. After calling of this function and write on the 
  227         //                protected register is the security level set to low 
  228         //                protected mode.
  229         //
  230         //----------------------------------------------------------------------------
  231         // @Returnvalue   None
  232         //
  233         //----------------------------------------------------------------------------
  234         // @Parameters    None
  235         //
  236         //----------------------------------------------------------------------------
  237         // @Date          2006-12-10
  238         //
  239         //****************************************************************************
  240         
  241         // USER CODE BEGIN (UnlockProtecReg,1)
C166 COMPILER V6.04, MAIN                                                                  12/10/2006 20:50:28 PAGE 5   

  242         
  243         // USER CODE END
  244         
  245         void MAIN_vUnlockProtecReg(void)
  246         {
  247  1        ubyte ubPASSWORD;
  248  1      
  249  1        if((SCUSLS & 0x1800) == 0x0800)      // if low protected mode
  250  1        {
  251  2      
  252  2          ubPASSWORD = SCUSLS & 0x00FF;
*** WARNING C192 IN LINE 252 OF MAIN.C: '=': value truncated
  253  2          ubPASSWORD = ~ubPASSWORD;
  254  2          SCUSLC = 0x8E00 | ubPASSWORD;      // command 4
  255  2      
  256  2        }  // end if low protected mode
  257  1      
  258  1        if((SCUSLS & 0x1800) == 0x1800)      // if write protected mode
  259  1        {
  260  2          SCUSLC = 0xAAAA;                   // command 0
  261  2          SCUSLC = 0x5554;                   // command 1
  262  2      
  263  2          ubPASSWORD = SCUSLS & 0x00FF;
*** WARNING C192 IN LINE 263 OF MAIN.C: '=': value truncated
  264  2          ubPASSWORD = ~ubPASSWORD;
  265  2      
  266  2          SCUSLC = 0x9600 | ubPASSWORD;      // command 2
  267  2          SCUSLC = 0x0800;                   // command 3; new PASSWOR is 0x00
  268  2      
  269  2          ubPASSWORD = SCUSLS & 0x00FF;
*** WARNING C192 IN LINE 269 OF MAIN.C: '=': value truncated
  270  2          ubPASSWORD = ~ubPASSWORD;
  271  2          SCUSLC = 0x8E00 | ubPASSWORD;      // command 4
  272  2      
  273  2        }  // end if write protected mode
  274  1      
  275  1      } //  End of function MAIN_vUnlockProtecReg
  276         
  277         
  278         //****************************************************************************
  279         // @Function      void main(void) 
  280         //
  281         //----------------------------------------------------------------------------
  282         // @Description   This is the main function.
  283         //
  284         //----------------------------------------------------------------------------
  285         // @Returnvalue   None
  286         //
  287         //----------------------------------------------------------------------------
  288         // @Parameters    None
  289         //
  290         //----------------------------------------------------------------------------
  291         // @Date          2006-12-10
  292         //
  293         //****************************************************************************
  294         
  295         // USER CODE BEGIN (Main,1)
  296            ubyte ch[8]="hellowo";
  297         int k,j;
  298         // USER CODE END
  299         
  300         void main(void)
C166 COMPILER V6.04, MAIN                                                                  12/10/2006 20:50:28 PAGE 6   

  301         {
  302  1        // USER CODE BEGIN (Main,2)
  303  1      
  304  1        // USER CODE END
  305  1      
  306  1        MAIN_vInit();
  307  1      
  308  1        // USER CODE BEGIN (Main,4)
  309  1              
  310  1        P1L=0xff;
  311  1        // USER CODE BEGIN (Main,4)
  312  1        while(1)
  313  1        {
  314  2               for(k=0;k<10000;k++)
  315  2                for(j=0;j<500;j++)
  316  2                ;
  317  2                       
  318  2        if(CAN_ubRequestMsgObj(1))//检验所选择的报文是否可以访问,即检验TXRQ 
  319  2        {
  320  3                      CAN_vLoadData(1,ch);  //将要发送的数据放入报文消息的数据区中
  321  3                
  322  3                      CAN_vTransmit(1);// set TXRQ, reset CPUUPD,然后发送数据 
  323  3              }
  324  2        }
  325  1        // USER CODE END
  326  1      
  327  1      } //  End of function main
  328         
  329         
  330         
  331         // USER CODE BEGIN (MAIN_General,10)
  332         
  333         // USER CODE END
  334         


MODULE INFORMATION:   INITIALIZED  UNINITIALIZED
  CODE SIZE        =         202     --------
  NEAR-CONST SIZE  =    --------     --------
  FAR-CONST SIZE   =    --------     --------
  HUGE-CONST SIZE  =    --------     --------
  XHUGE-CONST SIZE =    --------     --------
  NEAR-DATA SIZE   =          12     --------
  FAR-DATA SIZE    =    --------     --------
  XHUGE-DATA SIZE  =    --------     --------
  IDATA-DATA SIZE  =    --------     --------
  SDATA-DATA SIZE  =    --------     --------
  BDATA-DATA SIZE  =    --------     --------
  HUGE-DATA SIZE   =    --------     --------
  BIT SIZE         =    --------     --------
  INIT'L SIZE      =          12     --------
END OF MODULE INFORMATION.


C166 COMPILATION COMPLETE.  3 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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