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

📄 timer.lst

📁 Bitek 公司 bit1611b模拟屏驱动芯片外接MCU驱动DEMO源码
💻 LST
字号:
C51 COMPILER V7.50   TIMER                                                                 02/05/2007 16:33:26 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE TIMER
OBJECT MODULE PLACED IN .\OBJ\TIMER.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE TIMER.C ROM(COMPACT) OPTIMIZE(9,SPEED) NOAREGS DEFINE(PROJECT=DMO04015800,M
                    -CU_CFG=BIT5101,VP_IF_CFG=VP_IF_BITEK) PRINT(.\LST\TIMER.lst) OBJECT(.\OBJ\TIMER.obj)

line level    source

   1          /* **********************************************************************
   2          
   3                   Copyright (c) 2002-2006 Beyond Innovation Technology Co., Ltd
   4          
   5                  All rights are reserved. Reproduction in whole or in parts is
   6              prohibited without the prior written consent of the copyright owner.
   7             ----------------------------------------------------------------------
   8          
   9              Module: TIMER.C
  10          
  11              Purpose: Implementation of TIMER module.
  12          
  13              Version: 0.01                                   11:33AM  2005/11/17
  14          
  15              Compiler: Keil 8051 C Compiler v8.01
  16          
  17              Reference:
  18          
  19             ----------------------------------------------------------------------
  20              Modification:
  21          
  22              R0.01 11:33AM  2005/11/17 Jeffrey Chang
  23              Reason:
  24                  1. Original.
  25              Solution:
  26          
  27             ********************************************************************** */
  28          
  29          #define _TIMER_C_
  30          
  31          /* ------------------------------------
  32              Header Files
  33             ------------------------------------ */
  34          #include "common.h"
  35          #include "led.h"
  36          #include "key.h"
  37          #include "mcu.h"
  38          #include "menu.h"
  39          #include "platform.h"
  40          #include "timer.h"
  41          #include "yuv.h"
  42          
  43          #if (IR_CFG != IR_00_UNUSE)
                  #include "ir.h"
              #endif
  46          
  47          /* ------------------------------------
  48              Macro Definitions
  49             ------------------------------------ */
  50          
  51          /* ------------------------------------
  52              Type Definitions
  53             ------------------------------------ */
  54          
C51 COMPILER V7.50   TIMER                                                                 02/05/2007 16:33:26 PAGE 2   

  55          
  56          /* ------------------------------------
  57              Variables Definitions
  58             ------------------------------------ */
  59          
  60          
  61          /* ------------------------------------
  62              Function Prototypes
  63             ------------------------------------ */
  64          
  65          
  66          /* -------------------------------------------------------------------
  67              Name: TIMER_Init - To initialize TIMER module.
  68              Purpose:
  69              Passed: None.
  70              Returns: None.
  71              Notes:
  72          
  73              Reference: [3]87, [3]89
  74             ------------------------------------------------------------------- */
  75          void TIMER_Init (void)
  76          {
  77   1          IP  = 0x2A;
  78   1      
  79   1      
  80   1          // [3]64, 89
  81   1          TMOD            = TIMER_MODE;
  82   1      
  83   1          // Timer Mode 1 (16-bit)
  84   1          TIMER_COUNTER_H = (65536 - MACHINE_PER_TICK) / 256;
  85   1          TIMER_COUNTER_L = (65536 - MACHINE_PER_TICK) % 256;
  86   1      
  87   1          /* [3]89 Timer 0/1 start running */
  88   1          TIMER_RUN       = TRUE;
  89   1      
  90   1          /* [3]87 Enable Timer 0/1 overflow interrupt */
  91   1          TIMER_ENABLE    = TRUE;
  92   1      
  93   1          /* Initialize Variables */
  94   1          wTIMER_TickCnt  = 0;
  95   1      
  96   1          wTIMER_BurnInTick = 0;
  97   1      } /* TIMER_Init */
  98          
  99          
 100          /* -------------------------------------------------------------------
 101              Name: TIMER_ISR -
 102              Purpose: System Timer Interrupt Service Routine (ISR).
 103              Passed: None
 104              Returns: None.
 105              Notes:
 106          
 107              Reference: [2]19
 108             ------------------------------------------------------------------- */
 109          void TIMER_ISR (void) interrupt TIMER_INT   using TIMER_USING
 110          {
 111   1          // Timer Mode 1 (16-bit)
 112   1          TIMER_COUNTER_H = (65536 - MACHINE_PER_TICK) / 256;
 113   1          TIMER_COUNTER_L = (65536 - MACHINE_PER_TICK) % 256;
 114   1      
 115   1          wTIMER_TickCnt++;
 116   1      
C51 COMPILER V7.50   TIMER                                                                 02/05/2007 16:33:26 PAGE 3   

 117   1      
 118   1          /* ....................................
 119   1             KEY module
 120   1             .................................... */
 121   1          /* To scan the keypad every 8 System Ticks since
 122   1             the debounce needs 48 ms at least                */
 123   1          // Period = 8 Ticks
 124   1          if ((wTIMER_TickCnt & 0x0007) == 0)
 125   1              KEY_Scan();
 126   1      
 127   1          #if (KEY_VR_AIN21)
                  if (bKEY_VR_ADJUSTMENT)
                      bKEY_VR_ADJUSTMENT--;
                  #endif
 131   1      
 132   1          /* ....................................
 133   1             TIMER module
 134   1             .................................... */
 135   1          if (bTIMER_Tick)                 
 136   1              bTIMER_Tick--;
 137   1      
 138   1          if (wTIMER_Tick)
 139   1              wTIMER_Tick--;
 140   1      
 141   1          /* ....................................
 142   1             DISPATCH module
 143   1             .................................... */
 144   1          if (wTIMER_BurnInTick)
 145   1              wTIMER_BurnInTick--;
 146   1      
 147   1          /* ....................................
 148   1             MENU module
 149   1             .................................... */
 150   1          if (wMENU_Tick)
 151   1              wMENU_Tick--;
 152   1      
 153   1      
 154   1          /* ....................................
 155   1             LED module
 156   1             .................................... */
 157   1          if (fLED_RED_Blink)
 158   1          {
 159   2              // Period = 128 Ticks
 160   2              // 50% duty cycle
 161   2              if ((wTIMER_TickCnt & 0x007F) == 0x0000)
 162   2                  LED_RED_OFF;
 163   2      
 164   2              if ((wTIMER_TickCnt & 0x007F) == 0x0040)
 165   2                  LED_RED_ON;
 166   2          }
 167   1      
 168   1      
 169   1          if (fLED_GREEN_Blink)
 170   1          {
 171   2              // Period = 128 Ticks
 172   2              // 50% duty cycle
 173   2              if ((wTIMER_TickCnt & 0x007F) == 0x0010)
 174   2                  LED_GREEN_OFF;
 175   2      
 176   2              if ((wTIMER_TickCnt & 0x007F) == 0x0050)
 177   2                  LED_GREEN_ON;
 178   2          }
C51 COMPILER V7.50   TIMER                                                                 02/05/2007 16:33:26 PAGE 4   

 179   1      
 180   1      } /* TIMER_ISR */
 181          
 182          
 183          /* -------------------------------------------------------------------
 184              Name: TIMER_DelayMS -
 185              Purpose: To wait a moment in milli-seconds.
 186              Passed:
 187                  wMS = 1..65530                  @ System tick = 6ms
 188          
 189                  Delay duration = 1 Tick         @ wMS = 1
 190                                 = 6 ms           @ wMS = 1
 191                  Delay duration = 10922 Ticks    @ wMS = 65530
 192                                 = 65532 ms       @ wMS = 65530
 193          
 194              Returns: None.
 195              Notes:
 196              Reference: [2]19
 197             ------------------------------------------------------------------- */
 198          void TIMER_DelayMS (UW16 wMS)
 199          {
 200   1          TIMER_RUN   = FALSE;
 201   1      
 202   1          wTIMER_Tick = (wMS + MS_PER_TICK - 1) / MS_PER_TICK;
 203   1      
 204   1          TIMER_RUN   = TRUE;
 205   1      
 206   1          while (wTIMER_Tick)        
 207   1              ;                      
 208   1      } /* TIMER_DelayMS */
 209          
 210          
 211          /* -------------------------------------------------------------------
 212              Name:  -
 213              Purpose: .
 214              Passed: None.
 215              Returns: None.
 216              Notes:
 217             ------------------------------------------------------------------- */
 218          
 219          
 220          /* **********************************************************************
 221          
 222              Description:
 223          
 224          
 225             ********************************************************************** */
 226          
 227          /* %% End Of File %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */


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