main.lst

来自「DS1302资料lcd.rar」· LST 代码 · 共 151 行

LST
151
字号
C51 COMPILER V8.08   MAIN                                                                  06/12/2009 10:30:36 PAGE 1   


C51 COMPILER V8.08, 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          #include<intrins.h>
   2          #include<stdio.h>
   3          #include <REG52.H> 
   4          //#include "1602.h" 
   5          
   6          //这里各人的1602程序不一样.所以我把测试程序中的这一块去掉了
   7          
   8          #include "DS1302.h"
   9           
  10          sbit LCM_power = P0^0;
  11          sbit key01=P0^3;
  12          
  13          unsigned char code use[]={"date:/"};
  14          unsigned char code use1[]={"time:/"};
  15          
  16          extern void Init_1602(void);
  17          extern void DisplayOneChar(unsigned char X, unsigned char Y, unsigned char DData);
  18          extern void  DisplayListChar(unsigned char X, unsigned char Y, unsigned char code *DData);
  19          extern void Delay5Ms(void);
  20          void main() 
  21          { 
  22   1      SYSTEMTIME CurrentTime;
  23   1      
  24   1      //long int delay;
  25   1      //delay=100000;
  26   1      //while(delay--);
  27   1      
  28   1      
  29   1      
  30   1      /*波特率600 晶振12M与电脑串行通信*/
  31   1              SCON = 0x50; /*scon八位 SM0,SM1,SM2,REN,TB8,RB8,TI,RI 设置为01010000串
  32   1                                      口方式一,允许接收REN*/
  33   1              TMOD = 0x20; ;/*定时器一方式2 八位自动装载模式*/
  34   1              PCON = PCON&0x80;/*波特率倍数为SMOD位为1*/
  35   1              TCON = 0x40; /*TCON八位,TF1,TR1,TF0,TR0,,,,,*/
  36   1              
  37   1      //      IP=0X02;    //用于设置中断优先级,设置外部中断优先,
  38   1                                      //IP的第0位到第5位分别代表PX0,PT0,PX1,PT1,PS(串口通信),PT2
  39   1                                      //5---0   ps,pt1,px1,pt0,px0
  40   1              TH1 = 0xcc;
  41   1              TL1 = 0xcc;//设置初值
  42   1      
  43   1              TR1 =1;
  44   1              ET1=1;
  45   1      
  46   1              TI = 1; 
  47   1      //      TH0=0xd8;
  48   1      //      TL0=0x0d;//精确延时10ms
  49   1      //      TR0=1;
  50   1      //      ET0=1;  
  51   1      //      IT1=1;
  52   1      
  53   1               EA=1;
  54   1      
  55   1      // Lcddelay(0xaf);
C51 COMPILER V8.08   MAIN                                                                  06/12/2009 10:30:36 PAGE 2   

  56   1      // LcdReset(); 
  57   1      DS1302_Initial();
  58   1      Init_1602();
  59   1      // DisplayListChar(0,0,"Date: ",6);
  60   1      // DisplayListChar(0,1,"Time: ",6);
  61   1      
  62   1      CurrentTime.Year = 9;
  63   1      CurrentTime.Month = 6;
  64   1      CurrentTime.Day = 12;
  65   1      CurrentTime.Week = 3;
  66   1      CurrentTime.Hour = 13;
  67   1      CurrentTime.Minute = 12;
  68   1      CurrentTime.Second = 27;
  69   1      
  70   1      
  71   1      
  72   1      
  73   1      DS1302_SetTime(&CurrentTime);
  74   1      
  75   1      
  76   1      
  77   1              DisplayListChar(0, 0, use);
  78   1              DisplayListChar(0, 1, use1);
  79   1      
  80   1      
  81   1      
  82   1         DisplayOneChar(8,0,(CurrentTime.Year%100)/10+0x30);
  83   1         DisplayOneChar(9,0,(CurrentTime.Year%10)+0x30);
  84   1         DisplayOneChar(11,0,(CurrentTime.Month/10)+0x30);
  85   1         DisplayOneChar(12,0,(CurrentTime.Month%10)+0x30);
  86   1         DisplayOneChar(14,0,(CurrentTime.Day/10)+0x30);
  87   1         DisplayOneChar(15,0,(CurrentTime.Day%10)+0x30);
  88   1         LCM_power=1;
  89   1      
  90   1      while(1) 
  91   1      { 
  92   2         DS1302_GetTime(&CurrentTime); 
  93   2       // printf("year:%d\n\t",(int)CurrentTime.Year);
  94   2       // printf("month:%d\n\t",(int)CurrentTime.Month);
  95   2       // printf("day:%d\n\t",(int)CurrentTime.Day);
  96   2       // printf("week:%d\n\t",(int)CurrentTime.Week);
  97   2       // printf("Hour:%d\n\t",(int)CurrentTime.Hour);
  98   2       // printf("Minute:%d\n\t",(int)CurrentTime.Minute);
  99   2        //printf("Second:%d\n\t",(int)CurrentTime.Second);
 100   2      
 101   2      
 102   2        
 103   2         
 104   2         DisplayOneChar(6,1,(CurrentTime.Week)+0x30);
 105   2         DisplayOneChar(8,1,(CurrentTime.Hour%100)/10+0x30);
 106   2         DisplayOneChar(9,1,(CurrentTime.Hour%10)+0x30);
 107   2         DisplayOneChar(11,1,(CurrentTime.Minute/10)+0x30);
 108   2         DisplayOneChar(12,1,(CurrentTime.Minute%10)+0x30);
 109   2         DisplayOneChar(14,1,(CurrentTime.Second/10)+0x30);
 110   2         DisplayOneChar(15,1,(CurrentTime.Second%10)+0x30);
 111   2         key01=1;
 112   2         if(!key01)
 113   2         {
 114   3         key01=1;
 115   3         Delay5Ms();
 116   3         if(!key01)
 117   3                 {
C51 COMPILER V8.08   MAIN                                                                  06/12/2009 10:30:36 PAGE 3   

 118   4                 LCM_power=~LCM_power;
 119   4                 }
 120   3         }
 121   2      } 
 122   1      } 
 123          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    840    ----
   CONSTANT SIZE    =     14    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----       7
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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