User manual
mikroBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
513
SPI_Ethernet_24j600_getIpMask
SPI_Ethernet_24j600_confNetwork
Prototype
sub function SPI_Ethernet_24j600_getIpMask() as word
Description This routine should be used when DHCP server is present on the network to fetch assigned DNS IP address.
Parameters None.
Returns Pointer to the global variable holding DNS IP address.
Requires Ethernet module has to be initialized. See SPI_Ethernet_24j600_Init.
Available for PIC18 family MCUs only.
Example
dim
IpMask as byte[4] ‘ 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
sub procedure SPI_Ethernet_24j600_confNetwork(dim byref ipMask, gwIpAddr,
dnsIpAddr as byte[4])
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
dim
ipMask as byte[4] ‘ network mask (for example : 255.255.255.0)
gwIpAddr as byte[4] ‘ gateway (router) IP address
dnsIpAddr as byte[4] ‘ 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.