资源预览内容
第1页 / 共20页
第2页 / 共20页
第3页 / 共20页
第4页 / 共20页
第5页 / 共20页
第6页 / 共20页
第7页 / 共20页
第8页 / 共20页
第9页 / 共20页
第10页 / 共20页
亲,该文档总共20页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
v1.0可编辑可修改#Ether net Shield on Arduino - a webserver exampleProject n ote Ardui no Ether net Shield1. SchematicThe Arduino Ethernet Shield is dedicatedfor the Arduino boards. It uses the Microchip sENC28J60 SPI based stand-alone Ethernet controller (download datasheet here ) and a compatibleRJ45 socket with magnetics. Since the ENC28J60 is a 3V3 device that only drive 3V3 logic level output but capable of accepting 5V logic input, a 5V CMOS/TTL quad positive AND gates 74HCT08D is used to convert the logic level output to 5V logic level.IP列tpa;1453J,x;s:Tickft7fi7KJ3J3U3D124ADOIgAD!adj3JAD 3_6Q5Fig 1. Arduino Ethernet Shield schematic2. Software StructureThe Ethernet Shield software is in the format of Arduino library, which you can download fromhere. The library is implemented based on s open-source TCP/IP stack for Atmega88 and ENC28J60. The main files in the library are- a wrapper cpp file, as an Arduino library interface with tuxgraphic s codesimplified TCP/IP stack implementationENC28J60 SPI routinesnetwork protocol definitions3. TCP/IP implementationThe standard TCP is a protocl to establish a connection. To do this, a number of packets needsto be exchaged between two sides first to establish the connection; then data packets can be exchaged. Usually a complicated state-machine is needed to implement the TCP protocol.For Auduino s ATMEGA168a 8-bit AVRmicrocontroller with 1K SRAM,it is impossible to implement the full TCP stack. Also the webpage for 8-bit microcontroller that normally is used to control a relay or read a temperature sensor etc., is very simple. Therefore, instead of implementingfull TCP protocl, a single data packet TCPprotocol is used. You webpage contents, including all html tags, must be in one packet. The length of packet is limited by the SRAM size, currently half of the RAM space (500 bytes) is used for network Packet buffer. It is sufficient for simple webpages as shown below.4. Ethersheild library installation & modificationFirst download the ethershield libraryhere , then copy & unzip the library in your Arduino IDElibrary directory (for example arduino-0010/hardware/libraries/).There are three examples in the ethershield library, you might need to change the ip address in the example sketch (.pde) files. The ip address must be a free address with your network rangestatic uint8_t mymac6 = 0x54,0x55,0x58,0x10,0x00,0x24;static uin t8_t myip4 = 192,168,1,15;static char baseurl=;Also you might like to change the webpage contents in the print_webpage funtion. Note that the webpage contents are stored in the PROGMEM (using PSTR declaration) to save the precious SRAM space.5. ExamplesThree examples are included in the ethershield librarya PING exampleEep lyfrom192 .168丄15:Replyon192,16丄15:Beplyf PDA192.168丄丄15:Beplyf ron1921阴15:bytes =32 bytes-32 bytes =32 bytes =32Peplyf i*on192.168.1.15:bytes =32t ime =1 m?TTL=64Replyf ron192.68.1,15:bytes-32tlme1 msTTL-&4eplyf for192.ite-l-lS:hytes =32t lme =1iiisTTL=64Peplyf 1*011192-168.1,15:hytes =S2t Ime =1 msTTL=64!Ping iis t ics for 192-168.1.15:Packsi- - Sent - 4r Rece ived -4 ji Lot=毎 ping 192.168-1.15inging 1?2.t68,1.15 with 32 hyte of dta:t ine =lm IT L*6 4t irae =lin IT L=6 4t ime =1 rs T T Lt=6 4t i(ne=lms IT L =& 4Ping stat 1st ics oy- 192 _ 168 _ t. 15 :Packets: Sent = 4” Rec&iued =雯.Lost = 0 C&x Ioss,fipproxinate round trip tines in mi Hi-seconds:Min imum Iris, Haxinun Ims Auei*Ae 1 msa gen eral webserver examplev1.0可编辑可修改#a webserver with temperature sen sor (DS18B20) readi ngs New Webserver example, switch on/off LED#i nclude mac and ip have to be uniqueYou can not have the same nu mbers inif(buf,ple n)(buf);return;3a2fLinks & DownloadsArduino Ethernet Shield schematicArduino ethershield library - new version with web client funtions & examplesMicrochip ENC28J60 datasheetTags: Arduino , ethernet , network , ping , project , web serverv1.0可编辑可修改#This entry was posted on Monday, August 25th, 2008 at 5:45 pm and is filed underArduino projects . You can followan
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号