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

📄 main.lst

📁 硬件是8051f340+cp2200。插上网线
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V8.02   MAIN                                                                  03/31/2008 20:06:45 PAGE 1   


C51 COMPILER V8.02, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN .\main.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ..\..\web5动态好\main.c LARGE BROWSE DEBUG OBJECTEXTEND PRINT(.\main.lst) O
                    -BJECT(.\main.obj)

line level    source

   1          //------------------------------------------------------------------------------
   2          // main.c
   3          //------------------------------------------------------------------------------
   4          // Copyright (C) 2005 Silicon Laboratories, Inc.
   5          //
   6          // Date: 05/19/06 09:38:45
   7          // Target: C8051F34x 
   8          //
   9          // Description:
  10          //    This file contains the main routine, MCU initialization code, and
  11          //    callback functions used by the TCP/IP Library.
  12          //
  13          // Generated by TCP/IP Configuration Wizard Version 3
  14          //
  15          #include "mn_userconst.h"                      // TCP/IP Library Constants
  16          #include "mn_stackconst.h"                     // TCP/IP Library Constants
  17          #include "mn_errs.h"                           // Library Error Codes
  18          #include "mn_defs.h"                           // Library Type definitions
  19          #include "mn_funcs.h"                          // Library Function Prototypes
  20          #include "VFILE_DIR\index.h"
  21          #include <string.h>                    // Standard 'C' Libraries
  22          #include <intrins.h>
  23          #include <stdio.h>
  24          #include <ctype.h> 
  25          #include <c8051F340.h>                         // Device-specific SFR Definitions
  26          
  27          
  28          //------------------------------------------------------------------------------
  29          // Function Prototypes
  30          //------------------------------------------------------------------------------
  31          
  32          // Initialization Routines
  33          void PORT_Init (void);
  34          void SYSCLK_Init (void);
  35          void EMIF_Init(void);
  36          int establish_network_connection();
  37          void add();
  38          void Timer2_Init(void);
  39          void get_data (PSOCKET_INFO socket_ptr);
  40          
  41          bit_word16 msg_buff[4]={50,20,30,40};
  42          unsigned char HTML_BUFFER[400];
  43          //-----------------------------------------------------------------------------
  44          // 16-bit SFR Definitions for 'F34x
  45          //-----------------------------------------------------------------------------
  46          sfr16 TMR2RL   = 0xca;                    // Timer2 reload value
  47          sfr16 TMR2     = 0xcc;                    // Timer2 counter
  48          sfr16 ADC0     = 0xbd;                    // ADC0 data register
  49          
  50          //------------------------------------------------------------------------------
  51          // Global Constants
  52          //------------------------------------------------------------------------------
  53          #define SYSCLK                  48000000L      // System Clock Frequency in Hz
  54          #define T2_OVERFLOW_RATE        80L            // Timer 2 Overflow Rate in Hz
C51 COMPILER V8.02   MAIN                                                                  03/31/2008 20:06:45 PAGE 2   

  55          
  56          //-----------------------------------------------------------------------------
  57          // Main Routine
  58          //-----------------------------------------------------------------------------
  59          void main(void)
  60          {
  61   1      
  62   1         // Disable watchdog timer
  63   1         PCA0MD = 0x00;
  64   1      
  65   1         // Initialize the MCU
  66   1         PORT_Init();
  67   1         SYSCLK_Init();
  68   1         EMIF_Init();
  69   1         Timer2_Init();
  70   1      
  71   1         while(1)
  72   1         {
  73   2            // Initialize the TCP/IP stack.
  74   2            if (mn_init() < 0)
  75   2            {
  76   3               // If code execution enters this while(1) loop, the stack failed to initialize.
  77   3               // Verify that all boards are connected and powered properly.
  78   3               while(1);
  79   3            }
  80   2            
  81   2            // Connect to the network
  82   2            establish_network_connection();
  83   2      
  84   2            // Add web page to virtual file system.
  85   2            // The main page MUST be called index.htm or index.html.
  86   2            mn_vf_set_entry((byte *)"index.html", INDEX_SIZE, index_html, VF_PTYPE_FLASH);
  87   2            
  88   2                // Add CGI Script to Virtual File System         
  89   2            mn_pf_set_entry
  90   2            (
  91   2              (byte*)"get_data",                   // Script Name (ASCII)
  92   2              get_data                                      // Function Pointer
  93   2            );
  94   2            //add();
  95   2            // Start the Application Layer Services.
  96   2            mn_server();
  97   2           
  98   2            //add();
  99   2         }
 100   1      }
 101          
 102          //-----------------------------------------------------------------------------
 103          // establish_network_connection
 104          //-----------------------------------------------------------------------------
 105          //
 106          // This function calls mn_ether_init() to initialize the CP2200 and attach to
 107          // the network.
 108          //
 109          // If there is a network connection, the function returns 1.
 110          //
 111          // If there is no network connection, the function waits until either a
 112          // connection appears or the CP2200 is reset before calling mn_ether_init()
 113          // again. (The application may perform other tasks while polling
 114          // link_status and ether_reset).
 115          //
 116          int establish_network_connection()
C51 COMPILER V8.02   MAIN                                                                  03/31/2008 20:06:45 PAGE 3   

 117          {
 118   1         int retval;
 119   1      
 120   1         do
 121   1         {
 122   2            // mn_ether_init() initializes the Ethernet controller.
 123   2            // AUTO_NEG indicates that the controller will auto-negotiate.
 124   2            retval = mn_ether_init(AUTO_NEG, 3, 0);
 125   2      
 126   2            // If there is no link, poll link_status until it sets or the
 127   2            // CP2200 resets and then call mn_ether_init() again.
 128   2            if (retval == LINK_FAIL)
 129   2            {
 130   3               while(!link_status && !ether_reset);
 131   3            }
 132   2      
 133   2            // If retval is less than zero and is not AUTO_NEG_FAIL, there is a 
 134   2            // hardware error.
 135   2            else if ((retval < 0) && (retval != AUTO_NEG_FAIL))
 136   2            {
 137   3               // Verify that the Ethernet controller is connected and powered properly.
 138   3               // Verity that the EMIF has been configured at a speed compatible with the
 139   3               //    Ethernet controller.
 140   3               while(1);
 141   3            }
 142   2      
 143   2         }while((retval < 0) && (retval != AUTO_NEG_FAIL));
 144   1      
 145   1         return (1);
 146   1      
 147   1      }//-----------------------------------------------------------------------------
 148          // Interrupt Service Routines
 149          //-----------------------------------------------------------------------------
 150          
 151          //-----------------------------------------------------------------------------
 152          // Timer2_ISR (T2_OVERFLOW_RATE Hz)
 153          //-----------------------------------------------------------------------------
 154          //
 155          void Timer2_ISR (void) interrupt 5
 156          {
 157   1      
 158   1         // Define static counters for real time clock (RTC).
 159   1         static unsigned int RTC_counter = 0;
 160   1      
 161   1         // Clear Timer 2 Overflow Flag
 162   1         TF2H = 0;
 163   1      
 164   1         // Check if one second has passed and update RTC.
 165   1         if(RTC_counter >= T2_OVERFLOW_RATE){
 166   2      
 167   2            // Clear counter and update real time clock
 168   2            RTC_counter = 0;
 169   2             msg_buff[0]++;
 170   2            //netfinder_update_RTC();
 171   2      
 172   2         } else {
 173   2            // Increment interrupt count
 174   2            RTC_counter++;
 175   2         }
 176   1      
 177   1      }
 178          //-----------------------------------------------------------------------------
C51 COMPILER V8.02   MAIN                                                                  03/31/2008 20:06:45 PAGE 4   

 179          // CGI Script: get_data
 180          //-----------------------------------------------------------------------------
 181          //
 182          // This routine is called when the following is typed into the address bar
 183          // of a web browser:
 184          //    
 185          //    http://<ip-address>/get_data?arg1=hello&arg2=donotdisplay

⌨️ 快捷键说明

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