User manual

430
mikoBasic PRO for PIC32
MikroElektronika
SPI_Ethernet_renewDHCP
Prototype
sub function SPI_Ethernet_renewDHCP(dim tmax as byte) as byte
Description This is DHCP module routine. It sends IP address lease time renewal request to DHCP server.
Parameters - tmax: time in seconds to wait for an reply.
Returns - 1 - upon success (lease time was renewed).
- 0 - otherwise (renewal request timed out).
Requires Ethernet module has to be initialized. See SPI_Ethernet_Init.
Example
while true
...
if(SPI_Ethernet_doDHCPLeaseTime() <> 0) then
SPI_Ethernet_renewDHCP(5) ‘ it’s time to renew the IP address lease,
with 5 secs for a reply
end if
...
wend
Notes None.
Library Example
This code shows how to use the Ethernet mini library:
- the board will reply to ARP & ICMP echo requests
- the board will reply to UDP requests on any port:
- returns the request in upper char with a header made of remote host IP & port number
- the board will reply to HTTP requests on port 80, GET method with pathnames :
- / will return the HTML main page
- /s will return board status as text string
- /t0 ... /t7 will toggle RD0 to RD7 bit and return HTML main page
- all other requests return also HTML main page.
Copy Code To Clipboard
program HTTP_Demo
‘ ***********************************
‘ * RAM variables
‘ *
‘ mE ehternet NIC pinout
dim
SPI_Ethernet_Rst as sbit at LATF0_bit
SPI_Ethernet_CS as sbit at LATF1_bit