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

📄 lcd.lst

📁 菜鸟,详细NRF24E1运用,程序,电路
💻 LST
字号:
C51 COMPILER V9.00   LCD                                                                   11/13/2010 14:59:55 PAGE 1   


C51 COMPILER V9.00, COMPILATION OF MODULE LCD
OBJECT MODULE PLACED IN LCD.OBJ
COMPILER INVOKED BY: D:\Program Files\KEIL C  V4\C51\BIN\C51.EXE LCD.c LARGE BROWSE DEBUG OBJECTEXTEND

line level    source

*** WARNING C500 IN LINE 1 OF LCD.C: LICENSE ERROR (R208: RENEW LICENSE ID CODE (LIC))

   1          #include "reg24le1.h"
   2          
   3          #define F8              0X53
   4          #define F12             0X6E
   5          #define F16             0X54
   6          #define F24             0X6F
   7          #define F32             0X55
   8          #define head    0XAA
   9          
  10          //定义迪文液晶的各种操作
  11          typedef unsigned char uchar;
  12          typedef unsigned int  uint; 
  13          
  14          //发送一字节
  15          void uartsendB(unsigned char dat)
  16          {
  17   1      
  18   1        S0BUF=dat;
  19   1        while(!TI0);
  20   1        TI0=0;
  21   1      }
  22          //发送字符串
  23          void uartsendS(uchar *p,uchar s)
  24          {
  25   1           uchar m;
  26   1           for(m=0;m<s;m++)
  27   1           {
  28   2            uartsendB(*p);
  29   2           p++;
  30   2           }
  31   1      } 
  32          void DwinW(uint x)
  33          {
  34   1          uartsendB(x >>8);
  35   1          uartsendB(x);
  36   1      }
  37          void uartend() //发送帧结束符 cc 33 c3 3c
  38          {
  39   1           uartsendB(0xcc);
  40   1           uartsendB(0x33);
  41   1           uartsendB(0xc3);
  42   1           uartsendB(0x3c);
  43   1      }
  44          
  45          //位置转换
  46          void uartpos(uint x,uint y)
  47          {
  48   1          uartsendB(x>>8);
  49   1          uartsendB(x);
  50   1          uartsendB(y>>8);
  51   1          uartsendB(y); 
  52   1      }
  53          
  54          void uartp(uchar x,uchar y,char font)
C51 COMPILER V9.00   LCD                                                                   11/13/2010 14:59:55 PAGE 2   

  55          {
  56   1         x--;
  57   1           y--;
  58   1           if(font==F8)
  59   1              uartpos(x<<3,y<<3);
  60   1           else if(font==F12)
  61   1              uartpos((x<<3)+(x<<2),(y<<3)+(y<<2));
  62   1           else if(font==F16)
  63   1              uartpos((x<<4),(y<<4));
  64   1           else if(font==F24)
  65   1              uartpos((x<<4)+(x<<3),(y<<4)+(y<<3));
  66   1           else if(font==F32)
  67   1              uartpos((x<<5),(y<<5));  
  68   1      }
  69          void uartp1(uchar x,uchar y,char font)
  70          {
  71   1         x--;
  72   1           y--;
  73   1           if(font==F8)
  74   1              uartpos(x<<2,y<<3);
  75   1           else if(font==F12)
  76   1              uartpos((x<<2)+(x<<1),(y<<3)+(y<<2));
  77   1           else if(font==F16)
  78   1              uartpos((x<<3),(y<<4));
  79   1           else if(font==F24)
  80   1              uartpos((x<<3)+(x<<2),(y<<4)+(y<<3));
  81   1           else if(font==F32)
  82   1              uartpos((x<<4),(y<<5));  
  83   1      }
  84          
  85          //发送一字符
  86          void Dwinchar(uchar x,uchar y, char font, char byte)
  87          {
  88   1           uartsendB(head); 
  89   1           uartsendB(font);
  90   1               uartsendB(x/256);
  91   1               uartsendB(x%256);
  92   1               uartsendB(y/256);
  93   1               uartsendB(y%256);
  94   1           uartsendB(byte);
  95   1           uartend();
  96   1      }
  97          
  98          //发送一串汉字
  99          void prints(int x,int y,uchar font , uchar *s)
 100          {
 101   1           uartsendB(head); //帧头0xAA
 102   1           uartsendB(font); //0x54=16点阵字符串,0x55=32点阵 0x6E=12点阵 0x6F=24点阵 0x98=任意点阵
 103   1           uartsendB(x/256);
 104   1               uartsendB(x%256);
 105   1               uartsendB(y/256);
 106   1               uartsendB(y%256);
 107   1               while(*s!='\0') //发送字符串内容
 108   1           {
 109   2             uartsendB(*s);
 110   2             s++;
 111   2           }
 112   1           uartend(); //发送帧结束符
 113   1      }
 114          
 115          //开背景灯
 116          void DwinON(char x)
C51 COMPILER V9.00   LCD                                                                   11/13/2010 14:59:55 PAGE 3   

 117          {
 118   1          uartsendB(head);
 119   1          if(x)
 120   1              uartsendB(0x5e);
 121   1          else 
 122   1              uartsendB(0x5f);
 123   1          uartend();
 124   1      }
 125          //设置调色板
 126          void DwinColor(unsigned int Fcolor,unsigned int Bcolor)
 127          {
 128   1          uartsendB(head);
 129   1          uartsendB(0x40);
 130   1          uartsendB(Fcolor >>8);
 131   1          uartsendB(Fcolor);
 132   1          uartsendB(Bcolor >>8);
 133   1          uartsendB(Bcolor);
 134   1          uartend();
 135   1      }
 136          
 137          
 138          void DwinColor1(uint Fcolor)
 139          {
 140   1          uartsendB(head);
 141   1          uartsendB(0x42);
 142   1          uartsendB(Fcolor >>8);
 143   1          uartsendB(Fcolor);
 144   1          uartend();
 145   1      }
 146          //清屏
 147          void DwinClear(void)
 148          {
 149   1          uartsendB(head);
 150   1          uartsendB(0x52);
 151   1          uartend();
 152   1      }
 153          
 154          //显示光标
 155          void DwinCursor(uchar font,uchar cursorEn,uint x ,uint y,uchar cursorWidth,uchar cursorHeight)
 156          {
 157   1          uartsendB(head);
 158   1          uartsendB(0x44);
 159   1          uartsendB(cursorEn);
 160   1          uartp1(x,y,font);
 161   1              uartsendB(cursorWidth);
 162   1              uartsendB(cursorHeight);
 163   1              uartend();
 164   1      }
 165          void Dwinrec(uint x1,uint y1,uint x2,uint y2)
 166          {   
 167   1           
 168   1          uartsendB(head);
 169   1          uartsendB(0x59);
 170   1          uartpos(x1,y1);
 171   1          uartpos(x2,y2);
 172   1          uartend();
 173   1      }
 174          
 175          //填充
 176          void Dwinfillw(uint x,uint y, uint x1, uint y1)
 177          {
 178   1          uartsendB(head);
C51 COMPILER V9.00   LCD                                                                   11/13/2010 14:59:55 PAGE 4   

 179   1          uartsendB(0x5B);
 180   1          uartpos(x,y);
 181   1          uartpos(x1,y1);
 182   1          uartend();
 183   1          
 184   1      }
 185          void Dwinclrw(uint x,uint y, uint x1,uint y1)
 186          {
 187   1          uartsendB(head);
 188   1          uartsendB(0x5A);
 189   1          uartpos(x,y);
 190   1          uartpos(x1,y1);
 191   1          uartend();
 192   1      }
 193          
 194          //进度条显示
 195          void DwinJingdu(uint x,uint y,uint step)
 196          {   
 197   1          prints(70,40,F24,"系统启动。。。");
 198   1              if(step==199)
 199   1              {step=200;
 200   2          Dwinchar(x+240,y-20,F16,(step/2)/100+'0');
 201   2              }
 202   1              Dwinchar(x+252,y-20,F16,((step/2)%100)/10+'0');
 203   1          Dwinchar(x+264,y-20,F16,(step/2)%10+'0');
 204   1              Dwinchar(x+276,y-20,F16,'%');
 205   1      
 206   1          DwinColor1(0x001f);
 207   1          Dwinrec(x-2,y-2,x+202,y+14);
 208   1          Dwinrec(x,y,x+200,y+12);
 209   1          DwinColor(0x07e0,0x00);
 210   1          Dwinfillw(x+1,y+1,x+1+step,y+11);
 211   1          Dwinclrw(x+2+step,y+1,x+200,y+11);
 212   1      
 213   1          prints(200,200,F16,"小江制作");
 214   1      }
 215          
 216          
 217          //波特率设置38400
 218          void baudinint(unsigned int baud)
 219          { 
 220   1          CLKCTRL=0X28;
 221   1          CLKLFCTRL = 0x01; 
 222   1              P0DIR &= 0xF7;                          // P0.3 (TxD)输出
 223   1              P0DIR |= 0x10;                          // P0.4 (RxD)输入 
 224   1              P0|=0x18;        
 225   1                      
 226   1              S0CON = 0x50;  
 227   1              PCON |= 0x80;                           // 波特率倍增
 228   1              WDCON |= 0x80;                          // 选定内部波特率发生器
 229   1              if(baud==38400)         
 230   1          {
 231   2              S0RELL = 0xF3;              // 波特率38400
 232   2              S0RELH = 0x03;  
 233   2              }
 234   1              else if(baud==9600)
 235   1              {
 236   2              S0RELL = 0xCC;              // 波特率9600
 237   2              S0RELH = 0x03;  
 238   2              }
 239   1      }
 240          
C51 COMPILER V9.00   LCD                                                                   11/13/2010 14:59:55 PAGE 5   

 241          
 242          void dispword(void)
 243          {
 244   1      static uchar n=1;
 245   1      prints(100,100,F32,"南华大学!");
 246   1      n++;
 247   1      n=n%5;
 248   1      if(!n)
 249   1      n=1;
 250   1      DwinON(0);
 251   1      }
 252          
 253          
 254          void showstop(void)
 255          {
 256   1      
 257   1      prints(100,180,F32,"Stopping...");
 258   1      }
 259          void showplay(void)
 260          {
 261   1      
 262   1      prints(100,180,F32,"Playing...");
 263   1      
 264   1      }
 265          void showvol(char x)
 266          {
 267   1      prints(10,10,F16,"VOL:");
 268   1      Dwinchar(50,10,F16,x+'0');
 269   1      }
 270          void shownext(void)
 271          {
 272   1      prints(100,180,F32,"Nextone...");
 273   1      }
 274          void showback(void)
 275          {
 276   1      prints(100,180,F32,"Lastone...");
 277   1      
 278   1      }
 279          void showtitle(unsigned char num,unsigned char m,unsigned char s)
 280          {
 281   1      
 282   1      prints(25,40,F32,"Easy Music Player");
 283   1      prints(60,100,F16,"Name:");
 284   1      Dwinchar(110,100,F16,num/100+'0');
 285   1      Dwinchar(120,100,F16,(num%100)/10+'0');
 286   1      Dwinchar(130,100,F16,num%10+'0');
 287   1      prints(140,100,F16,".mp3");
 288   1      prints(60,130,F16,"Time:");
 289   1      Dwinchar(110,130,F16,m/10+'0');
 290   1      Dwinchar(120,130,F16,m%10+'0');
 291   1      Dwinchar(130,130,F16,':');
 292   1      Dwinchar(140,130,F16,s/10+'0');
 293   1      Dwinchar(150,130,F16,s%10+'0');
 294   1      
 295   1      }
 296          
 297          //根据当前的情况显示状态图形
 298          
 299          void showstate(void)
 300          {
 301   1      
 302   1      
C51 COMPILER V9.00   LCD                                                                   11/13/2010 14:59:55 PAGE 6   

 303   1      
 304   1      }
 305          
 306          
 307          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   2018    ----
   CONSTANT SIZE    =    120    ----
   XDATA SIZE       =      1      60
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  1 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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