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

📄 myshell.lst

📁 此代码是实现将lwip协议移植于51单片机的测试程序
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.02b   MYSHELL                                                              08/25/2006 12:00:12 PAGE 4   

 176   1              int i,j,adr,LineNum;
 177   1              unsigned int dat[ROMSIZE],x;
 178   1              unsigned char ch;
 179   1      
 180   1              if(WordTable->Num==1) {adr=0;LineNum=1;}
 181   1              else if(WordTable->Num==2){
 182   2                      if(StrToNum(WordTable->wt[1].Str,&Num)==0){PrintStr("Address error!\7\n");return;}
 183   2                      adr=Num;LineNum=1;
 184   2              }
 185   1              else{
 186   2                      if(StrToNum(WordTable->wt[1].Str,&Num)==0){PrintStr("Address error!\7\n");return;}
 187   2                      adr=Num;
 188   2                      if(StrToNum(WordTable->wt[2].Str,&Num)==0){PrintStr("Line number error!\7\n");return;}
 189   2                      LineNum=Num;
 190   2              }
 191   1              if(LineNum>(ROMSIZE/16)){PrintStr("Line number error!\7\n");return;}
 192   1              op93LC66B(READB,adr,LineNum*8,dat);//(*8)93LC66B 16bit/data,(*16)but x5045 8bit/data.
 193   1              for(i=0;i<LineNum;i++){
 194   2                      adr=adr&0x1FF;
 195   2                      ch=adr>>8;PrintByte(ch);ch=adr&0xFF;PrintByte(ch);PrintStr("  ");adr=adr+0x8;
 196   2                      for(j=0;j<4;j++){
 197   3                              x=dat[i*8+j];
 198   3                              PrintByte(x>>8);
 199   3                              //PrintStr(" ");                        
 200   3                              PrintByte(x);
 201   3                              PrintStr(" ");
 202   3                      }
 203   2                      PrintStr("    ");
 204   2                      for(j=0;j<4;j++){
 205   3                              x=dat[i*8+j+4];
 206   3                              PrintByte(x>>8);
 207   3                              //PrintStr(" ");                        
 208   3                              PrintByte(x);
 209   3                              PrintStr(" ");                  
 210   3                      }
 211   2                      PrintStr("   ");
 212   2                      for(j=0;j<8;j++){
 213   3                              x=dat[i*8+j];
 214   3                              ch=x>>8;
 215   3                              if((ch>=0x20)&&(ch<=0x7F))      PrintChar(ch);
 216   3                              else PrintChar('.');
 217   3                              ch=x;
 218   3                              if((ch>=0x20)&&(ch<=0x7F))      PrintChar(ch);
 219   3                              else PrintChar('.');
 220   3                      }
 221   2                      PrintStr("\n");
 222   2              }
 223   1      }
 224          
 225          void ReadByte66(WORDTABLE *WordTable)//按字节读93LC66B数据
 226          {
 227   1              long int Num;
 228   1              int i,j,adr,LineNum;
 229   1              unsigned int dat[ROMSIZE],x;
 230   1              unsigned char ch;
 231   1      
 232   1              if(WordTable->Num==1) {adr=0;LineNum=1;}
 233   1              else if(WordTable->Num==2){
 234   2                      if(StrToNum(WordTable->wt[1].Str,&Num)==0){PrintStr("Address error!\7\n");return;}
 235   2                      adr=Num;LineNum=1;
 236   2              }
 237   1              else{
C51 COMPILER V7.02b   MYSHELL                                                              08/25/2006 12:00:12 PAGE 5   

 238   2                      if(StrToNum(WordTable->wt[1].Str,&Num)==0){PrintStr("Address error!\7\n");return;}
 239   2                      adr=Num;
 240   2                      if(StrToNum(WordTable->wt[2].Str,&Num)==0){PrintStr("Line number error!\7\n");return;}
 241   2                      LineNum=Num;
 242   2              }
 243   1              if(LineNum>(ROMSIZE/16)){PrintStr("Line number error!\7\n");return;}
 244   1              op93LC66B(READB,adr,LineNum*8,dat);//(*8)93LC66B 16bit/data,(*16)but x5045 8bit/data.
 245   1              for(i=0;i<LineNum;i++){
 246   2                      adr=adr&0x1FF;
 247   2                      ch=adr>>8;PrintByte(ch);ch=adr&0xFF;PrintByte(ch);PrintStr("  ");adr=adr+0x10;
 248   2                      for(j=0;j<4;j++){
 249   3                              x=dat[i*8+j];
 250   3                              PrintByte(x);
 251   3                              PrintStr(" ");                  
 252   3                              PrintByte(x>>8);
 253   3                              PrintStr(" ");
 254   3                      }
 255   2                      PrintStr("    ");
 256   2                      for(j=0;j<4;j++){
 257   3                              x=dat[i*8+j+4];
 258   3                              PrintByte(x);
 259   3                              PrintStr(" ");                  
 260   3                              PrintByte(x>>8);
 261   3                              PrintStr(" ");                  
 262   3                      }
 263   2                      PrintStr("   ");
 264   2                      for(j=0;j<8;j++){
 265   3                              x=dat[i*8+j];
 266   3                              ch=x;
 267   3                              if((ch>=0x20)&&(ch<=0x7F))      PrintChar(ch);
 268   3                              else PrintChar('.');
 269   3                              ch=x>>8;
 270   3                              if((ch>=0x20)&&(ch<=0x7F))      PrintChar(ch);
 271   3                              else PrintChar('.');
 272   3                      }
 273   2                      PrintStr("\n");
 274   2              }
 275   1      }
 276          
 277          void Write66(WORDTABLE *WordTable)//写93LC66B
 278          {
 279   1              long int Num;
 280   1              int i,adr,len,tadr;
 281   1              unsigned int dat[MaxLenWordTable-1];
 282   1      
 283   1              if(WordTable->Num<3) PrintStr("Syntax error!\7\n");
 284   1              else{
 285   2                      yystrlwr(WordTable->wt[1].Str);
 286   2                      if(strcmp(WordTable->wt[1].Str,"all")==0){
 287   3                              if(StrToNum(WordTable->wt[2].Str,&Num)==0) {PrintStr("Data error!\7\n");return;}
 288   3                              dat[0]=Num;
 289   3                              op93LC66B(EWEN,0,0,dat);
 290   3                              op93LC66B(WRAL,0,1,dat);
 291   3                              op93LC66B(EWDS,0,0,dat);
 292   3                              PrintStr("Sir:Write all 93LC66B finished!\n");
 293   3                      }
 294   2                      else if(StrToNum(WordTable->wt[1].Str,&Num)==0) PrintStr("Address error!\7\n");
 295   2                      else{
 296   3                              if((strcmp(WordTable->wt[2].Str,"x")==0)||(strcmp(WordTable->wt[2].Str,"X")==0)){
 297   4                                      adr=Num;len=WordTable->Num-3;
 298   4                                      for(i=0;i<len;i++){
 299   5                                              if(StrToHEX(WordTable->wt[i+3].Str,&Num)==0){PrintStr("Data error!\7\n");return;}
C51 COMPILER V7.02b   MYSHELL                                                              08/25/2006 12:00:12 PAGE 6   

 300   5                                              dat[i]=Num;
 301   5                                      }                               
 302   4                                      for(i=0;i<len;i++){                             
 303   5                                              tadr=adr;tadr=tadr+i;tadr=tadr&0x1FF;
 304   5                                              op93LC66B(EWEN,tadr,0,&dat[i]);
 305   5                                              op93LC66B(WRITEB,tadr,1,&dat[i]);
 306   5                                              op93LC66B(EWDS,tadr,0,&dat[i]);                         
 307   5                                      }
 308   4                                      PrintStr("Sir:Write 93LC66B finished!\n");
 309   4                              }
 310   3                              else{                   
 311   4                                      adr=Num;len=WordTable->Num-2;
 312   4                                      for(i=0;i<len;i++){
 313   5                                              if(StrToNum(WordTable->wt[i+2].Str,&Num)==0){PrintStr("Data error!\7\n");return;}
 314   5                                              dat[i]=Num;
 315   5                                      }
 316   4                                      for(i=0;i<len;i++){                     
 317   5                                              tadr=adr;tadr=tadr+i;tadr=tadr&0x1FF;                           
 318   5                                              op93LC66B(EWEN,tadr,0,&dat[i]);
 319   5                                              op93LC66B(WRITEB,tadr,1,&dat[i]);
 320   5                                              op93LC66B(EWDS,tadr,0,&dat[i]);                         
 321   5                                      }
 322   4                                      PrintStr("Sir:Write 93LC66B finished!\n");
 323   4                              }
 324   3                      }
 325   2              }
 326   1      }
 327          
 328          void DisplayPortValue(WORDTABLE *WordTable)//显示IO端口数据
 329          {
 330   1              PrintStr("\n");
 331   1              PrintStr("ISIN=");PrintByte(isin);PrintStr("  ");
 332   1              PrintStr("LINKOK=");PrintByte(linkok);PrintStr("  ");
 333   1              PrintStr("TXSPEED=");PrintByte(txspeed);PrintStr("  ");
 334   1              PrintStr("POW0=");PrintByte(pow0);PrintStr("  ");
 335   1              PrintStr("POW1=");PrintByte(pow1);PrintStr("\n\n");
 336   1      }
 337          
 338          void DisplayHelpMenu(WORDTABLE *WordTable)//显示帮助采单
 339          {
 340   1              PrintStr("\n");
 341   1              PrintStr("\trdp       Read port data.\n");
 342   1              PrintStr("\twrbs      Write board select.\n");
 343   1              PrintStr("\twdx       Write data to X5045.\n");
 344   1              PrintStr("\trdx       Read data from X5045.\n");
 345   1              PrintStr("\twxr       Write X5045 register.\n");
 346   1              PrintStr("\trxr       Read X5045 register.\n");
 347   1              PrintStr("\terase66   Erase 93LC66B.\n");
 348   1              PrintStr("\trd66      Read data from 93LC66B.\n");
 349   1              PrintStr("\trdb66     Read data from 93LC66B.(Byte mode)\n");
 350   1              PrintStr("\twd66      Write data to 93LC66B.\n");
 351   1              PrintStr("\tConfigNet host/gateway/mask/snmphost/macadr/lc.\n");
 352   1              PrintStr("\tping/udp  net command.\n");
 353   1              PrintStr("\tclr       Clear screen.\n");
 354   1              PrintStr("\tls/lt     List ARP cache/List transmit buffer.\n");
 355   1              PrintStr("\texit      Exit.\n");
 356   1              PrintStr("\thelp      Display this menu.\n\n");
 357   1      }       

C51 COMPILATION COMPLETE.  1 WARNING(S),  2 ERROR(S)

⌨️ 快捷键说明

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