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

📄 main.lst

📁 58enc28j06protuesuip09.rar
💻 LST
字号:
C51 COMPILER V8.16   MAIN                                                                  03/16/2009 23:18:12 PAGE 1   


C51 COMPILER V8.16, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN .\debug\main.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE main.c LARGE BROWSE DEBUG OBJECTEXTEND PRINT(.\debug\main.lst) OBJECT(.\deb
                    -ug\main.obj)

line level    source

   1          /******************************************************************************
   2          **CPU:STC89C58RD+
   3          **RAM:HY62256       32k    0x0000H-0x7FFFH
   4          **EEPROM:STC EEPROM 16K    0x8000H-0xF3FFH
   5          **FLASH:STC 32K
   6          **OSC:22.1184M
   7          **NetChip:ENC28J60
   8          **Version:1.0
   9          **Data:2008-12-28
  10          **Author:jerkoh
  11          **E-mail:jerkoh@163.com
  12          **QQ Group:28221007   (ETTG)
  13          ******************************************************************************/ 
  14          /******************************************************************************
  15          **Record
  16          **08/12/28  创建工程文件gIP
  17          **09/01/02  完成单片机初始化
  18          **09/01/04  加入串口调试,STC EEPROM读写
  19          **09/01/05      分配收发缓冲区实体XRAM,测试串口在9600bps下接收回显1000,000 byte OK!
  20          **09/01/06  移植ENC28J60初始化驱动程序及模拟SPI读写
  21          **09/01/09  修改网络变压器连接,MAC层LINKED
  22          **09/01/10  移植IP,ARP,ICMP 
  23          **09/01/20  uip0.9移植
  24          **09/03/09  查询MAC_LINK LINK ON 状态时STOP赋值enc28j60Write(MICMD,0x00)
  25          **09/03/10  16进制转字符串 ping 串口显示,查询当前网线连接状态
  26          **09/03/11  串口将TCP包发送计算一个登记延时 否侧数据包过大导致登记溢出发送
  27          ******************************************************************************/
  28          /******************************************************************************
  29          ** SIMspi -ENC28J60
  30          ** P1.0 - /CS
  31          ** P1.1 - SCK
  32          ** P1.2 - SI
  33          ** P1.3 - SO
  34          ** P3.2 - /INT
  35          ** P1.4 - /WOL  
  36          ** P1.5 - RST
  37          ** P3.4 - RED   LED 
  38          ** p3.5 - GREEN LED 
  39          ******************************************************************************/
  40          #include "reg52.h"
  41          #include "uip.h" 
  42          #include "uip_arp.h"
  43          #include "httpd.h"
  44          #include "uart.h"
  45          #include "enc28j60.h"
  46          #include "tcp_server.h"
  47          #include "myopt.h"
  48          #include "time.h"
  49          #include <intrins.h>
  50          #include <stdio.h>
  51          #include <stdlib.h>
  52          
  53          
  54          
C51 COMPILER V8.16   MAIN                                                                  03/16/2009 23:18:12 PAGE 2   

  55          #define BUF ((struct uip_eth_hdr *)&uip_buf[0])
  56          
  57          
  58          
  59          u8_t xdata mydata[MYLEN];       
  60          u8_t xdata ComTxdBuf[COM_TXD_BUFF_SIZE];                                
  61          u8_t xdata ComRxdBuf[COM_RXD_BUFF_SIZE];
  62          
  63          
  64          
  65          void main(void)
  66          {
  67   1              idata u8_t i,arptimer;
  68   1              idata u16_t j,kk,ser_ct;
  69   1              
  70   1              AUXR=0x02;                             /*stc xram 关闭*/
  71   1              TIME0_Init();
  72   1              UART_Init();
  73   1              if(DEBUG) Printf_String("\r\n[MSG:] Copyright(c) 2008-2009 jerkoh");
  74   1              if(DEBUG) Printf_String("\r\n[MSG:] All rights reserved");
  75   1              if(DEBUG) Printf_String("\r\n[MSG:] uip0.9 running on 8051&enc28j60");                     
  76   1              if(DEBUG) Printf_String("\r\n[MSG:] Baudrate 9600 8/n/1  ");
  77   1              if(DEBUG) Printf_String("\r\n[MSG:] Now linking please wait......");
  78   1              
  79   1              dev_init();                            /*初始化以太网芯片enc28j60*/
  80   1              
  81   1         
  82   1              while(1)
  83   1           {
  84   2                if(enc28j60_mac_is_linked())     /*查询连接状态*/
  85   2                {
  86   3                  if(DEBUG) Printf_String("\r\n[MSG:] Link is successed!");
  87   3                  break;
  88   3                }
  89   2               }
  90   1         
  91   1              uip_arp_init();                                    
  92   1              /* Initialize the uIP TCP/IP stack. */
  93   1              httpd_init();
  94   1              uip_init();
  95   1              tcp_server_init();
  96   1              uip_listen(HTONS(4001));
  97   1              uip_listen(HTONS(4002));
  98   1              uip_listen(HTONS(4003));        
  99   1              arptimer = 0;
 100   1              
 101   1      
 102   1       while(1) 
 103   1        {
 104   2      
 105   2      /*@*task0*@*/ 
 106   2      
 107   2               if(enc28j60_mac_is_linked()==0)
 108   2                {
 109   3                  if(DEBUG) Printf_String("\r\n[MSG:] Link is removed!");
 110   3                      for(kk=0;kk<5000;kk++);
 111   3                      for(kk=0;kk<1000;kk++);                   /*检测网线断开*/
 112   3                      break; 
 113   3                }
 114   2      
 115   2      
 116   2      
C51 COMPILER V8.16   MAIN                                                                  03/16/2009 23:18:12 PAGE 3   

 117   2      
 118   2       /*@*task1*@*/ 
 119   2               ser_ct=Copy_Send_Data();                         /*串口回显测试*/
 120   2               if(ser_ct>0)
 121   2               {
 122   3                for(kk=0;kk<ser_ct;kk++)
 123   3                   {
 124   4                         Printf_Char(mydata[kk]);
 125   4                       }
 126   3               }
 127   2      
 128   2               
 129   2      
 130   2       /*@*task2*@*/ 
 131   2      
 132   2      
 133   2          /* Let the tapdev network device driver read an entire IP packet
 134   2             into the uip_buf. If it must wait for more than 0.5 seconds, it
 135   2             will return with the return value 0. If so, we know that it is
 136   2             time to call upon the uip_periodic(). Otherwise, the tapdev has
 137   2             received an IP packet that is to be processed by uIP. */
 138   2          uip_len = dev_poll();
 139   2              for(j=0;j<500;j++);
 140   2      
 141   2          if(uip_len == 0) 
 142   2              {
 143   3              for(i = 0; i < UIP_CONNS; i++) 
 144   3                        {
 145   4                     uip_periodic(i);
 146   4                     /* If the above function invocation resulted in data that
 147   4                        should be sent out on the network, the global variable
 148   4                        uip_len is set to a value > 0. */
 149   4                     if(uip_len > 0) 
 150   4                           {
 151   5                        uip_arp_out();
 152   5                        dev_send();
 153   5                       }
 154   4                }
 155   3      
 156   3      #if UIP_UDP
                      for(i = 0; i < UIP_UDP_CONNS; i++) 
                               {
                             uip_udp_periodic(i);
                             /* If the above function invocation resulted in data that
                                should be sent out on the network, the global variable
                                uip_len is set to a value > 0. */
                             if(uip_len > 0) 
                                   {
                                uip_arp_out();
                                dev_send();
                               }
                       }
              #endif /* UIP_UDP */
 170   3            
 171   3            /* Call the ARP timer function every 10 seconds. */
 172   3               if(++arptimer == 20) 
 173   3                        {     
 174   4                     uip_arp_timer();
 175   4                     arptimer = 0;
 176   4                }
 177   3            
 178   3           } 
C51 COMPILER V8.16   MAIN                                                                  03/16/2009 23:18:12 PAGE 4   

 179   2               
 180   2              else 
 181   2               
 182   2               {
 183   3              if(BUF->type == htons(UIP_ETHTYPE_IP)) 
 184   3                      {
 185   4                    uip_arp_ipin();
 186   4                    uip_input();
 187   4                    /* If the above function invocation resulted in data that
 188   4                       should be sent out on the network, the global variable
 189   4                       uip_len is set to a value > 0. */
 190   4                   if(uip_len > 0) 
 191   4                        {
 192   5                      uip_arp_out();
 193   5                      dev_send();
 194   5                    }
 195   4              } 
 196   3                      else if(BUF->type == htons(UIP_ETHTYPE_ARP)) 
 197   3                      {
 198   4                uip_arp_arpin();
 199   4                   /* If the above function invocation resulted in data that
 200   4                      should be sent out on the network, the global variable
 201   4                      uip_len is set to a value > 0. */       
 202   4                    if(uip_len > 0) 
 203   4                        {     
 204   5                     dev_send();
 205   5                    }
 206   4              }
 207   3          }
 208   2          
 209   2        }
 210   1      
 211   1      }
 212          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    467    ----
   CONSTANT SIZE    =    233    ----
   XDATA SIZE       =   4500    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----       8
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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