Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
Spi_Ethernet_getBytes
Spi_Ethernet_UserTCP
390
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6
Prototype
procedure Spi_Ethernet_getBytes(ptr : ^byte; addr : word; n :
byte);
Returns
Nothing.
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. 
Requires
Ethernet module has to be initialized. See Spi_Ethernet_Init.
Example
var 
buffer : 
array[16] of byte;
...
Spi_Ethernet_getBytes(buffer, 0x100, 16); // read 16 bytes,
starting from address 0x100
Prototype
function Spi_Ethernet_UserTCP(remoteHost : ^byte; remotePort :
word; localPort : word; reqLength : word) : word;
Returns
0
- there should not be a reply to the request. 
- Length of TCP/HTTP reply data field - otherwise. 
Description
This is TCP module routine. It is internally called by the library. The user accesses to
the TCP/HTTP request by using some of the Spi_Ethernet_get routines. The user
puts data in the transmit buffer by using some of the Spi_Ethernet_put routines. The
function must return the length in bytes of the TCP/HTTP reply, or 0 if there is nothing
to transmit. If there is no need to reply to the TCP/HTTP requests, just define 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/HTTP request data field length. 
Note: The function source code is provided with appropriate example projects.
The code should be adjusted by the user to achieve desired reply.