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

📄 menudrive.lst

📁 pdh控制程序
💻 LST
字号:
C51 COMPILER V7.20   MENUDRIVE                                                             02/20/2006 10:14:00 PAGE 1   


C51 COMPILER V7.20, COMPILATION OF MODULE MENUDRIVE
OBJECT MODULE PLACED IN .\output\menudrive.obj
COMPILER INVOKED BY: D:\keil c51 v7.09\C51\BIN\C51.EXE menudrive.c BROWSE DEBUG OBJECTEXTEND PRINT(.\list\menudrive.lst)
                    - OBJECT(.\output\menudrive.obj)

line level    source

   1          #ifndef _MENU_DRIVE_C_
   2          #define _MENU_DRIVE_C_
   3          
   4          #include "menudrive.h"
   5          
   6          #if _LCD_MENU_
   7          
   8          const char  CODE_TYPE char_code[5][8] = 
   9                          {
  10                              {0x04,0x0e,0x15,0x04,0x04,0x04,0x04,0x00},/*向上箭头符号*/
  11                              {0x02,0x06,0x0e,0x1e,0x0e,0x06,0x02,0x00},/*右三角*/
  12                              {0x04,0x04,0x04,0x04,0x15,0x0e,0x04,0x00},/*向下箭头符号*/
  13                              {0x18,0x04,0x02,0x01,0x01,0x02,0x04,0x18},/*右括号)*/
  14                              {0x03,0x04,0x08,0x10,0x10,0x08,0x04,0x03}/*左括号(*/
  15                          };
  16          
  17          void LcdWriteInstruction(char value);
  18          void LcdWriteData(char value);
  19          void init_particular_char(void);
  20          void InitLcd(void);
  21          
  22          void _delay_time_(unsigned int time)
  23          {
  24   1          unsigned int data cnt;
  25   1      
  26   1          for(cnt=0; cnt<time; cnt++) _nop_();
  27   1      }
  28          
  29          
  30          void InitLcd(void)
  31          {
  32   1          _delay_time_(_30_MS_);/*上电到初始化lcd必须有>30ms间隔*/
  33   1      
  34   1          WriteChip(WRITE_EN_ADDR,0x00);
  35   1      
  36   1          /*function set ,为2 line,5*8dots,8 bit*/
  37   1          LcdWriteInstruction(0x38);
  38   1      
  39   1          /*display on/off control*/
  40   1          _delay_time_(_39_US_);
  41   1          LcdWriteInstruction(0x0c);/*不显示光标指针*/
  42   1      
  43   1          /*clear display*/
  44   1          _delay_time_(_39_US_);
  45   1          LcdWriteInstruction(0x01);
  46   1      
  47   1          /*entry mode set*/
  48   1          _delay_time_(_1530_US_);
  49   1          LcdWriteInstruction(0x06);
  50   1      
  51   1          _delay_time_(_1530_US_);
  52   1          init_particular_char();
  53   1      }
  54          
C51 COMPILER V7.20   MENUDRIVE                                                             02/20/2006 10:14:00 PAGE 2   

  55          void LcdWriteInstruction(char value)
  56          {
  57   1          WRITE_INSTRUCTION;
  58   1          WriteChip(WRITE_EN_ADDR,0x01);/*enable*/
  59   1      
  60   1          WriteChip(WRITE_CODE_ADDR,value);/*write commad code*/
  61   1          LCD_CLK_WAIT;
  62   1          WriteChip(WRITE_EN_ADDR,0x00);/*disable*/
  63   1      }
  64          
  65          void LcdWriteData(char value)
  66          {
  67   1          WRITE_DATA_CHAR;
  68   1          WriteChip(WRITE_EN_ADDR,0x01);/*enable*/
  69   1      
  70   1          WriteChip(WRITE_CODE_ADDR,value);
  71   1      
  72   1          LCD_CLK_WAIT;
  73   1          WriteChip(WRITE_EN_ADDR,0x00);/*disable*/
  74   1      }
  75          
  76          void diaplay_up_char(void)
  77          {
  78   1          char cnt;
  79   1      
  80   1          LcdWriteInstruction(0x40);
  81   1          for(cnt=0;cnt<8;cnt++)
  82   1              LcdWriteData(char_code[0][cnt]);
  83   1      }
  84          
  85          
  86          void display_triangle_char(void)
  87          {
  88   1          char cnt;
  89   1      
  90   1          LcdWriteInstruction(0x48);
  91   1          for(cnt=0;cnt<8;cnt++)
  92   1              LcdWriteData(char_code[1][cnt]);
  93   1      }
  94             
  95          
  96          void display_down_char(void)
  97          {
  98   1          char cnt;
  99   1      
 100   1          LcdWriteInstruction(0x50);
 101   1          for(cnt=0;cnt<8;cnt++)
 102   1              LcdWriteData(char_code[2][cnt]);
 103   1      }
 104          
 105          void display_arcR_char(void)
 106          {
 107   1          char cnt;
 108   1      
 109   1          LcdWriteInstruction(0x58);
 110   1          for(cnt=0;cnt<8;cnt++)
 111   1              LcdWriteData(char_code[3][cnt]);
 112   1      }
 113           
 114          void display_arcL_char(void)
 115          {
 116   1          char cnt;
C51 COMPILER V7.20   MENUDRIVE                                                             02/20/2006 10:14:00 PAGE 3   

 117   1      
 118   1          LcdWriteInstruction(0x60);
 119   1          for(cnt=0;cnt<8;cnt++)
 120   1              LcdWriteData(char_code[4][cnt]);
 121   1      }
 122          
 123          void init_particular_char(void)
 124          {
 125   1          diaplay_up_char();
 126   1          display_triangle_char();
 127   1          display_down_char();
 128   1          display_arcR_char();
 129   1          display_arcL_char();
 130   1      }
 131          
 132          
 133          void diaplay_char(char row, char col, char value)
 134          {
 135   1          char initAddr;
 136   1      
 137   1          (row == 0)? (initAddr = 0x80) : (initAddr = 0xc0);
 138   1      
 139   1          LcdWriteInstruction(initAddr+col);    
 140   1          LcdWriteData(value);
 141   1      }
 142          
 143          void LcdDisplay_length(char row, char col, char *string, char length)
 144          {
 145   1          char initAddr;
 146   1          char len_display = length;
 147   1      
 148   1          (row == 0)? (initAddr = 0x80) : (initAddr = 0xc0);
 149   1      
 150   1          LcdWriteInstruction(initAddr+col);/*设置出初始位置*/
 151   1      
 152   1          while((*string) && (len_display>0))
 153   1          {
 154   2              if((*string>0x19) && (*string<0x7f))
 155   2              {
 156   3                  LcdWriteData(*string);
 157   3                  string++;
 158   3              }
 159   2              len_display--;
 160   2          }
 161   1      //      _delay_time_(100);
 162   1      }    
 163          
 164          void back_light_status( char status )
 165          {
 166   1          /*lcd 背光1 : 亮0:灭*/
 167   1          WriteChip( MENU_BACK_LIGHT, status );
 168   1      }
 169          
 170          void scrol_control( char status )
 171          {
 172   1          switch( status )
 173   1          {
 174   2          case SCROL_FIRST_ROW_NULL:
 175   2              diaplay_char( ROW_1, LCD_LAST_CASE, LCD_PRINT_SPACE );
 176   2              break;
 177   2      
 178   2          case SCROL_FIRST_ROW_UP:
C51 COMPILER V7.20   MENUDRIVE                                                             02/20/2006 10:14:00 PAGE 4   

 179   2              diaplay_char( ROW_1, LCD_LAST_CASE, LCD_PRINT_UP );
 180   2              break;
 181   2      
 182   2          case SCROL_SECOND_ROW_NULL:
 183   2              diaplay_char( ROW_2, LCD_LAST_CASE, LCD_PRINT_SPACE );
 184   2              break;
 185   2      
 186   2          case SCROL_SECOND_ROW_DOWN:
 187   2              diaplay_char( ROW_2, LCD_LAST_CASE, LCD_PRINT_DOWN );
 188   2              break;
 189   2          }
 190   1      }
 191          
 192          void backlight_control( char *status )
 193          {
 194   1              back_light_status( *status );
 195   1      }
 196          
 197          #endif
 198          #endif


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