AN2700 Freescale Semiconductor / Motorola, AN2700 Datasheet - Page 25

no-image

AN2700

Manufacturer Part Number
AN2700
Description
Basic Web Server Development with MC9S12NE64 and CMX-MicroNet TCP/IP Stack
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
callback.c
An excerpt of the source code for callback.c is provided. This section of callback.c is important because
it includes the MAC hardware and IP address settings. This file must be configured correctly. Review
Configuring the MAC Hardware and IP Addresses for details. The list below provides a simplified
description of the code provided.
The SMTP server IP address can also be set up in callback.c if the CMX-MicroNet SMTP client is used.
SMTP is used for sending email on the Internet. For this example, SMTP is not used.
Excerpt from callback.c:
#if Ethernet
byte ip_dest_addr[IP_ADDR_LEN] = {192,168,2,2};
#if (PING_GLEANING)
byte ip_src_addr[IP_ADDR_LEN] = {0,0,0,0};
#else
byte ip_src_addr[IP_ADDR_LEN] = {192,168,2,3}; // static IP address of embedded device
#endif
#else
byte ip_dest_addr[IP_ADDR_LEN] = {192,6,94,5};
#if (PING_GLEANING)
byte ip_src_addr[IP_ADDR_LEN] = {0,0,0,0};
#else
byte ip_src_addr[IP_ADDR_LEN] = {192,6,94,2};
#endif
#endif
#if (SMTP)
/* replace the ip address below with the ip address of your SMTP server */
byte ip_smtp_addr[IP_ADDR_LEN] = {216,148,227,71};
#endif
#if Ethernet
/************************************************************
*************************************************************/
byte eth_src_hw_addr[ETH_ADDR_LEN] = {0x00,0x00,0x12,0x34,0x56,0x78};
/************************************************************
Freescale Semiconductor
if using a chip with EEPROM you may need to write a routine
to take the value of the hw_addr in EEPROM and put it into
the array below on startup, otherwise replace eth_src_hw_addr
below with the proper Ethernet hardware address.
ip_dest_addr[IP_ADDR_LEN] — If HTTP or FTP is not being used, an IP address for a destination
node must be provided. If HTTP or FTP is used, this variable can be ignored. HTTP and FTP are
configured in mnconfig.h.
ip_src_addr[IP_ADDR_LEN] — Embedded device IP address. If DHCP is configured and used,
this variable can be ignored. DHCP is configured in mnconfig.h .
byte eth_src_hw_addr[ETH_ADDR_LEN] — This MAC hardware address for the embedded
device should be a unique 48-bit number as specified by IEEE.
byte eth_dest_hw_addr[ETH_ADDR_LEN] — If ARP is not being used, a MAC hardware address
for a destination node must be provided in this variable.
/* PING_GLEANING */
/* PING_GLEANING */
/* Ethernet */
/* (SMTP) */
Basic Web Server with MC9S12NE64 and CMX-MicroNet TCP/IP Stack, Rev. 0.3
Overview of a Web Server Developed Using CMX-MicroNet TCP/IP Stack
25

Related parts for AN2700