你的浏览器版本过低,可能导致网站不能正常访问!为了你能正常使用网站功能,请使用这些浏览器。
LWIPç§»æ¤è¯´æææ¡£.pdf
2012-6-25 10:55 上传
点击文件名下载附件
251.19 KB, 下载次数: 102
ææç½ç»åè®®çå ³ç³»ï¼.pdf
2012-7-30 00:54 上传
815.09 KB, 下载次数: 90
RE:【ST学习小组】STM32以太网
LWIPç§»æ¤è¯´æææ¡£.pdf
2012-6-25 10:55 上传
点击文件名下载附件
251.19 KB, 下载次数: 102
RE:【ST学习小组】STM32以太网
回复:【ST学习小组】STM32以太网
回复:【ST学习小组】STM32以太网
我参加,正在做这方面工作,我还有几块DEMO板可无偿提供,
您做什么项目?大家一起探讨下!
回复:【ST学习小组】STM32以太网
我参加,正在做这方面工作,我还有几块DEMO板可无偿提供,
做什么项目,大家一起探讨下
回复:【ST学习小组】STM32以太网
我参加,正在做这方面工作,我还有几块DEMO板可无偿提供,
做什么项目?大家研究下,你卖DEMO的吗?
回复:【ST学习小组】STM32以太网
我参加,正在做这方面工作,我还有几块DEMO板可无偿提供,
做什么项目呢?大家一起探讨下,什么样的DEMO?我搞了好久的STM32也没一个DEMO.您老人家一下就搞几个,卖DEMO啊?
回复:【ST学习小组】STM32以太网
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
#include "lwip/pbuf.h"
#include "lwip/tcp.h"
#include "lwip/memp.h"
#include
#include
#include "lwipopts.h"
#include "crc16.h"
/* Private typedef -----------------------------------------------------------*/
#define TCP_PORT 1000
static struct tcp_pcb *TcpPCB;
uint8_t Eth_Buffer[20];
uint8_t Eth_Counter = 0;
extern uint8_t server_err;
extern uint8_t LocalDisplay[82];
extern uint8_t HostID;
/* Private function prototypes -----------------------------------------------*/
void LwIP_Init(void);
static err_t tcp_client_accept(void *arg, struct tcp_pcb *pcb, err_t err);
static err_t tcp_client_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err);
/* Private functions ---------------------------------------------------------*/
/**
* @brief Initialize the client application.
* @param None
* @retval None
*/
void tcp_client_init(void)
{
struct tcp_pcb *tpcb;
struct ip_addr ipaddr;
IP4_ADDR(&ipaddr, 192, 168, 1, 125); //远程主机
/* Create a new TCP control block */
tpcb = tcp_new();
/* Assign to the new pcb a local IP address and a port number */
tcp_bind(tpcb, IP_ADDR_ANY, TCP_PORT);
/* Connect to the server: send the SYN */
tcp_connect(tpcb, &ipaddr, TCP_PORT, tcp_client_accept);
}
static err_t tcp_client_accept(void *arg, struct tcp_pcb *tpcb, err_t err)
{
/* Specify the function that should be called when the TCP connection receives data */
tcp_recv(tpcb, tcp_client_recv);
TcpPCB = tpcb;
return ERR_OK;
}
static err_t tcp_client_recv(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err)
{
uint8_t Data_len = 0;
uint8_t Success = 0;
uint8_t CRC_L = 0,CRC_H = 0;
uint16_t CRC_Temp = 0;
/************* 接收数据 ************/
Data_len = p->len;
memcpy(Eth_Buffer, p->payload, Data_len);
if((Eth_Buffer[0] == HostID) | (Eth_Buffer[0] == 0)) /*干扰*/
{
CRC_Temp = CRC16(Eth_Buffer,6);
CRC_L = CRC_Temp;
CRC_H = CRC_Temp>>8;
if(Eth_Buffer[6] == CRC_L && Eth_Buffer[7] == CRC_H)
{
Success = 1;
}
else
{
Success = 0;
}
}
else
{
Success = 0;
}
/*************回复数据*************/
if(Success)
{
tcp_write(tpcb,&LocalDisplay,sizeof(LocalDisplay),1);
}
else
{
}
/* Free the p buffer */
pbuf_free(p);
return ERR_OK;
}
void tcp_check(void)
{
char hello[] = "OK?\n";
if(tcp_write(TcpPCB,&hello,sizeof(hello),1) == ERR_CONN)
{server_err = 1;}
else
{server_err = 0;}
/* send the data right now */
//tcp_output(TcpPCB);
}
RE:【ST学习小组】STM32以太网
RE:【ST学习小组】STM32以太网
RE:【ST学习小组】STM32以太网
RE:【ST学习小组】STM32以太网
回复:【ST学习小组】STM32以太网
ææç½ç»åè®®çå ³ç³»ï¼.pdf
2012-7-30 00:54 上传
点击文件名下载附件
815.09 KB, 下载次数: 90
回复:【ST学习小组】STM32以太网
回复:【ST学习小组】STM32以太网