User manual

Table Of Contents
444
mikoC 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 dened before using this function.
The SPI module needs to be initialized. See the SPIx_Init and SPIx_Init_Advanced routines.
Example
#dene SPI_Ethernet_HALFDUPLEX 0
#dene SPI_Ethernet_FULLDUPLEX 1
// mE ethernet NIC pinout
sfr sbit SPI_Ethernet_Rst at RF0_bit;
sfr sbit SPI_Ethernet_CS at RF1_bit;
sfr sbit SPI_Ethernet_Rst_Direction at TRISF0_bit;
sfr sbit SPI_Ethernet_CS_Direction at TRISF1_bit;
// end ethernet NIC denitions
unsigned char myMacAddr[6] = {0x00, 0x14, 0xA5, 0x76, 0x19, 0x3f}; // my MAC
address
unsigned char myIpAddr = {192, 168, 1, 60 }; // my IP addr
SPI1_Init();
SPI_Ethernet_Init(myMacAddr, myIpAddr, SPI_Ethernet_FULLDUPLEX);
Notes None.