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

📄 main.lst

📁 英飞凌C166之XC164CS的IO读写操作程序
💻 LST
📖 第 1 页 / 共 2 页
字号:
  204  1        //// -----------------------------------------------------------------------
  205  1        //// Begin of Important Settings for the Start-Up File
  206  1        //// -----------------------------------------------------------------------
  207  1        ///  All following settings must be set in the start-up file. You can use 
  208  1        ///  DAvE's project file (*.dpt) to include this register values into your 
  209  1        ///  compiler EDE.
  210  1      
  211  1          ///  ---------------------------------------------------------------------
  212  1          ///  Initialization of the CPUCON1 Register:
  213  1          ///  ---------------------------------------------------------------------
  214  1          ///  - space between two vectors is 16 words
  215  1          ///  - DISWDT executable until End of Init
  216  1          ///  - segmentation is enabled
  217  1          ///  - switch context is interruptible
  218  1          ///  - branch prediction is enabled
  219  1          ///  - zero cycle jump function is enabled
  220  1      
  221  1          //// this register must be set in the start-up file
  222  1          //// CPUCON1  =  0x0067
  223  1      
  224  1          ///  ---------------------------------------------------------------------
  225  1          ///  Initialization of the VECSEG Register:
  226  1          ///  ---------------------------------------------------------------------
  227  1          ///  - start from internal program memory
  228  1      
  229  1          //// this register must be set in the start-up file
  230  1          //// VECSEG  =  0x00C0
  231  1      
  232  1          ///  ---------------------------------------------------------------------
  233  1          ///  Initialization of the SYSCON0 Register:
  234  1          ///  ---------------------------------------------------------------------
  235  1      
  236  1          //// this register must be set in the start-up file
  237  1          //// SYSCON0  =  0x0000
  238  1      
  239  1          ///  ---------------------------------------------------------------------
  240  1          ///  Initialization of the SYSCON1 Register:
  241  1          ///  ---------------------------------------------------------------------
C166 COMPILER V6.08, MAIN                                                                  08/13/2008 13:00:04 PAGE 5   

  242  1          ///  clock prescaler for system is fpll / 1
  243  1      
  244  1          //// this register must be set in the start-up file
  245  1          //// SYSCON1  =  0x0000
  246  1      
  247  1          ///  ---------------------------------------------------------------------
  248  1          ///  Initialization of the SYSCON3 Register:
  249  1          ///  ---------------------------------------------------------------------
  250  1      
  251  1          //// this register must be set in the start-up file
  252  1          //// SYSCON3  =  0x0000
  253  1      
  254  1          ///  ---------------------------------------------------------------------
  255  1          ///  Initialization of EBC
  256  1          ///  ---------------------------------------------------------------------
  257  1      
  258  1          //// this register must be set in the start-up file
  259  1          //// EBCMOD1  =  0x004F
  260  1      
  261  1          ///  EBC is disabled
  262  1        //// -----------------------------------------------------------------------
  263  1        //// End of Important Settings for the Start-Up File
  264  1        //// -----------------------------------------------------------------------
  265  1      
  266  1      
  267  1        //   -----------------------------------------------------------------------
  268  1        //   Initialization of the Peripherals:
  269  1        //   -----------------------------------------------------------------------
  270  1      
  271  1        //   initializes the Parallel Ports
  272  1        IO_vInit();
  273  1      
  274  1        // USER CODE BEGIN (Init,3)
  275  1      
  276  1        // USER CODE END
  277  1      
  278  1        //   globally enable interrupts
  279  1        PSW_IEN        =  1;          
  280  1      
  281  1      } //  End of function MAIN_vInit
  282         
  283         
  284         //****************************************************************************
  285         // @Function      void MAIN_vUnlockProtecReg(void) 
  286         //
  287         //----------------------------------------------------------------------------
  288         // @Description   This function makes it possible to write one protected 
  289         //                register. After calling of this function and write on the 
  290         //                protected register is the security level set to low 
  291         //                protected mode.
  292         //
  293         //----------------------------------------------------------------------------
  294         // @Returnvalue   None
  295         //
  296         //----------------------------------------------------------------------------
  297         // @Parameters    None
  298         //
  299         //----------------------------------------------------------------------------
  300         // @Date          2006-07-27
  301         //
  302         //****************************************************************************
  303         
C166 COMPILER V6.08, MAIN                                                                  08/13/2008 13:00:04 PAGE 6   

  304         // USER CODE BEGIN (UnlockProtecReg,1)
  305         
  306         // USER CODE END
  307         
  308         void MAIN_vUnlockProtecReg(void)
  309         {
  310  1        uword ubPASSWORD;
  311  1      
  312  1        if((SCUSLS & 0x1800) == 0x0800)      // if low protected mode
  313  1        {
  314  2      
  315  2          ubPASSWORD = SCUSLS & 0x00FF;
  316  2          ubPASSWORD = ~ubPASSWORD;
  317  2          SCUSLC = 0x8E00 | ubPASSWORD;      // command 4
  318  2      
  319  2        }  // end if low protected mode
  320  1      
  321  1        if((SCUSLS & 0x1800) == 0x1800)      // if write protected mode
  322  1        {
  323  2          SCUSLC = 0xAAAA;                   // command 0
  324  2          SCUSLC = 0x5554;                   // command 1
  325  2      
  326  2          ubPASSWORD = SCUSLS & 0x00FF;
  327  2          ubPASSWORD = ~ubPASSWORD;
  328  2      
  329  2          SCUSLC = 0x9600 | ubPASSWORD;      // command 2
  330  2          SCUSLC = 0x0800;                   // command 3; new PASSWOR is 0x00
  331  2      
  332  2          ubPASSWORD = SCUSLS & 0x00FF;
  333  2          ubPASSWORD = ~ubPASSWORD;
  334  2          SCUSLC = 0x8E00 | ubPASSWORD;      // command 4
  335  2      
  336  2        }  // end if write protected mode
  337  1      
  338  1      } //  End of function MAIN_vUnlockProtecReg
  339         
  340         
  341         //****************************************************************************
  342         // @Function      void main(void) 
  343         //
  344         //----------------------------------------------------------------------------
  345         // @Description   This is the main function.
  346         //
  347         //----------------------------------------------------------------------------
  348         // @Returnvalue   None
  349         //
  350         //----------------------------------------------------------------------------
  351         // @Parameters    None
  352         //
  353         //----------------------------------------------------------------------------
  354         // @Date          2006-07-27
  355         //
  356         //****************************************************************************
  357         
  358         // USER CODE BEGIN (Main,1)
  359         
  360         // USER CODE END
  361         
  362         void main(void)
  363         {
  364  1        // USER CODE BEGIN (Main,2)
  365  1      
C166 COMPILER V6.08, MAIN                                                                  08/13/2008 13:00:04 PAGE 7   

  366  1        // USER CODE END
  367  1      
  368  1        MAIN_vInit();
  369  1      
  370  1        // USER CODE BEGIN (Main,4)
  371  1        while(1) 
  372  1        {
  373  2              RightMovLed();                          // LED点亮后单个右移
  374  2              delay(100);
  375  2          LeftMovLed();                               // LED点亮后单个左移
  376  2              delay(100);
  377  2          LedFlash();                                 // 实现两个LED从中间跑两边
  378  2              delay(100);
  379  2         // crossFlash();                             // 交叉闪烁
  380  2              delay(100);
  381  2         }
  382  1      
  383  1        // USER CODE END
  384  1      
  385  1      } //  End of function main
  386         
  387         
  388         
  389         // USER CODE BEGIN (MAIN_General,10)
  390         
  391         // USER CODE END
  392         


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


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

⌨️ 快捷键说明

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