0% found this document useful (0 votes)
8 views

Web server

This manual provides instructions for synchronizing user-defined web pages with the S7-1200 and S7-1500 CPUs using the WWW instruction. It details the initialization and synchronization processes, including the setup of data blocks and error handling. Additionally, it includes a program example demonstrating the interaction between user-defined web pages and the CPU's user program.

Uploaded by

Uhule Peter
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Web server

This manual provides instructions for synchronizing user-defined web pages with the S7-1200 and S7-1500 CPUs using the WWW instruction. It details the initialization and synchronization processes, including the setup of data blocks and error handling. Additionally, it includes a program example demonstrating the interaction between user-defined web pages and the CPU's user program.

Uploaded by

Uhule Peter
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

WWW: Synchronizing user pages (S7-1200,

S7-1500) 1

Web server (S7-1200, S7-


1500)

Manual

V20

11/2024
Legal information
Warning notice system

This manual contains notices you have to observe in order to ensure your personal safety, as
well as to prevent damage to property. The notices referring to your personal safety are
highlighted in the manual by a safety alert symbol, notices referring only to property damage
have no safety alert symbol. These notices shown below are graded according to the degree of
danger.

DANGER

indicates that death or severe personal injury will result if proper precautions are not taken.

WARNING

indicates that death or severe personal injury may result if proper precautions are not taken.

CAUTION

indicates that minor personal injury can result if proper precautions are not taken.

NOTICE

indicates that property damage can result if proper precautions are not taken.

If more than one degree of danger is present, the warning notice representing the highest
degree of danger will be used. A notice warning of injury to persons with a safety alert symbol
may also include a warning relating to property damage.

Qualified Personnel

The product/system described in this documentation may be operated only by personnel


qualified for the specific task in accordance with the relevant documentation, in particular its
warning notices and safety instructions. Qualified personnel are those who, based on their
training and experience, are capable of identifying risks and avoiding potential hazards when
working with these products/systems.

Proper use of Siemens products

Note the following:

WARNING

Siemens products may only be used for the applications described in the catalog and in the
relevant technical documentation. If products and components from other manufacturers are
used, these must be recommended or approved by Siemens. Proper transport, storage,
installation, assembly, commissioning, operation and maintenance are required to ensure
that the products operate safely and without any problems. The permissible ambient

2 Manual, 11/2024
conditions must be complied with. The information in the relevant documentation must be
observed.

Trademarks

All names identified by ® are registered trademarks of Siemens Aktiengesellschaft. The


remaining trademarks in this publication may be trademarks whose use by third parties for their
own purposes could violate the rights of the owner.

Disclaimer of Liability

We have reviewed the contents of this publication to ensure consistency with the hardware and
software described. Since variance cannot be precluded entirely, we cannot guarantee full
consistency. However, the information in this publication is reviewed regularly and any
necessary corrections are included in subsequent editions.

Siemens Aktiengesellschaft
Copyright © Siemens 2024.
Digital Industries
11/2024 Subject to change All rights reserved
Postfach 48 48
90026 NÜRNBERG
GERMANY

Manual, 11/2024 3
Table of content

1 WWW: Synchronizing user pages (S7-1200, S7-1500) 6


1.1 WWW: Synchronizing user pages (S7-1200, S7-1500) 6
1.2 Program example of WWW (S7-1200, S7-1500) 8

4 Manual, 11/2024
Manual, 11/2024 5
WWW: Synchronizing user pages (S7-1200, S7-1500)

1.1 WWW: Synchronizing user pages (S7-1200, S7-1500)


1
Description
The instruction WWW initializes the web server of the CPU or synchronizes user-defined web
pages, in short: "user pages", with the user program in the CPU.
Together with the Web server, user web pages make it possible for the CPU to access freely
designed web pages of the CPU with a web browser.
Use script instructions (such as Javascript) and HTML code in user web pages to transfer data via
a web browser for further processing to the CPU and to display data from the operand area of
the CPU in the web browser. To synchronize the user program and the Web server, but also to
initialize, call the instruction "WWW" in the user program.

Initialization
User web pages are "packaged" in data blocks for processing by the CPU. You will have to
generate appropriate data blocks from the source files (HTML files, screens, Javascript files, ...)
during configuration. The Web Control DB takes on a special role (default: DB 333). It contains
status and control information as well as links to additional data blocks with coded web pages.
The data blocks with coded web pages are called fragment DBs.
When the data blocks are downloaded into the CPU, the CPU does not "know" that user web
pages are coded inside it. The instruction "WWW" in the startup OB, for example, will inform the
CPU which DB is the Web Control DB. After this initialization, the user pages are accessible via a
web browser.

Synchronization
If you want the user program to interact with the user pages, then the instruction "WWW" must
be used in the cyclical program part.
Examples of interaction between user program and web page:

Check received data

Assemble and send back data to the web browser making the request

In this case it must be possible to evaluate the current status information and the Web server
must receive control information, such as release of a web page requested by a web browser.

Parameter
The following table shows the parameters of the "WWW" instruction:

Parameter Declaration Data Memory Description


type area

6 Manual, 11/2024
CTRL_DB Input DB_WWW I, Q, M, D, L or Data block that describes the user
constant pages (Web control DB)

RET_VAL Output INT I, Q, M, D, L Error information

You can find additional information on valid data types under Overview of the valid data types.

Parameter RET_VAL

Error code Explanation

(W#16#...)

0000 No error occurred. There are no web page requests that have to be
released by the user program.

00xy x: indicates whether an error has occurred during initialization of the Web
Control DB (CTRL_DB):
x=0: No errors occurred.
x=1: Error occurred. The error is coded in the byte "CTRL_DB.last_error" of
the Web Control DB, see description of Web Control DB.
y: Number of the pending request. Several requests are possible (e. g.
requests "0" and "1" are pending: y="3".
y="1": Request "0"
y="2": Request "1"
y="4": Request "2"
y="8": Request "3"

803A The specified Web Control DB does not exist on the CPU.

8081 Incorrect version or incorrect format of the Web Control DB.

8082 Web server is not enabled.

8083 User-defined web pages (user-defined pages) are not enabled for the
communication with the web server. Only the web-based API (Web API)
and web applications based on it are released.

80C1 There are no resources to initialize the web application, for example,
because only two or four web applications may be running.

Example
You will find the example here: Program example of WWW.
See also

Manual, 11/2024 7
Overview of the valid data types
What you need to know about user pages (S7-300, S7-400, S7-1500)
Sample Library for Instructions (S7-1200, S7-1500)

1.2 Program example of WWW (S7-1200, S7-1500)

Introduction
In the following example, you synchronize a user-defined Website with the program example in
a CPU S7-1500 and test the program example via a Web server.

Requirement
Create nineteen tags in a global data block for storing the data.

Interconnect parameters - in FB “SLI_FB_www“


You create the following interconnections in an FB "SLI_FB_www": You call the FB in an OB1.
Network 1: Interconnect the parameters of the "WWW" instruction as follows.

8 Manual, 11/2024
Network 2: You create the program for the Website in the FC “SLI_FC_MainWebProg_www“. You
then call the FC “SLI_FC_MainWebProg_www“ in network 2 of the FB.

Interconnecting parameters - in FC "SLI_FC_SetTOD_www"


In an FC “SLI_FC_SetTOD_www“ you create a program for using a time-of-day interrupt OB
(OB11). You create the following interconnections:
Network 1: In the FC you interconnect the following local tags with the instructions “RD_SYS_T“
and “T_ADD“.

Network 2: This is followed by interconnecting the tags for setting the time-of-day interrupt OB.
The local tag “#startDateTime“ (data type “Date_And_Time”) transfers the start time to the time-
of-day interrupt OB.

Network 3: This is followed by interconnecting the tags for activating the time-of-day interrupt
OB.

Manual, 11/2024 9
Interconnecting parameters - in the OB “SLI_todOB_www“
In the time-of-day interrupt OB “SLI_todOB_www“ (OB11) you create the following
interconnections for cyclic increasing of the tag “tankLevel“.

Interconnecting parameters - in FC "SLI_FC_MainWebProg_www"


You create the following interconnections in the FC "SLI_FC_MainWebProg_www“.
The program “SLI_FC_MainWebProg_www“ allows control of a motor, a valve and the tank filling.
In addition to this the output of various interrupt statuses is made possible. The program is
controlled via the Web server.
Network 1: You call the FC “SLI_FC_SetTOD_www“ in the FC “SLI_FC_MainWebProg_www“.

Network 2: This is followed by interconnecting the tags for opening the valve.

Network 3: This is followed by interconnecting the tags for starting the motor.

10 Manual, 11/2024
Network 4: This is followed by interconnecting the tags for querying the interrupt status “1“.

Networks 5 to 8: This is followed by interconnecting the tags for querying the interrupt status
“2“.
Interconnect the tags for querying the other interrupt statuses in the same way.

Network 9: This is followed by interconnecting the tags for resetting the motor and the filling of
the tank..

Network 10: This is followed by interconnecting the tags for resetting all the other values
(BOOL).

Manual, 11/2024 11
Setting CPU properties
Make the following settings in the CPU properties:

Activate web server access under "... > PROFINET interface > Access to the web server".

In “CPU properties > Web server enable the Web server for the module,

In the section “User administration“ create a new user with read and write rights.

Make the following settings in the section "User pages":

- You set the “HTML file path”.

Note

The storage path should be the same as the path of the Sample Library for
Instructions (SLI). The folder name is “SLI_html“. For example:
“C:\TIA\_library\SLI_html“.

- Enter the text "index.html" for the Start HTML page.

- For the application you enter the name “WWW sample“.

- Click the "Create block" button. The Web DB (333) and the Fragment DB (334) are then

created.

Result for WWW


If the normally open contact ("executeWWW") supplies the signal state "TRUE", the "WWW"
instruction is executed. The number of the data block that describes user defined Website is
stored via the input parameter CTRL_DB ("333"). The “WWW“ instruction initializes the user
defined Website in the Web server of the CPU and immediately synchronizes the program
example.
The output parameter RET_VAL ("returnValueWWW") indicates that the processing is running
without errors.

12 Manual, 11/2024
Result for the Web server
You call the Web server via the “Internet browser > IP of the Web server”. You log in with your
user name user name and -password.
In the Web server in “User pages” a link to the website defined by the user is displayed.

On the Website of the program example it is possible for you to output tags and transfer new
values to the tags.

Manual, 11/2024 13
Functions used in the HTML document
Below you will see excerpts of the functions used in the program example with which the tags
are transferred to the source code in the HTML document. For each function a tag is
implemented via a call in the HTML document and at the relevant location in the HTML
document is used with a further call.

Function To call in the HTML document To output in the HTML


element

Data output: <!-- AWP_In_Variable :="SLI_gDB_www".tankLevel:


Name='"SLI_gDB_www".tankLevel'
-->

14 Manual, 11/2024
Enumeration <!-- AWP_Enum_Def <!-- AWP_Enum_Ref
(value Name="OpValvValue" Name='"SLI_gDB_www".valveOutput'
replacement): Values='0:"Closed", 1:"Opened"' - Enum="OpValvValue" --
-> >:="SLI_gDB_www".valveOutput:

Value change <!-- AWP_In_Variable <form method="post" action=""


(from INT): Name='"SLI_gDB_www".flowrate' onsubmit="return check();">
-->
<input type="text"
name='"SLI_gDB_www".flowrate'
size="10px"/>
<input class="button1"
type="submit" value="Set flowrate"/>
</form>

Value change <!-- AWP_Enum_Def <form method="post" action="">


(from BOOL): Name="ResetValue" <input class="button1"
Values='0:"Off", 1:"On"' -->
type="submit" value="Reset"/>
<input type="hidden"
name='"SLI_gDB_www".reset'
size="34px" value="1"/>
</form>

See also
Sample Library for Instructions (S7-1200, S7-1500)

Manual, 11/2024 15

You might also like