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

📄 main.lst

📁 不带字库LCD12864设计,在田老师的MINI51上测试
💻 LST
字号:
C51 COMPILER V8.02   MAIN                                                                  11/23/2008 11:17:38 PAGE 1   


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

line level    source

   1          //写汉字液晶,液晶屏为128*64,4行*8列汉字
   2          /*
   3           D7 D6 D5 D4 D3 D2 D1 D0   
   4           0  0  0  1  1  1  1  D         *D=1时显示开,D=0时显示关
   5           1  1  A  A  A  A  A  A         *设定显示开始行寄存器位置
   6           1  0  1  1  1  A  A  A         *设定页地址
   7           0  1  A  A  A  A  A  A         *设定列地址
   8           D7 0  D5 D4 0  0  0  0         *D7=1表示LCD忙,D7=0可以读写操作,D5=1显示关状态,
   9                                                                  *D5=0显示开状态,D4=1表示正在初始化,D4=0初始化完毕
  10          */
  11          
  12          /**************头文件定义***********/
  13          #include "STC89C51RC.H"
  14          #include <math.h>
  15          #include <intrins.h>
  16          #include <absacc.h>
  17          #include "hanzi.h"
  18          #include "number.h"
  19          #include "DS1302.H"
  20          #include "LCD12864.H"
  21          
  22          void main(void)
  23          {
  24   1              uchar n;        
  25   1              SYSTEMTIME CurrentTime;
  26   1              Delay(10);
  27   1              lcd_init(); 
  28   1              Initial_DS1302();
  29   1      
  30   1              // 时间设定
  31   1              Write1302(DS1302_YEAR, 0x07);
  32   1              Write1302(DS1302_MONTH, 0x04);
  33   1              Write1302(DS1302_DAY, 0x10);
  34   1              Write1302(DS1302_WEEK, 0x02);
  35   1              Write1302(DS1302_HOUR, 0x12);           
  36   1              Write1302(DS1302_MINUTE, 0x51);                 
  37   1              //*/
  38   1          lcd_clr();  
  39   1      
  40   1        while(1)      
  41   1        {     
  42   2              DS1302_GetTime(&CurrentTime); //读时间
  43   2      
  44   2              lcd_asci_wr(Line0,0,2);                                         //2
  45   2              lcd_asci_wr(Line0+8,0,0);                                       //0
  46   2              lcd_asci_wr(Line0+16,0,(CurrentTime.Year/10));  //0
  47   2              lcd_asci_wr(Line0+24,0,(CurrentTime.Year%10));  //7
  48   2              
  49   2              lcd_hanzi_wr(Line0+32,0,nian);  //年
  50   2      
  51   2              lcd_asci_wr(Line0+48,0,(CurrentTime.Month/10)); 
  52   2              lcd_asci_wr(Line0+56,0,(CurrentTime.Month%10)); 
  53   2              
  54   2              lcd_hanzi_wr(Line0+64,0,yue);   //月
  55   2      
C51 COMPILER V8.02   MAIN                                                                  11/23/2008 11:17:38 PAGE 2   

  56   2              lcd_asci_wr(Line0+80,0,(CurrentTime.Day/10));   
  57   2              lcd_asci_wr(Line0+88,0,(CurrentTime.Day%10));
  58   2      
  59   2              lcd_hanzi_wr(Line0+96,0,ri);    //日
  60   2      
  61   2              lcd_hanzi_wr(Line1+2,2,xing);   //星
  62   2              lcd_hanzi_wr(Line1+16,2,qi);    //期
  63   2      
  64   2              lcd_asci_wr(Line1+32,2,(CurrentTime.Week%10));  
  65   2      
  66   2              lcd_asci_wr(Line1+48,2,(CurrentTime.Hour/10));  
  67   2              lcd_asci_wr(Line1+56,2,(CurrentTime.Hour%10));  
  68   2      
  69   2              lcd_asci_wr(Line1+64,2,10);     //Dot
  70   2      
  71   2              lcd_asci_wr(Line1+72,2,(CurrentTime.Minute/10));        
  72   2              lcd_asci_wr(Line1+80,2,(CurrentTime.Minute%10));        
  73   2      
  74   2              lcd_asci_wr(Line1+88,2,10);     //Dot
  75   2      
  76   2              lcd_asci_wr(Line1+96,2,(CurrentTime.Second/10));        
  77   2              lcd_asci_wr(Line1+104,2,(CurrentTime.Second%10));       
  78   2              
  79   2              lcd_hanzi_wr(Line2,4,ju); 
  80   2              lcd_hanzi_wr(Line2+16,4,wo); 
  81   2              lcd_hanzi_wr(Line2+32,4,yuan); 
  82   2              lcd_hanzi_wr(Line2+48,4,ben); 
  83   2              lcd_hanzi_wr(Line2+64,4,ke); 
  84   2              lcd_hanzi_wr(Line2+80,4,jiao); 
  85   2              lcd_hanzi_wr(Line2+96,4,xue); 
  86   2              lcd_hanzi_wr(Line2+112,4,shui); 
  87   2              lcd_hanzi_wr(Line3,6,pin); 
  88   2              lcd_hanzi_wr(Line3+16,6,ping); 
  89   2              lcd_hanzi_wr(Line3+32,6,gu); 
  90   2              lcd_hanzi_wr(Line3+48,6,hai);
  91   2              lcd_hanzi_wr(Line3+64,6,you);  
  92   2      
  93   2              n = 164-CurrentTime.Month*30-CurrentTime.Day-1;
  94   2      
  95   2              lcd_asci_wr(Line3+80,6,(n/100%10));     
  96   2              lcd_asci_wr(Line3+88,6,(n/10%10));      
  97   2              lcd_asci_wr(Line3+96,6,(n%10)); 
  98   2              
  99   2              lcd_hanzi_wr(Line3+104,6,tian); //天
 100   2              lcd_asci_wr(Line3+120,6,11);//! 
 101   2      
 102   2              Delay(300);                                     
 103   2        }
 104   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   1370    ----
   CONSTANT SIZE    =    800    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----      47
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----       1
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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