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

📄 main.lst

📁 英飞凌C166之XC164CS按钮键盘扫描程序
💻 LST
📖 第 1 页 / 共 2 页
字号:
  170  1          //// this register must be set in the start-up file
  171  1          //// SYSCON0  =  0x0000
  172  1      
  173  1          ///  ---------------------------------------------------------------------
  174  1          ///  Initialization of the SYSCON1 Register:
  175  1          ///  ---------------------------------------------------------------------
  176  1          ///  clock prescaler for system is fpll / 1
  177  1      
  178  1          //// this register must be set in the start-up file
  179  1          //// SYSCON1  =  0x0000
C166 COMPILER V6.08, MAIN                                                                  08/28/2008 11:42:10 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        // USER CODE BEGIN (Init,3)
  209  1      
  210  1        // USER CODE END
  211  1      
  212  1        //   globally enable interrupts
  213  1        PSW_IEN        =  1;          
  214  1      
  215  1      } //  End of function MAIN_vInit
  216         
  217         
  218         //****************************************************************************
  219         // @Function      void MAIN_vUnlockProtecReg(void) 
  220         //
  221         //----------------------------------------------------------------------------
  222         // @Description   This function makes it possible to write one protected 
  223         //                register. After calling of this function and write on the 
  224         //                protected register is the security level set to low 
  225         //                protected mode.
  226         //
  227         //----------------------------------------------------------------------------
  228         // @Returnvalue   None
  229         //
  230         //----------------------------------------------------------------------------
  231         // @Parameters    None
  232         //
  233         //----------------------------------------------------------------------------
  234         // @Date          2007-5-25
  235         //
  236         //****************************************************************************
  237         
  238         // USER CODE BEGIN (UnlockProtecReg,1)
  239         
  240         // USER CODE END
  241         
C166 COMPILER V6.08, MAIN                                                                  08/28/2008 11:42:10 PAGE 5   

  242         void MAIN_vUnlockProtecReg(void)
  243         {
  244  1        uword ubPASSWORD;
  245  1      
  246  1        if((SCUSLS & 0x1800) == 0x0800)      // if low protected mode
  247  1        {
  248  2      
  249  2          ubPASSWORD = SCUSLS & 0x00FF;
  250  2          ubPASSWORD = ~ubPASSWORD;
  251  2          SCUSLC = 0x8E00 | ubPASSWORD;      // command 4
  252  2      
  253  2        }  // end if low protected mode
  254  1      
  255  1        if((SCUSLS & 0x1800) == 0x1800)      // if write protected mode
  256  1        {
  257  2          SCUSLC = 0xAAAA;                   // command 0
  258  2          SCUSLC = 0x5554;                   // command 1
  259  2      
  260  2          ubPASSWORD = SCUSLS & 0x00FF;
  261  2          ubPASSWORD = ~ubPASSWORD;
  262  2      
  263  2          SCUSLC = 0x9600 | ubPASSWORD;      // command 2
  264  2          SCUSLC = 0x0800;                   // command 3; new PASSWOR is 0x00
  265  2      
  266  2          ubPASSWORD = SCUSLS & 0x00FF;
  267  2          ubPASSWORD = ~ubPASSWORD;
  268  2          SCUSLC = 0x8E00 | ubPASSWORD;      // command 4
  269  2      
  270  2        }  // end if write protected mode
  271  1      
  272  1      } //  End of function MAIN_vUnlockProtecReg
  273         
  274         
  275         //****************************************************************************
  276         // @Function      void main(void) 
  277         //
  278         //----------------------------------------------------------------------------
  279         // @Description   This is the main function.
  280         //
  281         //----------------------------------------------------------------------------
  282         // @Returnvalue   None
  283         //
  284         //----------------------------------------------------------------------------
  285         // @Parameters    None
  286         //
  287         //----------------------------------------------------------------------------
  288         // @Date          2007-5-25
  289         //
  290         //****************************************************************************
  291         
  292         // USER CODE BEGIN (Main,1)
  293         
  294         // USER CODE END
  295         
  296         void main(void)
  297         {
  298  1        // USER CODE BEGIN (Main,2)
  299  1      
  300  1        // USER CODE END
  301  1      
  302  1        MAIN_vInit();
  303  1      
C166 COMPILER V6.08, MAIN                                                                  08/28/2008 11:42:10 PAGE 6   

  304  1        // USER CODE BEGIN (Main,4)
  305  1        while(1)
  306  1        {
  307  2              if(P1H_P0 == 0)                         //扫描P1H_P0口,通过P1L_P0指示它的当前状态
  308  2                 P1L_P0=0;
  309  2         
  310  2          if(P1H_P0 ==1) 
  311  2                 P1L_P0 =1;
  312  2              }
  313  1        // USER CODE END
  314  1      
  315  1      } //  End of function main
  316         
  317         
  318         
  319         // USER CODE BEGIN (MAIN_General,10)
  320         
  321         // USER CODE END
  322         


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


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

⌨️ 快捷键说明

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