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

📄 main.lst

📁 keil C51 ISR事例
💻 LST
字号:
C51 COMPILER V7.06   MAIN                                                                  12/16/2004 15:42:44 PAGE 1   


C51 COMPILER V7.06, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN MAIN.OBJ
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE MAIN.C OPTIMIZE(6,SPEED) BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          /*------------------------------------------------------------------*-
   2          
   3             Main.c
   4          
   5            ------------------------------------------------------------------
   6          
   7             Simple timer ISR demonstration program.
   8          
   9          
  10             COPYRIGHT
  11             ---------
  12          
  13             This code is associated with the book:
  14          
  15             EMBEDDED C by Michael J. Pont 
  16             [Pearson Education, 2002: ISBN: 0-201-79523-X].
  17          
  18             This code is copyright (c) 2001 by Michael J. Pont.
  19           
  20             See book for copyright details and other information.
  21          
  22          -*------------------------------------------------------------------*/
  23          
  24          #include <Reg52.H>
  25          
  26          #define INTERRUPT_Timer_2_Overflow 5
  27          
  28          // Function prototype
  29          // NOTE: ISR is not explictly called and does not require a prototype
  30          void Timer_2_Init(void);
  31          void X(void);
  32          
  33          /* --------------------------------------------------------------- */
  34          
  35          void main(void)
  36             {
  37   1         Timer_2_Init();  // Set up Timer 2
  38   1      
  39   1         EA = 1;          // Globally enable interrupts
  40   1         
  41   1         while(1) ;        // An empty Super Loop
  42   1         }
  43          
  44          /* --------------------------------------------------------------- */
  45          
  46          void Timer_2_Init(void)
  47             {
  48   1         // Timer 2 is configured as a 16-bit timer,
  49   1         // which is automatically reloaded when it overflows
  50   1         //
  51   1         // This code (generic 8051/52) assumes a 12 MHz system osc.  
  52   1         // The Timer 2 resolution is then 1.000 祍
  53   1         //
  54   1         // Reload value is FC18 (hex) = 64536 (decimal)
  55   1         // Timer (16-bit) overflows when it reaches 65536 (decimal)
C51 COMPILER V7.06   MAIN                                                                  12/16/2004 15:42:44 PAGE 2   

  56   1         // Thus, with these setting, timer will overflow every 1 ms
  57   1         T2CON   = 0x04;   // Load Timer 2 control register
  58   1      
  59   1         TH2     = 0xFF;   // Load Timer 2 high byte
  60   1         RCAP2H  = 0xFF;   // Load Timer 2 reload capt. reg. high byte
  61   1         TL2     = 0x18;   // Load Timer 2 low byte
  62   1         RCAP2L  = 0x18;   // Load Timer 2 reload capt. reg. low byte
  63   1      
  64   1         // Timer 2 interrupt is enabled, and ISR will be called 
  65   1         // whenever the timer overflows - see below.
  66   1         ET2     = 1;
  67   1      
  68   1         // Start Timer 2 running
  69   1         TR2   = 1;        
  70   1         }
  71          
  72          /* --------------------------------------------------------------- */
  73          
  74          void X(void) interrupt INTERRUPT_Timer_2_Overflow
  75             {
  76   1        
  77   1         // This ISR is called every 1 ms
  78   1         
  79   1         // Place required code here...
  80   1         }
  81          
  82          /*------------------------------------------------------------------*-
  83            ---- END OF FILE -------------------------------------------------
  84          -*------------------------------------------------------------------*/


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =     29    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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