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

📄 timer.lst

📁 8051 Web Server project See Makefile for build notes Written for Keil C51 V5.1 compiler, notes:
💻 LST
字号:
C51 COMPILER V8.02   TIMER                                                                 01/11/2008 21:15:51 PAGE 1   


C51 COMPILER V8.02, COMPILATION OF MODULE TIMER
OBJECT MODULE PLACED IN TIMER.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE TIMER.C OPTIMIZE(9,SPEED) BROWSE DEBUG OBJECTEXTEND

line level    source

   1          //-----------------------------------------------------------------------------
   2          // Net TIMER.C
   3          //
   4          // This module sets up the timer and handles the timer interrupt
   5          //-----------------------------------------------------------------------------
   6          #include "C8051f.h"
   7          #include "net.h"
   8          #include "timer.h"
   9          
  10          
  11          extern UINT volatile event_word;
  12          extern ULONG idata initial_sequence_nr;
  13          
  14          
  15          //--------------------------------------------------------------------------
  16          // Timer 2 interrupt service routing. Intr vector location is
  17          // address 0x002B. The timer generates an interrupt every 25 msec
  18          // It is set to auto reload so do not need to reload it.
  19          //--------------------------------------------------------------------------
  20          void timer2_interrupt(void) interrupt 5
  21          {
  22   1              static UINT count1 = 0;
  23   1              static UINT count2 = 0;
  24   1              
  25   1              TF2 = 0;                // Clear interrupt flag
  26   1      
  27   1              
  28   1              // Advance the initial sequence number
  29   1              initial_sequence_nr += 6250;
  30   1         // Keep it some distance from rolling over
  31   1         if (initial_sequence_nr & 0x10000000L) initial_sequence_nr = 1;
  32   1              
  33   1              count1++;
  34   1              // These events happens every 0.50 seconds, not simultaneously
  35   1              if (count1 == 5) event_word |= EVENT_ARP_RETRANSMIT;
  36   1              
  37   1              if (count1 == 10) event_word |= EVENT_TCP_INACTIVITY;
  38   1              
  39   1              if (count1 == 15) event_word |= EVENT_READ_ANALOG;
  40   1              
  41   1              if (count1 == 20)
  42   1              {
  43   2                      count1 = 0;
  44   2                      event_word |= EVENT_TCP_RETRANSMIT;
  45   2              }
  46   1              
  47   1              count2++;
  48   1              if (count2 == 2401)
  49   1              {
  50   2                      // This happens every 60.025 seconds, not simultaneous
  51   2                      // with above tasks
  52   2                      count2 = 0;
  53   2                      event_word |= EVENT_AGE_ARP_CACHE;
  54   2              }
  55   1      }
C51 COMPILER V8.02   TIMER                                                                 01/11/2008 21:15:51 PAGE 2   

  56          
  57          
  58          
  59          
  60          
  61          //--------------------------------------------------------------------------
  62          // Setup Timer2 in mode 1 which is 16 bit auto reload
  63          // Intr rate = 22.1184 MHz /(12 * (65536 - reload value))
  64          // For 25 msec reload value = 19456 = 0x4C00
  65          //--------------------------------------------------------------------------
  66          void init_timer2(void)
  67          {
  68   1              T2CON = 0x00;
  69   1              RCAP2H = 0x4C;          // Reload value
  70   1              RCAP2L = 0x00;
  71   1              TH2 = 0x4C;                             // Initial load value
  72   1              TL2 = 0x00;
  73   1              TR2 = 1;                                        // Timer 2 run
  74   1      }
  75          
  76          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    189    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      4    ----
   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 + -