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

📄 main.lst

📁 Embedded C 这本书的范例光碟程式
💻 LST
字号:
C51 COMPILER V6.21  MAIN                                                                   01/23/2002 17:46:38 PAGE 1   


C51 COMPILER V6.21, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN MAIN.OBJ
COMPILER INVOKED BY: C:\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          
  32          /* --------------------------------------------------------------- */
  33          
  34          void main(void)
  35             {
  36   1         Timer_2_Init();  // Set up Timer 2
  37   1      
  38   1         EA = 1;          // Globally enable interrupts
  39   1         
  40   1         while(1);        // An empty Super Loop
  41   1         }
  42          
  43          /* --------------------------------------------------------------- */
  44          
  45          void Timer_2_Init(void)
  46             {
  47   1         // Timer 2 is configured as a 16-bit timer,
  48   1         // which is automatically reloaded when it overflows
  49   1         //
  50   1         // This code (generic 8051/52) assumes a 12 MHz system osc.  
  51   1         // The Timer 2 resolution is then 1.000 祍
  52   1         //
  53   1         // Reload value is FC18 (hex) = 64536 (decimal)
  54   1         // Timer (16-bit) overflows when it reaches 65536 (decimal)
  55   1         // Thus, with these setting, timer will overflow every 1 ms
C51 COMPILER V6.21  MAIN                                                                   01/23/2002 17:46:38 PAGE 2   

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


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 + -