亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? main.#2

?? 硬件是8051f340+cp2200。插上網線
?? #2
字號:
//------------------------------------------------------------------------------// main.c//------------------------------------------------------------------------------// Copyright (C) 2005 Silicon Laboratories, Inc.//// Date: 05/19/06 09:38:45// Target: C8051F34x //// Description://    This file contains the main routine, MCU initialization code, and//    callback functions used by the TCP/IP Library.//// Generated by TCP/IP Configuration Wizard Version 3//#include "mn_userconst.h"                      // TCP/IP Library Constants#include "mn_stackconst.h"                     // TCP/IP Library Constants#include "mn_errs.h"                           // Library Error Codes#include "mn_defs.h"                           // Library Type definitions#include "mn_funcs.h"                          // Library Function Prototypes#include "VFILE_DIR\index.h"
#include <string.h>                    // Standard 'C' Libraries
#include <intrins.h>
#include <stdio.h>
#include <ctype.h> #include <c8051F340.h>                         // Device-specific SFR Definitions#include "CP2200DK.H"
//------------------------------------------------------------------------------// Function Prototypes//------------------------------------------------------------------------------ sbit LED=P2^4;// Initialization Routinesvoid PORT_Init (void);void SYSCLK_Init (void);void EMIF_Init(void);int establish_network_connection();
void add();void Timer2_Init(void);
void get_data (PSOCKET_INFO socket_ptr);
void DelayMs(unsigned int n);//延時(n)MS
SystemInit();//系統配置
	SysClkInit();//配置系統時鐘
void SysClkInit(void);/配置系統時鐘
void SystemInit(void);/系統配置
void PortInit(void);/端口配置	

unsigned char num_buff[4]={0,20,30,40};
unsigned char HTML_BUFFER[400];
unsigned char num;
//-----------------------------------------------------------------------------
// 16-bit SFR Definitions for 'F34x
//-----------------------------------------------------------------------------
sfr16 TMR2RL   = 0xca;                    // Timer2 reload value
sfr16 TMR2     = 0xcc;                    // Timer2 counter
sfr16 ADC0     = 0xbd;                    // ADC0 data register

//------------------------------------------------------------------------------
// Global Constants
//------------------------------------------------------------------------------
#define SYSCLK                  48000000L      // System Clock Frequency in Hz
#define T2_OVERFLOW_RATE        80L            // Timer 2 Overflow Rate in Hz

//-----------------------------------------------------------------------------
// Main Routine
//-----------------------------------------------------------------------------
void main(void)
{
   unsigned char KeyBuff;
   // Disable watchdog timer
   	PCA0MD&=~0x40;//禁止看門狗定時器

   // Initialize the MCU
   //PORT_Init();
   //SYSCLK_Init();
   //EMIF_Init();
   //Timer2_Init();
   
	SystemInit();//系統配置
	SysClkInit();//配置系統時鐘

	Uart0Init();//串口初始化
	Uart0SendString("OK\n",3);
	LED=0;

	

   while(1)
   {  /* KeyBuff=KeyScan();
		if(KeyBuff==1)
		{  LED=1;
			DelayMs(100);
			LED=0;
	   num=Uart0Get();
		} */
		KeyBuff=KeyScan();
		if(KeyBuff==1)
		{
			LED=1;
			DelayMs(100);
			LED=0;
			Uart0SendString("KEY1\n",5);
		}
		if(KeyBuff==2)
		{
			LED=1;
			DelayMs(100);
			LED=0;
			Uart0SendString("KEY2\n",5);
		}
		if(KeyBuff==3)
		{
			LED=1;
			DelayMs(100);
			LED=0;
			Uart0SendString("KEY3\n",5);
		}
      // Initialize the TCP/IP stack.
    /*  if (mn_init() < 0)
      {
         // If code execution enters this while(1) loop, the stack failed to initialize.
         // Verify that all boards are connected and powered properly.
         while(1);
      }
      
      // Connect to the network
      establish_network_connection();

      // Add web page to virtual file system.
      // The main page MUST be called index.htm or index.html.
      mn_vf_set_entry((byte *)"index.html", INDEX_SIZE, index_html, VF_PTYPE_FLASH);
      
	  // Add CGI Script to Virtual File System	   
      mn_pf_set_entry
      (
      	(byte*)"get_data",	             // Script Name (ASCII)
      	get_data		                      // Function Pointer
      );
      //add();
      // Start the Application Layer Services.
      mn_server();
     
      //add(); */
   }
   
}

//-----------------------------------------------------------------------------
// establish_network_connection
//-----------------------------------------------------------------------------
//
// This function calls mn_ether_init() to initialize the CP2200 and attach to
// the network.
//
// If there is a network connection, the function returns 1.
//
// If there is no network connection, the function waits until either a
// connection appears or the CP2200 is reset before calling mn_ether_init()
// again. (The application may perform other tasks while polling
// link_status and ether_reset).
//
int establish_network_connection()
{
   int retval;

   do
   {
      // mn_ether_init() initializes the Ethernet controller.
      // AUTO_NEG indicates that the controller will auto-negotiate.
      retval = mn_ether_init(AUTO_NEG, 3, 0);

      // If there is no link, poll link_status until it sets or the
      // CP2200 resets and then call mn_ether_init() again.
      if (retval == LINK_FAIL)
      {
         while(!link_status && !ether_reset);
      }

      // If retval is less than zero and is not AUTO_NEG_FAIL, there is a 
      // hardware error.
      else if ((retval < 0) && (retval != AUTO_NEG_FAIL))
      {
         // Verify that the Ethernet controller is connected and powered properly.
         // Verity that the EMIF has been configured at a speed compatible with the
         //    Ethernet controller.
         while(1);
      }

   }while((retval < 0) && (retval != AUTO_NEG_FAIL));

   return (1);

}//-----------------------------------------------------------------------------
// Interrupt Service Routines
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// Timer2_ISR (T2_OVERFLOW_RATE Hz)
//-----------------------------------------------------------------------------
//
void Timer2_ISR (void) interrupt 5
{

   // Define static counters for real time clock (RTC).
   static unsigned int RTC_counter = 0;

   // Clear Timer 2 Overflow Flag
   TF2H = 0;

   // Check if one second has passed and update RTC.
   if(RTC_counter >= T2_OVERFLOW_RATE){

      // Clear counter and update real time clock
      RTC_counter = 0;
       num_buff[0]++;
      //netfinder_update_RTC();

   } else {
      // Increment interrupt count
      RTC_counter++;
   }

}
//-----------------------------------------------------------------------------
// CGI Script: get_data
//-----------------------------------------------------------------------------
//
// This routine is called when the following is typed into the address bar
// of a web browser:
//    
//    http://<ip-address>/get_data?arg1=hello&arg2=donotdisplay
//
//    where <ip-address> = the IP address of the embedded system
//void get_data (PSOCKET_INFO socket_ptr)
{
   byte msg_buff1[50];
   
   int status1,status2,status3;   

   // Search for the type field and store the result in <msg_buff1>.
   status1 = mn_http_find_value (BODYptr, (byte*)"b1", msg_buff1);
   
   // Check status1 and status2 to determine if msg_buff1 and msg_buff2 are valid.
   if(status1){    
	    // num_buff[0]=2;
		 num_buff[1]=2; 
		 sprintf(HTML_BUFFER, "<html><body bgcolor=blue text=yellow><center><span style=\"font-family: sans-serif; font-size: 28pt; font-weight: bold;\">%d.%d</span></center></body></html>",num,num_buff[1]);     
      
      // Fill the socket with data to send.
      socket_ptr->send_ptr = HTML_BUFFER;
      socket_ptr->send_len = strlen(HTML_BUFFER);
		  }
   status2 = mn_http_find_value (BODYptr, (byte*)"b2", msg_buff1);
	  if(status2){   
	    num_buff[0]=3;
	    num_buff[1]=3;	   
	  sprintf(HTML_BUFFER, "<html><body bgcolor=blue text=yellow><center><span style=\"font-family: sans-serif; font-size: 28pt; font-weight: bold;\">%d.%d</span></center></body></html>",num,num_buff[1]);     
      
      // Fill the socket with data to send.
      socket_ptr->send_ptr = HTML_BUFFER;
      socket_ptr->send_len = strlen(HTML_BUFFER);
    }
	
  status3 = mn_http_find_value (BODYptr, (byte*)"To", msg_buff1);
  if(status3){   
       	    
		   
	 //sprintf(HTML_BUFFER, "<html><body bgcolor=blue text=yellow><center><span style=\"font-family: sans-serif; font-size: 28pt; font-weight: bold;\">%d.%d</span></center></body></html>",num_buff[0],num_buff[1]);     
      sprintf(HTML_BUFFER, "<html><body bgcolor=blue text=yellow><center><span style=\"font-family: sans-serif; font-size: 28pt; font-weight: bold;\">%s</span></center></body></html>",msg_buff1);
      // Fill the socket with data to send.
      socket_ptr->send_ptr = HTML_BUFFER;
      socket_ptr->send_len = strlen(HTML_BUFFER);
  }
}
//-----------------------------------------------------------------------------// Initialization Routines//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------// PORT_Init//-----------------------------------------------------------------------------//// Configure the Interrupts, Crossbar and GPIO ports//void PORT_Init (void){   IT01CF = 0x07;                      // Enable Interrupt 0 on P0.7   TCON &= ~0x01;                      // Make /INT0 level triggered   XBR0    = 0x01;                     // Enable UART on P0.4(TX) and P0.5(RX)   XBR1    = 0x40;                     // Enable crossbar and enable                                       // weak pull-ups   P0MDOUT = 0x40;                    // enable UTX as push-pull output   P1MDOUT = 0xC8;                    // /WR and /RD are push-pull   P2MDOUT = 0xF0;   P3MDOUT = 0xFF;   P4MDOUT = 0xFF;
  	P0MDIN    = 0xF3;
    P1MDIN    = 0xDF;
    P2MDIN    = 0xF0;    
    P0SKIP    = 0x0C;
    P1SKIP    = 0x20;}//-----------------------------------------------------------------------------// EMIF_Init//-----------------------------------------------------------------------------//// Configure the External Memory Interface for both on and off-chip access.//void EMIF_Init (void){   EMI0CF = 0x0B;             // Multiplex mode   EMI0TC = EMIF_TIMING;      // This constant may be modified                              // according to SYSCLK to meet the                              // timing requirements for the CP2200   EMI0CN = BASE_ADDRESS;     // Page of XRAM accessed by EMIF}//-----------------------------------------------------------------------------// SYSCLK_Init//-----------------------------------------------------------------------------//// This routine initializes the system clock.//void SYSCLK_Init (void){   int i;   OSCICN = 0x03;                     // Configure internal oscillator for                                       // its maximum frequency     CLKMUL = 0x00;                      // Reset Clock Multiplier and select                                       // internal oscillator as input source   CLKMUL |= 0x80;                     // Enable the Clock Multiplier   for(i = 0; i < 256; i++);           // Delay at least 5us      CLKMUL |= 0xC0;                     // Initialize the Clock Multiplier      while(!(CLKMUL & 0x20));            // Wait for MULRDY => 1      RSTSRC = 0x04;                      // Enable missing clock detector                                       // and VDD monitor      FLSCL |= 0x10;                      // Set Flash Scale for 48MHz      CLKSEL |= 0x03;                     // Select output of clock multiplier                                       // as the system clock.}//-----------------------------------------------------------------------------
// Timer2_Init
//-----------------------------------------------------------------------------
//
// This routine initializes Timer 2 to <T2_OVERFLOW_RATE> Hz.
//
void Timer2_Init(void)
{
   TMR2CN  = 0x00;                     // Stop Timer2; Use SYSCLK/12 as timebase
   CKCON  &= ~0x60;                    // Timer2 clock based on T2XCLK;

   // Initialize Reload Value
   TMR2RL = -(SYSCLK/12/T2_OVERFLOW_RATE);
   TMR2 = TMR2RL;

   ET2 = 1;                            // Enable Timer 2 interrupts
   TR2 = 1;                            // Start Timer 2

}//-----------------------------------------------------------------------------// ether_reset_low//-----------------------------------------------------------------------------//// This routine drives the reset pin of the ethernet controller low.//void ether_reset_low(){   P0 &= ~0x40;               // Pull reset low}//-----------------------------------------------------------------------------// ether_reset_high//-----------------------------------------------------------------------------//// This routine places the reset pin in High-Z allowing it to be pulled up // using the external pull-up resistor.//// Additionally, this routine waits for the reset pin to read high before// exiting.//void ether_reset_high (void){   P0 |= 0x40;               // Allow /RST to rise   while(!(P0 & 0x40));      // Wait for /RST to go high}

void DelayMs(unsigned int n)//延時(n)MS
{
	unsigned int i;
	for(;n>0;n--)
	{
		for(i=1200;i>0;i--);
	}
}

void SysClkInit(void)//配置系統時鐘
{
	OSCICN=0x83;
	RSTSRC=0x04;
}

void SystemInit(void)//系統配置
{
	PCA0MD&=~0x40;//禁止看門狗定時器
	//EA=1;
}

void PortInit(void)//端口配置
{
    P0MDIN    = 0xF3;
    P1MDIN    = 0xDF;
    P2MDIN    = 0xF0;
    P0MDOUT   = 0x40;
    P2MDOUT   = 0xF0;
    P0SKIP    = 0x0C;
    P1SKIP    = 0x20;
    XBR0      = 0x01;
    XBR1      = 0x40;
} 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
奇米色777欧美一区二区| 99久久国产综合色|国产精品| 麻豆成人综合网| 成人性色生活片| 欧美一区二区视频免费观看| 欧美激情在线一区二区| 日韩—二三区免费观看av| 成人av午夜电影| 欧美成人三级电影在线| 一区二区三区欧美视频| 激情综合网天天干| 欧美性猛片xxxx免费看久爱| 国产欧美综合在线观看第十页| 天天亚洲美女在线视频| 成人av网站免费观看| 久久久天堂av| 视频一区二区三区在线| 日本久久一区二区| 欧美国产精品专区| 国模大尺度一区二区三区| 欧美另类一区二区三区| 一区二区三区四区高清精品免费观看| 国产精品99久久不卡二区| 欧美一级生活片| 婷婷丁香激情综合| 色素色在线综合| 日韩毛片一二三区| www.色精品| 国产精品国产自产拍在线| 国产一区二区精品久久| 精品国产一二三区| 久久99精品国产.久久久久久 | 一区二区成人在线| 99国产精品久久久久| 国产亚洲综合色| 国产在线精品一区二区夜色| 欧美区在线观看| 免费看欧美美女黄的网站| 制服.丝袜.亚洲.另类.中文| 亚洲国产成人av网| 欧美三级一区二区| 丝袜亚洲另类丝袜在线| 欧美日韩免费高清一区色橹橹| 一区二区高清免费观看影视大全| 色老综合老女人久久久| 一卡二卡欧美日韩| 欧美日免费三级在线| 日韩精品一区第一页| 欧美精品三级日韩久久| 久久er精品视频| 久久精品免视看| www.亚洲色图.com| 亚洲成人av一区| 91精品国产综合久久精品图片| 日韩制服丝袜先锋影音| 欧美大黄免费观看| 成人在线视频首页| 亚洲亚洲精品在线观看| 91麻豆精品国产91久久久| 久久精品国产亚洲aⅴ| 国产婷婷一区二区| 91国产成人在线| 麻豆免费精品视频| 久久精品欧美一区二区三区不卡 | 日本不卡一二三| 久久中文字幕电影| 91麻豆精品视频| 日日夜夜免费精品| 国产婷婷色一区二区三区 | 国产91精品一区二区麻豆网站 | 国产69精品久久99不卡| 亚洲色图在线播放| 欧美一区二区在线观看| 99精品欧美一区二区三区综合在线| 午夜精品久久久久久久久| 精品久久久久久久人人人人传媒| 成人精品高清在线| 琪琪一区二区三区| 中文字幕欧美一| 精品国产一区二区三区四区四| 97精品久久久久中文字幕| 久久99久久99精品免视看婷婷| 中文字幕制服丝袜成人av | 日日噜噜夜夜狠狠视频欧美人| 久久久久9999亚洲精品| 欧美午夜理伦三级在线观看| 国产精品1区2区| 日韩精品一级中文字幕精品视频免费观看 | 在线电影一区二区三区| 丁香六月综合激情| 免费看欧美美女黄的网站| 亚洲人精品午夜| 久久精品一区二区三区不卡牛牛| 91久久精品国产91性色tv| 国产精品一区二区三区乱码| 亚洲成人第一页| 亚洲精品免费电影| 亚洲国产精品激情在线观看| 日韩一区二区电影网| 欧美午夜片在线观看| 91蝌蚪porny| 粉嫩高潮美女一区二区三区 | |精品福利一区二区三区| 久久久综合视频| 欧美电影免费观看高清完整版在线| 91麻豆国产自产在线观看| www.日韩大片| 不卡在线观看av| 国产精品伊人色| 久久99国产乱子伦精品免费| 午夜国产精品一区| 午夜精品久久久久久久99樱桃| 亚洲精品美腿丝袜| 亚洲精品视频在线观看免费| 国产精品黄色在线观看| 中文字幕中文乱码欧美一区二区 | 国产成人综合在线观看| 久草热8精品视频在线观看| 亚洲一区二区中文在线| 一区二区不卡在线播放| 一区二区三国产精华液| 亚洲欧美欧美一区二区三区| 国产精品初高中害羞小美女文| 中文字幕在线不卡| 国产精品第四页| 亚洲少妇30p| 亚洲影院久久精品| 亚洲综合久久久久| 午夜精品福利一区二区三区蜜桃| 亚洲免费视频成人| 午夜视频一区二区| 青青草视频一区| 国产尤物一区二区| 成人综合在线网站| 色综合久久久久综合99| 欧美色男人天堂| 精品国产免费一区二区三区四区 | 国产精品美女久久久久久久网站| 最新久久zyz资源站| 亚洲欧美视频在线观看| 亚洲国产精品一区二区久久恐怖片| 亚洲成av人片| 韩国三级在线一区| 成人激情开心网| 日本道在线观看一区二区| 欧美日韩亚洲高清一区二区| 日韩欧美国产综合| 日本一区二区三区国色天香| 亚洲三级在线免费| 美女视频黄 久久| 国产精品综合一区二区三区| 91婷婷韩国欧美一区二区| 欧美精三区欧美精三区| 久久综合给合久久狠狠狠97色69| 自拍偷拍国产精品| 男女男精品视频| 不卡av在线网| 日韩欧美的一区| 亚洲欧美一区二区三区久本道91| 日本成人在线视频网站| www.欧美色图| 欧美成人艳星乳罩| 一区二区三区不卡视频 | 精品国产欧美一区二区| 亚洲美女少妇撒尿| 狠狠色丁香婷婷综合| 在线免费精品视频| 久久久久久久久免费| 亚洲午夜视频在线观看| 国产一区二区三区久久久| 在线国产电影不卡| 国产欧美精品一区二区色综合朱莉| 亚洲午夜私人影院| 成人永久免费视频| 日韩欧美国产一区二区在线播放| 亚洲女厕所小便bbb| 韩国精品在线观看| 欧美精品少妇一区二区三区| 综合中文字幕亚洲| 韩国成人精品a∨在线观看| 91.com视频| 亚洲愉拍自拍另类高清精品| 成人永久免费视频| 久久久久久亚洲综合| 全部av―极品视觉盛宴亚洲| 日本乱码高清不卡字幕| 亚洲欧洲精品一区二区精品久久久 | 国产毛片精品视频| 91精品国产综合久久精品麻豆| 亚洲精品视频在线看| 99精品偷自拍| 国产精品五月天| 国产成人在线看| 精品91自产拍在线观看一区| 婷婷夜色潮精品综合在线| 欧美日韩免费观看一区二区三区 | 久久久精品日韩欧美| 看片网站欧美日韩| 日韩午夜激情av| 日产国产高清一区二区三区|