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

📄 hzk_lcd.lst

📁 8051手机短信源程序,用单片机控制手机模块发短信
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V8.02   HZK_LCD                                                               10/13/2008 11:41:33 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"main.h"
   4          #include"LCD.h"
   5          
   6          #define LCDCOM XBYTE[0x7ff0] 
   7          #define LCDDAT XBYTE[0x7ff1] 
   8          #define LCDREAD XBYTE[0x7ff2] 
   9          #define Disp_On  0x3f
  10          #define Disp_Off 0x3e
  11          #define Col_Add  0x40                            
  12          #define Page_Add 0xb8                             
  13          #define Start_Line 0xc0
  14          
  15          //////////////////////////////////////////////
  16          /*
  17          sbit Busy=ACC^7;
  18          sbit CS1=P3^2; 
  19          sbit CS2=P3^3;
  20          */      
  21          sbit P10=P1^0;
  22          sbit P11=P1^1;
  23          sbit P12=P1^2;
  24          sbit CE0=P1^3;
  25          sbit CE1=P1^4;
  26          //sbit CE2=P1^5;
  27          //sbit CE3=P1^6;
  28          //sbit CE4=P1^7;
  29          
  30          uchar star=0;
  31                                           
  32          //==============忙测试===================//
  33          void wait_lcd(void)
  34          {
  35   1          do 
  36   1          {
  37   2              ACC=LCDREAD;
  38   2          }
  39   1          while(Busy==1);
  40   1      }
  41          /////////////////////////////////////
  42          //==============延时1*d ms===============//
  43          void delay(uint d)
  44          {
  45   1          uchar j;
  46   1          while(d--)
  47   1          {
  48   2              for (j=0;j<125;j++)
  49   2              {
  50   3                  ;
  51   3              }
  52   2          }
  53   1      }
  54          //void  gled(uchar y)
  55          //{
C51 COMPILER V8.02   HZK_LCD                                                               10/13/2008 11:41:33 PAGE 2   

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

 118   1              uchar col=0;
 119   1              uint zhtemp=0;
 120   1              uint cs=0;
 121   1          uint j=0,i=0,c1,c2,c3;
 122   1          unsigned long int k;        
 123   1      
 124   1          if(pag==0)
 125   1          {
 126   2              if((col<64)&&(cs==0))
 127   2              {
 128   3                  CS1=0;
 129   3                  CS2=1;
 130   3                              cs=0;
 131   3              }
 132   2              else
 133   2              {
 134   3                  CS1=1;
 135   3                  CS2=0;
 136   3                              cs=1;
 137   3              }
 138   2              
 139   2          }
 140   1          else if(pag==2)
 141   1          {
 142   2              if(col<64)
 143   2              {
 144   3                  CS1=0;
 145   3                  CS2=1;
 146   3                              cs=2;
 147   3              }
 148   2              else
 149   2              {
 150   3                  CS1=1;
 151   3                  CS2=0;
 152   3                              cs=3;
 153   3              }
 154   2          }
 155   1          else if(pag==4)
 156   1          {
 157   2              if(col<64)
 158   2              {
 159   3                  CS1=0;
 160   3                  CS2=1;
 161   3                              cs=4;
 162   3              }
 163   2              else
 164   2              {
 165   3                  CS1=1;
 166   3                  CS2=0;
 167   3                              cs=5;
 168   3              }
 169   2          }
 170   1          else //if(pag==6)
 171   1          {
 172   2              if(col<64)
 173   2              {
 174   3                  CS1=0;
 175   3                  CS2=1;
 176   3                              cs=6;
 177   3              }
 178   2              else
 179   2              {
C51 COMPILER V8.02   HZK_LCD                                                               10/13/2008 11:41:33 PAGE 4   

 180   3                  CS1=1;
 181   3                  CS2=0;
 182   3                              cs=7;
 183   3              }
 184   2          }           
 185   1          while(hzk[zhtemp])
 186   1          {
 187   2              
 188   2                      c1=hzk[zhtemp];c2=hzk[zhtemp+1];
 189   2              P10=0;P11=0;P12=0;
 190   2              
 191   2              k=haizhi(c1,c2);
 192   2              if(c1>128)
 193   2              {
 194   3                  if((k>0x8000)&&(k<0x10000))
 195   3                  {
 196   4                      //CE0=1;
 197   4      
 198   4                                      P10=0;P11=0;P12=0;
 199   4                      k=(uint)(k-0x8000);
 200   4                  }
 201   3                  else if((k>0x10000)&&(k<0x18000))
 202   3                  {
 203   4                      //CE1=0;CE0=1;
 204   4                                      CE0=1;CE1=0;
 205   4                                      P10=1;P11=0;P12=0;
 206   4                      k=(uint)(k-0x10000);
 207   4                      
 208   4                  }
 209   3                  else if((k>0x18000)&&(k<0x20000))
 210   3                  {
 211   4                      //CE1=1;CE0=1;
 212   4                                      CE1=1;CE0=0;
 213   4                                      P10=1;P11=0;P12=0;
 214   4                      k=(uint)(k-0x18000);
 215   4                      
 216   4                  }
 217   3                  else if((k>0x20000)&&(k<0x28000))
 218   3                  {
 219   4                      //CE1=1;CE0=1;CE2=0;
 220   4                                      CE1=1;CE0=0;
 221   4                                      P10=0;P11=1;P12=0;
 222   4                      k=(uint)(k-0x20000);
 223   4                      
 224   4                  }
 225   3                  else if((k>0x28000)&&(k<0x30000))
 226   3                  {
 227   4                      //CE1=1;CE0=1;CE2=1;
 228   4                                      CE1=1;CE0=1;
 229   4                                      P10=0;P11=1;P12=0;
 230   4                      k=(uint)(k-0x28000);
 231   4                      
 232   4                  }
 233   3                  else if((k>0x30000)&&(k<0x38000))
 234   3                  {
 235   4                      //CE1=1;CE0=1;CE2=1;CE3=0;
 236   4                                      CE1=1;CE0=1;
 237   4                                      P10=1;P11=1;P12=0;
 238   4                      k=(uint)(k-0x30000);
 239   4                      
 240   4                  }
 241   3                  else if((k>0x38000)&&(k<0x40000))
C51 COMPILER V8.02   HZK_LCD                                                               10/13/2008 11:41:33 PAGE 5   

 242   3                  {
 243   4                      //CE1=1;CE0=1;CE2=1;CE3=1;
 244   4                                      CE1=0;CE0=1;
 245   4                                      P10=1;P11=1;P12=0;
 246   4                      k=(uint)(k-0x38000);
 247   4                      
 248   4                  }
 249   3                  else

⌨️ 快捷键说明

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