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

📄 ok.lst

📁 51单片机通讯类软件。菜鸟级别。希望大家多多指点!
💻 LST
字号:
C51 COMPILER V7.08   OK                                                                    09/12/2005 20:36:11 PAGE 1   


C51 COMPILER V7.08, COMPILATION OF MODULE OK
OBJECT MODULE PLACED IN ok.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ok.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #define TIME_OVER 100
   2          
   3          #include<reg52.h>
   4          #include<stdlib.h>
   5          #include<string.h>
   6          
   7          
   8          unsigned char *compare=0x0040;
   9          unsigned char *indata=0x0050;
  10          int     wait=0;
  11          int     exam=0;
  12          
  13          void serial_init();
  14          void send(char);
  15          void send_string(const char *);
  16          void receive_string();
  17          int compare_string(char *);
  18          
  19          void main(){
  20   1              int i;
  21   1              int test=1;
  22   1              wait=0;
  23   1              exam=0;
  24   1              serial_init();
  25   1              for(;;){
  26   2                      receive_string();
  27   2                      if(wait!=0) exam++;
  28   2                      if(exam>=TIME_OVER){
  29   3                              *compare=NULL;
*** WARNING C260 IN LINE 29 OF OK.C: '=': pointer truncation
  30   3                              compare=0x0040;
  31   3                              test=compare_string(compare);
  32   3                              switch(test){
  33   4                                      case 0:{
  34   5                                              send_string("error");
  35   5                                              break;
  36   5                                      }
  37   4                                      case 1:{
  38   5                                              send_string("ccc1500cccc1000000ccc");
  39   5      /*                                      *indata='$';
  40   5                                              indata++;
  41   5                                              *indata=0x50;
  42   5                                              indata++;
  43   5                                              *indata=0x51;
  44   5                                              indata++;
  45   5                                              *indata='$';
  46   5                                              indata++;
  47   5                                              *indata=0x52;
  48   5                                              indata++;
  49   5                                              *indata=0x80;
  50   5                                              indata++;
  51   5                                              *indata='$';
  52   5                                              indata++;
  53   5                                              *indata=NULL;
  54   5                                              indata=0x0050;  
C51 COMPILER V7.08   OK                                                                    09/12/2005 20:36:11 PAGE 2   

  55   5                                              send_string(indata);
  56   5                                              indata=0x0050;
  57   5      */                                      break;
  58   5                                      }
  59   4                                      case 2:{
  60   5                                              send_string("write ram");
  61   5                                              break;
  62   5                                      }
  63   4                                      case 3:{
  64   5                                              send_string("ram format");
  65   5                                              break;
  66   5                                      }
  67   4                                      case 4:{
  68   5                                              send_string("hello");
  69   5                                              break;
  70   5                                      }
  71   4                                      case 5:{
  72   5                                              for(i=0;i<100;i++)
  73   5                                              send_string("go go go ");
  74   5                                              break;
  75   5                                      }
  76   4                                      default:{
  77   5                                              break;
  78   5                                      }                                               
  79   4                              }
  80   3                              wait=0;
  81   3                              exam=0;
  82   3                              compare=0x0040;
  83   3                              test=5;
  84   3                        }
  85   2              }
  86   1              return;
  87   1      } 
  88          
  89          void send_string(char *string){
  90   1              char *read_string=string;
  91   1              char *buffer=string;
  92   1              int COUNT=strlen(read_string);
  93   1          for(;COUNT!=0;COUNT--){
  94   2                      send(*buffer);
  95   2                      buffer++;
  96   2              }
  97   1      }
  98          
  99          void send(char a){
 100   1              SBUF=a;
 101   1                      while(TI!=1);TI=0;
 102   1      }
 103          
 104          void serial_init()
 105          {
 106   1              SCON=0x50;
 107   1              PCON=0;
 108   1              TMOD=0X20;
 109   1              TH1=0xfd;
 110   1              TL1=0xfd;
 111   1              TR1=1;
 112   1              ET1=1;
 113   1          return;
 114   1      }
 115          
 116          void receive_string(){
C51 COMPILER V7.08   OK                                                                    09/12/2005 20:36:11 PAGE 3   

 117   1              unsigned char temp;
 118   1              if(RI==1) { 
 119   2                      wait++;
 120   2              exam=0;
 121   2                      RI=0;
 122   2                  temp=SBUF;
 123   2                  *compare=temp;
 124   2              compare++;
 125   2                      return;
 126   2              }
 127   1              return; 
 128   1      }
 129          
 130          int compare_string(char *test){
 131   1              char *comp=test;
 132   1              char *temp="1";
 133   1              if(strcmp(temp,comp)==0){return 1;}
 134   1              temp="2";
 135   1              if(strcmp(temp,comp)==0){return 2;}
 136   1              temp="3";
 137   1              if(strcmp(temp,comp)==0){return 3;}
 138   1              temp="4";
 139   1              if(strcmp(temp,comp)==0){return 4;}
 140   1              temp="5";
 141   1              if(strcmp(temp,comp)==0){return 5;}
 142   1              return 0;                       
 143   1      }
 144          
 145          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    489    ----
   CONSTANT SIZE    =     75    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     10      18
   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 + -