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

📄 scheduler.lst

📁 PLL的资料文档,包括资料
💻 LST
📖 第 1 页 / 共 4 页
字号:
  32      =1  extern  data    Byte    disp_state;               /* disp state */
  33      =1  extern  data    Byte    vol_value;               /* volume value */
  34      =1  extern  bdata   bit             vol_flag;
  35      =1  extern  data    int    vol_tick;            /* volume tick */
  36      =1  extern  data    Byte     disp_tick;            /* disp tick */
  17          #include "task\dts_task.h"
   1      =1  /*H**************************************************************************
   2      =1  * NAME:         disp_task.h         
   3      =1  *----------------------------------------------------------------------------
   4      =1  * Copyright (c) 2006 Atmel.
   5      =1  *----------------------------------------------------------------------------
   6      =1  * RELEASE:      C51 Sample      
   7      =1  * REVISION:     1.00    
   8      =1  *----------------------------------------------------------------------------
   9      =1  * PURPOSE:
  10      =1  *****************************************************************************/
  11      =1  
  12      =1  /*_____ I N C L U D E S ____________________________________________________*/
  13      =1  
  14      =1  void dts_divider (void); 
  15      =1  void dts_task_init (void);
  16      =1  void dts_task(void);
  17      =1  void dts_FerInc (void);
  18      =1  void dts_FerDec (void);
  19      =1  void dts_GetFer (void);
  20      =1  void DelayX1ms(Byte count);
  21      =1  Byte I2c_ReadByte (Byte address);
  22      =1  void I2c_WriteByte (Byte address, Byte bByte);
  23      =1  int dts_scanByte(void);
  24      =1  void dts_IntToByte (Byte address,int bByte);
  25      =1  void dts_MemInit (void);
  26      =1  void dts_DispMem (void);
  27      =1  
  28      =1  void HT1621_getdata(Byte address,Byte bByte);
  29      =1  extern Byte code ht1621disp_Map[];
  30      =1  //extern        idata   char    ht1621disp_Buffer[9];
  31      =1  
  32      =1  extern  idata   char    DTS_buffer[6];
  33      =1  extern  idata   int             dts_frequency;
  34      =1  extern  idata   int             Mem_frequency;
  35      =1  extern  data    Byte    Mem_add;
  36      =1  extern  bdata   bit             DtsMen_flag ;
  18          
  19          /*F**************************************************************************
  20          * NAME:     sch_scheduler_init
  21          *----------------------------------------------------------------------------
C51 COMPILER V8.01   SCHEDULER                                                             08/07/2006 11:16:10 PAGE 10  

  22          * PARAMS:
  23          *
  24          * return:
  25          *----------------------------------------------------------------------------
  26          * PURPOSE: 
  27          *   Scheduler initialization
  28          *----------------------------------------------------------------------------
  29          * EXAMPLE:
  30          *----------------------------------------------------------------------------
  31          * NOTE:
  32          *   Task_x_init() and Task_x_fct() are defined in scheduler.h
  33          *----------------------------------------------------------------------------
  34          * REQUIREMENTS:
  35          *****************************************************************************/
  36          void sch_scheduler_init (void)
  37          {
  38   1              Task_1_init();
  39   1              Task_2_init();
  40   1              Task_3_init();
  41   1              DelayX10ms(150);   
  42   1              Task_4_init();  
  43   1              Task_5_init();  
  44   1              Task_6_init();  
  45   1              Task_7_init();  
  46   1              Task_8_init();  
  47   1              Task_9_init();  
  48   1              Task_10_init();
  49   1      //  sch_time_init();                /* start time base */
  50   1      }
  51          
  52          /*F**************************************************************************
  53          * NAME:     sch_scheduler
  54          *----------------------------------------------------------------------------
  55          * PARAMS:
  56          *
  57          * return:
  58          *----------------------------------------------------------------------------
  59          * PURPOSE:
  60          *   Task execution scheduler 
  61          *----------------------------------------------------------------------------
  62          * EXAMPLE:
  63          *----------------------------------------------------------------------------
  64          * NOTE:
  65          *----------------------------------------------------------------------------
  66          * REQUIREMENTS:
  67          *****************************************************************************/
  68          void sch_scheduler (void)
  69          {
  70   1              while (1)
  71   1              {
  72   2                      Task_1_fct();
  73   2                      Task_2_fct();
  74   2                      Task_3_fct();
  75   2                      Task_4_fct();
  76   2                      Task_5_fct();
  77   2                      Task_6_fct();
  78   2                      Task_7_fct();
  79   2                      Task_8_fct();
  80   2                      Task_9_fct();
  81   2                      Task_10_fct();
  82   2              }
  83   1      }
C51 COMPILER V8.01   SCHEDULER                                                             08/07/2006 11:16:10 PAGE 11  

  84          
  85          /*F**************************************************************************
  86          * NAME:     sch_time_init
  87          *----------------------------------------------------------------------------
  88          * PARAMS:
  89          *
  90          * return:
  91          *----------------------------------------------------------------------------
  92          * PURPOSE:
  93          *   Scheduler time base (timer 0) initialization
  94          *----------------------------------------------------------------------------
  95          * EXAMPLE:
  96          *----------------------------------------------------------------------------
  97          * NOTE:
  98          *   mode 16-bit Timer, Time counter
  99          *   T0_PRIO to be defined in config.h
 100          *   TIM_LOW & TIM_HIGH defined in scheduler.h
 101          *----------------------------------------------------------------------------
 102          * REQUIREMENTS:
 103          *****************************************************************************/
 104          void sch_timer0_init (void)
 105          {
 106   1              TMOD = TMOD |0x01;
 107   1              TL0 = TIM_LOW;
 108   1              TH0 = TIM_HIGH;
 109   1              //T0_enable_int();              /* enable interrupt */
 110   1              IE = IE | 0x82;
 111   1              //T0_start();                   /* start time base */
 112   1              TR0 = High;
 113   1              ET0 = High;
 114   1              EA = High;
 115   1      } 
 116          /*F**************************************************************************
 117          * NAME:     timer0
 118          *----------------------------------------------------------------------------
 119          * PARAMS:
 120          *
 121          * return:
 122          *----------------------------------------------------------------------------
 123          * PURPOSE:
 124          *   Timer 0 interrupt function
 125          *----------------------------------------------------------------------------
 126          * EXAMPLE:
 127          *----------------------------------------------------------------------------
 128          * NOTE:
 129          *----------------------------------------------------------------------------
 130          * REQUIREMENTS:
 131          ******************************************************************************/
 132          void timer0(void) interrupt 1 using 2  
 133          {
 134   1              TL0 = TIM_LOW;                /* reload timer */ 
 135   1              TH0 = TIM_HIGH;
 136   1        /* increment task tick counters */
 137   1              gl_cpt_tick++;                /* general timer */
 138   1              gl_kbd_tick++;                /* keyboard timer */
 139   1              gl_act_tick++;                          /* Inactivity TIMER */
 140   1              vol_tick++;
 141   1              disp_tick++;
 142   1              touch_tick++;
 143   1              if(gl_cpt_tick> 50){
 144   2                      P1_5 = ~P1_5;
 145   2                      gl_cpt_tick = 0;
C51 COMPILER V8.01   SCHEDULER                                                             08/07/2006 11:16:10 PAGE 12  

 146   2                      }
 147   1              if(gl_kbd_tick >150)  gl_kbd_tick = 0;
 148   1              if(gl_act_tick >150)  gl_act_tick = 0;
 149   1              if(vol_tick >1000)  vol_tick = 0;
 150   1              if(disp_tick >150)  disp_tick = 0;
 151   1              if(touch_tick >150)  touch_tick = 0;
 152   1      
 153   1      }
 154          
 155          /*F**************************************************************************
 156          * NAME: System_init
 157          *----------------------------------------------------------------------------
 158          * PARAMS:
 159          *
 160          * return:
 161          *----------------------------------------------------------------------------
 162          * PURPOSE: 
 163          *----------------------------------------------------------------------------
 164          * EXAMPLE:
 165          *----------------------------------------------------------------------------
 166          * NOTE:
 167          *----------------------------------------------------------------------------
 168          * REQUIREMENTS:
 169          *****************************************************************************/
 170          void System_init (void)
 171          {
 172   1              I2c_init();
 173   1      
 174   1              DtsMen_flag = Low;
 175   1              Mem_add = Mem_StartAdd; /* DTS setp at 24c02 start address */
 176   1              DtsMen_flag = Low;              /* DTS mem pointer flag initializtion */
 177   1              dts_frequency = DTS_FreStart;           /* DTS frequency value initializtion */
 178   1              
 179   1              gl_kbd_tick = 0x00;
 180   1              gl_cpt_tick = 0x00;
 181   1              gl_act_tick = 0x00;
 182   1              vol_tick = 0x00;
 183   1              disp_tick = 0x00;
 184   1      }
 185          
 186          /*F**************************************************************************
 187          * NAME: System_init
 188          *----------------------------------------------------------------------------
 189          * PARAMS:
 190          *
 191          * return:
 192          *----------------------------------------------------------------------------
 193          * PURPOSE: 
 194          *----------------------------------------------------------------------------
 195          * EXAMPLE:
 196          *----------------------------------------------------------------------------
 197          * NOTE:
 198          *----------------------------------------------------------------------------
 199          * REQUIREMENTS:
 200          *****************************************************************************/
 201          void Tick_init (void)
 202          {
 203   1              gl_kbd_tick = 0x00;
 204   1              gl_cpt_tick = 0x00;
 205   1              gl_act_tick = 0x00;
 206   1              vol_tick = 0x00;
 207   1              disp_tick = 0x00;
C51 COMPILER V8.01   SCHEDULER                                                             08/07/2006 11:16:10 PAGE 13  

 208   1              touch_tick = 0x00;
 209   1      }
 210          
C51 COMPILER V8.01   SCHEDULER                                                             08/07/2006 11:16:10 PAGE 14  

ASSEMBLY LISTING OF GENERATED OBJECT CODE


             ; FUNCTION sch_scheduler_init (BEGIN)
                                           ; SOURCE LINE # 36
                                           ; SOURCE LINE # 37
                                           ; SOURCE LINE # 38
0000 120000      R     LCALL   sch_timer0_init
                                           ; SOURCE LINE # 39
0003 120000      R     LCALL   System_init
                                           ; SOURCE LINE # 40
0006 120000      E     LCALL   disp_task_init
                                           ; SOURCE LINE # 41
0009 7F96              MOV     R7,#096H
000B 120000      E     LCALL   _DelayX10ms
                                           ; SOURCE LINE # 42
000E 120000      R     LCALL   Tick_init
                                           ; SOURCE LINE # 43
0011 120000      E     LCALL   vol_task_init
                                           ; SOURCE LINE # 44

⌨️ 快捷键说明

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