Mikroelektronika MIKROE-738 Datenbogen
![Mikroelektronika](https://files.manualsbrain.com/attachments/e0529b3b58069a916ad7bb89f7e9f5f0eda73421/common/fit/150/50/1b07b99aa3112e022a916b06db07f1f4f211e91d41878452d87c7638b1bf/brand_logo.gif)
mikroC PRO for PIC32
MikroElektronika
449
SPI_Ethernet_putConstString
SPI_Ethernet_getByte
SPI_Ethernet_getBytes
Prototype
unsigned int SPI_Ethernet_putConstString(const unsigned char *ptr);
Description This is MAC module routine. It stores whole const string (excluding null termination) into
ENC28J60
RAM starting from current
ENC28J60
write pointer (EWRPT) location.
Parameters -
ptr
: const string to be written into
ENC28J60
RAM.
Returns
Number of bytes written into
ENC28J60
RAM.
Requires
Ethernet module has to be initialized. See SPI_Ethernet_Init.
Example
const char *buffer = “mikroElektronika”;
...
SPI_Ethernet_putConstString(buffer); // put a const string into ENC28J60
buffer
Notes
None.
Prototype
unsigned char SPI_Ethernet_getByte();
Description This is MAC module routine. It fetches a byte from address pointed to by current
ENC28J60
read
pointer (
ERDPT
).
Parameters None.
Returns
Returns
Byte read from
ENC28J60
RAM.
Requires
Ethernet module has to be initialized. See SPI_Ethernet_Init.
Example
char buffer;
...
buffer = SPI_Ethernet_getByte(); // read a byte from ENC28J60 buffer
Notes
None.
Prototype
void SPI_Ethernet_getBytes(unsigned char *ptr, unsigned int addr, unsigned
int n);
Description This is MAC module routine. It fetches equested number of bytes from
ENC28J60
RAM starting from
given address. If value of
0xFFFF
is passed as the address parameter, the reading will start from
current
ENC28J60
read pointer (
ERDPT
) location.
Parameters -
ptr
: buffer for storing bytes read from
ENC28J60
RAM.
-
addr
:
ENC28J60
RAM start address. Valid values:
0..8192
.
-
n
: number of bytes to be read.
Returns
Nothing.
Requires
Ethernet module has to be initialized. See SPI_Ethernet_Init.
Example
char buffer[16];
...
SPI_Ethernet_getBytes(buffer, 0x100, 16); // read 16 bytes, starting from
address 0x100
Notes
None.