mikroC

mikroC - C Compiler for Microchip PIC microcontrollers

making it simple...

Eth_Set_Inport

Prototype

unsigned short Eth_Inport(unsigned short address);

 

 

Returns

One byte from the specified address.

 

 

Description

Retrieves a byte from the specified address of the Ethernet card chip.

 

 

Requires

The card (NIC) must be properly initialized. See Eth_Init.

 

 

Example

udp_length = Eth_Inport(NIC_DATA);

 

 

Eth_Scan_For_Event

Prototype

unsigned Eth_Scan_For_Event(unsigned short *next_ptr);

 

 

Returns

Type of the ethernet packet received. Two types are distinguished: ARP (MAC-IP

 

address data request) and IP (Internet Protocol).

 

 

Description

Retrieves sender’s MAC (hardware) address and type of the packet received. The

 

function argument is an (internal) pointer to the next data packet in RTL8019’s buffer,

 

and is of no particular importance to the end user.

 

 

Requires

The card (NIC) must be properly initialized. See Eth_Init. Also, the function must be

 

called in a proper sequence, i.e. right after the card init, and IP address/UDP port init.

 

 

Example

Eth_Init(&PORTB, &PORTD, &PORTE, 2, 1, 0);

 

Eth_Set_Ip_Address(192u, 168u, 20u, 25u);

 

Eth_Set_Udp_Port(10001);

 

do { // Main block of every Ethernet example

 

event_type = Eth_Scan_For_Event(&next_ptr);

 

if (event_type) {

 

switch (event_type) {case ARP: Arp_Event(); break;

 

case IP : Ip_Event();}

 

Eth_Outport(CR, 0x22);

 

Eth_Outport(BNDRY, next_ptr);

 

}

 

} while (1);

 

 

page

 

176

MikroElektronika: Development tools - Books - Compilers