User manual
mikroPascal PRO for dsPIC30/33 and PIC24
MikroElektronika
512
SPI_Ethernet_24j600_getIpMask
SPI_Ethernet_24j600_confNetwork
Prototype
function SPI_Ethernet_24j600_getIpMask() : word;
Description This routine should be used when DHCP server is present on the network to fetch assigned IP subnet mask.
Parameters None.
Returns Pointer to the global variable holding IP subnet mask.
Requires Ethernet module has to be initialized. See SPI_Ethernet_24j600_Init.
Example
var
IpMask : array[4] of byte; // user IP subnet mask buffer
...
memcpy(IpMask, SPI_Ethernet_24j600_getIpMask(), 4); // fetch IP subnet mask
Notes User should always copy the IP address from the RAM location returned by this routine into it’s own IP
subnet mask buffer. These locations should not be altered by the user in any case!
Prototype
procedure SPI_Ethernet_24j600_confNetwork(var ipMask, gwIpAddr, dnsIpAddr
: array[4] of byte);
Description Congures network parameters (IP subnet mask, gateway IP address, DNS IP address) when DHCP
is not used.
Parameters - ipMask: IP subnet mask.
- gwIpAddr gateway IP address.
- dnsIpAddr: DNS IP address.
Returns Nothing.
Requires Ethernet module has to be initialized. See SPI_Ethernet_24j600_Init.
Example
var
ipMask : array[4] of byte; // network mask (for example :
255.255.255.0)
gwIpAddr : array[4] of byte; // gateway (router) IP address
dnsIpAddr : array[4] of byte; // DNS server IP address
...
gwIpAddr[0] := 192;
gwIpAddr[1] := 168;
gwIpAddr[2] := 20;
gwIpAddr[3] := 6;
dnsIpAddr[0] := 192;
dnsIpAddr[1] := 168;
dnsIpAddr[2] := 20;
dnsIpAddr[3] := 100;
ipMask[0] := 255;
ipMask[1] := 255;
ipMask[2] := 255;
ipMask[3] := 0;
...
SPI_Ethernet_24j600_confNetwork(ipMask, gwIpAddr, dnsIpAddr); // set
network conguration parameters
Notes The above mentioned network parameters should be set by this routine only if DHCP module is not
used. Otherwise DHCP will override these settings.