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

📄 monitor.lst

📁 在89C51上实现TCPIP协议
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.07   MONITOR                                                               04/20/2004 18:04:41 PAGE 1   


C51 COMPILER V7.07, COMPILATION OF MODULE MONITOR
OBJECT MODULE PLACED IN .\out\monitor.obj
COMPILER INVOKED BY: F:\Keil\C51\BIN\C51.EXE src\monitor.c BROWSE DEBUG OBJECTEXTEND PRINT(.\lst\monitor.lst) OBJECT(.\o
                    -ut\monitor.obj)

stmt level    source

   1          /*
   2           * Copyright (C) 2002 by TechiZ. All rights reserved.
   3           *
   4           * This program was written in Korean(Comment and some more).
   5           *
   6           * This program was developed by TechiZ(The Company name).
   7           * TechiZ want to share this program with you who loves the 8051 & the TCP/IP.
   8           * 
   9           * You MUST DOWNLOAD THIS CODE from TechiZ Homepage.
  10           * You DO NOT USE THIS CODE FOR COMMERCIAL PURPOSE.
  11           * This code is ONLY FREE FOR THE STUDY.
  12           * If you want more, send me E-mail.
  13           *
  14           * E-mail: techiz@techiz.com
  15           * ( Subject is : [T89C51RD2 & TinyTCP] bla~ bla bla.... )
  16           *
  17           * Homepage: http://www.techiz.com
  18           * 
  19           * You DO NOT DELETE THIS COPYRIGHT MESSAGE IN THE USING OF THIS CODE.
  20           *
  21           * In the using of this code, TechiZ does NOT GUARANTEE ABOUT WORKING WITHOUT ERROR.
  22           */
  23          
  24          /*****************************************************************************/
  25          /*                      Part of Monitor Program to use RS-232                            */
  26          /*****************************************************************************/
  27          #include <stdio.h>
  28          #include <aduc812.h>
*** WARNING C318 IN LINE 28 OF src\monitor.c: can't open file 'aduc812.h'
  29          
  30          #define     XBYTE           ((unsigned char *) 0x20000L)
  31          #define     HIGH            1
  32          #define     LOW             0
  33          #define         BYTE    byte
  34          #define         WORD    word
  35          #define         write_ram(address,value)                XBYTE [address] = value
  36          #define         read_ram(address)                               XBYTE [address] 
  37          #define         inportb(address)                                XBYTE [address]
  38          #define         outportb(address,value)                 XBYTE [address] = value
  39          #define         outp(address,value)                             XBYTE [address] = value
  40          typedef         unsigned long longword;         /* 32 bits          */
  41          typedef         unsigned int word;                      /* 16 bits          */
  42          typedef         unsigned char byte;         /*  8 bits          */
  43          
  44          extern data word buf_addr;
  45          extern data word buf_addr2;
  46          extern data byte loading_ready;
  47          extern data byte dump_auto;
  48          extern data word dump_address;
  49          
  50          
  51          byte ascii_to_hex(byte ch);
  52          word address_ascii_to_hex(void);
  53          word address_ascii_to_hex_echo(void);
C51 COMPILER V7.07   MONITOR                                                               04/20/2004 18:04:41 PAGE 2   

  54          void clear_external_ram(void);
  55          void delay(word d);
  56          void delay_1ms(int times);
  57          void dump_memory(void);
  58          byte get_serial(void);
  59          byte get_serial_echo(void);
  60          void help_message(void);
  61          byte hex_to_ascii( byte hex);
  62          void input_port1(void);
  63          void loading_program(void);
  64          byte mask_a_nibble ( byte hhex_lhex, byte HIGH_or_LOW );
  65          void output_port0(void);
  66          void output_port1(void);
  67          void output_port2(void);
  68          void output_port3(void);
  69          void print(byte *ch);
  70          void print_int(const byte *ch);
  71          void print_logo(void);
  72          void putb_ser(byte byte_data);
  73          void quit_program(void);
  74          void reset (void);
  75          void system_init(void);
  76          byte two_ascii_to_hex(void);
  77          byte two_ascii_to_hex_echo(void);
  78          
  79          /*****************************************************************************/
  80          /*          Monitor & Serial routine for string control                      */
  81          /*****************************************************************************/
  82          
  83          byte ascii_to_hex( byte ch )                     /*   ex) 30h = '0'    */
  84          {
  85   1              if (ch >= 'A' && ch <= 'F'){
  86   2                       return ( ch - 'A' + 10 );
  87   2              }
  88   1              else if (ch >= 'a' && ch <= 'f'){ 
  89   2                      return (ch - 'a' + 10);
  90   2              }
  91   1              else return ( ch - '0');
  92   1      }
  93          
  94          word address_ascii_to_hex(void)
  95          {
  96   1          union d {
  97   1              word serial_four;
  98   1              byte serial_temp[2];
  99   1              }s ;
 100   1      
 101   1                      s.serial_temp[0] = two_ascii_to_hex();    /*  high address 1 byte */
 102   1              s.serial_temp[1] = two_ascii_to_hex();    /*  low  address 2 byte */
 103   1              return (s.serial_four);
 104   1      }
 105          
 106          word address_ascii_to_hex_echo(void)
 107          {
 108   1              union d {
 109   1              word serial_four;
 110   1              byte serial_temp[2];
 111   1              }s ;
 112   1              
 113   1              s.serial_temp[0] = two_ascii_to_hex_echo();    /* high address 1 byte */
 114   1              s.serial_temp[1] = two_ascii_to_hex_echo();    /* low  address 2 byte */
 115   1              return (s.serial_four);
C51 COMPILER V7.07   MONITOR                                                               04/20/2004 18:04:41 PAGE 3   

 116   1      }
 117          
 118          void delay(word d)
 119          {
 120   1              data word i;
 121   1              for(i=0;i<d*100;i++);
 122   1      }
 123          
 124          /* --------------------------- 1mS 矫埃瘤楷 橇肺弊伐 ------------------------- */
 125          /* [牢荐] void                                                              */
 126          /* [曼炼] 1mS 矫埃 瘤楷                                                     */
 127          /* ------------------------------------------------------------------------ */
 128          void delay_1ms(int times)
 129          {
 130   1              for(times = 0;times < 198;times++);        /* Delay Loop */
 131   1      }
 132          
 133          
 134          void clear_external_ram(void)                     /*  clear data memory from 8000h  */
 135          {
 136   1              word address,i;
 137   1              
 138   1              print("lear external RAM from 0000...");
 139   1              address = 0xffff;
 140   1              
 141   1              for(i=0;i<address;i++){
 142   2                      write_ram(i,0xff);
 143   2              }
 144   1      }
 145          void dump_memory( void )                          /*  dump from xxxx 16line  */
 146          {
 147   1              byte num1,num2;
 148   1      
 149   1              if (dump_auto != 1){
 150   2                      print("ump Address at = "); buf_addr = address_ascii_to_hex_echo();
 151   2                      dump_address = buf_addr;
 152   2              }
 153   1              else {
 154   2                      dump_address = dump_address + 0x100;
 155   2                      buf_addr = dump_address;
 156   2                      printf("%x",dump_address);
 157   2              }
 158   1              
 159   1              print("\n\r");
 160   1              print("------------------------------------------------------------------------ \n\r");
 161   1              print("ADDR   +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F    ASCII CODE\n\r");
 162   1              print("------------------------------------------------------------------------ \n\r");
 163   1      
 164   1              buf_addr = buf_addr & 0xfff0;
 165   1              buf_addr2= buf_addr & 0xfff0;
 166   1              for( num2=0x10; !(num2 == 0x00); num2--){
 167   2      
 168   2                      printf("%x",buf_addr);
 169   2                      print(" : ");
 170   2      
 171   2                      for( num1 = 0x10; num1 != 0x00; buf_addr++, num1--){
 172   3                              putb_ser(read_ram(buf_addr));
 173   3                              print(" ");
 174   3                      }
 175   2                      print(" ");
 176   2                      for( num1 = 0x10; num1 != 0x00; buf_addr2++, num1--){
 177   3                              if (read_ram(buf_addr2) < 0x20 || read_ram(buf_addr2) > 0x7f){
C51 COMPILER V7.07   MONITOR                                                               04/20/2004 18:04:41 PAGE 4   

 178   4                                      print(".");
 179   4                              }
 180   3                              else{
 181   4                                      putchar(read_ram(buf_addr2));
 182   4                              }
 183   3                      }
 184   2                      print("\n\r");
 185   2              }
 186   1              print("------------------------------------------------------------------------ \n");
 187   1      }
 188          
 189          byte get_serial(void)                 /*  one character receive from keyboard  */
 190          {
 191   1              while(!RI);
*** ERROR C202 IN LINE 191 OF SRC\MONITOR.C: 'RI': undefined identifier
 192   1              RI = 0;
*** ERROR C202 IN LINE 192 OF SRC\MONITOR.C: 'RI': undefined identifier
 193   1              return(SBUF);
*** ERROR C202 IN LINE 193 OF SRC\MONITOR.C: 'SBUF': undefined identifier
 194   1      }
 195          
 196          byte get_serial_echo(void)            /*  one character receive and display it  */
 197          {
 198   1              while(!RI);
*** ERROR C202 IN LINE 198 OF SRC\MONITOR.C: 'RI': undefined identifier
 199   1              RI = 0;
*** ERROR C202 IN LINE 199 OF SRC\MONITOR.C: 'RI': undefined identifier
 200   1      
 201   1          putchar((char)SBUF);
*** ERROR C202 IN LINE 201 OF SRC\MONITOR.C: 'SBUF': undefined identifier
 202   1              return(SBUF);
*** ERROR C202 IN LINE 202 OF SRC\MONITOR.C: 'SBUF': undefined identifier
 203   1      }

⌨️ 快捷键说明

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