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>>

Terminology Overview

Accessing the Internet and the World Wide Web ("the Web" for short) can quickly lead to a proliferation of protocol names and acronyms. This section reviews some relevant terminology.

Ethernet, LANs, and IP Addresses

The Ethernet protocol defines a packet-based computer networking technology for Local Area Networks (LANs) that is broadly supported by desktop PCs and a variety of computer-based instruments. The Ethernet standard defines wiring and signaling for the physical layer, and frame formats and protocols. The wired version of Ethernet used by the EtherSmart Wildcard is known as IEEE 802.3.

A LAN is a group of interconnected computers with a "gateway" computer that serves as a "router" to direct traffic on the LAN and between the LAN and other networks.  Each computer on the LAN must have a unique 32-bit "IP address" (Internet Protocol address).  An IP address is typically written as 4 decimal numbers (each between 0 and 255) separated by periods.  For example, the following is a valid IP address:

10.0.1.22

The IP addresses 0.0.0.0 and 255.255.255.255 are reserved and should never be assigned to a device on a LAN.  The EtherSmart Wildcard can be assigned an IP address by calling some configuration functions as explained in a later section, or it can get its IP address automatically via "DHCP" (Dynamic Host Configuration Protocol) running on the gateway computer. 

 

You must know your EtherSmart’s IP address or its equivalent name before you can connect to it

EtherSmart system configuration and IP address assignment are discussed in more detail in the section titled “Assigning an IP Address to the EtherSmart Wildcard”.

 

The assigned IP address can be associated with a computer name (so you don’t have to type numbers in your browser’s address bar if you don’t want to).  The name can be assigned by asking your LAN system administrator to make an entry in the DNS (Domain Name Service) configuration file.  Alternatively, you can create a local name on your PC by editing the hosts file. On a Windows XP machine, this file is found at:

C:\Windows\system32\drivers\etc\hosts

The "gateway" is the router computer on the LAN.  The gateway routes to a subset of IP addresses specified by the zeros in the LAN’s "netmask".  The number of "subnet bits" is equal to the number of bits specified as zeros in the LAN’s netmask.  For example, setting the number of subnet bits to 8 is equivalent to specifying a "netmask" of 255.255.255.0, meaning that a maximum of 255 IP addresses can be represented on the LAN; this is a "type C" LAN.  Specifying 16 subnet bits is equivalent to a netmask of 255.255.0.0, corresponding to a "type B" LAN.  Specifying 24 subnet bits is equivalent to a netmask of 255.0.0.0, corresponding to a "type A" LAN.

The IP addresses on the LAN are typically accessible only to other computers on the same LAN.  The gateway or router is the only computer on the LAN that is accessible to one or more networks in "the outside world". The gateway typically has one IP address for use on the LAN, and a different one that allow it to be accessed by other networks.  Sometimes the external IP address of the gateway changes from session to session; this is how most "DSL" network connections function.  To be able to connect to the EtherSmart or other computers on a specified LAN from an arbitrary computer on the Internet, you must know the externally available IP address of the LAN’s gateway or router device.  Talk to your system administrator about how to accomplish this if you need to access the EtherSmart from computers that are not part of the EtherSmart’s Local Area Network.

TCP and Serial Tunneling

The format of the communications among the computers on the LAN is defined by various "protocols".  The fundamental point-to-point connection protocol is called "TCP/IP" (Transmission Control Protocol/Internet Protocol).  TCP is a connection-based protocol that ensures that no data is lost as long as the connection remains open.  If for some reason a packet sent by one computer does not arrive at the communicating partner, the TCP protocol re-transmits the packet until it is received intact.

When one host (computer, instrument, etc.) wants to communicate with a remote host via TCP, it requests a connection by sending a "SYN" (synchronization) packet to the remote’s IP address.  The remote accepts the connection by responding with a [SYN, ACK] acknowledge packet directed to the IP address of the requester, and the requester completes the process with an ACK acknowledge packet to establish the connection.  This handshaking is performed by the XPort firmware and requires no intervention on the part of the programmer or the application.  The application program simply uses a high level function such as Ether_Connect to open a connection as described in a later section, and then calls other high level functions to send and receive data.

For experts who want to view the raw TCP/IP packet exchange on the LAN, download the Ethereal network analyzer software that is available at www.ethereal.com.  This free PC software can be very useful when debugging Ethernet network application software.

"Serial tunneling" is a common name for the exchange of serial data between two computers, typically using the TCP/IP protocol.  In network terminology, a "tunnel" is a path that passes data without the sender and receiver having to know or care about the details of the transfer mechanism.  "Serial tunneling" was originally coined as a term to describe a method for allowing instruments and computers that were designed to communicate via RS-232 to now communicate via TCP/IP.  Its meaning has broadened to encompass a variety of serial data exchanges between instruments via Ethernet.

Outgoing Email

The SMTP (Simple Mail Transfer Protocol) email protocol builds on a TCP/IP connection. The EtherSmart Wildcard can send outgoing email using SMTP. A single high level function named Ether_Send_Email handles all of the details for you.  You pass to the function the gateway IP address on your LAN, and strings that specify the sender email address, recipient email address, and the email body.  The EtherSmart driver software and the mail server running on the gateway computer cooperate to process the email. Sending email is explained in detail in a later section.

HTTP Web Service

World wide web traffic uses "HTTP" (HyperText Transfer Protocol) which builds on a TCP/IP connection.  Web pages that are served out using HTTP are typically formatted using the "HTML" (HyperText Markup Language) format.  Many good books and online references describe HTTP and HTML.  Most web pages are "static", meaning that their content does not change with each visit to the page.  However, in the context of embedded computers, "dynamic" web pages that provide up-to-date status information about the computer’s state (inputs, outputs, memory contents, etc.) are very useful.  The pre-coded driver functions enable you to serve both static and dynamic web pages. 

By coding web content into your application, you can enable remote monitoring and control of your instrument from your web-connected PC.  The "embedded web server" that runs when you execute the EtherSmart library code responds to information requests from your browser.  You can create a set of web pages, each with a specified name, or "URL" (Uniform Resource Locator) and an associated "handler function" that serves out the static or dynamic web content. 

A URL is a web page address as sent by the browser running on your desktop PC to the embedded web server.  For the purposes of this document, the URL is the portion of the web address that is in the browser’s address bar after the IP address or computer name.  For example, if you have assigned IP address 10.0.1.22 to the EtherSmart Wildcard, and you type into your browser’s address bar:

10.0.1.22/index.html

then the URL as defined in this document is

/index.html

Each URL starts with a / character, and is case sensitive.  Some URL’s include a "query field" that starts with the ? character and contains fieldname and value fields resulting from "forms" that are filled out by the user in the browser window.  The software driver functions make it easy to extract data from these fields to direct the operation of the handler functions.  In fact, form data from the browser provides an excellent way for the web interface to give commands to the embedded computer (to take data samples, extract data from memory and report the results to the browser, etc.)

Web-Based Remote Front Panel

The web interface can be used to implement a "remote front panel" on instruments that contain a Graphical User Interface (GUI) and touchscreen such as the QVGA Controller or PDQScreen.  This feature allows a pixel-by-pixel replica of the GUI screen to be presented in the browser window on a remote PC, and mouse clicks to mimic the action of touches on the instrument’s touchscreen.  A set of functions in this driver and a complementary set of functions in the GUI toolkit coordinate this capability. This feature is described in a later section.

Function Naming Conventions

Functions that provide basic Ethernet functionality, including initialization, configuration, serial tunneling (point to point Ethernet communications), and email start with the Ether_ prefix. 

Functions that implement world-wide-web functionality start with the HTTP_ prefix.  The HTTP protocol underlies the web data exchanges.

Functions that implement the web "remote front panel" feature for GUI-based instruments start with the HTTP_GUI prefix.

<< 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