EasyManua.ls Logo

Siemens SIMATIC S7-1200

Siemens SIMATIC S7-1200
1614 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Web server
12.7 User-defined Web pages
S7-1200 Programmable controller
System Manual, V4.2, 09/2016, A5E02486680-AK
1051
12.7.2.7
Referencing CPU variables with an enum type
You can assign a variable in the CPU to an enum type. This variable can be used elsewhere
in your user-defined Web page in a read operation (Page 1044) or a write operation
(Page 1045). On a read operation, the Web server will replace the numerical value that is
read from the CPU with the corresponding enum text value. On a write operation, the Web
server will replace the text value with the integer value of the enumeration that corresponds
to the text before writing the value to the CPU.
Syntax
<!-- AWP_In_Variable Name='<Varname>' Enum="<EnumType>" -->
<!-- AWP_Out_Variable Name='<Varname>' Enum="<EnumType>" -->
Parameters
<Varname> Name of PLC tag or data block tag to associate with the enum type, or the name of
the alias name for a PLC tag (Page 1049) if declared.
Varname must be enclosed in single quotation marks. Within the single quotes, use
double quotation marks around a PLC tag or data block name. Note that for data
block tags, you use the name of the block and not a data block number. The data
block name is within the double quotes but not the data block tag name.
<EnumType> Name of the enumerated type, which must be enclosed in single or double quota-
tion marks
The scope of an enum type reference is the current fragment.
Example usage in a variable read
<!-- AWP_Out_Variable Name='"Alarm"' Enum="AlarmEnum" -->...
<p>The current value of "Alarm" is :="Alarm":</p>
If the value of "Alarm" in the CPU is 2, the HTML page displays 'The current value of "Alarm"
is Tank is empty' because the enum type definition (Page 1050) assigns the text string "Tank
is empty" to the numerical value 2.
Example usage in a variable write
<!-- AWP_Enum_Def Name='AlarmEnum' Values='0:"No alarms", 1:"Tank is
full", 2:"Tank is empty"' -->
<!-- AWP_In_Variable Name='"Alarm"' Enum='AlarmEnum' -->...
<form method="POST">
<p><input type="hidden" name='"Alarm"' value="Tank is full" /></p>
<p><input type="submit" value='Set Tank is full' /><p>
</form>
Because the enum type definition (Page 1050) assigns "Tank is full" to the numerical value
1, the value 1 is written to the PLC tag named "Alarm" in the CPU.
Note that the Enum clause in the AWP_In_Variable declaration must correspond exactly to
the Name clause in the AWP_Enum_Def declaration.

Table of Contents

Other manuals for Siemens SIMATIC S7-1200

Related product manuals