User manual

mikroPascal PRO for dsPIC30/33 and PIC24
MikroElektronika
492
gwIpAddr : array[4] of byte; // gateway (router) IP address
ipMask : array[4] of byte; // network mask (for example : 255.255.255.0)
dnsIpAddr : array[4] of byte; // DNS server IP address
{************************************************************
* ROM constant strings
*}
const httpHeader : string[30] = ‘HTTP/1.1 200 OK’+#10+’Content-type: ‘; // HTTP
header
const httpMimeTypeHTML : string[11] = ‘text/html’+#10+#10; // HTML MIME type
const httpMimeTypeScript : string[12] = ‘text/plain’+#10+#10; // TEXT MIME type
const httpMethod : string[5] = ‘GET /’;
{*
* web page, splited into 2 parts :
* when coming short of ROM, fragmented data is handled more efciently by linker
*
* this HTML page calls the boards to get its status, and builds itself with
javascript
*}
const indexPage : string[761] =
‘<meta http-equiv=”refresh” content=”3;url=http://192.168.20.60”>’
+
‘<HTML><HEAD></HEAD><BODY>’+
‘<h1>dsPIC + ENC28J60 Mini Web Server</h1>’+
‘<a href=/>Reload</a>’+
‘<script src=/s></script>’+
‘<table><tr><td valign=top><table border=1 style=”font-size:20px
;font-family: terminal ;”>’+
‘<tr><th colspan=2>ADC</th></tr>’+
‘<tr><td>AN0</td><td><script>document.write(AN0)</script></td></
tr>’+
‘<tr><td>AN1</td><td><script>document.write(AN1)</script></td></
tr>’+
‘</table></td><td><table border=1 style=”font-size:20px ;font-family:
terminal ;”>’+
‘<tr><th colspan=2>PORTB</th></tr>’+
‘<script>’+
‘var str,i;’+
‘str=””;’+
‘for(i=2;i<10;i++)’+
‘{str+=”<tr><td bgcolor=pink>BUTTON #”+i+”</td>”;’+
‘if(PORTB&(1<<i)){str+=”<td bgcolor=red>ON”;}’+
‘else {str+=”<td bgcolor=#cccccc>OFF”;}’+
‘str+=”</td></tr>”;}’+
‘document.write(str);’+
‘</script>’;
const indexPage2 : string[466] =
‘</table></td><td>’+
‘<table border=1 style=”font-size:20px ;font-family: terminal ;”>’+
‘<tr><th colspan=3>PORTD</th></tr>’+
<script>’+
‘var str,i;’+