User manual

432
mikoBasic PRO for PIC32
MikroElektronika
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;”+
“str=”+chr(34)+chr(34)+”; “+
“for(i=0;i<8;i++)”+
“{str+=”+chr(34)+”<tr><td bgcolor=yellow>LED #”+chr(34)+”+i+”+chr(34)+”</
td>”+chr(34)+”; “+
“if(PORTD&(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><td><a href=/t”+chr(34)+”+i+”+chr(34)+”>Toggl
e</a></td></tr>”+chr(34)+”;}”+
“document.write(str) ;”+
“</script>”+
“</table></td></tr></table>”+
“This is HTTP request #<script>document.write(REQ)</script></
BODY></HTML>”
dim getRequest as byte[15] ‘ HTTP request buffer
dyna as char[30] ‘ buffer for dynamic response
httpCounter as word ‘ counter of HTTP requests
txt as string[11]
‘ *******************************************
‘ * user dened functions
‘ *
‘ *
‘ * this function is called by the library
* the user accesses to the HTTP request by successive calls to Spi_Ethernet_
getByte()
* the user puts data in the transmit buffer by successive calls to Spi_Ethernet_
putByte()
‘ * the function must return the length in bytes of the HTTP reply, or 0 if nothing to
transmit
‘ *
‘ * if you don’t need to reply to HTTP requests,
‘ * just dene this function with a return(0) as single statement
‘ *
‘ *
sub function Spi_Ethernet_UserTCP(dim byref remoteHost as byte[4],
dim remotePort, localPort, reqLength as word, dim byref
ags as TEthPktFlags) as word
dim i as word ‘ my reply length
bitMask as byte ‘ for bit mask
txt as string[11]
result = 0