manufacturer of I/O-rich SBCs, operator interfaces, handheld instruments, and development tools for embedded control low cost single board computers, embedded controllers, and operator interfaces for scientific instruments & industrial control development tools for embedded control order our low cost I/O-rich embedded control products embedded controller manufacturer profile single board computers & embedded controllers development tools & starter kits for your embedded design operator interfaces with touchscreens and graphical user interface plug-in expansion modules for digital & analog I/O C language & Forth language integrated development tools, IDE single board and embedded computer accessories embedded controller enclosures, bezels, environmental gaskets

The EtherSmart Wildcard User Guide

Table of Contents

Introduction

Internet Protocol Support

Summary of EtherSmart Capabilities

Hardware

Connecting To the Wildcard Bus

Selecting the Wildcard Address

Terminology Overview

Browser Notes

The EtherSmart Software Driver Routines

EtherSmart Driver Data Structures

The Demo Program

EtherSmart Initialization, Configuration and Diagnostics

Initialization Functions

Configuring the XPort Device

Assigning an IP Address

Reporting Routines

Using "Ping" for Diagnostics

Initializing Multiple EtherSmart Wildcards

Code Downloads and Interactive Communications via Ethernet

Serial Tunneling

A Serial Tunneling Example

Serial Tunneling Buffer Management Functions

Serial Tunneling Data Transmission and Reception Functions

Serial Tunneling Connection Functions

Serial Tunneling Inter-Task Service Management Functions

Sending Email

Introduction to the Dynamic Webserver

Using the Dynamic Webserver

HTTP Buffer Management

HTTP Header Generation

HTTP Data Transfer Functions

Web Form Processing

An Example of a Dynamic Web Page with a Remote Image Reference

Serving Out a Stand-Alone Image

Implementing a "Remote Front Panel" Using the Webserver

Appendix A: Installing the Software

Generating the EtherSmart Kernel Extension Library

Creating Web Page and Image Resources with the Image Converter

Loading the Software onto the Controller

Using the EtherSmart Driver with C

Using the Driver Code with Forth

Appendix B: C Demo Program

Appendix C: C Remote Front Panel Demo Program

Appendix D: Forth Demo Program

Appendix E: Forth Remote Front Panel Demo Program

Appendix F: Browser Configuration

Using Opera Is Highly Recommended

Reconfiguring the Internet Explorer Browser

Firefox and Mozilla

Appendix G: Hardware Schematic (pdf)

<< Previous | Next>>

Code Downloads and Interactive Communications via Ethernet

The EtherSmart Wildcard can be configured to replace the serial port on the controller, enabling code downloads and interactive development to be performed via Ethernet instead of via RS-232.† This is called "revectored serial via Ethernet" and is conceptually very simple: the three fundamental serial primitives Key, AskKey, and Emit are "revectored" so that they use the Ethernet port instead of the serial port on the controller.†

The simplest approach to revectoring is to store the correct modulenum of the Wildcard into the global variable named ether_revector_module, and then to call Ether_Serial_Revector to revector the serial primitives.† This runs the default (startup) task through the specified EtherSmart Wildcard with no additional data structures needed.† In other words, once this action is performed, you no longer communicate with the controllerís operating system monitor via the standard RS-232 terminal; all communications must take place via an Ethernet connection using an Ethernet terminal such as Putty.

For information about how to download and use the Putty terminal, see the section above titled "Using the Free Putty Ethernet Terminal for Testing and Development".† Briefly, after a simple Google search for "Putty", download the small executable, and double click its icon to start it. Simply type the EtherSmart Wildcardís IP address (such as 10.0.1.22) and port 80 into the boxes in the Putty configuration screen, select the "Rlogin" mode, and click the "Open" button to establish the connection.† C programmers may notice a 1-line response from the Mosaic controller in the form:

 

XTERM/38400SSP ?

This message can be safely ignored; it results from an unrecognized login message from the Rlogin protocol that passes through the XPort to the operating system.

Ether_Serial_Revector revectors the serial primitives of the current task (that is, the task that invokes this routine) to use the EtherSmart Wildcard that is specified by the contents of the ether_revector_module variable.† Make sure to explicitly store a value to the ether_revector_module variable before invoking Ether_Serial_Revector, as the variable is not initialized by default. Ether_Serial_Revector stores the xcfa (32-bit execution address) of E_Emit into the user variable UEMIT, stores the xcfa of E_Ask_Key into UASK_KEY (U?KEY in Forth), and stores the xcfa of E_ASCII_Key into UKEY.

After invoking Ether_Serial_Revector, use the Putty "Rlogin" mode to connect to the local port (typically port 80) at the specified local IP address, and youíre talking to the QED monitor via Ethernet. To revert to standard serial operation via QED Term, type COLD in the Putty terminal window to revert to standard serial, then from QEDTerm type RESTORE to bring back access to all compiled routines, and continue communications using QEDTerm.

If you want to maintain serial communications via QEDTerm with the default task while running a separate task with I/O revectored via the EtherSmart Wildcard, then build and activate a task using Ether_Monitor as the activation routine. Use Putty "Rlogin" mode to connect to the local port (typically = 80) at the specified local IP address, and youíre talking to the task via Ethernet while simultaneously maintaining serial communications with the primary task.† An example of this approach is presented in Listing 1‑5 excerpted from the Demo program. The interactively callable Ether_Monitor_Demo routine from the demonstration program sets the ether_revector_module variable, and builds and activates a task to run the Ether_Monitor function. Ether_Monitor is an infinite task loop that calls Ether_Serial_Revector and then invokes the QED-Forth monitor routine named QUIT.† Executing this routine, or using it as the activation function for a task causes serial I/O for the affected task to be revectored to the EtherSmart Wildcard whose modulenum is stored in the ether_revector_module global variable.

Listing 15†††† Demo Program Code To Implement Revectored Serial via Ethernet.

// ***************** REVECTORED SERIAL VIA ETHERNET ************

 

TASK ether_montask;† // 1 Kbyte per task area

 

_Q void Ether_Monitor_Demo( int modulenum )

// builds and activates a monitor task for the specified module.

// this function expects the modulenum as an input parameter so that

// you can run 2 installed Ethersmart wildcards at once:

// one wildcard can run the standard services (web, email, tunneling)

// while the other one (running Ether_Monitor_Demo) is used to download code

// and control program development and debugging.

// To do this, first call main (which runs services on the E_MODULENUM wildcard),

// then call this Ether_Monitor_Demo function with a different modulenum.

{† ether_revector_module = modulenum;† // set to specify which moduleís revectored

†† SERIAL_ACCESS = RELEASE_ALWAYS; // allow sharing of serial ports

†// NEXT_TASK = TASKBASE;// empties task loop; comment out if other tasks are allowed

†† BUILD_C_TASK(0, 0, &ether_montask );

†† ACTIVATE(Ether_Monitor, &ether_montask );

}

<< Previous | Next>>


Home|Site Map|Products|Manuals|Resources|Order|About Us
Copyright (c) 2006 Mosaic Industries, Inc.
Your source for single board computers, embedded controllers, and operator interfaces for instruments and automation