remoteControlViaEthernetUseENC28J60
所属分类:单片机开发
开发工具:C/C++
文件大小:136KB
下载次数:119
上传日期:2007-05-28 09:40:20
上 传 者:
proakis
说明: 用AVR单片机实现的一个服务器,值得参考。
(AVR MCU with a server, a good reference.)
文件列表:
以太网远程控制ENC28J60\avr_compat.h (1198, 2006-06-18)
以太网远程控制ENC28J60\enc28j60.c (10454, 2006-10-27)
以太网远程控制ENC28J60\enc28j60.h (9524, 2006-10-23)
以太网远程控制ENC28J60\hardware\enc28j60_ph.sym (5742, 2006-06-20)
以太网远程控制ENC28J60\hardware\eth-remote-device.pdf (14717, 2006-06-26)
以太网远程控制ENC28J60\hardware\eth-remote-device.sch (12832, 2006-06-26)
以太网远程控制ENC28J60\hardware\magjack.sym (4699, 2006-06-22)
以太网远程控制ENC28J60\hardware\magjack08b01x1t03_pcb_element (926, 2006-06-21)
以太网远程控制ENC28J60\hardware\rfc0791.txt (94892, 2006-10-28)
以太网远程控制ENC28J60\hardware\rfc793.txt (172710, 2006-08-05)
以太网远程控制ENC28J60\hardware\WhatIsWhat.txt (411, 2006-11-01)
以太网远程控制ENC28J60\hardware (0, 2007-05-17)
以太网远程控制ENC28J60\ip_arp_udp_tcp.c (16151, 2006-11-27)
以太网远程控制ENC28J60\ip_arp_udp_tcp.h (1374, 2006-11-27)
以太网远程控制ENC28J60\main.c (14131, 2006-11-27)
以太网远程控制ENC28J60\Makefile (3794, 2006-11-09)
以太网远程控制ENC28J60\net.h (2838, 2006-10-27)
以太网远程控制ENC28J60\prg_fusebit_uc_88 (2990, 2006-06-19)
以太网远程控制ENC28J60\prg_load_uc_88 (1018, 2006-06-17)
以太网远程控制ENC28J60\test0.c (1752, 2006-06-18)
以太网远程控制ENC28J60\test1.c (4189, 2006-11-27)
以太网远程控制ENC28J60\test2.c (4139, 2006-11-27)
以太网远程控制ENC28J60\test_readSiliconRev.c (7475, 2006-11-27)
以太网远程控制ENC28J60\timeout.c (836, 2006-06-18)
以太网远程控制ENC28J60\timeout.h (177, 2006-06-17)
以太网远程控制ENC28J60\traffic_tcp.cap (1268, 2006-10-28)
以太网远程控制ENC28J60\traffic_tcp.txt (19664, 2006-10-28)
以太网远程控制ENC28J60\traffic_udp.cap (1961, 2006-06-26)
以太网远程控制ENC28J60\traffic_udp.txt (40840, 2006-06-26)
以太网远程控制ENC28J60\udpcom\unix\Makefile (289, 2006-06-25)
以太网远程控制ENC28J60\udpcom\unix\precompiled\md5sum.txt (104, 2006-07-01)
以太网远程控制ENC28J60\udpcom\unix\precompiled\udpcom_linux (6604, 2006-07-01)
以太网远程控制ENC28J60\udpcom\unix\precompiled\udpcom_MacOSX_10.4_PPC (14264, 2006-06-25)
以太网远程控制ENC28J60\udpcom\unix\precompiled (0, 2007-05-17)
以太网远程控制ENC28J60\udpcom\unix\udpcom.c (4817, 2006-07-01)
以太网远程控制ENC28J60\udpcom\unix (0, 2007-05-17)
以太网远程控制ENC28J60\udpcom\win\Makefile (351, 2006-06-25)
以太网远程控制ENC28J60\udpcom\win\md5sum.txt (49, 2006-06-26)
... ...
# vim:sw=8:ts=8:si:et
This is the software for the tuxgraphics.org
ethernet remote device. See http://tuxgraphics.org/electronics/
Copyright of most software and all diagrams: Guido Socher
Copyright of enc28j60.c/enc28j60.h Pascal Stang (http://www.procyonengineering.com/)
and small modifications by Guido Socher
License for everything: GPL V2
See http://www.gnu.org/licenses/gpl.html
---------------------------------------------------------------------------
All parts needed to build this AVR ethernet solution can be ordered from
http://shop.tuxgraphics.org/
Note that the magnetics need to fit exactly the requirements of the enc28j60
chip. You can not just take any transformer.
!! READ THIS FIRST !!
---------------------
! Edit the file main.c and change the 3 lines:
! static uint8_t mymac[6] = {0x54,0x55,0x58,0x10,0x00,0x24};
! static uint8_t myip[4] = {10,0,0,24};
! static char baseurl[]="http://10.0.0.24/";
For the first device you build you will not need to change the mymac line.
But you will probably need to change the IP address (myip). It must be a
free address from the address range in your home network.
There is a range of private addresses (not routed on the public internet)
which you can use:
Netmask Network Addresses
255.0.0.0 10.0.0.0 - 10.255.255.255
255.255.0.0 172.16.0.0 - 172.31.255.255
255.255.255.0 192.168.0.0 - 192.168.255.255
Example: you wlan router might have 192.168.1.1, your PC might have
192.168.1.2. This means you could e.g use 192.168.1.10 and leave some
room for more PCs. If you use DHCP then make sure that the address it not
double allocated (exclude it from the DHCP range).
To compile the final software and download it to the Atmega88 use the commands:
make
make load
Note: There is no need to change any fuse bytes on the atmega88.
You need at least avrlibc-1.4.x !! The atmega88 will not work with earilier
version.
! Note your programmer might interfer with the enc28j60! For the avrusb500
! with 30cm cable you can normally leave the cable on. For all other programmers
! it is however saver to remove the programmer cable and power down/up the device.
! This is because the SPI interface is used for loading of the software and
! communication to the enc28j60.
To see a list of all possible build targets run the command:
make help
Loading the test software
-------------------------
Test of the atmega88:
make test0
make load_test0
This will case a LED on PB1 to blink with 1Hz
---------------
Edit the file test1.c and change the lines (see description above):
static uint8_t mymac[6] = {0x54,0x55,0x58,0x10,0x00,0x24};
static uint8_t myip[4] = {10,0,0,24};
make test1
make load_test1
The program will perform a LED test for the LEDs on the magjack.
The LEDs will go on and off after startup and then the green LED
should stray on indicating that the link is up. When you ping the circuit
it will answer. The yellow LED should blink when the a packet arrives.
The red LED on PB1 should go on/off with every ping packet.
---------------
Edit the file test1.c and change the lines (see description above):
static uint8_t mymac[6] = {0x54,0x55,0x58,0x10,0x00,0x24};
static uint8_t myip[4] = {10,0,0,24};
make test2
make load_test2
The green LED on the magjack should go on indicating that the link is up.
When you ping the circuit it will answer. The yellow LED should blink when
the a packet arrives.
You can use the program udpcom and send the string test to the device. It will
answer with "hello". Exmaple:
./udpcom/unix/udpcom test 10.0.0.24
II: data: test, ip: 10.0.0.24 port: 1200
OK: 10.0.0.24: hello
A simple web server example
---------------------------
The test_readSiliconRev.c reads the enc28j60 silicon revision
and displays it. You can use it as a base for a simple application
where you want to just read data (e.g thermometer)
make
make load_readSiliconRev
Read via udp:
udpcom ver 10.0.0.25
will answer:
II: data: ver, ip: 10.0.0.25 port: 1200
OK: 10.0.0.25: ver=4
Read via webbrowser:
http://10.0.0.24
will display a webpage with:
ENC28J60 silicon rev is: 4
Using the eth_rem_dev_tcp with UDP
------------------------------
The only supported useful function in this release is to switch on or
of the transistor connected to PD7.
The command to switch on is: t=1
The command to switch off is: t=0
Query the status: t=?
The udpcom syntax is: udpcom password,X=Y IP-addr
Here is an example:
./udpcom/unix/udpcom secret,t=0 10.0.0.24
II: data: secret,t=0, ip: 10.0.0.24 port: 1200
OK: 10.0.0.24: t=0
./udpcom/unix/udpcom secret,t=1 10.0.0.24
II: data: secret,t=1, ip: 10.0.0.24 port: 1200
OK: 10.0.0.24: t=1
./udpcom/unix/udpcom secret,t=? 10.0.0.24
II: data: secret,t=?, ip: 10.0.0.24 port: 1200
OK: 10.0.0.24: t=1
./udpcom/unix/udpcom secret,t=0 10.0.0.24
II: data: secret,t=0, ip: 10.0.0.24 port: 1200
OK: 10.0.0.24: t=0
./udpcom/unix/udpcom secret,t=? 10.0.0.24
II: data: secret,t=?, ip: 10.0.0.24 port: 1200
OK: 10.0.0.24: t=0
Using the eth_rem_dev_tcp with TCP/HTTP
-----------------------------------
Point your web browser to
http://10.0.0.24 (or what ever IP address you have given your hardware)
You should get as answer a web page with:
Usage: http://10.0.0.24/password
Point your web browser to
http://10.0.0.24/secret
(secret is the default password)
You should get a web page like this:
Output is: off
Switch on
________________________________
eth_rem_dev_tcp, tuxgraphics.org
Messages form a Network analyser
--------------------------------
traffic_XXX.txt and traffic_XXX.cap are
decoded and binary messages of the communication with the
eth_rem_dev_tcp. This will help you to understand the code.
Revision history
----------------
2006-09-01: version 2.0 -- ported code from the eth_rem_dev (the udp only version)
to this version which implements now a web server
2006-10-31: version 2.1 -- first public version
2006-11-01: version 2.2 -- Editorial changes and better sequence number
handling.
2006-11-26: version 2.3 -- Add webserver functionallity to the
test_readSiliconRev.c example program.
Make the web server port configurable.
近期下载者:
相关文件:
收藏者: