Installing and Running the Example Programs
For example application programs that exercise the capabilities of the EtherSmart Wildcard, see the demonstration ("demo") program listings that are provided in both C and Forth. See installing the Ethernet-WiFi device drivers for a discussion of how to load the resources and the kernel extension library files onto the controller board before loading your custom application program. Briefly, you’ll need a version of the pre-compiled driver code which includes an install file containing the code in S-record format, and *.c and *.h (C code and header) files.
You’ll also need the "resource files" created by the "Image Converter" program that is part of the CD you get from Mosaic when you buy your starter kit. The Image/Resource converter creates an image_data.txt
download file and an image_headers.h
(for C) and image_headers.4th
(for Forth) header file that encode any images and/or HTML pages you define if you are implementing a web server. After sending the driver’s install file and the image_data.txt
file to the controller, you’ll send the program. C programs are compiled by clicking the "make" icon in the Mosaic IDE and sending the resulting file to the controller. Forth programs are compiled by simply sending the source file to the controller using the QED Terminal program. Note that the demo program references the driver library files using #include
statements near the top of the file listing.
The next page presents code examples that are excerpted from the C version of the demo program. We recommend that you look at the code listing to familiarize yourself with the demo program. Because function names and parameter lists are the same in both the C and Forth versions of the code, interested Forth programmers can look up the relevant excerpts by locating the referenced function name.
Recall that most of the functions expect the Wildcard address called the "module number" or simply "modulenum" in their input parameter lists. Make sure that the jumper settings on the Wildcard hardware match the modulenum parameter that is specified in your application program. In the demo program, the constant E_MODULENUM
is declared to hold the modulenum. Its default value is 4 in the provided code. If your EtherSmart or WiFi Wildcard is not installed as module number 4, you must change the value of this constant to equal the hardware modulenum as specified in the "Selecting the Wildcard Address" section above.
See installing the Ethernet-WiFi device drivers for a discussion of how to load the resources and the kernel extension library files onto the controller board before loading your custom application program.
Once you’ve loaded the demo program onto your controller board and typed Ether_Web_Demo
or WiFi_Web_Demo
to start the program, you can learn the EtherSmart or WiFi Wildcard’s IP address by typing at the QED Terminal:
Ether_IP_Report( )
(Forth users would type the Ether_IP_Report
command without any parentheses).
This reports the IP address of the Lantronix XPort or WiPort ethernet device servers on the Wildcard. Assuming that the reported IP address is non-zero, you can then type the reported IP address into the web address bar of your web browser1) to see the demonstration web page. If the reported IP address is 0.0.0.0, then there is no DHCP service running on your LAN to assign an IP address. See the section below titled "Assigning an IP Address to the EtherSmart or WiFi Wildcard".
The next page explains all the features of the demo program; it provides a starting point for web-enabling your instrumentation application.
See also → Using Example Application