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

📄 yejinshizhong.lst

📁 在1602液晶
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V8.05a   YEJINSHIZHONG                                                        02/14/2008 14:34:57 PAGE 1   


C51 COMPILER V8.05a, COMPILATION OF MODULE YEJINSHIZHONG
OBJECT MODULE PLACED IN yejinshizhong.OBJ
COMPILER INVOKED BY: D:\学习软件\KeilC51\C51\BIN\C51.EXE yejinshizhong.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include<reg52.h>
   2          #define uchar unsigned char
   3          #define uint unsigned int 
   4          uchar code table[]="2000 00 00 00"; 
   5          uchar code table1[]="00:00:00  "  ;
   6          sbit rs=P3^5;
   7          sbit lcden=P3^4;
   8          sbit we=P2^7;
   9          sbit rd=P3^7;
  10          sbit s13=P3^1;
  11          sbit s17=P3^2;
  12          sbit s21=P3^3;
  13          uchar num,tt,miao,fen,shi,temp,shi1,ge;
  14          uchar ri,yue,nian,xingqi;
  15          void delay(uint z)
  16          {
  17   1              uint x,y;
  18   1              for(x=100;x>0;x--)
  19   1                  for(y=z;y>0;y--);
  20   1      } 
  21          void write_com(uchar com)
  22          {       
  23   1          lcden=0;
  24   1      //      rs=1;
  25   1      //      delay(2);
  26   1              rs=0;   
  27   1              delay(2);
  28   1              lcden=1;
  29   1              delay(2);
  30   1              P0=com;                                                         
  31   1              
  32   1              delay(2);
  33   1              lcden=0;
  34   1      //      rs=1;
  35   1      }
  36          void write_date(uchar date)
  37          {
  38   1            rs=1;
  39   1                lcden=0;
  40   1                delay(2);     
  41   1                lcden=1; 
  42   1                delay(2);             
  43   1                P0=date;
  44   1      //        rs=1;
  45   1                        
  46   1                
  47   1                delay(2);
  48   1                lcden=0;
  49   1               // rs=0;
  50   1      }
  51          void init()
  52          {       
  53   1          we=0;
  54   1              lcden=0;
  55   1              TMOD=0x01;
C51 COMPILER V8.05a   YEJINSHIZHONG                                                        02/14/2008 14:34:57 PAGE 2   

  56   1              TH0=(65535-50000)/256;
  57   1              TL0=(65535-50000)%256;
  58   1              EA=1;
  59   1              ET0=1;
  60   1              TR0=1;                                                                    
  61   1              write_com(0x38);
  62   1              write_com(0x0c);
  63   1              write_com(0x06); 
  64   1              write_com(0x01);
  65   1               
  66   1              write_com(0x80+0x01);
  67   1               for(num=0;num<13;num++)
  68   1               {
  69   2                       write_date(table[num]);
  70   2                       delay(2); 
  71   2               }
  72   1      
  73   1               write_com(0x80+0x40+3);
  74   1               for(num=0;num<8;num++)
  75   1               {
  76   2                       write_date(table1[num]);
  77   2                       delay(2);       
  78   2               }      
  79   1      }
  80          void timer0() interrupt 1
  81          {
  82   1              TH0=(65535-50000)/256;
  83   1              TL0=(65535-50000)%256;
  84   1              tt++;
  85   1      }       
  86          void write_mfs(uchar add,uchar temp)
  87          {
  88   1      //      uchar temp;
  89   1              shi1=temp/10;
  90   1              ge=temp%10;
  91   1              write_com(0x80+0x40+add);//曾经卡住思路
  92   1              write_date(0x30+shi1);
  93   1              write_date(0x30+ge);
  94   1      }
  95          void write_nyr(uchar add,uchar temp)
  96          {
  97   1              shi1=temp/10;
  98   1              ge=temp%10;
  99   1              write_com(0x80+add);
 100   1              write_date(0x30+shi1);
 101   1              write_date(0x30+ge);
 102   1      }
 103          
 104          
 105          
 106          void keyscan()
 107          {
 108   1          uchar num1;
 109   1              rd=0;
 110   1              if(s13==0)
 111   1              {        
 112   2                      delay(1);
 113   2                              if(s13==0)
 114   2                              {       
 115   3                                  num1++;
 116   3                                  while(!s13);                                
 117   3                                      if(num1==1)
C51 COMPILER V8.05a   YEJINSHIZHONG                                                        02/14/2008 14:34:57 PAGE 3   

 118   3                                      {
 119   4                                              TR0=0;                                                          
 120   4                                              write_com(0x80+0x40+10);
 121   4                                              write_com(0x0f);
 122   4                                      }                                       
 123   3                                      if(num1==2)
 124   3                                      {                                                                                               
 125   4                                              write_com(0x80+0x40+7);
 126   4                                              write_com(0x0f);
 127   4                                      }                                                  
 128   3                              if(num1==3)
 129   3                                      {                                                                                                       
 130   4                                              write_com(0x80+0x40+4);
 131   4                                              write_com(0x0f);
 132   4                                      }                                                       
 133   3                                      if(num1==4)
 134   3                                      {                                                                                                       
 135   4                                              write_com(0x80+13);
 136   4                                              write_com(0x0f);
 137   4                                      }       
 138   3                                      if(num1==5)
 139   3                                      {                                                                                               
 140   4                                              write_com(0x80+10);
 141   4                                              write_com(0x0f);
 142   4                                      }       
 143   3                                      if(num1==6)
 144   3                                      {                                                                                                       
 145   4                                              write_com(0x80+7);
 146   4                                              write_com(0x0f);
 147   4                                      }       
 148   3                                      if(num1==7)
 149   3                                      {                                                                                                       
 150   4                                              write_com(0x80+4);
 151   4                                              write_com(0x0f);
 152   4                                      }
 153   3                                      if(num1==8)
 154   3                                      {
 155   4                                              TR0=1;
 156   4                                              num1=0;                 
 157   4                                              write_com(0x0c);
 158   4                                      }               
 159   3                              }
 160   2              }
 161   1              if(num1!=0)
 162   1              {
 163   2                      if(s17==0)
 164   2                      {
 165   3                              delay(2);
 166   3                              if(s17==0)
 167   3                              {                       
 168   4                                  while(!s17);
 169   4                                      if(num1==1)
 170   4                                      { 
 171   5                                        miao++;       
 172   5                                      if(miao==60)
 173   5                                          miao=0;
 174   5                                      write_mfs(9,miao);
 175   5                                      write_com(0x80+0x40+10);
 176   5                                      
 177   5                                      }
 178   4                                      if(num1==2)
 179   4                                      { 
C51 COMPILER V8.05a   YEJINSHIZHONG                                                        02/14/2008 14:34:57 PAGE 4   

 180   5                                         fen++; 
 181   5                                         if(fen==60)
 182   5                                            fen=0;
 183   5                                              write_mfs(6,fen);
 184   5                                              write_com(0x80+0x40+7);                         
 185   5                                      

⌨️ 快捷键说明

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