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

📄 hzk_lcd.lst

📁 8051+iic字库+lcd显示+接收串口+仿真+keil完整工程。需用电脑串口软件调试。波特率9600.
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V8.02   HZK_LCD                                                               09/29/2008 08:38:30 PAGE 1   


C51 COMPILER V8.02, COMPILATION OF MODULE HZK_LCD
OBJECT MODULE PLACED IN HZK_LCD.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE HZK_LCD.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include <reg51.h>
   2          #include<absacc.h> 
   3          #include"LCD.h"
   4          
   5          #define LCDCOM XBYTE[0x7ff0] 
   6          #define LCDDAT XBYTE[0x7ff1] 
   7          #define LCDREAD XBYTE[0x7ff2] 
   8          #define Disp_On  0x3f
   9          #define Disp_Off 0x3e
  10          #define Col_Add  0x40                            
  11          #define Page_Add 0xb8                             
  12          #define Start_Line 0xc0
  13          
  14          //////////////////////////////////////////////
  15          sbit Busy=ACC^7;
  16          sbit CS1=P3^2; 
  17          sbit CS2=P3^3;  
  18          sbit P10=P1^0;
  19          sbit P11=P1^1;
  20          sbit P12=P1^2;
  21          sbit CE0=P1^3;
  22          sbit CE1=P1^4;
  23          sbit CE2=P1^5;
  24          sbit CE3=P1^6;
  25          sbit CE4=P1^7;
  26          
  27          uchar star=0;
  28                                           
  29          //==============忙测试===================//
  30          void wait_lcd(void)
  31          {
  32   1          do 
  33   1          {
  34   2              ACC=LCDREAD;
  35   2          }
  36   1          while(Busy==1);
  37   1      }
  38          /////////////////////////////////////
  39          //==============延时1*d ms===============//
  40          void delay(uint d)
  41          {
  42   1          uchar j;
  43   1          while(d--)
  44   1          {
  45   2              for (j=0;j<125;j++)
  46   2              {
  47   3                  ;
  48   3              }
  49   2          }
  50   1      }
  51          //void  gled(uchar y)
  52          //{
  53          //      wait_lcd();
  54          //      LED=y;
  55          //}
C51 COMPILER V8.02   HZK_LCD                                                               09/29/2008 08:38:30 PAGE 2   

  56          //===============送命令字================//
  57          void  I_SEND(uchar y)
  58          {
  59   1          wait_lcd();
  60   1          LCDCOM=y;
  61   1      }
  62          //================送数据=================//
  63          void D_SEND(uchar x)
  64          {
  65   1          wait_lcd();
  66   1          LCDDAT=x;
  67   1      }
  68          void init_lcd()
  69          {
  70   1          
  71   1          delay(10);
  72   1          I_SEND(Disp_Off);
  73   1          I_SEND(Page_Add+0);
  74   1          I_SEND(Start_Line+0);
  75   1          I_SEND(Col_Add+0);
  76   1          I_SEND(Disp_On);
  77   1              star=1;
  78   1              disp_string("欢迎您和我交流mcu_china@sina.com");
  79   1              delay(200);
  80   1              disp_string("                                                           ");
  81   1              
  82   1      }
  83          unsigned long int haizhi(uchar i,uchar j)
  84          {
  85   1          unsigned long int k;           
  86   1          k=((unsigned long int)(((i-0xa1)*94+(j-0xa1))))*32;
  87   1              if(star==1)   
  88   1          return k;
  89   1              else
  90   1              return 0x10;
  91   1      }
  92          
  93          
  94          void disp_string(uchar *hzk)
  95          {
  96   1          uchar pag=0;
  97   1              uchar col=0;
  98   1              uint zhtemp=0;
  99   1              uint cs=0;
 100   1          uint j=0,i=0,c1,c2,c3;
 101   1          unsigned long int k;
 102   1      
 103   1          if(pag==0)
 104   1          {
 105   2              if((col<64)&&(cs==0))
 106   2              {
 107   3                  CS1=0;
 108   3                  CS2=1;
 109   3                              cs=0;
 110   3              }
 111   2              else
 112   2              {
 113   3                  CS1=1;
 114   3                  CS2=0;
 115   3                              cs=1;
 116   3              }
 117   2              
C51 COMPILER V8.02   HZK_LCD                                                               09/29/2008 08:38:30 PAGE 3   

 118   2          }
 119   1          else if(pag==2)
 120   1          {
 121   2              if(col<64)
 122   2              {
 123   3                  CS1=0;
 124   3                  CS2=1;
 125   3                              cs=2;
 126   3              }
 127   2              else
 128   2              {
 129   3                  CS1=1;
 130   3                  CS2=0;
 131   3                              cs=3;
 132   3              }
 133   2          }
 134   1          else if(pag==4)
 135   1          {
 136   2              if(col<64)
 137   2              {
 138   3                  CS1=0;
 139   3                  CS2=1;
 140   3                              cs=4;
 141   3              }
 142   2              else
 143   2              {
 144   3                  CS1=1;
 145   3                  CS2=0;
 146   3                              cs=5;
 147   3              }
 148   2          }
 149   1          else //if(pag==6)
 150   1          {
 151   2              if(col<64)
 152   2              {
 153   3                  CS1=0;
 154   3                  CS2=1;
 155   3                              cs=6;
 156   3              }
 157   2              else
 158   2              {
 159   3                  CS1=1;
 160   3                  CS2=0;
 161   3                              cs=7;
 162   3              }
 163   2          }           
 164   1          while(hzk[zhtemp])
 165   1          {
 166   2              
 167   2                      c1=hzk[zhtemp];c2=hzk[zhtemp+1];
 168   2              P10=0;P11=0;P12=0;
 169   2              
 170   2              k=haizhi(c1,c2);
 171   2              if(c1>128)
 172   2              {
 173   3                  if((k>0x8000)&&(k<0x10000))
 174   3                  {
 175   4                      CE0=1;P10=0;P11=0;P12=0;
 176   4                      k=(uint)(k-0x8000);
 177   4                  }
 178   3                  else if((k>0x10000)&&(k<0x18000))
 179   3                  {
C51 COMPILER V8.02   HZK_LCD                                                               09/29/2008 08:38:30 PAGE 4   

 180   4                      CE1=0;CE0=1;P10=1;P11=0;P12=0;
 181   4                      k=(uint)(k-0x10000);
 182   4                      
 183   4                  }
 184   3                  else if((k>0x18000)&&(k<0x20000))
 185   3                  {
 186   4                      CE1=1;CE0=1;P10=1;P11=0;P12=0;
 187   4                      k=(uint)(k-0x18000);
 188   4                      
 189   4                  }
 190   3                  else if((k>0x20000)&&(k<0x28000))
 191   3                  {
 192   4                      CE1=1;CE0=1;CE2=0;P10=0;P11=1;P12=0;
 193   4                      k=(uint)(k-0x20000);
 194   4                      
 195   4                  }
 196   3                  else if((k>0x28000)&&(k<0x30000))
 197   3                  {
 198   4                      CE1=1;CE0=1;CE2=1;P10=0;P11=1;P12=0;
 199   4                      k=(uint)(k-0x28000);
 200   4                      
 201   4                  }
 202   3                  else if((k>0x30000)&&(k<0x38000))
 203   3                  {
 204   4                      CE1=1;CE0=1;CE2=1;CE3=0;P10=1;P11=1;P12=0;
 205   4                      k=(uint)(k-0x30000);
 206   4                      
 207   4                  }
 208   3                  else if((k>0x38000)&&(k<0x40000))
 209   3                  {
 210   4                      CE1=1;CE0=1;CE2=1;CE3=1;P10=1;P11=1;P12=0;
 211   4                      k=(uint)(k-0x38000);
 212   4                      
 213   4                  }
 214   3                  else
 215   3                  {
 216   4                      CE0=0;P10=0;P11=0;P12=0;
 217   4                  }

⌨️ 快捷键说明

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