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

📄 disp_task.lst

📁 本人at89c51snd1c主控IC增加了128*32点阵驱动显示
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.20   DISP_TASK                                                             03/24/2007 10:02:39 PAGE 1   


C51 COMPILER V7.20, COMPILATION OF MODULE DISP_TASK
OBJECT MODULE PLACED IN .\Output\disp_task.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE modules\display\disp_task.c OPTIMIZE(7,SPEED) BROWSE INCDIR(.\modules\syste
                    -m;.\;.\;.\lib_refd) DEFINE(KEIL) DEBUG OBJECTEXTEND PRINT(.\Output\disp_task.lst) OBJECT(.\Output\disp_task.obj)

line level    source

   1          /*C**************************************************************************
   2          * NAME:         disp_task.c
   3          *----------------------------------------------------------------------------
   4          * Copyright (c) 2003 Atmel.
   5          *----------------------------------------------------------------------------
   6          * RELEASE:      snd1c-refd-nf-4_0_3      
   7          * REVISION:     1.13     
   8          *----------------------------------------------------------------------------
   9          * PURPOSE:
  10          * This file contains the display task and attached routines
  11          *
  12          * NOTES:
  13          * Global Variables:
  14          *   - gl_cpt_tick:    global tick counter in data space
  15          *   - gl_sbc_wr_busy: SCSI write busy flag set to OFF in this task
  16          *   - gl_sbc_rd_busy: SCSI read busy flag set to OFF in thsi task
  17          *****************************************************************************/
  18          
  19          /*_____ I N C L U D E S ____________________________________________________*/
  20          
  21          #include "config.h"                         /* system configuration */
  22          #include "board.h"                          /* board definition */
  23          #include "modules\file\file.h"              /* file definition */
  24          #include "modules\display\disp.h"           /* display definition */
  25          #include "disp_task.h"                      /* display task definition */
  26          #ifndef CONF_DISPLAY
                #define LCD 0
                #define LED 1
                #define CONF_DISPLAY   LCD
              #endif
  31          #if CONF_DISPLAY == LED
  32          #include "modules\display\led.h"            /* led definition */
  33          #endif
  34          
  35          /*_____ M A C R O S ________________________________________________________*/
  36          #if CONF_DISPLAY == LED
  37          #define REF_STATE_SONG      0
  38          #define REF_STATE_VOICE     1
  39          #define REF_STATE_USB       2
  40          #define REF_STATE_FORMAT    3
  41          #endif
  42          
  43          /*_____ D E F I N I T I O N ________________________________________________*/
  44          extern void LCDDisplayInit();
  45          extern void Draw2Digit( Uchar Pos, Uchar HexCode );
  46          extern void LCDClearLine( Uchar page, Uchar column, Uint16 Length );
  47          extern void Draw8x6Icons( Uchar Page, Uchar Column, Uchar Index );
  48          
  49          extern  data    Byte    gl_cpt_tick;        /* general tick counter */
  50          extern  bdata   bit     fs_memory;          /* selected file system */
  51          extern          bit     gl_sbc_wr_busy;     /* SBC write busy flag */
  52          extern          bit     gl_sbc_rd_busy;     /* SBC read busy flag */
  53          static  bdata   bit     disp_scroll_on;     /* set to TRUE to scroll name */
  54          static  bdata   bit     disp_clock_on;      /* set to TRUE to start clock */
C51 COMPILER V7.20   DISP_TASK                                                             03/24/2007 10:02:39 PAGE 2   

  55          static  data    Byte    disp_sec_cpt;       /* second counter */
  56          static  data    Byte    disp_min_cpt;       /* minute counter */
  57          static  data    char pdata *  disp_buffer;
  58          
  59          
  60          static  xdata   Byte    gl_cpt_tick_save;   /* tick counter saved value */
  61          static  xdata   Byte    disp_sec_cpt_save;  /* second counter saved value */
  62          static  xdata   Byte    disp_min_cpt_save;  /* minute counter saved value */
  63          
  64          static  data    Byte    disp_state;         /* task state */
  65          
  66          #if CONF_DISPLAY == LED
  67          extern xdata Byte  func_state;
  68          extern xdata Byte  func_timeout;  // Time out special function
  69          extern xdata Byte  ref_state;
  70          extern bit         playing;
  71          extern bit         pause;
  72          extern bit         recording;
  73          extern bit         connected;
  74          extern xdata Byte  LED_ON;
  75          extern xdata Byte  LED_FAST;
  76          #endif
  77          
  78          /*_____ D E C L A R A T I O N ______________________________________________*/
  79          
  80          
  81          /*F**************************************************************************
  82          * NAME: disp_task_init
  83          *----------------------------------------------------------------------------
  84          * PARAMS:
  85          *
  86          * return:
  87          *----------------------------------------------------------------------------
  88          * PURPOSE: 
  89          *   Display task initialization
  90          *----------------------------------------------------------------------------
  91          * EXAMPLE:
  92          *----------------------------------------------------------------------------
  93          * NOTE:
  94          *----------------------------------------------------------------------------
  95          * REQUIREMENTS:
  96          *****************************************************************************/
  97          void disp_task_init (void)
  98          {
  99   1        disp_scroll_on = FALSE;
 100   1        disp_clock_on = FALSE;
 101   1        disp_state = DISP_IDLE;
 102   1        print_init();
 103   1        LCDDisplayInit();
 104   1        LCDClearLine( 0, 0, 128 );
 105   1        LCDClearLine( 1, 0, 128 );
 106   1        LCDClearLine( 2, 0, 128 );
 107   1        LCDClearLine( 3, 0, 128 );   //LCD清屏
 108   1        
 109   1      }
 110          
 111          
 112          /*F**************************************************************************
 113          * NAME: disp_task
 114          *----------------------------------------------------------------------------
 115          * PARAMS:
 116          *
C51 COMPILER V7.20   DISP_TASK                                                             03/24/2007 10:02:39 PAGE 3   

 117          * return:
 118          *----------------------------------------------------------------------------
 119          * PURPOSE: 
 120          *   Display task handling display of clock and scrolling of file name
 121          *----------------------------------------------------------------------------
 122          * EXAMPLE:
 123          *----------------------------------------------------------------------------
 124          * NOTE:
 125          *----------------------------------------------------------------------------
 126          * REQUIREMENTS:
 127          *****************************************************************************/
 128          void disp_task (void)
 129          {
 130   1        #if CONF_DISPLAY == LED
 131   1        led_task();
 132   1        #endif
 133   1        switch (disp_state)
 134   1        {
 135   2          case DISP_IDLE:
 136   2          {
 137   3            #if CONF_DISPLAY != LED
                    if (gl_sbc_wr_busy || gl_sbc_rd_busy) /* still busy */
                    {
                     // Lcd_cur_on();                       /* blinking cursor for .5 sec */
                      gl_sbc_wr_busy = FALSE;
                      gl_sbc_rd_busy = FALSE;
                      gl_cpt_tick = 0;
                      disp_state = DISP_MS_BUSY;
                    }
                    #endif
 147   3            break;
 148   3          }
 149   2      
 150   2          case DISP_INIT:
 151   2          {
 152   3            disp_state = DISP_TICK0;
 153   3            gl_cpt_tick = 0;
 154   3            disp_buffer = File_get_name();
 155   3            if (print_name(disp_buffer) != TRUE)  /* test if not short name */
 156   3            {
 157   4              disp_scroll_on = TRUE;              /* activate name scrolling */
 158   4            }
 159   3            else
 160   3            {
 161   4              disp_scroll_on = FALSE;             /* no scrolling */
 162   4            }
 163   3            break;
 164   3          }
 165   2      
 166   2          case DISP_TICK0:
 167   2          {
 168   3            if (gl_cpt_tick > DISP_TICK_500)      /* 1/2 sec expiration */
 169   3            {
 170   4              if (disp_scroll_on)
 171   4              {
 172   5                if (print_name(disp_buffer))
 173   5                {
 174   6                  disp_buffer = File_get_name();
 175   6                }
 176   5                else
 177   5                {
 178   6                  disp_buffer++;
C51 COMPILER V7.20   DISP_TASK                                                             03/24/2007 10:02:39 PAGE 4   

 179   6                }
 180   5              }
 181   4              disp_state = DISP_TICK1;
 182   4            }
 183   3            break;
 184   3          }
 185   2      
 186   2          case DISP_TICK1:
 187   2          {
 188   3            if (gl_cpt_tick > DISP_TICK_SEC)      /* 1/2 sec expiration */
 189   3            {
 190   4              gl_cpt_tick -= DISP_TICK_SEC;
 191   4              if (disp_scroll_on)
 192   4              {
 193   5                if (print_name(disp_buffer))
 194   5                {
 195   6                  disp_buffer = File_get_name();
 196   6                }
 197   5                else
 198   5                {
 199   6                  disp_buffer++;
 200   6                }
 201   5              }
 202   4              if (disp_clock_on)
 203   4              {
 204   5                disp_state = DISP_SEC;
 205   5              }
 206   4              else
 207   4              {
 208   5                disp_state = DISP_TICK0;
 209   5              }
 210   4            }
 211   3            break;
 212   3          }
 213   2      
 214   2          case DISP_SEC:
 215   2          {
 216   3            if (disp_sec_cpt == DISP_SEC_MIN)     //init disp_sec_cpt
 217   3            {
 218   4              disp_sec_cpt = 0;
 219   4              disp_state = DISP_MIN;
 220   4            }
 221   3            else
 222   3            {
 223   4              disp_sec_cpt++;
 224   4              print_sec(disp_sec_cpt);
 225   4              disp_state = DISP_TICK0;
 226   4            }
 227   3            break;
 228   3          }
 229   2      
 230   2          case DISP_MIN:
 231   2          {
 232   3            disp_min_cpt++;
 233   3            print_min(disp_min_cpt);
 234   3            disp_state = DISP_TICK0;
 235   3            break;
 236   3          }
 237   2      
 238   2          case DISP_MS_BUSY:
 239   2          {
 240   3            #if CONF_DISPLAY != LED
C51 COMPILER V7.20   DISP_TASK                                                             03/24/2007 10:02:39 PAGE 5   

                    if (gl_sbc_wr_busy || gl_sbc_rd_busy) /* still busy */
                    {
                      gl_sbc_wr_busy = FALSE;
                      gl_sbc_rd_busy = FALSE;
                      gl_cpt_tick = 0;
                    }
                    else
                    {
                      if (gl_cpt_tick > DISP_TICK_500)    /* 1/2 sec expiration */
                      {
                        //Lcd_cur_off();
                        disp_state = DISP_IDLE;
                      }
                    }
                    #endif
 256   3          }
 257   2        }
 258   1      }
 259          
 260          
 261          /*F**************************************************************************
 262          * NAME: disp_name_start 
 263          *----------------------------------------------------------------------------
 264          * PARAMS:
 265          *
 266          * return:
 267          *----------------------------------------------------------------------------
 268          * PURPOSE: 
 269          *   Start name display
 270          *----------------------------------------------------------------------------
 271          * EXAMPLE:
 272          *----------------------------------------------------------------------------
 273          * NOTE:
 274          *----------------------------------------------------------------------------
 275          * REQUIREMENTS:
 276          *****************************************************************************/
 277          void disp_name_start (void)
 278          {
 279   1        disp_state = DISP_INIT;
 280   1      }
 281          
 282          
 283          #if CONF_DISPLAY == LED
 284          /*F**************************************************************************
 285          * NAME: disp_end_of_play 
 286          *----------------------------------------------------------------------------
 287          * PARAMS:
 288          *
 289          * return:
 290          *----------------------------------------------------------------------------
 291          * PURPOSE:
 292          *   Suspend name display
 293          *----------------------------------------------------------------------------
 294          * EXAMPLE:
 295          *----------------------------------------------------------------------------
 296          * NOTE:
 297          *----------------------------------------------------------------------------
 298          * REQUIREMENTS:
 299          *****************************************************************************/
 300          void disp_end_of_play (void)
 301          {
 302   1      LED_ON = (8>>ref_state);
C51 COMPILER V7.20   DISP_TASK                                                             03/24/2007 10:02:39 PAGE 6   

 303   1      LED_FAST = 3;
 304   1      if (recording)
 305   1        {
 306   2        SHUT_MIC = 1;
 307   2        pause=FALSE;
 308   2        recording=FALSE;
 309   2        }
 310   1      else if (playing && ref_state==REF_STATE_VOICE)
 311   1        {
 312   2        func_state=0;
 313   2        recording=TRUE;
 314   2        LED_FAST=2;
 315   2        }
 316   1      else func_state=0;
 317   1      playing=FALSE;

⌨️ 快捷键说明

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