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

📄 monitor.lst

📁 在89C51上实现TCPIP协议
💻 LST
📖 第 1 页 / 共 2 页
字号:
 204          
 205          void help_message(void)               /*  manual for this program   */
 206          {
 207   1          print("elp message...\n\r");
 208   1          print("0 : Output xx to the PORT 0\n\r");
 209   1          print("1 : Output xx to the PORT 1\n\r");
 210   1          print("2 : Output xx to the PORT 2\n\r");
 211   1          print("3 : Output xx to the PORT 3\n\r");
 212   1          print("4 : Ethernet Register reading..\n\r");
 213   1          
 214   1          print("C : Clear external Memory from 8000h\n\r");
 215   1          print("D : Dump xxxx\n\r");
 216   1          print("H : This screen for help\n\r");
 217   1          print("I : Input xx from the PORT 1\n\r");
 218   1          print("L : Down loading program (autodetect ':')\n\r");
 219   1          print("O : Output xx to the PORT 1\n\r");
 220   1          print("Q : GO program from 8000h\n\r");
 221   1          print("R : Reset by software\n\r");
 222   1          print("S : Show Ethernet & IP address\n\r");
 223   1          print("t : tinymain execute..\n\r");
 224   1          delay(10); /* only use to prevent warning */
 225   1      }
 226          
 227          void input_port1(void)
 228          {                                          /*  read PORT1 pin level (HIGH/LOW)   */
 229   1              byte temp;
 230   1              
 231   1              print("n port 1 ...  Press RESET to stop Test !\n\r");
 232   1              print("\n       Note ! ...  Only detect LOW level condition.\n\r");
C51 COMPILER V7.07   MONITOR                                                               04/20/2004 18:04:41 PAGE 5   

 233   1              print("\n       PORT  ||  P1.7  P1.6  P1.5  P1.4  P1.3  P1.2  P1.1  P1.0\n\r");
 234   1              while(1){
 235   2                      temp = P1;
*** ERROR C202 IN LINE 235 OF SRC\MONITOR.C: 'P1': undefined identifier
 236   2                      printf("       %x  ||   %d     %d     %d     %d     %d     %d     %d     %d\r",temp,P1_7,P1_6,P1_5,P1_4,
             -P1_3,P1_2,P1_1,P1_0);
*** ERROR C202 IN LINE 236 OF SRC\MONITOR.C: 'P1_7': undefined identifier
 237   2              }
 238   1      }
 239          
 240          byte hex_to_ascii( byte hex )         /*  convert hex to ascii 4bit   */
 241          {
 242   1              byte ascii_hex_nibble;
 243   1              if ( (0x00 <= hex) && (hex <= 0x09) ) {
 244   2                      ascii_hex_nibble = hex + 0x30;
 245   2              } else if ( 0xA <= hex && hex <= 0xF ) {
 246   2                              ascii_hex_nibble = hex + 0x41 - 10;
 247   2              } else ascii_hex_nibble = '#';     /*  just a detect a error but not used   */
 248   1              return ascii_hex_nibble;
 249   1      }
 250          
 251          void loading_program(void)                   /*  down_loading intel format file.hex at 8000h */
 252          {
 253   1              byte checksum,serial_temp2;
 254   1              word count,address;
 255   1              if (loading_ready == 1) goto cont1;
 256   1              print("Down Loading Program !!\n\r");
 257   1      
 258   1      cont:;
 259   1              if (get_serial() == ':'){
 260   2      
 261   2      cont1:;
 262   2                      count = two_ascii_to_hex();                                      /* read serial data number  */
 263   2                      if (count == 0) goto no_data;            /* detect down ending       */
 264   2                      address = address_ascii_to_hex();        /* ram start address        */
 265   2                      two_ascii_to_hex();                      /*       intel dummy code   */
 266   2                      while (count){
 267   3                              count -=1;
 268   3                              serial_temp2 = two_ascii_to_hex();
 269   3                              write_ram(address,serial_temp2);
 270   3                              address++;
 271   3                      }
 272   2              serial_temp2 = two_ascii_to_hex();               /*  read checksum data */
 273   2              checksum =+ serial_temp2;
 274   2              }
 275   1              goto cont;
 276   1      no_data:;
 277   1              print("\nDownloading Complete!\n\r");
 278   1              loading_ready = 0;
 279   1      }
 280          
 281          byte mask_a_nibble ( byte hhex_lhex, byte HIGH_or_LOW )     /* select 4bit */
 282          {
 283   1              byte a_nibble;
 284   1              if ( HIGH_or_LOW == HIGH ){
 285   2                      a_nibble = ( hhex_lhex & 0xF0 ) >> 4;
 286   2              } else if ( HIGH_or_LOW == LOW ){
 287   2                      a_nibble = ( hhex_lhex & 0x0F );
 288   2              } else a_nibble = '#';
 289   1              return a_nibble;
 290   1      }
 291          
C51 COMPILER V7.07   MONITOR                                                               04/20/2004 18:04:41 PAGE 6   

 292          void output_port0(void)                                     /* PORT0 output pin level */
 293          {
 294   1          byte temp;
 295   1          
 296   1          print(" Port = ");
 297   1              temp = two_ascii_to_hex_echo();
 298   1              print("h");
 299   1          P0 = temp;
*** ERROR C202 IN LINE 299 OF SRC\MONITOR.C: 'P0': undefined identifier
 300   1      }
 301          
 302          void output_port1(void)                                     /* PORT1 output pin level */
 303          {
 304   1          byte temp;
 305   1          
 306   1          print(" Port = ");
 307   1              temp = two_ascii_to_hex_echo();
 308   1              print("h");
 309   1              P1 = temp;
*** ERROR C202 IN LINE 309 OF SRC\MONITOR.C: 'P1': undefined identifier
 310   1      }
 311          
 312          void output_port2(void)                                     /* PORT2 output pin level */
 313          {
 314   1          byte temp;
 315   1          
 316   1          print(" Port = ");
 317   1              temp = two_ascii_to_hex_echo();
 318   1              print("h");
 319   1          P2 = temp;
*** ERROR C202 IN LINE 319 OF SRC\MONITOR.C: 'P2': undefined identifier
 320   1      }
 321          
 322          void output_port3(void)                                     /* PORT3 output pin level */
 323          {
 324   1          byte temp;
 325   1          
 326   1          print(" Port = ");
 327   1              temp = two_ascii_to_hex_echo();
 328   1              print("h");
 329   1              P3 = temp;
*** ERROR C202 IN LINE 329 OF SRC\MONITOR.C: 'P3': undefined identifier
 330   1      }
 331          
 332          void print(const byte *ch)                 /* display string ,u must understand pointer concept  */
 333          {
 334   1              while(*ch){
 335   2                      while(!TI);
*** ERROR C202 IN LINE 335 OF SRC\MONITOR.C: 'TI': undefined identifier
 336   2                      TI =0;
*** ERROR C202 IN LINE 336 OF SRC\MONITOR.C: 'TI': undefined identifier
 337   2                      SBUF = *ch++;
*** ERROR C202 IN LINE 337 OF SRC\MONITOR.C: 'SBUF': undefined identifier
 338   2              }
 339   1      }
 340          
 341          void print_int(const byte *ch)                 /* display string ,u must understand pointer concept  */
 342          {
 343   1              while(*ch){
 344   2                      while(!TI);
*** ERROR C202 IN LINE 344 OF SRC\MONITOR.C: 'TI': undefined identifier
 345   2                      TI =0;
C51 COMPILER V7.07   MONITOR                                                               04/20/2004 18:04:41 PAGE 7   

*** ERROR C202 IN LINE 345 OF SRC\MONITOR.C: 'TI': undefined identifier
 346   2                      SBUF = *ch++;
*** ERROR C202 IN LINE 346 OF SRC\MONITOR.C: 'SBUF': undefined identifier
 347   2              }
 348   1      }
 349          
 350          void print_logo(void)                /*  if u press RESET key, show this message */
 351          {
 352   1          print("\n\n\n\r");
 353   1          print("     Ver 1.1       C.S.L.  Technology Co., Ltd.        \n\r");
 354   1          print("                   Press   'H' for Information.      \n\r");
 355   1          print("                   since 1997.07.26 by @KYOUNG-SOFT    \n\r");
 356   1          print("                   @ copyleft girle999@yahoo.co.kr    \n\r");
 357   1      }
 358          
 359          void putb_ser(byte byte_data)        /* display ex)  0xf9  --> 'f' and '9'  */
 360          {
 361   1          putchar( (char)hex_to_ascii(        mask_a_nibble( byte_data, HIGH ) ) );
 362   1          putchar( (char)hex_to_ascii(        mask_a_nibble( byte_data, LOW  ) ) );
 363   1      }
 364          
 365          void quit_program(void)
 366          {
 367   1          print("\n\r Quit Monitor.. Excute Downloading program from 8000h \n\r");
 368   1              ((void (code *) (void)) 0x8000) ();
 369   1               /* void (*pfunc)(void);             variable with no parameter and no return value  */
 370   1               /* pfunc = (void(*)(void)) 0;       make a reset vector 0000h and save to pfunc     */
 371   1               /* (*pfunc)();                      excute at 8000h pointer function = "jmp 0000h"  */
 372   1              //_opc(0x02);                     /*  #asm       ljmp   */
 373   1              //_opc(0x80);                                           /*  #asm     0x80       */
 374   1              //_opc(0x00);                                           /*  #asm         0x00   */
 375   1      }
 376          
 377          void reset (void)
 378          {
 379   1              ((void (code *) (void)) 0x0000) ();
 380   1              print_int("\n\rSoftware RESET !");
 381   1              
 382   1      }
 383          
 384          byte two_ascii_to_hex(void)     /*  display ex) '6' and 'e' --> 0x6e   */
 385          {
 386   1              byte serial_two;
 387   1              byte serial_two2;
 388   1      
 389   1              serial_two = ascii_to_hex(get_serial()) << 4;
 390   1              serial_two2 = ascii_to_hex(get_serial());
 391   1              serial_two |= serial_two2;
 392   1              return (serial_two);
 393   1      }
 394          
 395          byte two_ascii_to_hex_echo(void)        /*  two_ascii_to_hex() + display  */
 396          {
 397   1              byte serial_two;
 398   1              byte serial_two2;
 399   1              
 400   1              serial_two = ascii_to_hex(get_serial_echo()) << 4;
 401   1              serial_two2 = ascii_to_hex(get_serial_echo());
 402   1              serial_two |= serial_two2;
 403   1              return (serial_two);
 404   1      }
 405          
C51 COMPILER V7.07   MONITOR                                                               04/20/2004 18:04:41 PAGE 8   


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

⌨️ 快捷键说明

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