Mikroelektronika MIKROE-738 Datenbogen
![Mikroelektronika](https://files.manualsbrain.com/attachments/e0529b3b58069a916ad7bb89f7e9f5f0eda73421/common/fit/150/50/1b07b99aa3112e022a916b06db07f1f4f211e91d41878452d87c7638b1bf/brand_logo.gif)
mikroC PRO for PIC32
MikroElektronika
447
SPI_Ethernet_doPacket
SPI_Ethernet_putByte
Prototype
unsigned int SPI_Ethernet_doPacket();
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_UserTCP function is called for further processing.
- upon UDP request the SPI_Ethernet_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.
ENC28J60
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_Init.
Example
if (SPI_Ethernet_doPacket() == 0)(1) { // process received packets
...
}
Notes
SPI_Ethernet_doPacket
must be called as often as possible in user’s code.
Prototype
void SPI_Ethernet_putByte(unsigned char v);
Description This is MAC module routine. It stores one byte to address pointed by the current
ENC28J60
write
pointer (
EWRPT
).
Parameters -
v
: value to store
Returns
Nothing.
Requires
Ethernet module has to be initialized. See SPI_Ethernet_Init.
Example
char data_;
...
SPI_Ethernet_putByte(data); // put a byte into ENC28J60 buffer
Notes
None.