|
|
Tip  --  Popping Up An Alert Dialog Window
This tip demonstrates a unique way to use the META REFRESH tag to detect a loss of serial communications with an external device and force a jump to another page which will pop up as an alert dialog window.
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.10 URL=LostComm.htm" >
where:
URL=LostComm.htm specifies the page to jump to, and 0.10 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 an internal byte variable that will trigger the URL jump.
The Example
The HTML page in Figure 1 (" AC.htm" ) defines several META refresh tags. The META refresh tag that will be examined in this example is the very last one. Note that the META REFRESH  tag uses HREF=Amulet:internal.lostComm.byteValue() to request an internal lostcomm byte variable which returns the count of consecutive communication time-outs when at least one variable is being requested over the UART. If the byte value returned from the HREF matches the value specified by TRIGGER, then the matching URL is launched.

Figure 1.
Step 1
Use the HREF attribute to call the byteValue() method of the Amulet:internal.lostcomm object, and the TRIGGER attribute to specify the jump condition. Remember, the Amulet Module will wait up to one second after sending a UART command in order to receive a response, if not, then the module increments an internal lostcomm byte variable. For this reason, this example assumes that at least one variable is being requested via the UART on the HTML page.
< META HTTP-EQUIV=" REFRESH" CONTENT=" 0.10 HREF=Amulet:internal.lostcomm.byteValue() TRIGGER=0x03 URL=LostComm.htm" >
Will redirect the Amulet module to " LostComm.htm" when the value of the internal lostcomm byte variable, signifying the number of consecutive time-outs, equals 0x03. The polling rate for the internal lostcomm byte variable is specified as 100ms (0.10 seconds).
Step 2
The HTML page in Figure 2 (" LostComm.htm" ) uses a META refresh tag that defines a transition type when the page is loaded in order to get the illusion of an alert dialog window popping up.

Figure 2.
Note that the META REFRESH  tag uses transition=GrayLCD to specify how the page is to be loaded. GrayLCD means that upon loading the page, gray out the previous page instead of clearing it.
Step 3
Now save, compile, and program " AC.htm" into the Amulet Module. The demo will pop up an alert dialog window after a few seconds if data is not recieved via the UART which is being requested by one of the numeric field widgets.
| Download this Demo |
|   |
 |
PopUpTip.zip |
|   |
Last Updated: July 11, 2002 |
|
|
Amulet Tip Archive
Amulet Tips |
|