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

📄 utility.lst

📁 世纪民生公司的带网络功能的单片机CS6209开发http服务器的演示源代码。
💻 LST
📖 第 1 页 / 共 4 页
字号:
 361   1        show_gateway(n);
 362   1        printf(menudata4);
 363   1        show_mac();
 364   1        printf(menudata5);  
C51 COMPILER V7.50   UTILITY                                                               10/12/2006 15:31:40 PAGE 7   

 365   1        show_mask(n);
 366   1        puts("\n");
 367   1      /*if (eeprom_flag)
 368   1      {
 369   1        puts(menudata6); 
 370   1        puts(menudata7); 
 371   1        puts(menudata8); 
 372   1        puts(menudata9); 
 373   1        puts(menudata10); 
 374   1        puts(menudata11); 
 375   1      
 376   1      }*/
 377   1      }
*** WARNING C280 IN LINE 355 OF ..\..\LIB\UTILITY.C: 'eeprom_flag': unreferenced local variable
 378          
 379          /************************************************************************
 380          /*      Function Name : getnumbers                                                                                      *
 381          /*                                                                                                                                              *
 382          /*      Arguments :                                                                                                             *
 383          /*                      unsigned char *str :Point to a string to parse numbers.         *
 384          /*                      unsigned char *nums :Point to a BYTE array to return            *
 385          /*                                                              numbers parsing from str.                               *
 386          /*                      char max_nums :The maximus numbers to parse from str.           *
 387          /*                                                                                                                                              *
 388          /*      Return :                                                                                                                        *
 389          /*                      The number of numbers parsing out from str.                                     *
 390          /*                                                                                                                                              *
 391          /*  Comment :                                                                                                                   *
 392          /*                      This function parse numbers from a string like                          *
 393          /*                      xxx.xxx.xxx.xxx(IP address Format).                                                     *
 394          /*                                                                                                                                              *
 395          /************************************************************************/
 396          char getnumbers(unsigned char *str,unsigned char *nums, char max_nums)
 397          {
 398   1       unsigned char i, num_cnt,cnt=20;//,hexcnt;
 399   1       unsigned int temp=0;
 400   1       
 401   1        i = 0;
 402   1        num_cnt = 0;
 403   1        /*Ignore command char and space.*/      
 404   1        while ( (str[i] == 'i') || (str[i] == 'M') || (str[i]==' ')|| (str[i]=='n')|| (str[i]=='g'))
 405   1          i++;
 406   1      
 407   1        cnt=max_nums;
 408   1      
 409   1        while ( i < 20 )
 410   1        {
 411   2              /*0-9*/
 412   2          if ((str[i] <= 0x39) && (str[i] >= 0x30))
 413   2            {  
 414   3              temp=temp*10+(str[i]-0x30);
 415   3            }
 416   2          else if ((str[i] == ' ') || (str[i] == '.') )
 417   2            {
 418   3                   if (temp<256)
 419   3                      nums[num_cnt] = temp;
 420   3                       else {
 421   4                       num_cnt=0; 
 422   4                       break;
 423   4                       }
 424   3               temp=0;
 425   3               num_cnt++;
C51 COMPILER V7.50   UTILITY                                                               10/12/2006 15:31:40 PAGE 8   

 426   3                      if (num_cnt == cnt)
 427   3                              i=20;
 428   3            }
 429   2              /*End of string.*/
 430   2              else if (str[i] == 0)
 431   2              {
 432   3                   if (temp<256)
 433   3                      nums[num_cnt] = temp;
 434   3                       else {
 435   4                       num_cnt=0; 
 436   4                       break;
 437   4                       }
 438   3               num_cnt++;
 439   3                       break;
 440   3              }
 441   2              else {
 442   3                num_cnt=0; 
 443   3                break;
 444   3              }
 445   2          i++;
 446   2         }
 447   1      
 448   1          if (num_cnt != cnt )
 449   1             puts(error_str);   
 450   1              
 451   1        return num_cnt;
 452   1      }
 453          /************************************************************************
 454          /*      Function Name : EEPROM_writer                                                                           *
 455          /*                                                                                                                                              *
 456          /*      Arguments :                                                                                                             *
 457          /*                      char gdc : The character get form RS232 .                                       *
 458          /*                                                                                                                                              *
 459          /*      Return :                                                                                                                        *
 460          /*                      None.                                                                                                           *
 461          /*                                                                                                                                              *
 462          /*  Comment :                                                                                                                   *
 463          /*                      This function is main routine for I2C eeprom ISP .                      *
 464          /*                                                                                                                                              *
 465          /************************************************************************/
 466          #ifdef I2C_EERROM_WRITER
 467          void EEPROM_writer(char gdc)
 468          {
 469   1      #ifndef mon51
 470   1      /*Definations of I2C EEPROM Writer command.*/
 471   1      #define SET_ADDR_COMMAND  0xe1
 472   1      #define SET_LEN_COMMAND  0xe2
 473   1      #define WRITE_COMMAND  0xe3
 474   1      #define SET_READ_COMMAND  0xe5
 475   1      #define END_OF_COMMAND  0xe7
 476   1      
 477   1          char id_index=0;
 478   1              unsigned char tmp=gdc;
 479   1              unsigned char I2C_ID=0x11;
 480   1              unsigned int count;
 481   1              unsigned int start_addr=0,length=0x7fff;
 482   1      
 483   1              if (tmp!=EEPROM_writer_id[0])
 484   1                      return;
 485   1      
 486   1              id_index++;
 487   1              while (id_index<sizeof(EEPROM_writer_id))
C51 COMPILER V7.50   UTILITY                                                               10/12/2006 15:31:40 PAGE 9   

 488   1              {
 489   2                      /*Read a char from RS232.*/
 490   2                      while (RS232_rx_empty());
 491   2                      tmp=RS232_rx_getchar();
 492   2      
 493   2                      /*Check ID*/
 494   2                      if (tmp!=EEPROM_writer_id[id_index])
 495   2                      {
 496   3                              id_index=0;
 497   3                              break;
 498   3                      }
 499   2      
 500   2                      id_index++;
 501   2              }
 502   1              /*ID is right send IDOK to host.*/
 503   1              if (id_index==sizeof(EEPROM_writer_id))
 504   1              {
 505   2              printf("IDOK");
 506   2              /*Pad to 6 Bytes.*/
 507   2              tx_char(0);
 508   2              tx_char(0);
 509   2              }
 510   1              else 
 511   1              {
 512   2                      printf("ERROR");
 513   2                      tx_char(0);
 514   2                      return ;  
 515   2              }
 516   1              while (1)
 517   1              {
 518   2                      /*Read a char from RS232*/
 519   2                      while (RS232_rx_empty());
 520   2                      tmp=RS232_rx_getchar();
 521   2      
 522   2                      switch (tmp){
 523   3                      case END_OF_COMMAND:
 524   3                              printf("EOCOK");
 525   3                              tx_char(0);
 526   3                              return ;
 527   3                      case SET_ADDR_COMMAND:
 528   3                          while (RS232_rx_empty());
 529   3                              tmp=RS232_rx_getchar();
 530   3      
 531   3                              start_addr=(((unsigned int)tmp)<<8)&0xff00;
 532   3                                while (RS232_rx_empty());
 533   3                                tmp=RS232_rx_getchar();
 534   3                              start_addr+=(tmp&0xff);
 535   3      
 536   3                              if (start_addr>0x7fff)
 537   3                              {
 538   4                                      printf("%4.4x",start_addr);
 539   4                              //      printf("ERROR");
 540   4                                      tx_char(0);
 541   4                                      tx_char(0);
 542   4                              }
 543   3                              else 

⌨️ 快捷键说明

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