User manual
424
mikoPascal PRO for PIC32
MikroElektronika
bitMask := 1 shl bitMask; // create bit mask
LATD := PORTD xor bitMask; // toggle PORTD with xor operator
end;
end;
if(result = 0) then // what do to by default
begin
result := SPI_Ethernet_putConstString(@httpHeader); // HTTP header
result := result + SPI_Ethernet_putConstString(@httpMimeTypeHTML); // with HTML
MIME type
result := result + SPI_Ethernet_putConstString(@indexPage); // HTML page
rst part
result := result + SPI_Ethernet_putConstString(@indexPage2); // HTML page
second part
end;
// return to the library with the number of bytes to transmit
end;
{*
* this function is called by the library
* the user accesses to the UDP 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 UDP reply, or 0 if nothing to
transmit
*
* if you don’t need to reply to UDP requests,
* just dene this function with a return(0) as single statement
*
*}
function SPI_Ethernet_UserUDP(var remoteHost : array[4] of byte;
remotePort, destPort, reqLength : word; var ags:
TEthPktFlags) : word;
var tmp : string[5];
begin
result := 0;
// reply is made of the remote host IP address in human readable format
byteToStr(remoteHost[0], dyna); // rst IP address byte
dyna[3] := ‘.’;
byteToStr(remoteHost[1], tmp); // second
dyna[4] := tmp[0];
dyna[5] := tmp[1];
dyna[6] := tmp[2];
dyna[7] := ‘.’;
byteToStr(remoteHost[2], tmp); // second
dyna[8] := tmp[0];
dyna[9] := tmp[1];
dyna[10] := tmp[2];
dyna[11] := ‘.’;
byteToStr(remoteHost[3], tmp); // second
dyna[12] := tmp[0];
dyna[13] := tmp[1];
dyna[14] := tmp[2];
dyna[15] := ‘:’; // add separator