mikroC

making it simple...

Eth_Init

mikroC - C Compiler for Microchip PIC microcontrollers

Prototype

void Eth_Init(char *addrP, char *dataP, char *ctrlP,

 

char pinReset, char pinIOW, char pinIOR);

 

 

Description

Performs initialization of Ethernet card and library. This includes:

 

- Setting of control and data ports;

 

- Initialization of the Ethernet card (also called the Network Interface Card, or NIC);

 

- Retrieval and local storage of the NIC’s hardware (MAC) address;

 

- Putting the NIC into the LISTEN mode.

 

Parameter addrP is a pointer to address port, which handles the addressing lines.

 

Parameter dataP is pointer to data port. Parameter ctrlP is the control port. Parameter

 

pinReset is the reset/enable pin for the ethernet card chip (on control port). Parameter

 

pinIOW is the I/O Write request control pin. Parameter pinIOR is the I/O read request

 

control pin.

 

 

Requires

As specified for the entire library (please see top of this page).

 

 

Example

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

 

 

Eth_Set_Ip_Address

Prototype

void Eth_Set_Ip_Address(char ip1, char ip2, char ip3, char ip4);

Description Sets the IP address of the connected and initialized Ethernet network card. The arguments are the IP address numbers, in IPv4 format (e.g. 127.0.0.1).

Requires This function should be called immediately after the NIC initialization (see Eth_Init). You can change your IP address at any time, anywhere in the code.

Example

// Set IP address 192.168.20.25

 

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

 

 

page

 

MikroElektronika: Development tools - Books - Compilers

175