pCOWeb
+030220966 – rel. 1.1 – 12.12.2017
68
CAREL TAGS FOR
pCOWeb
HTML PAGES -THE PW_DEMO.HTML PAGE
APPENDIX G
Each CAREL tag entered on an html page is used to read or modify the
pCO
controller data or the
pCOWeb
settings. This makes the html page dynamic, that
is, it contains the values of variables. The tags are managed by an internal program on
pCOWeb
with tag parser functions, called “pcotagfilt”. In fact, the web
server on
pCOWeb
has been programmed to recognise the following row in an html page (row position is irrelevant):
<!--tagparser="/pcotagfilt"-->
following which the web server searches for the “pcotagfilt” program in the default root position for the web server (“/usr/local/root”), and then starts it, sending
all the contents of the html page. The “pcotagfilt” program recognises the CAREL tags, replaces them with the results, and returns the resulting html page.
IMPORTANT
If the row
<!--tagparser="/pcotagfilt"-->
is not included in the html page, the CAREL tags will not work, and will be shown on the PC as they are written
.
NOTE
Browsers such as Mozilla Firefox, Google Chrome and others create a copy of the pages visited in their cache, and when the page is next called
the contents may be loaded from the cache, rather than requesting an update from
pCOWeb
. This means that at times the desired result is not
displayed, above all with dynamic pages such as those used on
pCOWeb
.
The browsers, nonetheless, feature of a specific command to force them to update the pages from the web server; for example, by using F5 both Mozilla
Firefox and Google Chrome update the page, but by using Ctrl+F5 they do it without using the cache contents.
Ctrl+F5 should be used whenever there is doubt that the result may haven been loaded from the cache on the PC.
CAREL TAGS FOR HANDLING THE
pCO
VARIABLES
“var”
: read / write a variable
Used to read or write the value of a
pCO
controller supervisor variable.
SYNTAX
<%var(0,
VariableType
,
VariableIndex
,
[MinValue]
,
[MaxValue]
)%>
where:
•
0 (zero): required; reserved for future extensions;
•
VariableType
: 1: Digital, 2: Analog, 3: Integer;
•
VariableIndex
(1 to 207 for Carel protocol/5000 for ModBus Extended protocol): choose the variable;
•
[MinValue] (Int.: -32768 to 32767 step 1, An.: -3276.8 to 3276.7 step 0.1),
optional when writing, no affect when reading:
pCOWeb
will not send the
pCO
a value less than
MinValue
;
•
[MaxValue] (Int.: -32768 to 32767 step 1, An.: -3276.8 to 3276.7 step 0.1),
no affect when reading, optional when writing:
pCOWeb
will not send the
pCO
a value greater than
MaxValue
.
READING
Returns the value of the variable saved in a table on
pCOWeb
. The table is updated based on the variations that
pCO
sends to
pCOWeb
around 3 times a
second, as displayed by the green flashes of the Status LED. The result of the read operation may be:
•
value of the variable;
•
or: “U” (Undefined): indicates that the value of the variable contained in the table on the
pCOWeb
is not valid.
Possible causes of the value “U”:
•
pCOWeb
has not yet received a value for the variable from the
pCO
; wait around one minute and retry;
•
alternatively: communication between the
pCOWeb
and the
pCO
is interrupted (the Status LED on the
pCOWeb
flashes red, all the variables are equal
to “U” on the page shown in
Figure 9.b
on page 42): check the correspondence of the communication parameters between
pCOWeb
and the
pCO
application (see 9.5 on page 46);
•
alternatively: the address of the variable is outside of the range managed by the
pCO
BIOS firmware (not a recent version); In the example shown in
Figure 9.b
on page 42, the
pCO
only manages the first 199 digital variables, the first 127 analog variables and the first 127 integer variables.
Example (Figure G.a on page 68)
Reading the value of digital variable 5:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<!--tagparser="/pcotagfilt"-->
<head>
<meta content="text/html; charset=ISO-8859-15" http-equiv="content-type">
<title>pCOWeb Configuration</title>
</head>
<body>
<div style="color: red">Variable Digital 5 value is: <%var(0,1,5)%></div>
</body>
</html>
Figure G.a - The “var” TAG used for reading
WRITING