User manual
510
mikoBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
SPI_Ethernet_24j600_getBytes
SPI_Ethernet_24j600_UserTCP
Prototype
sub procedure SPI_Ethernet_24j600_getBytes(dim ptr as ^byte, dim addr as
word, dim n as word)
Description This is MAC module routine. It fetches equested number of bytes from ENC24J600 RAM starting from
given address. If value of 0xFFFF is passed as the address parameter, the reading will start from
current ENC24J600 read pointer (ERDPT) location.
Parameters - ptr: buffer for storing bytes read from ENC24J600 RAM.
- addr: ENC24J600 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_24j600_Init.
Example
dim
buffer as byte[16]
...
SPI_Ethernet_24j600_getBytes(buffer, 0x100, 16) ‘ read 16 bytes, starting
from address 0x100
Notes None.
Prototype
sub function SPI_Ethernet_24j600_UserTCP(dim byref remoteHost as byte[4],
dim remotePort as word, dim localPort as word, dim reqLength as word, dim
byref ags as TEthJ600PktFlags) as word
Description This is TCP module routine. It is internally called by the library. The user accesses to the TCP request
by using some of the SPI_Ethernet_24j600_get routines. The user puts data in the transmit buffer by
using some of the SPI_Ethernet_24j600_put routines. The function must return the length in bytes of
the TCP reply, or 0 if there is nothing to transmit. If there is no need to reply to the TCP requests, just
dene this function with return(0) as a single statement.
Parameters - remoteHost: client’s IP address.
- remotePort: client’s TCP port.
- localPort: port to which the request is sent.
- reqLength: TCP request data eld length.
- ags: structure consisted of two bit elds :
Copy Code To Clipboard
structure TEthj600PktFlags
dim canCloseTCP as boolean ‘ ag which closes socket
dim isBroadcast as boolean ‘ ag which denotes that the IP package has
been received via subnet broadcast address
end structure
Returns - 0 - there should not be a reply to the request.
- Length of TCP reply data eld - otherwise.
Requires Ethernet module has to be initialized. See SPI_Ethernet_24j600_Init.
Example This function is internally called by the library and should not be called by the user’s code.
Notes The function source code is provided with appropriate example projects. The code should be adjusted
by the user to achieve desired reply.