Industrial Automation Tech Note 56 - TNIA56
Abstract
This technical note explains how to access I/O registers on an IPm using the SIXNET web server add-on software (SXIPM-WEB).
Products
ST-IPM-6350 / VT-MIPM-245-D / VT-MIPM-135-D / VT-IPM2M-213-D / VT-IPM2M-113-D / VT-UIPM-431-H
Introduction
The SIXNET SXIPM-WEB add-on package provides the following capabilities using a “fast CGI” application:
- Read/write access to SIXNET I/O registers on an IPm (direct method)
- Read/write access to SIXNET I/O registers on an IPm (using tags)
- Read access to station name, station number and serial number
- Read access to information about a network interface (ip addr, netmask, broadcast, destaddr, ifname, mtu, hwaddr, if_flags)
Access is provided by a “fast CGI” program. Fast CGI is similar to normal CGI (Common Gateway Interface), but unlike CGI, its requests are persistent. Normally with CGI, when a request is made to the web server, the CGI program is started up, processes the request, and terminates. With fast CGI, the program is started up and waits for a request to come in. After processing the request, the fast CGI program does not terminate. Instead it waits for the next request to come in from the client.
Installation
The SXIPM-WEB add-on package comes with two tar files:
- sxweb.tgz – contains the web server, web server configuration files, and the sxweb.fcgi (fast CGI) program.
- sxweb_samples.tgz – contains sample html files used to demonstrate how to access the I/O registers and other station information.
Each of these packages is installed using the SIXNET I/O Tool Kit configuration utility. You can use the Install Tar File feature of the File Operation window found under the Operation menu. Or you can load these files as part of your configuration load. To do this you must define them in the User Software tab in the configuration for your IPm. Refer to the Tool Kit help for details on either of these methods.
Accessing Information
Information is retrieved from the IPm by sending an URL (Uniform Resource Locator) request with a query string as part of the request. This query string is processed by the web server and a result string is sent back to the web browser. This information can then be displayed in the web browser. See below for details.
Read I/O register
- Query String:
- func=0&type=<xx>&addr=<yy>&numregs=<zz>
- Result String
- <list of comma separated values>
Write I/O register
- Query String
- func=1&type=<xx>&addr=<yy>&numregs=<zz>&values=<comma separated list of values>
- Result String
- None if successful.
Read Tag
- Query String
- func=2&tagname=<tagname>
- Result String
- <list of comma separated values>
Write Tag
- Query String
- func=3&tagname=<tagname>&values=<comma separated list of values>
- Result String
- None if successful.
- Error=<string indicating cause of failure>
Station Information
- Station Name
- Query String
- func=4&station_name
- Result String
- station_name=<station name>
- Station Number
- Query String
- func=4&station_number
- Result String
- station_num=<station number>
- Serial Number
- Query String
- func=4&serial_num
- Result String
- serial_num=<serial number>
Network Interface Information
Returns information about a network interface based on if_index.
- Query String
- func=5&if_index=<if_infdex>
- Result String – contains the following tags separated by an ‘&’.
- if_name=<interface name>
- ipaddr=<ip addrress>
- netmask=<netmask>
- destaddr=<destination address>
- broadcast=<broadcast address>
- mtu=<mtu>
- hwaddr=<hwaddr>
- if_flags=<if_flags>
Sample code
Sample code is provided by the sxweb_samples.tgz file. The following html files are included:
- index.html – main page – contains links to other pages that actually show how to access different information.
- io_registers.html – shows how to access I/O registers directly (type, addr, numregs)
- tags.html – shows how to access I/O registers using tagnames
- station_info.html – shows how to access station name, station number and serial number
- net_info.html – shows how to get information about a network interface based on if_index.
You can untar the files locally to view them, or you can install them with the I/O Tool Kit and use a web browser to try them out.
Resource Links
http://www.fastcgi.com – Information about the fast cgi standard.
http://www.lighttpd.net – Information of the lighttpd web server
Disclaimer
It is the customer's responsibility to review the advice provided herein and its applicability to the system. Red Lion makes no representation about specific knowledge of the customer's system or the specific performance of the system. Red Lion is not responsible for any damage to equipment or connected systems. The use of this document is at your own risk. Red Lion standard product warranty applies.
Red Lion Technical Support
If you have any questions or trouble contact Red Lion Technical Support by clicking here or calling 1-877-432-9908.
For more information: http://www.redlion.net/support/policies-statements/warranty-statement