这是一个用stm32实现玉成控制家用太阳能或者是工业太阳能的远程控制器,使用了AD转换、看门狗、flash的读写,TCP/IP协议等。
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2012-04-10 19:49 智能热水工程控制系统(校验版)
文件 9648 2012-04-05 22:09 智能热水工程控制系统(校验版)ENC28J60.C
文件 9354 2012-04-05 22:09 智能热水工程控制系统(校验版)ENC28J60.H
目录 0 2012-04-10 19:46 智能热水工程控制系统(校验版)FATFS
文件 8252 2012-04-05 22:09 智能热水工程控制系统(校验版)FATFS 0readme.txt
文件 25104 2012-04-05 22:09 智能热水工程控制系统(校验版)FATFSSPI_SD_driver.c
文件 2408 2012-04-05 22:09 智能热水工程控制系统(校验版)FATFSSPI_SD_driver.h
文件 6235 2012-04-05 22:09 智能热水工程控制系统(校验版)FATFSdiskio.c
文件 1864 2012-04-05 22:09 智能热水工程控制系统(校验版)FATFSdiskio.h
文件 67089 2012-04-05 22:09 智能热水工程控制系统(校验版)FATFSff.c
文件 11811 2012-04-05 22:09 智能热水工程控制系统(校验版)FATFSff.h
文件 911 2012-04-05 22:09 智能热水工程控制系统(校验版)FATFSinteger.h
文件 58520 2012-04-05 22:09 智能热水工程控制系统(校验版)FATFS ff.c
文件 10614 2012-04-05 22:09 智能热水工程控制系统(校验版)FATFS ff.h
文件 659780 2012-04-05 22:09 智能热水工程控制系统(校验版)FS_CM3.lib
文件 12950 2012-04-05 22:09 智能热水工程控制系统(校验版)File_Config.h
文件 319488 2012-04-05 22:09 智能热水工程控制系统(校验版)Flex.ocx
文件 677 2012-04-05 22:09 智能热水工程控制系统(校验版)JD.pic
文件 497 2012-04-10 19:48 智能热水工程控制系统(校验版)Jlink Regs CM3.txt
文件 327741 2012-04-10 19:49 智能热水工程控制系统(校验版)JlinkLog.txt
文件 285 2012-04-05 22:09 智能热水工程控制系统(校验版)JlinkSettings.ini
目录 0 2012-04-10 19:46 智能热水工程控制系统(校验版)List
文件 256903 2012-04-10 19:48 智能热水工程控制系统(校验版)ListDLP.map
文件 91188 2012-04-05 22:09 智能热水工程控制系统(校验版)ListSTM3210E-EVAL.map
文件 26137 2012-04-10 19:48 智能热水工程控制系统(校验版)Listcortexm3_macro.lst
文件 36908 2012-04-10 19:48 智能热水工程控制系统(校验版)Liststm32f10x_vector.lst
文件 1081616 2012-04-05 22:09 智能热水工程控制系统(校验版)MSCOMCTL.OCX
文件 162816 2012-04-05 22:09 智能热水工程控制系统(校验版)MSCOMM32.OCX
文件 1388544 2012-04-05 22:09 智能热水工程控制系统(校验版)MSVBVM60.DLL
文件 108336 2012-04-05 22:09 智能热水工程控制系统(校验版)MSWINSCK.OCX
文件 49152 2012-04-05 22:09 智能热水工程控制系统(校验版)NCset.exe
............此处省略223个文件信息
#include “include.h“
#define pgm_read_byte(ptr) ((char)*(ptr))
static unsigned short wwwport = 80;
static unsigned char macaddr[6];
static unsigned char ipaddr[4];
static unsigned int info_hdr_len = 0;
static unsigned int info_data_len = 0;
static unsigned char seqnum = 0xa; // my initial tcp sequence number
// The Ip checksum is calculated over the ip header only starting
// with the header length field and a total length of 20 bytes
// unitl ip.dst
// You must set the IP checksum field to zero before you start
// the calculation.
// len for ip is 20.
//
// For UDP/TCP we do not make up the required pseudo header. Instead we
// use the ip.src and ip.dst fields of the real packet:
// The udp checksum calculation starts with the ip.src field
// Ip.src=4bytesIp.dst=4 bytesUdp header=8bytes + data length=16+len
// In other words the len here is 8 + length over which you actually
// want to calculate the checksum.
// You must set the checksum field to zero before you start
// the calculation.
// len for udp is: 8 + 8 + data length
// len for tcp is: 4+4 + 20 + option len + data length
//
// For more information on how this algorithm works see:
// http://www.netfor2.com/checksum.html
// http://www.msc.uky.edu/ken/cs471/notes/chap3.htm
// The RFC has also a C code example: http://www.faqs.org/rfcs/rfc1071.html
unsigned int checksum(unsigned char* buf unsigned int len unsigned char type)
{
// type 0=ip
// 1=udp
// 2=tcp
unsigned long sum = 0;
//if(type==0){
// // do not add anything
//}
if (type == 1)
{
sum += IP_PROTO_UDP_V; // protocol udp
// the length here is the length of udp (data+header len)
// =length given to this function - (IP.scr+IP.dst length)
sum += len - 8; // = real tcp len
}
if (type == 2)
{
sum += IP_PROTO_TCP_V;
// the length here is the length of tcp (data+header len)
// =length given to this function - (IP.scr+IP.dst length)
sum += len - 8; // = real tcp len
}
// build the sum of 16bit words
while (len > 1)
{
sum += 0xFFFF & (*buf << 8 | *(buf + 1));
buf += 2;
len -= 2;
}
// if there is a byte left then add it (padded with zero)
if (len)
{
sum += (0xFF & *buf) << 8;
}
// now calculate the sum over the bytes in the sum
// until the result is only 16bit long
while (sum >> 16)
{
sum = (sum & 0xFFFF) + (sum >> 16);
}
// build 1‘s complement:
return((unsigned int) sum ^ 0xFFFF);
}
// you must call this function once before you use any of the other functions:
void init_ip_arp_udp_tcp(unsigned char* mymac unsigned char* myip unsigned short wwwp)
{
unsigned char i = 0;
wwwport = wwwp;
while (i < 4)
{
ipaddr[i] = myip[i];
i++;
}
i = 0;
while (i < 6)
{
macaddr[i] = mymac[i];
i++;
}
}
void set_tcp_port(
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2012-04-10 19:49 智能热水工程控制系统(校验版)
文件 9648 2012-04-05 22:09 智能热水工程控制系统(校验版)ENC28J60.C
文件 9354 2012-04-05 22:09 智能热水工程控制系统(校验版)ENC28J60.H
目录 0 2012-04-10 19:46 智能热水工程控制系统(校验版)FATFS
文件 8252 2012-04-05 22:09 智能热水工程控制系统(校验版)FATFS 0readme.txt
文件 25104 2012-04-05 22:09 智能热水工程控制系统(校验版)FATFSSPI_SD_driver.c
文件 2408 2012-04-05 22:09 智能热水工程控制系统(校验版)FATFSSPI_SD_driver.h
文件 6235 2012-04-05 22:09 智能热水工程控制系统(校验版)FATFSdiskio.c
文件 1864 2012-04-05 22:09 智能热水工程控制系统(校验版)FATFSdiskio.h
文件 67089 2012-04-05 22:09 智能热水工程控制系统(校验版)FATFSff.c
文件 11811 2012-04-05 22:09 智能热水工程控制系统(校验版)FATFSff.h
文件 911 2012-04-05 22:09 智能热水工程控制系统(校验版)FATFSinteger.h
文件 58520 2012-04-05 22:09 智能热水工程控制系统(校验版)FATFS ff.c
文件 10614 2012-04-05 22:09 智能热水工程控制系统(校验版)FATFS ff.h
文件 659780 2012-04-05 22:09 智能热水工程控制系统(校验版)FS_CM3.lib
文件 12950 2012-04-05 22:09 智能热水工程控制系统(校验版)File_Config.h
文件 319488 2012-04-05 22:09 智能热水工程控制系统(校验版)Flex.ocx
文件 677 2012-04-05 22:09 智能热水工程控制系统(校验版)JD.pic
文件 497 2012-04-10 19:48 智能热水工程控制系统(校验版)Jli
文件 327741 2012-04-10 19:49 智能热水工程控制系统(校验版)Jli
文件 285 2012-04-05 22:09 智能热水工程控制系统(校验版)Jli
目录 0 2012-04-10 19:46 智能热水工程控制系统(校验版)List
文件 256903 2012-04-10 19:48 智能热水工程控制系统(校验版)ListDLP.map
文件 91188 2012-04-05 22:09 智能热水工程控制系统(校验版)ListSTM3210E-EVAL.map
文件 26137 2012-04-10 19:48 智能热水工程控制系统(校验版)Listcortexm3_macro.lst
文件 36908 2012-04-10 19:48 智能热水工程控制系统(校验版)Liststm32f10x_vector.lst
文件 1081616 2012-04-05 22:09 智能热水工程控制系统(校验版)MSCOMCTL.OCX
文件 162816 2012-04-05 22:09 智能热水工程控制系统(校验版)MSCOMM32.OCX
文件 1388544 2012-04-05 22:09 智能热水工程控制系统(校验版)MSVBVM60.DLL
文件 108336 2012-04-05 22:09 智能热水工程控制系统(校验版)MSWINSCK.OCX
文件 49152 2012-04-05 22:09 智能热水工程控制系统(校验版)NCset.exe
............此处省略223个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)