Datasheet

// duplex config flags
#define Spi_Ethernet_HALFDUPLEX 0x00 // half duplex
#define Spi_Ethernet_FULLDUPLEX 0x01 // full duplex
// mE ehternet NIC pinout
sfr sbit SPI_Ethernet_Rst at PORTB.B4;
sfr sbit SPI_Ethernet_CS at PORTB.B5;
sfr sbit SPI_Ethernet_Rst_Direction at DDRB.B4;
sfr sbit SPI_Ethernet_CS_Direction at DDRB.B5;
// end ethernet NIC definitions
/************************************************************
* ROM constant strings
*/
const code unsigned char httpHeader[] = "HTTP/1.1 200 OKnContent-
type: " ; // HTTP header
const code unsigned char httpMimeTypeHTML[] = "text/htmlnn" ;
// HTML MIME type
const code unsigned char httpMimeTypeScript[] = "text/plainnn" ;
// TEXT MIME type
unsigned char httpMethod[] = "GET /";
/*
* web page, splited into 2 parts :
* when coming short of ROM, fragmented data is handled more effi-
ciently by linker
*
* this HTML page calls the boards to get its status, and builds
itself with javascript
*/
const code char *indexPage = // Change the IP
address of the page to be refreshed
"<meta http-equiv="refresh" content="3;url=http://192.168.20.60">
<HTML><HEAD></HEAD><BODY>
<h1>AVR + ENC28J60 Mini Web Server</h1>
<a href=/>Reload</a>
<script src=/s></script>
<table><tr><td><table border=1 style="font-size:20px ;font-family:
terminal ;">
<tr><th colspan=2>PINC</th></tr>
<script>
var str,i;
str="";
for(i=0;i<8;i++)
{str+="<tr><td bgcolor=pink>BUTTON #"+i+"</td>";
if(PINC&(1<<i)){str+="<td bgcolor=red>ON";}
else {str+="<td bgcolor=#cccccc>OFF";}
str+="</td></tr>";}
document.write(str) ;
</script>
" ;
445
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroC PRO for AVR
CHAPTER 6