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

📄 dts_task.lst

📁 本源程序使用C51控制的PLL(SANYO LC72131)收音,可以通过HT1621驱动LCD显示,有完整的按键控制程序模块,能通过KEY进行各种功能操作,整个程序采用模块化设计,移植方便,可以初学
💻 LST
📖 第 1 页 / 共 5 页
字号:
  26      =1  
  27      =1  #define FALSE   0
  28      =1  #define TRUE    1         
  29      =1  #define Low             0
  30      =1  #define High    1
  31      =1  
  32      =1  /* Display driver */
  33      =1  #define LCD         0
  34      =1  #define LED         1
  35      =1  #define LCM         2
  36      =1  #define HT1621      3
  37      =1  #define CONF_DISPLAY     HT1621
  38      =1  
  39      =1  /*----- HT1621 Command Definition -----*/
  40      =1  #define         HT1621_COMBIAS          ((Byte)0x52) 
  41      =1  #define         HT1621_RC                       ((Byte)0x30)    
  42      =1  #define         HT1621_TIMER            ((Byte)0x08) 
  43      =1  #define         HT1621_SYSEN            ((Byte)0x02) 
  44      =1  #define         HT1621_ON                       ((Byte)0x06)
  45      =1   
  46      =1  /*----- HT1621 Address Definition -----*/
  47      =1  #define         HT1621_ADDRESS0         ((Byte)0x00)
  48      =1  #define         HT1621_ADDRESS1         ((Byte)0x02)
  49      =1  #define         HT1621_ADDRESS2         ((Byte)0x04)    
  50      =1  #define         HT1621_ADDRESS3         ((Byte)0x06)
  51      =1  #define         HT1621_ADDRESS4         ((Byte)0x08)
  52      =1  #define         HT1621_ADDRESS5         ((Byte)0x0a)
  53      =1  #define         HT1621_ADDRESS6         ((Byte)0x0c)
  54      =1  #define         HT1621_ADDRESS7         ((Byte)0x0e)
  55      =1  #define         HT1621_ADDRESS8         ((Byte)0x10)
  56      =1  
  57      =1  #define         HT1621TRACK_ADD         HT1621_ADDRESS1
  58      =1  #define         HT1621VOLUME_ADD        HT1621_ADDRESS1
  59      =1  #define         HT1621SEC_ADDL          HT1621_ADDRESS1
  60      =1  #define         HT1621SEC_ADDH          HT1621_ADDRESS2
  61      =1  #define         HT1621MIN_ADDL          HT1621_ADDRESS3
  62      =1  #define         HT1621MIN_ADDH          HT1621_ADDRESS4
  63      =1  #define         HT1621TRACK_ADDL        HT1621_ADDRESS5
  64      =1  #define         HT1621TRACK_ADDH        HT1621_ADDRESS6
  65      =1  #define         HT1621TRACK_H_ADD       HT1621_ADDRESS8
  66      =1  
  67      =1  #define         HT1621COL                       ((Byte)0x10)
  68      =1  #define         HT1621VOL                       ((Byte)0x01)
C51 COMPILER V8.01   DTS_TASK                                                              08/07/2006 11:16:10 PAGE 6   

  69      =1  
  70      =1  /*----- Task states -----*/
  71      =1  #define KBD_IDLE        (Byte)0x00
  72      =1  #define KBD_DEBOUNCE    (Byte)0x01
  73      =1  #define KBD_DECODE      (Byte)0x02
  74      =1  
  75      =1  /*----- Key Decoding Mask -----*/
  76      =1  #define NO_KEY                  ((Byte)0x1f)    /* 00011111 */
  77      =1  #define KEY_0                   ((Byte)0x1e)    /* 00011110,REPEAT/PRESET */
  78      =1  #define KEY_1                   ((Byte)0x1d)    /* 00011101,STOP */
  79      =1  #define KEY_2                   ((Byte)0x1B)    /* 00011011,ALBUM/+10 */
  80      =1  #define KEY_3                   ((Byte)0x17)    /* 00010111,PLAY/PAUSE */
  81      =1  #define KEY_4                   ((Byte)0x0f)    /* 00001111,S16 */
  82      =1  
  83      =1  #define KEY_5                   ((Byte)0x1c)    /* 00011100,EQ/PROG/MEM */
  84      =1  #define KEY_6                   ((Byte)0x1a)    /* 00011010,RADIO */
  85      =1  #define KEY_7                   ((Byte)0x16)    /* 00010110,CD */
  86      =1  #define KEY_8                   ((Byte)0x0e)    /* 00001110,VOL+ */
  87      =1  
  88      =1  #define KEY_9                   ((Byte)0x19)    /* 00011001,TAPE */
  89      =1  #define KEY_10                  ((Byte)0x15)    /* 00010101,MAIN POWER */
  90      =1  #define KEY_11                  ((Byte)0x0d)    /* 00001101,VOL- */
  91      =1  
  92      =1  #define KEY_12                  ((Byte)0x13)    /* 00010011,BAND */
  93      =1  #define KEY_13                  ((Byte)0x0B)    /* 00001011,FF/UP */
  94      =1  
  95      =1  #define KEY_14                  ((Byte)0x07)    /* 00000111,FR/DOWN */
  96      =1  
  97      =1  #define KEY_REPEAT                      KEY_0
  98      =1  #define KEY_STOP                        KEY_1
  99      =1  #define KEY_ALBUM                       KEY_2
 100      =1  #define KEY_PALY_PAUSE          KEY_3
 101      =1  #define KEY_S16                         KEY_4
 102      =1  
 103      =1  #define KEY_EQ_PROG                     KEY_5
 104      =1  #define KEY_RADIO                       KEY_6
 105      =1  #define KEY_CD                          KEY_7
 106      =1  #define KEY_VOL_INC                     KEY_8
 107      =1  
 108      =1  #define KEY_TAPE                        KEY_9
 109      =1  #define KEY_MainPower           KEY_10
 110      =1  #define KEY_VOL_DEC                     KEY_11
 111      =1  
 112      =1  #define KEY_BAND                        KEY_12
 113      =1  #define KEY_FF                          KEY_13
 114      =1  
 115      =1  #define KEY_FR                          KEY_14
 116      =1  
 117      =1  #define Kbd_key_pressed()   ((P1&0x1f) != 0x1f)
 118      =1   
 119      =1  /*----- Disp clock task states -----*/
 120      =1  #define DISP_IDLE             0
 121      =1  #define DISP_INIT             1
 122      =1  #define DISP_TICK0            2
 123      =1  #define DISP_TICK1            3
 124      =1  #define DISP_SEC              4
 125      =1  #define DISP_MIN              5
 126      =1  #define DISP_MS_BUSY          6
 127      =1  #define DISP_PRO                  7
 128      =1  
 129      =1  #define KBD_DEBOUNCE_TEMPO  20   /* debounce period: 8 ms */
 130      =1  #define KBD_DEBOUNCE_INIT   0 
C51 COMPILER V8.01   DTS_TASK                                                              08/07/2006 11:16:10 PAGE 7   

 131      =1  #define SCHEDULER_TICK          10
 132      =1  
 133      =1  #define TIM_LOW                 0xf0
 134      =1  #define TIM_HIGH                0xd8
 135      =1  //#define T0_set_TMOD()         (TMOD = TMOD | 0x01)
 136      =1  
 137      =1  #define I2C_ID0                 0xa0
 138      =1  #define I2C_ID1                 0xa1
 139      =1  #define I2C_ADD                 0x00
 140      =1  
 141      =1  /*----- Volume Control Start -----*/
 142      =1  #define SC7313_ADD              0x88
 143      =1  #define RADIO_IN                0x5c
 144      =1  #define CD_IN                   0x59    //01011001
 145      =1  #define TAPE_IN                 0x5e
 146      =1  
 147      =1  /*----- Touch Pad Control Define -----*/
 148      =1  #define TOUCH_REQUEST   0x52
 149      =1  #define TOUCH_RETURN    0x53
 150      =1  
 151      =1  #define FWVER_REG               0x00
 152      =1  #define BUTTON_REG              0x10
 153      =1  #define XY_REG                  0x20
 154      =1  #define ANGLE_REG               0x30
 155      =1  #define TPSEN_REG               0x40
 156      =1  #define FWID_REG                0xf0
 157      =1  
 158      =1  /*----- DTS system define -----*/
 159      =1  #define Mem_StartAdd    0x10
 160      =1  #define Mem_EndAdd              0x1f
 161      =1  
 162      =1  #define Mem_test                0
 163      =1  #define Mem_5                   5
 164      =1  #define Mem_10                  10
 165      =1  #define DTS_Mem_Size    Mem_10
 166      =1  
 167      =1  #define DTS_FreStart    878
 168      =1  #define DTS_FreEnd              1080
 169      =1  
 170      =1  #if             DTS_Mem_Size == Mem_5
           =1 #define Mem_Fre0                878
           =1 #define Mem_Fre1                900
           =1 #define Mem_Fre2                100
           =1 #define Mem_Fre3                960
           =1 #define Mem_Fre4                1080
           =1 #endif
 177      =1   
 178      =1  #if             DTS_Mem_Size == Mem_10
 179      =1  #define Mem_Fre0                878
 180      =1  #define Mem_Fre1                900
 181      =1  #define Mem_Fre2                940
 182      =1  #define Mem_Fre3                960
 183      =1  #define Mem_Fre4                980
 184      =1  #define Mem_Fre5                1000
 185      =1  #define Mem_Fre6                1020
 186      =1  #define Mem_Fre7                1040
 187      =1  #define Mem_Fre8                1060
 188      =1  #define Mem_Fre9                1080
 189      =1  #endif
  88          #include "driver\io_def.h"
   1      =1  /*H**************************************************************************
   2      =1  * NAME:         io_def.h         
C51 COMPILER V8.01   DTS_TASK                                                              08/07/2006 11:16:10 PAGE 8   

   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   
  15      =1  #define DTS_DOUT        P3_6
  16      =1  #define DTS_DIN         P3_4
  17      =1  #define DTS_CLK         P3_5
  18      =1  #define DTS_CE          P3_7
  19      =1  
  20      =1  #define MPOWER          P3_1
  21      =1  #define CDPOWER         P1_7
  22      =1  #define TAPE_POWER      P1_5
  23      =1  
  24      =1  #define LCD_DA          P0_0
  25      =1  #define LCD_RW          P0_1
  26      =1  #define LCD_CS          P0_2
  27      =1  
  28      =1  #define ISDA            P2_1
  29      =1  #define ISCL            P2_0
  30      =1  
  31      =1  #define TOUCH_SDI               P0_3
  32      =1  #define TOUCH_SDO               P0_4
  33      =1  #define TOUCH_SCK               P0_5
  34      =1  #define TOUCH_SS                P0_6
  89          #include "dts_task.h"                      /* displayer task definition */
   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[];
C51 COMPILER V8.01   DTS_TASK                                                              08/07/2006 11:16:10 PAGE 9   

  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 ;
  90          #include "driver\dts_drv.h"
   1      =1  /*H**************************************************************************
   2      =1  * NAME:         kbd_drv.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_In1mode (void);
  15      =1  void dts_In2mode (void);   
  16      =1  void getByteLSB(Byte bByte);
  17      =1  void dts_FerInc (void);
  18      =1  
  19      =1  extern  idata   char    DTS_buffer[6];
  91          /*_____ M A C R O S ________________________________________________________*/
  92          
  93          
  94          /*_____ D E F I N I T I O N ________________________________________________*/
  95          
  96          
  97          
  98          /*F**************************************************************************
  99          * NAME: disp_task_init
 100          *----------------------------------------------------------------------------
 101          * PARAMS:
 102          *
 103          * return:

⌨️ 快捷键说明

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