Tip  --  Changing Pages Via The Serial Port

This tip demonstrates a unique way to use the META REFRESH tag to force a jump to a preset page upon a specific UART response.

A < META> Refresher
If you are already familiar with the META REFRESH tag, then you know that you can force your Amulet module to jump to another µ HTML page after a preset time. The syntax is as follows:
< META HTTP-EQUIV=" REFRESH" CONTENT=" 0.07 URL=Australia.htm" >

where:
URL=Australia.htm specifies the page to jump to, and
0.07 is the delay time, in seconds.

Additionally, you may also specify an HREF function that will be called after the delay time, and a TRIGGER attribute that will specify a return value of the HREF call that will trigger the URL jump. These two new attributes will be utilized in the following example to request a value from the serial port that will trigger the URL jump.

The Example
The HTML page in Figure 1 (" America.htm" ) defines two META refresh tags, each specifying a jump to a different page. However, both META REFRESH  tags use HREF=Amulet:UART.byteValue(5) to request a single byte value via the UART. If the byte value returned from the HREF matches either of the values specified by TRIGGER, then the matching URL is launched.


Figure 1.

Step 1
Create a unique META refresh tag for each HTML page that you want to force a jump to. Use the HREF attribute to call the byteValue(x) method of the Amulet:UART object, and the TRIGGER attribute to specify the jump condition.

a)  < META HTTP-EQUIV=" REFRESH" CONTENT=" 0.07 HREF=Amulet:UART.byteValue(5) TRIGGER=0x7F URL=Australia.htm" >
Will redirect the Amulet module to " Australia.htm" when the value of external byte variable #5 equals 0x7F. The polling rate for external byte variable #5 is specified as 70ms (0.07 seconds).

b)  < META HTTP-EQUIV=" REFRESH" CONTENT=" 0.07 HREF=Amulet:UART.byteValue(5) TRIGGER=0xFF URL=France.htm" >
Will redirect the Amulet module to " France.htm" when the value of the same external byte variable #5 equals 0xFF.

NOTE: The URL can be a jump to another page, or it can actually send out a command over the UART, or it can call some method of another object that appears on the page, or any combination of the above -- its all up to you and your imagination.

Step 2
Now save, compile, and program " America.htm" into the Amulet Module. Use the Amulet Simulator to send the Amulet Module server responses to the variable #5 requests in order to launch to either " Australia.htm" or " France.htm."

Download this Demo
  ServerTip.zip
  Last Updated: July 11, 2002

Amulet Tip Archive
Amulet Tips


© 2003-2005 Amulet Technologies. U.S. and Foreign Patents Pending.
µ HTML is a Trademark of Amulet Technologies