104BWeb server
11.3 User-defined web pages
S7-1200 Programmable controller
System Manual, 11/2011, A5E02486680-05
509
You must provide the control data block input parameter (CTRL_DB) which corresponds to
the integer DB number of the control DB. You can find this control DB block number (called
Web DB Number) in the Web Server properties of the CPU after you create the blocks for
the user-defined Web pages. Enter the integer DB number as the CTRL_DB parameter of
the WWW instruction. The return value (RET_VAL) contains the function result. Note that the
WWW instruction executes asynchronously and that the RET_VAL output might have an
initial value of 0 although an error can occur later. The program can check the state of the
control DB to ensure that the application started successfully, or check RET_VAL with a
subsequent call to WWW.
Table 11- 4 Return value
RET_VAL
Description
0
No error
16#00yx
x: The request represented by the respective bit is in the waiting state:
x=1: request 0
x=2: request 1
x=4: request 2
x=8: request 3
The x values can be logically OR-ed to represent waiting states of multiple requests. If x = 6, for
example, requests 1 and 2 are waiting.
y: 0: no error; 1: error exists and "last_error" has been set in the control DB
16#803a
The control DB is not loaded.
16#8081
The control DB is of the wrong type, format, or version.
16#80C1
No resources are available to initialize the web application.
Usage of the Control DB
STEP 7 creates the control data block when you click "Generate blocks" and displays the
control DB number in the User-defined Web pages properties. You can find the control DB
as well in the Program blocks folder in the project navigation tree.
Typically, your STEP 7 program uses the control DB directly as created by the "Generate
blocks" process with no additional manipulation. However, the STEP 7 user program can set
global commands in the control DB to deactivate the web server or to subsequently re-
enable it. Also, for user-defined pages that you create as manual fragment DBs (Page 507),
the STEP 7 user program must control the behavior of these pages through a request table
in the control DB. For information on these advanced tasks, see the topic Advanced user-
defined Web page control (Page 526).
11.3.5
Downloading the program blocks to the CPU
After you have generated the blocks for user-defined Web pages, they are part of your STEP
7 program just like any other program blocks. You follow the normal process to download the
program blocks to the CPU. Note that you can only download user-defined Web page
program blocks when the CPU is in STOP mode.