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

📄 yyshellsub.lst

📁 UCOS在C51上实现的两个例子
💻 LST
📖 第 1 页 / 共 2 页
字号:
 140   3                              
 141   3                              PrintStr("\nOLD GATEWAY IP ADDRESS=");
 142   3                              HEXToIPadr(ipstr,&temp_ip_address);
 143   3                              PrintStr(ipstr);PrintStr("\n");
 144   3      
 145   3                              //setadr(GATEWAY,&tgateway_ip_address.bytes[0]);
 146   3                              //getadr(GATEWAY,&gateway_ip_address.bytes[0]);
 147   3                              gateway_ip_address.dwords=tgateway_ip_address.dwords;
 148   3                              
 149   3                              PrintStr("\nNEW GATEWAY IP ADDRESS=");
 150   3                              HEXToIPadr(ipstr,&gateway_ip_address);
 151   3                              PrintStr(ipstr);PrintStr("\n\n");
 152   3                      }               
 153   2              }
 154   1      }
 155          
 156          void PrintConfig(WORDTABLE *WordTable) reentrant//显示配置信息
 157          {
 158   1              unsigned char ipstr[16];
 159   1      
 160   1              PrintStr("\nConfig options:\n");
 161   1              /*
 162   1              getadr(MACADR,&my_ethernet_address.bytes[0]);//读出主机MAC地址存到my_ethernet_address里 
 163   1              PrintStr("\nHOST MAC ADDRESS=");
 164   1              PrintWord(my_ethernet_address.words[0]);PrintStr(" ");
 165   1              PrintWord(my_ethernet_address.words[1]);PrintStr(" ");
 166   1              PrintWord(my_ethernet_address.words[2]);PrintStr("\n");
 167   1                      
 168   1              page(1);//init 8019as PAR
 169   1              reg01=my_ethernet_address.bytes[0];
 170   1              reg02=my_ethernet_address.bytes[1];
 171   1              reg03=my_ethernet_address.bytes[2];
 172   1              reg04=my_ethernet_address.bytes[3];
 173   1              reg05=my_ethernet_address.bytes[4];
 174   1              reg06=my_ethernet_address.bytes[5];     
 175   1      
 176   1              page(0);
 177   1              reg00=0x22;
C51 COMPILER V7.50   YYSHELLSUB                                                            04/11/2006 17:11:50 PAGE 4   

 178   1              */
 179   1              //getadr(HOST,&my_ip_address.bytes[0]);//读出本机IP地址存到my_ip_address.bytes[4]里
 180   1              PrintStr("HOST IP ADDRESS=");
 181   1              HEXToIPadr(ipstr,&my_ip_address);
 182   1              PrintStr(ipstr);PrintStr("\n");
 183   1      
 184   1              //getadr(GATEWAY,&gateway_ip_address.bytes[0]);//读出网关IP地址存到gateway_ip_address.bytes[4]里
 185   1              PrintStr("GATEWAY IP ADDRESS=");
 186   1              HEXToIPadr(ipstr,&gateway_ip_address);
 187   1              PrintStr(ipstr);PrintStr("\n");
 188   1      
 189   1              //getadr(MASK,&mask_ip_address.bytes[0]);//读出本机掩码存到mask_ip_address.bytes[4]里
 190   1              PrintStr("SUBNET MASK=");
 191   1              HEXToIPadr(ipstr,&mask_ip_address);
 192   1              PrintStr(ipstr);PrintStr("\n\n");
 193   1      
 194   1              /*
 195   1              getadr(SNMPHOST,&SNMP_ip_address.bytes[0]);//读出SNMP网管主机IP地址存到SNMP_ip_address.bytes[4]里       
 196   1              PrintStr("SNMPHOST IP ADDRESS=");
 197   1              HEXToIPadr(ipstr,&SNMP_ip_address);
 198   1              PrintStr(ipstr);PrintStr("\n\n");*/
 199   1      }
*** WARNING C280 IN LINE 156 OF YYSHELLSUB.C: 'WordTable': unreferenced local variable
 200          
 201          void DisplayHelpMenu(WORDTABLE *WordTable) reentrant//显示帮助采单
 202          {
 203   1              PrintStr("\n");
 204   1              PrintStr("\tlt        Display active task.\n");
 205   1              PrintStr("\tkill      Kill active task.\n");
 206   1              PrintStr("\tping/udp  net command.\n");
 207   1              PrintStr("\tConfigNet host/mask/gateway/ipcfg.\n");     
 208   1              PrintStr("\tclr       Clear screen.\n");        
 209   1              PrintStr("\texit      Exit.(this command is limited here.)\n");
 210   1              PrintStr("\thelp      Display this menu.\n\n");
 211   1      }
*** WARNING C280 IN LINE 201 OF YYSHELLSUB.C: 'WordTable': unreferenced local variable
 212          
 213          bit IPadrToHEX(unsigned char *Str,union ip_address_type *ip)
 214          {
 215   1              unsigned char i,j,ch,x;
 216   1      
 217   1              ch=*Str++;
 218   1      
 219   1              for(j=0;j<3;j++){
 220   2                      x=0;
 221   2                      for(i=0;i<4;i++){
 222   3                              if(ch=='.') {ch=*Str++;break;}
 223   3                              else if(i==3) return 0;
 224   3                              else if(ch<0&&ch>9) return 0;
 225   3                              else
 226   3                                      x=10*x+(ch-'0');
 227   3                              ch=*Str++;
 228   3                      }
 229   2                      ip->bytes[j]=x;
 230   2              }
 231   1      
 232   1              x=0;
 233   1              for(i=0;i<4;i++){
 234   2                      if(ch=='\0') {ch=*Str++;break;}
 235   2                      else if(i==3) return 0;
 236   2                      else if(ch<0&&ch>9) return 0;
 237   2                      else
C51 COMPILER V7.50   YYSHELLSUB                                                            04/11/2006 17:11:50 PAGE 5   

 238   2                              x=10*x+(ch-'0');
 239   2                      ch=*Str++;
 240   2              }
 241   1              ip->bytes[3]=x;
 242   1              return 1;
 243   1      }
 244          
 245          void HEXToIPadr(unsigned char *Str,union ip_address_type *ip)
 246          {
 247   1              unsigned char i;
 248   1              unsigned char x,y;
 249   1      
 250   1              for(i=0;i<4;i++){
 251   2                      x=ip->bytes[i];
 252   2                      if(x>99){
 253   3                              y=x/100;*Str++=y+'0';
 254   3                              x=x-100*y;y=x/10;*Str++=y+'0';
 255   3                              x=x-10*y;*Str++=x+'0';
 256   3                              if(i==3) *Str++='\0';
 257   3                              else *Str++='.';
 258   3                      }
 259   2                      else if(x>9){
 260   3                              y=x/10;*Str++=y+'0';
 261   3                              x=x-10*y;*Str++=x+'0';
 262   3                              if(i==3) *Str++='\0';
 263   3                              else *Str++='.';
 264   3                      }
 265   2                      else{
 266   3                              *Str++=x+'0';
 267   3                              if(i==3) *Str++='\0';
 268   3                              else *Str++='.';
 269   3                      }
 270   2              }       
 271   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   2221    ----
   CONSTANT SIZE    =    719    ----
   XDATA SIZE       =   ----      15
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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