104BWeb server
11.3 User-defined web pages
S7-1200 Programmable controller
496
System Manual, 11/2011, A5E02486680-05
Examples
:="Conveyor_speed"::="My_Data_Block".flag1:
:=I0.0:
:=MW100:
Example reading an aliased variable
<!--AWP_Out_Variable Name='flag1' Use='"My_Data_Block".flag1' -->
:=flag1:
Note
Defining alias names for PLC tags and data block tags is described in the topic Using an
alias for a variable reference (Page 500).
If a tag name or data block name includes special characters, you must use additional
quotation marks or escape characters as described in the topic Handling tag names that
contain special characters (Page 505).
11.3.2.2
Writing variables
User-defined pages can write data to the CPU. This is accomplished by using an AWP
command to identify a variable in the CPU to be writable from the HTML page. The variable
must be specified by PLC tag name or data block tag name. You can declare multiple
variable names in one statement. To write the data to the CPU, you use standard HTTP
POST commands.
A typical usage is to design a form in your HTML page with text input fields or select list
choices that correspond to writable CPU variables. As with all user-defiined pages, you then
generate the blocks from STEP 7 such that they are included in your STEP 7 program.
When an admin user subsequently accesses this page and types data into the input fields or
selects a choice from a select list, the Web server converts the input to the appropriate data
type for the variable, and writes the value to the variable in the CPU. Note that the name
clause for HTML input fields and HTML select lists uses syntax typical for the name clause of
the AWP_In_Variable command. Typically enclose the name in single quotation marks and if
you reference a data block, enclose the data block name in double quotation marks.
For form management details, refer to documentation for HTML.
Syntax
<!-- AWP_In_Variable Name='<Varname1>' [Use='<Varname2>'] ... -->
Parameters
<Varname1>
If no Use clause is provided, Varname1 is the variable to be written. It can be a
PLC tag name from your STEP 7 program or a tag from a specific data block.
If a Use clause is provided, Varname1 is an alternate name for the variable
referenced in <Varname2> (Page 500). It is a local name within the HTML page.
<Varname2>
If a Use clause is provided, Varname2 is the variable to be written. It can be a PLC
tag name from your STEP 7 program or a tag from a specific data block.