Mikroelektronika MIKROE-442 데이터 시트
mikroBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
507
SPI_Ethernet_24j600_doPacket
SPI_Ethernet_24j600_putByte
Prototype
sub function SPI_Ethernet_24j600_doPacket() as byte
Description This is MAC module routine. It processes next received packet if such exists. Packets are processed
in the following manner:
- ARP & ICMP requests are replied automatically.
- upon TCP request the SPI_Ethernet_24j600_UserTCP function is called for further processing.
- upon UDP request the SPI_Ethernet_24j600_UserUDP function is called for further processing.
Parameters None.
Returns
Returns
-
0
- upon successful packet processing (zero packets received or received packet processed
successfully).
-
1
- upon reception error or receive buffer corruption.
ENC24J600
controller needs to be restarted.
-
2
- received packet was not sent to us (not our IP, nor IP broadcast address).
-
3
- received IP packet was not IPv4.
-
4
- received packet was of type unknown to the library.
Requires
Ethernet module has to be initialized. See SPI_Ethernet_24j600_Init.
Example
while TRUE
...
SPI_Ethernet_24j600_doPacket() ‘ process received packets
...
wend
Notes
SPI_Ethernet_24j600_doPacket
must be called as often as possible in user’s code.
Prototype
sub procedure SPI_Ethernet_24j600_putByte(dim v as byte)
Description This is MAC module routine. It stores one byte to address pointed by the current
ENC24J600
write
pointer (
EWRPT
).
Parameters -
v
: value to store
Returns
Nothing.
Requires
Ethernet module has to be initialized. See SPI_Ethernet_24j600_Init.
Example
dim data as byte
...
SPI_Ethernet_24j600_putByte(data) ‘ put an byte into ENC24J600 buffer
Notes
None.