User manual

mikroBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
479
SPI_Ethernet_Enable
Prototype
sub procedure SPI_Ethernet_Enable(dim enFlt as byte)
Description This is MAC module routine. This routine enables appropriate network trafc on the ENC28J60 module
by the means of it’s receive lters (unicast, multicast, broadcast, crc). Specic type of network trafc
will be enabled if a corresponding bit of this routine’s input parameter is set. Therefore, more than one
type of network trafc can be enabled at the same time. For this purpose, predened library constants
(see the table below) can be ORed to form appropriate input value.
Advanced ltering available in the ENC28J60 module such as Pattern Match, Magic Packet
and Hash Table can not be enabled by this routine. Additionally, all lters, except CRC, enabled with
this routine will work in OR mode, which means that packet will be received if any of the enabled lters
accepts it.
This routine will change receive lter conguration on-the-y. It will not, in any way, mess with enabling/
disabling receive/transmit logic or any other part of the ENC28J60 module. The ENC28J60 module
should be properly cogured by the means of SPI_Ethernet_Init routine.
Parameters - enFlt: network trafc/receive lter ags. Each bit corresponds to the appropriate network trafc/
receive lter:
Returns Nothing.
Requires Ethernet module has to be initialized. See SPI_Ethernet_Init.
Example
SPI_Ethernet_Enable(_SPI_Ethernet_CRC or _SPI_Ethernet_UNICAST) enable
CRC checking and Unicast trafc
Notes Advanced ltering available in the ENC28J60 module such as Pattern Match, Magic Packet
and Hash Table can not be enabled by this routine. Additionaly, all lters, except CRC, enabled with
this routine will work in OR mode, which means that packet will be received if any of the enabled lters
accepts it.
This routine will change receive lter conguration on-the-y. It will not, in any way, mess with enabling/
disabling receive/transmit logic or any other part of the ENC28J60 module. The ENC28J60 module
should be properly cogured by the means of SPI_Ethernet_Init routine.
Bit Mask Description Predened library const
0
0x01
MAC Broadcast trafc/receive lter ag. When set, MAC
broadcast trafc will be enabled.
_SPI_Ethernet_BROADCAST
1
0x02
MAC Multicast trafc/receive lter ag. When set, MAC
multicast trafc will be enabled.
_SPI_Ethernet_MULTICAST
2
0x04
not used
none
3
0x08
not used
none
4
0x10
not used
none
5
0x20
CRC check ag. When set, packets with invalid CRC eld
will be discarded.
_SPI_Ethernet_CRC
6
0x40
not used
none
7
0x80
MAC Unicast trafc/receive lter ag. When set, MAC
unicast trafc will be enabled.
_SPI_Ethernet_UNICAST