User manual
416
mikoBasic PRO for PIC32
MikroElektronika
Parameters - mac: RAM buffer containing valid MAC address.
- ip: RAM buffer containing valid IP address.
- fullDuplex: ethernet duplex mode switch. Valid values: 0 (half duplex mode) and 1 (full duplex
mode).
Returns Nothing.
Requires Global variables:
- SPI_Ethernet_CS: Chip Select line
- SPI_Ethernet_CS_Direction: Direction of the Chip Select pin
- SPI_Ethernet_RST: Reset line
- SPI_Ethernet_RST_Direction: Direction of the Reset pin
must be dened before using this function.
The SPI module needs to be initialized. See the SPIx_Init and SPIx_Init_Advanced routines.
Example
‘ mE ehternet NIC pinout
dim SPI_Ethernet_RST as sbit at LATF0_bit
dim SPI_Ethernet_CS as sbit at LATF1_bit
dim SPI_Ethernet_RST_Direction as sbit at TRISF0_bit
dim SPI_Ethernet_CS_Direction as sbit at TRISF1_bit
‘ end mE ehternet NIC pinout
const SPI_Ethernet_HALFDUPLEX = 0
const SPI_Ethernet_FULLDUPLEX = 1
myMacAddr as byte[6] ‘ my MAC address
myIpAddr as byte[4] ‘ my IP addr
...
myMacAddr[0] = 0x00
myMacAddr[1] = 0x14
myMacAddr[2] = 0xA5
myMacAddr[3] = 0x76
myMacAddr[4] = 0x19
myMacAddr[5] = 0x3F
myIpAddr[0] = 192
myIpAddr[1] = 168
myIpAddr[2] = 20
myIpAddr[3] = 60
SPI1_Init()
SPI_Ethernet_Init(myMacAddr, myIpAddr, SPI_Ethernet_FULLDUPLEX)
Notes None.