AN2700 Freescale Semiconductor / Motorola, AN2700 Datasheet - Page 23

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
examplee.c
examplee.c contains main() for the user application. In main() , the MC9S12NE64 MCU and its integrated
Ethernet controller are configured and enabled. main() also initializes the CMX-MicroNet TCP/IP stack
then waits and serves a web page on request.
Note that mn_init() must be called before using any other CMX-MicroNet function. Refer to CMX-MicroNet
TCP/IP Stack API for more information about the CMX-MicroNet API functions used in the provided code.
examplee.c Source Code:
/*********************************************************
Copyright (c) CMX Systems, Inc. 2003. All rights reserved
*********************************************************/
#include "micronet.h"
/* put #includes for web pages here */
#include "index.h"
#include "cmxlogo.h"
#include "bot.h"
#include "head.h"
#include "main1.h"
#include "side.h"
#include "ta7rssmall.h"
#include "analogcl.h"
#include "javacl.h"
/* Local functions */
void set_demo_var_func(PSOCKET_INFO socket_ptr) cmx_reentrant;
word16 get_demo_var_func(byte **) cmx_reentrant;
#define MSG_BUFF_SIZE
byte msg_buff[MSG_BUFF_SIZE];
/* Global variable to be set by web page. */
#pragma DATA_SEG DEMO_MEM
int demo_var;
#pragma DATA_SEG DEFAULT
int main(void)
{
Freescale Semiconductor
/* call mn_init before using any other MicroNet API functions */
if (mn_init() < 0)
/* Add web pages to virtual file system.
*/
mn_vf_set_entry((byte *)"index.htm", INDEX_SIZE, index_htm,VF_PTYPE_STATIC);
mn_vf_set_entry((byte *)"head.htm", HEAD_SIZE, head_htm,VF_PTYPE_STATIC);
mn_vf_set_entry((byte *)"side.htm", SIDE_SIZE, side_htm,VF_PTYPE_STATIC);
mn_vf_set_entry((byte *)"main1.htm", MAIN1_SIZE, main1_htm,VF_PTYPE_STATIC);
mn_vf_set_entry((byte *)"bot.htm", BOT_SIZE, bot_htm,VF_PTYPE_STATIC);
mn_vf_set_entry((byte *)"cmxlogo.gif", CMXLOGO_SIZE, cmxlogo_gif,VF_PTYPE_STATIC);
mn_vf_set_entry((byte *)"ta7rsSmall.jpg", TA7RSSMALL_SIZE, ta7rssmall_jpg,VF_PTYPE_STATIC);
EXIT(1);
The main page MUST be called index.htm or index.html.
Basic Web Server with MC9S12NE64 and CMX-MicroNet TCP/IP Stack, Rev. 0.3
17
Overview of a Web Server Developed Using CMX-MicroNet TCP/IP Stack
23

Related parts for AN2700