Dynamic Web Pages
[HTTP Server]

Introduction

The HTTP Server can dynamically alter pages and substitute real-time information, such as input/output status. The web server will parse CGI files for special tags, and replace them with user defined string. Only "*.cgi" files are parsed for these special tags.

To incorporate this real-time information, the corresponding CGI file (*.cgi) must contain a text string with the format: "%nxx". Where the '%' character serves as a control code, 'n' represents the variable group and "xx" represents a two-digit variable value ( in uper case hex format).
The variable value has a range of 00-FF (Which translates to 0-255 decimal), and must use upper case characters!
The variable group ('n' character) can be any alpha numeric character ('0-9', 'a-z', 'A-Z'), giving a total of 10+26+26 = 62 groups. Each group can have 256 variable values. This gives a total of 15872 possible variables.

When the HTTP Server encounters this text string, it removes the '%' character and calls the HTTPGetVar() function. This function has been implemented by the Modtronix SBC65EC Web Server in the "httpexec.c" file! All tags implemented by the Modtronix SBC65EC Web Server are listed below.

The HTTPGetVar() function will define strings that will replace tags found in the "*.cgi" file. If the page requires '%' as a display character, it should be preceded by another '%' character. For example, to display "23%" in a page, put "23%%".

Defined Tags

The following list of tags are implemented by the Modtronix SBC65EC Web Server in the "httpexec.c" file. This file can be modified by the user to add aditional tags:


PIC Ports

The variable groups a to j can be used to display the value of any input pin or port on the PIC. The lower 3 bits of the 8 bit variable value is used to specify the desired bit of the given port (port is given by variable group). The upper 5 bits are used to specify how the ports value should be displayed. The following variable groups are defined:
Variable GroupDescription
aPIC Port A
bPIC Port B
cPIC Port C
dPIC Port D
ePIC Port E
fPIC Port F
gPIC Port G
hReserved for furture use
jReserved for furture use

The following variable values(in hex) are defined:
Variable ValueString returned by HTTP Server - displayed on web page
00 - 07'1' or '0' returned depending on PORT state
10 - 17"on" or "off" returned depending on PORT state
20 - 27"<!--" returned if port is configured as input
28 - 2f"-->" returned if port is configured as input
30 - 37"<!--" returned if port is configured as output
38 - 3f"-->" returned if port is configured as output
40 - 47"checked" returned if port is configured as output
48 - 4f"checked" returned if port is configured as input
50 - 57"0" returned if port is configured as output. "1" returned if port is configured as input.
For variable values where bit 3 is set (values from x8 to xf):
x8=port bit 0, x9=port bit 1, xa=port bit 2, xb=port bit 3
xc=port bit 4, xd=port bit 5, xe=port bit 6, xf=port bit 8
For example, variable value 48 will return "checked" if port bit 0 is configured as an input

Examples:
Example TagDescription
%a02Variable group = a, Variable value = 0x02. This example will display the value of port A2 as '1' or '0'. So, if port A2 is set, a '1' will be displayed on the web page in stead of '%a02'
%c17Variable group = c, Variable value = 0x17. This example will display the value of port C7 as 'on' or 'off'. So, if port C7 is clear for example, 'off' will be displayed on the web page in stead of '%c17'
%f22Variable group = f, Variable value = 0x22. Variable values 20 to 2F can be used to place HTML comments around HTML code if a port is configured as an input. For example, to only display an image if a Port pin RF1 is configured as an output, you could write:
%f21<img src="picture.jpg">%f29
%g52Variable group = g, Variable value = 0x52. This example will display '1' if port G2 is configured as an input, and '0' if port G2 is configured as an output.
%b45Variable group = b, Variable value = 0x45. This example will display 'checked' if port B5 is configured as an output.
%c4cVariable group = c, Variable value = 0x4c. This example will display 'checked' if port C5 is configured as an intput.


Analog Inputs

The variable group n can be used to display the value of any Analog Input on the PIC.

The following variable values(in hex) are defined:
Variable ValueString returned by HTTP Server - displayed on web page
00 - 0A2 or 3 digit hex value in capital letters
10 - 1ADecimal value 0 - 255 or 0 - 1023
20 - 2ADecimale value, 2 decimal places for 5V reference
30 - 3A"<!--" returned if the channels is configured for ADC
40 - 4A"-->" returned if the channels is configured for ADC
50 - 5A"<!--" returned if the channels is NOT configured for ADC
60 - 6A"-->" returned if the channels is NOT configured for ADC

Examples:
Example TagDescription
%n02Variable group = n, Variable value = 0x02. This example will display the value of Analog Input 2 in uppercase hex. For example, "A8" will be displayed on the web page in stead of '%n02' if Analog Input 2 has the value 0xA8.
%n1AVariable group = n, Variable value = 0xaA. This example will display the value of Analog input 10 in decimal. For example, "210" will be displayed on the web page in stead of '%n1A' if Analog Input 10 has the value 210.
%n32Variable group = n, Variable value = 0x32. Variable values 30-3A and 40-4A can be used to place HTML comments around HTML code if a PIC port pin is configured as an Analog Input. For example, to only display an image if a Analog Input 2 is configured as an Analog Input, you could write:
%n32<img src="picture.jpg">%n42


General

The variable group l is used for displaying general information.

The following variable values(in hex) are defined. If the Logged In column contains a 'X' character then this tag will only be parsed if the current user is logged in!
Variable Value Logged In String returned by HTTP Server - displayed on web page
00  Displays the Username of the current user. For example "Guest" or "Admin". The current user will be "Guest" if the user has not logged in.
01  Displays the TCP/IP stack version. For example "V2.04".
02  Displays the Application version. For example "V3.00".
03  Returns '0' if we are currently not logged in, or '1' if we are.
04  Displays 'Yes' if the board has a bootloader, else 'No'
05  Displays our NetBIOS name
10  Displays first part of current IP address. For example, will be '5' if our IP is '10.1.0.5'.
11  Displays second part of current IP address.
12  Displays third part of current IP address.
13  Displays fourth part of current IP address. For example, will be '10' if our IP is '10.1.0.5'.
14  Displays first part of MAC address. For example, will be '5' if our MAC is '0.1.2.3.4.5'.
15  Displays second part of MAC address.
16  Displays third part of MAC address.
17  Displays fourth part of MAC address.
18  Displays fifth part of MAC address.
19  Displays sixth part of MAC address. For example, will be '200' if our MAC is '200.1.2.3.4.5'.
1A  Displays first part of current Network MASK. For example, will be '255' if our mask is '0.0.0.255'.
1B  Displays second part of current Network MASK.
1C  Displays third part of current Network MASK.
1D  Displays fourth part of current Network MASK. For example, will be '15' if our mask is '15.0.0.255'.
1E  Displays first part of current Gateway address. For example, will be '5' if our Gateway Address is '10.1.0.5'.
1F  Displays second part of current Gateway address.
20  Displays third part of current Gateway address.
21  Displays fourth part of current Gateway address. For example, will be '10' for '10.1.0.5'.

Examples:
Example TagDescription
%l00Variable group = l, Variable value = 00. This example will display the name of the user currently logged in. If the username of the user currently logged in is "Admin", then "Admin" will be displayed on the web page in stead of '%l00'
%l10.%l11.%l12.%l13Variable group = l, Variable value = 10 to 13. This example will display our IP address.


Configuration Values

The variable group k is used for displaying the contents of the Application Configuration bytes. The values are displayed in decimal! The variable value (in uppercase hex) is used to specify the offset of the configuration byte to display. All of these tags are only parsed if the current user is logged in!

Examples:
Example TagDescription
%k00.%k01.%k02.%k03This example will display the currently configured IP address. If the IP address is "10.1.0.1", then "10.1.0.1" will be displayed on the web page in stead of "%k00.%k01.%k02.%k03".
%k0A.%k0B.%k0C.%k0DThis example will display the currently configured network MASK. If the MASK is "255.0.0.0", then "255.0.0.0" will be displayed on the web page in stead of "%k0A.%k0B.%k0C.%k0D".


Generated on Mon Oct 9 13:22:09 2006 for SBC65EC Web Server by  doxygen 1.4.7