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