WWW: Synchronizing user pages (S7-1200, S7-1500, S7-1200 G2) - STEP 7

Web server (S7-1200, S7-1500, S7-1200 G2)

ft:publication_title
Web server (S7-1200, S7-1500, S7-1200 G2)
Product
STEP 7
Version
V21
Publication date
11/2025
Language
en-US
WWW: Synchronizing user pages

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 type

Memory area

Description

CTRL_DB

Input

DB_WWW

I, Q, M, D, L or constant

Data block that describes the user 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

(W#16#...)

Explanation

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.