Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
Spi_Ethernet_Enable
383
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6
Description
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). 
Requires
The appropriate hardware SPI module must be previously initialized.
Example
const Spi_Ethernet_HALFDUPLEX = 0;
const Spi_Ethernet_FULLDUPLEX = 1;
var
myMacAddr : 
array[6] of byte; // my MAC address
myIpAddr  : 
array[4] of byte; // 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]  := 1;
myIpAddr[3]  := 60;
Spi_Init();
Spi_Ethernet_Init(PORTC, 0, PORTC, 1, myMacAddr, myIpAddr,
Spi_Ethernet_FULLDUPLEX);
Prototype
procedure Spi_Ethernet_Enable(enFlt: byte);
Returns
Nothing. 
Description
This is MAC module routine. This routine enables appropriate network traffic on the
ENC28J60
module by the means of it's receive filters (unicast, multicast, broadcast,
crc). Specific type of network traffic will be enabled if a corresponding bit of this rou-
tine's input parameter is set. Therefore, more than one type of network traffic can be
enabled at the same time. For this purpose, predefined library constants (see the
table below) can be ORed to form appropriate input value.