timer.lst

来自「世纪民生公司的带网络功能的单片机CS6209开发http服务器的演示源代码。」· LST 代码 · 共 250 行 · 第 1/2 页

LST
250
字号
C51 COMPILER V7.50   TIMER                                                                 10/12/2006 15:31:40 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE TIMER
OBJECT MODULE PLACED IN .\Release\Timer.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ..\..\lib\Timer.c LARGE OPTIMIZE(9,SIZE) BROWSE ORDER MODDP2 INCDIR(..\..\i
                    -nc\) DEBUG OBJECTEXTEND PRINT(.\Release\Timer.lst) OBJECT(.\Release\Timer.obj)

line level    source

   1          /*
   2           * 
   3           * timer.c
   4           * 
   5           * Part of the Myson Century CS620X     Ping demo program.
   6           *
   7           * Authors: LY Lin, WM Wang, IJ Chen, WH Lee
   8           *
   9           * timer.c contains setting timer2 interrupt and other time-out functions.
  10           *
  11           * This program was developed using the Keil 8051 C uVision 2 system.
  12           * The Keil compiler MUST be used if working with Myson Century supplied
  13           * firmware.
  14           *
  15           * This program must be linked with the 620xlib.LIB library 
  16           * supplied     by Myson Century in object module form.  
  17           * 
  18           *
  19           * Note: This file must be include if you use TCP/IP with the 620xlib.LIB library .
  20          */
  21          #include "stdio.h"
  22          #include "timeouth.h"
  23          #include "hpserver.h"
  24          #include "timer.h"
  25          
  26          /* Generic 8051/52 timer interrupts (used in most schedulers)*/
  27          /*#define INTERRUPT_Timer_0_Overflow 1*/
  28          /*#define INTERRUPT_Timer_1_Overflow 3*/
  29          /*#define INTERRUPT_Timer_2_Overflow 5*/
  30          
  31          /*
  32           The global time out counter
  33           currently it is declared as an unsigned long integer.  
  34           If it is incremented every milli-second, it will overflow in about 50 days
  35           Hopefully by then this counter will get reset.
  36          */
  37          unsigned long tickcount;
  38          char tick_rtc;
  39          /************************************************************************
  40          /*      Function Name : init_timer2                                                                             *
  41          /*                                                                                                                                              *
  42          /*      Arguments :                                                                                                             *
  43          /*                              None.                                                                                                   * 
  44          /*                                                                                                                                              *
  45          /*      Return : None.                                                                                                          *               
  46          /*                                                                                                                                              *
  47          /*                                                                                                                                              *
  48          /*  Comment :                                                                                                                   *
  49          /*                      This function initialize timer2 and enable interrupt for it.*
  50          /*                      You must call this function before using the time-out           *
  51          /*                      function.                                                                                                       *
  52          /*                                                                                                                                              *
  53          /************************************************************************/
  54          void init_timer2(void) 
C51 COMPILER V7.50   TIMER                                                                 10/12/2006 15:31:40 PAGE 2   

  55          {
  56   1      
  57   1         /* 
  58   1              set up Timer 2
  59   1          16-bit timer function with automatic reload
  60   1         */   
  61   1      
  62   1         T2CON = 0x04;   /* load Timer 2 control register*/
  63   1         T2MOD = 0x00;   /* load Timer 2 mode register*/
  64   1      
  65   1         TH2    = T_15ms_H;   /* load timer 2 high byte*/
  66   1         RCAP2H = T_15ms_H;   /* load timer 2 reload capture reg, high byte*/
  67   1         TL2    = T_15ms_L;   /* load timer 2 low byte*/
  68   1         RCAP2L = T_15ms_L;   /* load timer 2 reload capture reg, low byte*/
  69   1      
  70   1         ET2   = 1;  /* Timer 2 interrupt is enabled*/
  71   1         TR2   = 1;  /* Start Timer 2*/
  72   1         tickcount = 0L;
  73   1      }
  74          
  75          /************************************************************************
  76          /*      Function Name : Enable_interrupt                                                                        *
  77          /*                                                                                                                                              *
  78          /*      Arguments :                                                                                                             *
  79          /*                              None.                                                                                                   *
  80          /*                                                                                                                                              *
  81          /*      Return : None.                                                                                                          *
  82          /*                                                                                                                                              *
  83          /*                                                                                                                                              *
  84          /*  Comment :                                                                                                                   *
  85          /*                      This function enable interrupt.                                                         *
  86          /*                                                                                                                                              *
  87          /************************************************************************/
  88          void Enable_interrupt(void) 
  89             {
  90   1         EA = 1;
  91   1         }
  92          
  93          /************************************************************************
  94          /*      Function Name : Disable_interrupt                                                                       *
  95          /*                                                                                                                                              *
  96          /*      Arguments :                                                                                                             *
  97          /*                              None.                                                                                                   *
  98          /*                                                                                                                                              *
  99          /*      Return : None.                                                                                                          *
 100          /*                                                                                                                                              *
 101          /*                                                                                                                                              *
 102          /*  Comment :                                                                                                                   *
 103          /*                      This function disable interrupt.                                                        *
 104          /*                                                                                                                                              *
 105          /************************************************************************/
 106          void Disable_interrupt(void) 
 107             {
 108   1         EA = 0;
 109   1         }
 110          
 111          /************************************************************************
 112          /*      Function Name : Timer2_Update                                                                           *
 113          /*                                                                                                                                              *

⌨️ 快捷键说明

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