Sie sind auf Seite 1von 148

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

FAQs for
SIEMENS S7-1200
2009 to 2011

( jovanx.jovan@gmail.com , v1.0-01/2012 )

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

(folha em branco)

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)


FAQs 2009 to 2011

How do you establish MODBUS-RTU communication with STEP 7 Basic V10.5 for the
SIMATIC S7-1200 ?
How can you prevent data loss of runtime-generated parameters when updating your S7-1200
PLC program ?
How can you share runtime-generated between several S7-1200 PLCs with a KTP Basic
Panel ?
How do you synchronize the time and date of an HMI Basic Panel with an S7PLC using the "Job mailbox" area pointer ?
How can you manage block execution errors detected by the S7-1200 PLC ?
How can you deal with time errors detected by the S7-1200 CPU ?
How is numerical integration programmed in STEP 7 Basic V10.5 ?
How can you access an S7-1200 PLC by PC-Access and what is to be considered?
How can you establish a connection between an S7-1200 PLC and SIMATIC NET OPC ?
How can you erase the IP address and set your S7-1200 PLC back to factory settings , using
the SIMATIC MC memory card (2MB or 24MB) ?
How can you change the IP address of an S7-1200 PLC without STEP 7 Basic ?
How can you download to a network of several S7-1200 PLCs with the same IP address ?
How you reset the IP address of your S7-1200 PLC using STEP7 Basic software?
How can you manage peripheral device errors detected by the S7-1200 PLC ?
How can you use an analog current output with wire break diagnostics on your S7-1200 PLC
?
How can you use analog 0-20mA signal modules and signal boards with 4-20mA signals ?
How do you synchronize the time of the HMI Basic Panel with S7-1200 PLC ?
How do you access S7-1200 tags with a panel or RT configured with WinCC flexible 2008
SP2 ?
With which devices can the S7-1200 communicate via the PN connection ?
How do you compensate for the string mismatch caused by the RCV_PTP and SEND_PTP
blocks ?
How can you reduce memory usage with Multi instancing ?
How many high-speed counters (HSCs) are provided by SIMATIC S7-1200 PLC?
How do you connect a sensor to the analog signal modules of the SIMATIC S7-1200 ?
How can you back up parameters before loading a new control program ?
How can you determine the coordinates of your S7-1200 PLC with a standard GPS receiver ?
How can you establish a connection between an S7-1200 PLC and SIMATIC NET OPC ?
How do you implement a weekly timer for the SIMATIC S7-1200 in STEP 7 V11 ?
With which devices can the S7-1200 comminicate via the integrated PROFINET interface and
which protocols support the S7-1200 ?
How can you access tags of the S7-1200 with WinCC ?
How can you change the IP address of an S7-1200 without using STEP 7 Basic ?
What is the connection between subnet masks and IP addresses with regard to subnetting and
supernetting (classless inter domain routing CIDR) ?
How does startup work in an S7-1200 ?

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

(folha em branco)

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

How do you establish MODBUS-RTU communication with STEP 7 Basic V10.5 for the SIMATIC
S7-1200 ?
Description
The SIMATIC S7-1200 enables point-to-point communication using the communication modules CM
1241 RS485 and CM 1241 RS232.
You can add up to three communication modules to each S7-1200 controller.
Using the MODBUS library integrated in STEP 7 Basic V10.5 you can define each communication
module as a MODBUS master or slave.
If you define the CM 1241 RS232 as MODBUS master, then there is a physical limitation that permits
communication with one slave only.
If you define the CM 1241 RS485 as MODBUS master, then it is possible to communicate with up to
32 slaves one after the other.
We will take a sample project to describe the configuration procedure in STEP 7 Basic V10.5 for
communication with multiple slaves using the CM 1241 RS485.
Instructions
We have taken the example of MODBUS communication between a master and a slave.
There is alternate writing to the holding register of the slave (function code 16) and reading from the
holding register of the slave (function code 03).
Since the RS485 has a two-wire (half-duplex) interface, writing and reading must be conducted
consecutively.
By the same principle, the address of the slave to be addressed can be changed between two actions
(here writing and reading), thus making it possible to exchange data with multiple slaves.

Fig. 01
The CM 1241 RS485 communication modules are linked to each other using a PROFIBUS cable.
You can continue with the PROFIBUS cable to connect up to 31 additional MODBUS slaves to the
master.
The configuration is done in STEP 7 Basic V10.5 SP2. The program code is transferred to the
controllers with the switch CSM 1277.
MB_COMM_LOAD
The configuration block MB_COMM_LOAD is required on both sides (master and slave) for
MODBUS communication.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 02

The MB_COMM_LOAD block is used to select the communication module, set the communication
parameters and establish the connection with the master or slave parameters.

The MB_COMM_LOAD block must be called in the first program cycle (by activating the system
marker M1.0 in the hardware settings or by a call in Startup OB 100).

After inserting the communication module in the hardware configuration you can select the symbolic
name of the communication module at the PORT parameter.

The communication parameters BAUD (transmission rate) and PARITY (parity) must be identical for
all nodes. The port configuration of the RS485 interface in the STEP 7 V10.5 device view is irrelevant
here.

The instance data block of the master or slave block is transferred at the MB_DB parameter and thus
defines the communication module (PORT parameter) as MODBUS master or slave.
MB_MASTER
You use the MB_MASTER block to define the communication module selected with the
MB_COMM_LOAD configuration block as MODBUS master.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 03
The MB_MASTER block is used to select the MODBUS slave to be addressed, select the function code
(read/write, MODBUS start address and data length) and define the local data storage area.

The communication is triggered by the REQ parameter.

The MODBUS-RTU station address to be addressed is transferred at the MB_ADDR parameter.

The MODE parameter specifies the direction of transmission ("0" = read, "1" = write or additional
diagnostics functions).

The MB_MASTER block must be called in the first program cycle (by activating the system marker
M1.0 in the hardware settings or by a call in Startup OB 100).

The DATA_ADDR and DATA_LEN parameters are for setting the MODBUS start address and the
data length (bits or words depending on the MODBUS start address selected).

The DATA_PTR parameter defines the local receive and send data storage areas of the master.
DATA_PTR must refer to a global data block created with the "Symbolic access only" option disabled.
When multiple elements are to be transferred (bits or words), the symbolic name of an array or struct
that covers this data storage area (DATA_ADDR and DATA_PTR) must be transferred here.
MB_SLAVE
You use the MB_SLAVE block to define the communication module selected with the
MB_COMM_LOAD configuration block as MODBUS slave.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 04
The MB_SLAVE block is used to define the MODBUS-RTU station address and specify the local data
storage area for the holding register data transfer.

The local MODBUS-RTU station address is transferred at the MB_ADDR parameter. The MODBUS
master identifies the slave with this.

The MB_HOLD_REG parameter defines the local holding register data storage area of the slave.
MB_HOLD_REG must refer to a global data block created with the "Symbolic access only" option
disabled. When multiple registers (words) are to be transferred, the symbolic name of an array or struct
that covers the specified data volume of the master (DATA_ADDR and DATA_PTR) must be
transferred here. The first word of this array or struct corresponds to the MODBUS holding register
start address 40001.
The parameters can be switched with the inputs and outputs of the blocks or by accessing the instance
data block concerned.

Sample project

In the master project, the alternate writing to / reading from the holding register of the slave is done
using a sequencer.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 05
The MB_COMM_LOAD configuration block is called in the initialization step 0.

In Step 1 the MB_Master with the communication parameters for writing to the slave (MODE = 1) is
called and executed (REQ = 1).

The transition to Step 2 is made by the positive (DONE) or negative (ERROR) confirmation from the
MB_MASTER.

The transition resets the execution of the MB_MASTER (REQ = 0).

In Step 2 the communication parameters for reading from the slave (MODE = 0) are written using the
MB_MASTER in the same instance data block as from Step 1 (MB_DB parameter of the
MB_COMM_LOAD block).

Execution and transition are the same as in Step 1.


The figure below shows a step (networks 6 and 7) with transition (network 8).

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 06
The MB_ADDR parameter (see Network 6) can therefore also be used to change the slave to be
addressed per step, which permits data to be exchanged with up to 32 slaves.
Download
The compressed file "MODBUS_RTU.zip" contains the sample project "MODBUS_RTU.ap10" for

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

10

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

alternate data transfer between a master and a slave.

Unpack the "MODBUS_RTU.zip" file and open the sample project "MODBUS_RTU.ap10" with STEP
7 Basic V10.5 (>= SP2).

The version of the firmware of the SIMATIC S7-1200 controllers used is V1.0.2.

Download the project folders ("Master" and "Slave") into the controllers.

You can track the data transfer in the monitoring table.

Modbus_RTU.zip

( 969 KB )

Note
More information about Modbus Library Operations is available in the SIMATIC S7 S7-1200
Programmable Controller System Manual (Entry ID: 36932465).

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

11

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

(folha em branco)

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

12

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

How can you prevent data loss of runtime-generated parameters when updating your S7-1200
PLC program ?
Description
You need to apply changes to your user program running on a S7-1200 PLC, but you do not want to
loose your runtime-generated parameters. Buffer your runtime-generated parameters in the HMI
"Runtime" recipe function of STEP 7 Basic and download your program changes to your S7-1200 PLC.
To apply this feature, execute the following steps:

Prepare your STEP 7 Basic HMI project to buffer your parameters. No changes to your PLC
program are necessary.
Buffer your parameters in the HMI "Runtime" recipe function of STEP 7 Basic.
Download your changed program to your S7-1200 PLC.
Retrieve your parameters from the HMI "Runtime".

Capacity of the recipe function:

You can buffer up to 20 elements (tags) per recipe.


You can use up to a maximum of 5 recipes.

Each recipe allows you to buffer different sets of tags (total sum of tags: 5x20=100). Please find an
example project in the attached file.

Fig. 01
Configuring the buffering feature in your project
In the following description, the HMI project of the attached STEP 7 Basic project is used.

No. Integrating the recipe function

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

13

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

1. Prepare the projects


Follow these steps:

Open your own project with STEP 7 Basic.


Download, unzip, and open the attached STEP 7 Basic project " DataStore".

This project is designed to match the following devices:

S7-1200 PLC with CPU 1214 (6ES7 214-1BE30-0XB0)


KPT600PN Basic Panel (6AV6 647-0AD11-3AX0)

The panel type is not important as the HMI "Runtime" can simulate any configured type of KPT
Basic Panels.
2. Copy the HMI device into your project

Drag and Drop the "HMI_DataStore" HMI project from the attached "DataStore" STEP
7 Basic project into your own project.
Drag and Drop the "DataStore" global data block from the "DataStore" project to your
own project.
Drag and Drop the "RuntimeParameters" global data block from the "DataStore" project
to your own project.
Compile the data blocks of "PLC_1".

The "RuntimeParameters" data block holds the parameter tags for the example project. It is used
to demonstrate this feature. In your own project any data tag capable of holding numerals can be
used.

Fig. 02
Important

Compile the data blocks of "PLC_1".


Make sure the used data tags are "retentive". Otherwise the restored data will not survive
a PLC STOP or a power-cycle condition.

3. Delete the HMI tags


Follow these steps:

Browse the "Project tree" for the "HMI tags" editor.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

14

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Select all "HMI_connection_x" entries, and click "Delete" in the context menu.

Fig. 03
Note
Do not delete the "s_ipAddress" internal tag.
4. Configure the HMI Connection
Follow these steps:

Browse for "Device&Networks" and click the "Connections" button. Select the
"Connections" tab and delete the HMI connection of the "HMI_DataStore" panel by
clicking "Delete" in the context menu. Acknowledge the following dialog window.

Fig. 04
Connect the Ethernet ports of the "HMI_DataStore" panel and the "PLC_1" S7-1200
PLC. A new HMI connection is established.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

15

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 05
5. Configure the HMI area pointer
Follow these steps:
In the context menu of the "HMI_connection_2" select the "Go to Connections editor.." item (see
Fig. 05).
In the "Area pointers" tab, check the Data record area pointer active, and assign the
"aw_dataRecord" tag from the "DataStore" data block.
Check the "Job mailbox" area pointer, and assign the "aw_jobMailbox" tag from the "DataStore"
data block.

Fig 06
6. Add the tags to recipe function
Follow these steps:

Browse the "Project tree" for the "Recipes" item of the "HMI_dataStore" HMI device.
In the recipe, view select "Recipe 1"

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

16

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Change to the "Elements" tab, and assign the tags you want to share with your other S71200 PLCs to the elements of this recipe.
The default setting for decimal places is zero. Increase the number of decimal places up
to the resolution you need.
Configure up to 20 elements per recipe.

Note
Any invalid tag needs to be deleted or reassigned. Invalid tags are highlighted red.

Fig. 07
7. Configure the screen tags

Browse the "Project tree" for the "Screens" folder of the "HMI_DataStore" device, and
open the "root screen".
Assign the "aw_dataRecord[3]" word tag to the status output field.

Fig. 08
Assign the "HMI_connection_2" connection to the "Release" event of the Change IP
button.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

17

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 09

Table 01
Buffering and retrieving the parameters with HMI "Runtime"
No. Buffering and retrieving the parameters
1. Start the HMI "Runtime" of STEP 7 Basic
Follow these steps:

Select the "HMI_DataStore" HMI device.


Click the "Start runtime" button.

Fig. 10

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

18

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

2. Buffer the parameters in the HMI


Follow these steps:

On your HMI display select "Recipe_1" and click the "OPEN" button. The
"Recipe_data_record_1" opens.

Fig.11

Press the "PLC>>HMI" button to read the parameters from the S7-1200 PLC. The "Save
as" window opens.

Fig. 12

To save the data record number "1", enter the number "1" in the "Number" input field,
and click the "OK" button.

Fig. 13

Click the "Open" button to see the parameter values of this data record.

Fig. 14
Your parameters are now stored in Runtime.
Note
You can also archive / retrieve parameter element values.
3. Download your program
Click the "Download to device" button to download your program to your S7-1200 PLC.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

19

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 15
4. Restore the parameters to the PLC
Follow these steps:

On your HMI display select "Recipe_1" and click the "OPEN" button. The
"Recipe_data_record_1" opens. See Fig. 11/12 for details.
Press the "HMI>>PLC" button to write the parameters to your S7-1200 PLC.

Table 02
Adjusting the IP address
Change the IP address, that is configured in the HMI connection, if you want to access another S7-1200
PLC (for example, PLC_2). Each S7-1200 PLC has a unique IP address.

No. Adjust the IP address


1. If the IP address of the S7-1200 PLC in the project does not match the IP address of the actual
S7-1200 PLC you are using, you must change the IP address configured in the HMI "Runtime"
(for example, you run the same project on several S7-1200 PLCs).
Follow these steps:

On your HMI "Runtime", enter the IP address of the S7-1200 PLC (for example,
"192.168.0.1") in the input field.
Click the "Change IP" button.

Fig. 16

Table 03
Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

20

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Requirements

S7-1200 PLC
Ethernet cable
PG / PC
STEP 7 Basic V10.5

S71200_DataStore.zi
p

( 3134 KB )

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

21

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

(folha em branco)

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

22

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

How can you share runtime-generated between several S7-1200 PLCs with a KTP Basic Panel ?
Description
Your application consists of one master project which you want to run simultaneously on several PLCs.
While commissioning the first PLC, miscellaneous specific parameters will be generated which shall be
used for all other PLCs. Archive these parameters in your KTP Basic Panel, and retrieve them on your
other PLCs, instead of commissioning every single PLC. The KTP Basic Panel allows for the archiving
and retrieving of these parameters, while being connected to an S7-1200 PLC, using its retentive recipe
function.
The recipe function of the KTP Basic Panel is used for this task. To use this "Parameter sharing"
feature, follow these steps:
1.

Integrate the recipe function into your HMI program, and link the parameter tags you want to
archive / retrieve.
2. Download your master project to all of your PLCs.
3. Assign unique IP addresses to each of your PLCs.Youcan use either STEP 7 Basic or the "IP
TOOL" which you will find in entry ID 41737436.
4. Download your HMI program to your KTP Basic Panel.
5. Connect your KTP Basic Panel to your first S7-1200 PLC.
6. In the configuration of the KTP Basic Panel, adjust the IP address (for example, 192.168.0.1)
for communications with your first S7-1200 PLC.
7. Commission your first PLC, and generate specific runtime parameters.
8. Archive the commissioned parameters in your KTP Basic Panel.
9. Connect your KTP Basic Panel to your next S7-1200 PLC.
10. In the configuration of the KTP Basic Panel, adjust the IP address (for example, 192.168.0.2)
for communications with your next S7-1200 PLC.
11. Retrieve your parameters from your KTP Basic Panel.
12. Repeat steps 9 through 11 until all your S7-1200 PLCs are updated.
To integrate this feature into your program, follow the steps described in the "Integrating the recipe
function" section of this article.
An overview on the use of this feature can be found in the "Applying the parameter sharing feature"
section of this article.

Fig. 01
Integrating the recipe function

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

23

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

No. Integrating the recipe function


1. Prepare the projects
Follow these steps:

Open your own project with STEP 7 Basic.


Download, unzip and open the attached STEP 7 Basic project " DataStore".

This project is designed to match the following devices:

S7-1200 PLC with CPU 1214 (6ES7 214-1BE30-0XB0)


KTP600PN Basic Panel (6AV6 647-0AD11-3AX0)

2. Copy the HMI device and the data blocks into your project
Follow these steps:

Drag and Drop the "HMI_DataStore" HMI project from the "DataStore" project to your
own project.
Drag and Drop the "DataStore" global data block from the "DataStore" project to your
own project.
Drag and Drop the "RuntimeParameters" global data block from the "DataStore" project
to your own project.
Compile the data blocks of "PLC_1".

The "RuntimeParameters" data block holds the parameter tags for the example project. It is used
to demonstrate this feature. In your own project any data tag capable of holding numerals can be
used.

Fig. 02
Important

Compile the data blocks of "PLC_1".


Make sure the used data tags are "rententive". Otherwise the restored data will not
survive a PLC STOP or a power-cycle condition.

3. Delete HMI tags


Follow these steps:

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

24

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Browse the "Project tree" for the "HMI tags" editor.


Select all "HMI_connection_x" entries, and click "Delete" in the context menu.

Fig. 03
Note
Do not delete the "s_ipAddress" internal tag.
4. Configure HMI Connection
Follow these steps:

Browse for "Device&Networks" and click the "Connections" button. Select the
"Connections" tab, and delete the HMI connection of the "HMI_DataStore" panel by
clicking "Delete" in the context menu. Acknowledge the following dialog w

Fig.
04

Connect the Ethernet ports of the "HMI_DataStore" panel and the "PLC_1" S7-1200
PLC. A new HMI connection is established

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

25

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 05
5. Configure the HMI area pointer
Follow these steps:

In the context menu of the "HMI_connection_2" select the "Go to Connections editor.."
item (see Fig. 05).
In the "Area pointers" tab, check the Data record area pointer active, and assign the
"aw_dataRecord" tag from the "DataStore" data block.
Check the "Job mailbox" area pointer, and assign the "aw_jobMailbox" tag from the
"DataStore" data block.

Fig 06

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

26

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

6. Add the tags to recipe function


Follow these steps:

Browse the "Project tree" for the "Recipes" item of the "HMI_dataStore" HMI device.
In the recipe view, select "Recipe 1"
Change to the "Elements" tab, and assign the tags you want to share with your other S71200 PLCs to the elements of this recipe.

Note
Any invalid tag needs to be deleted or to reassigned. Invalid tags are highlighted in red.

Fig. 07
Note
You can configure the tags stored in the HMI by adding new elements to the "Elements" view of
the "Recipe_data_record_1".

There are up to 5 recipes available for you to configure 5 different sets of tags.
One recipe holds up to 20 data records with 20 elements each. Therefore you can store
20 different setups in one recipe.

7. Configure the screen tags


Follow these steps:

Browse the "Project tree" for the "Screens" folder of the "HMI_DataStore" device, and
open the "root screen".
Assign the "aw_dataRecord[3]" word tag to the status output field.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

27

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 08

Assign the "HMI_connection_2" connection to the "Release" event of the Change IP


button.

Fig. 09

Table 01
Applying the "parameter sharing" feature
The following overview is based on the attached "DataStore" project.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

28

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

No. Applying the "parameter sharing" feature


1. Download your program to all of your PLCs
Follow these steps:

Select the "PLC_DataStore" S7-1200 PLC.


Click the "Download to device" button and acknowledge the following dialog windows.

Fig. 10
2. Assign unique IP addresses
Assign unique IP addresses to all of your S7-1200 PLCs. You can use either STEP 7 Basic or the
IP TOOL. Please find the IP TOOL in entry ID 41737436.

3. Download your HMI program to your HMI device


Follow these steps:

Select the "HMI_DataStore" HMI device.


Click the "Download to device" button. See Fig. 10 for details.

4. Change IP address
To address an S7-1200 PLC with your KTP Basic Panel, you need to use the IP address of the
S7-1200 PLC in your HMI device:

Connect your KTP Basic Panel to your S7-1200 PLC.


On your KTP Basic Panel, enter the IP address of the S7-1200 PLC (for example,
"192.168.0.1") in the input field.
Click the "Change IP" button.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

29

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 11
5. Store parameters in HMI

Follow these steps:

On your HMI display, select "Recipe_1", and click the "OPEN" button. The
"Recipe_data_record_1" opens.
Press the "PLC>>HMI" button to read the parameters from the S7-1200 PLC. The "Save
as" window opens.

Fig. 12

To save the data record number "1", enter the number "1" in the "Number" input field,
and click the "OK" button.

Fig. 13

Click the "Open" button to see the parameter values of this data record.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

30

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 14
Your parameters are now stored in your panel.
Note
It is also possible to archive / retrieve parameter elements.
6. Restore data in PLC

On your HMI display, select "Recipe_1", and click the "OPEN" button. The
"Recipe_data_record_1" opens. See Fig. 11/12 for details.
Press the "HMI>>PLC" button to write the parameters to your S7-1200 PLC.

Table 02
Note
You can also use the "Runtime" feature of STEP 7 Basic instead of a KTP Basic Panel.
Requirements

S7-1200 PLC
Ethernet cable
PG / PC
STEP 7 Basic V10.5
KTP600PN basic panel

S71200_DataStore.zi
p

( 3137 KB )

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

31

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

(folha em branco)

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

32

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

How do you synchronize the time and date of an HMI Basic Panel with an S7-1200 PLC using
the "Job mailbox" area pointer ?
Description
To synchronize the time and date of your HMI Basic Panel to the local time of your S7-1200 PLC,
perform the following steps:

Set up a tag array for the area pointer to store the time and date information.
Enable and configure the "Job mailbox" area pointer.
Enter the time and date information into the tag array.
Evaluate the "Job mailbox".

Synchronizing the time and date


The necessary steps to synchronize time and date via the "Job mailbox" area pointer are described in the
table below.
No. Synchronizing the time and date
1.

Set up a tag array for the area pointer


You use the area pointer to access a data area in the PLC, and this data area is saved in the PLC.
Set up the data area as a tag array in a global data block or an instance data block. The
configuration of the tags in a data block is based upon the length of the area pointer you want to
use. The unit for the length of an area pointer is a 16-bit word.
The "Job mailbox" area pointer requires an array of 4 elements.
1.

2.
3.

4.

5.

Expand the view of the PLC in the "Project tree", and open the "Program blocks" folder.
Double-click on "Add new block", click on "Data block (DB)" with "Global DB" as the
type and click the "OK" button. The data block opens.

Fig. 01
Enter a tag name (for example "a_jobMailbox") in the "Name" column.
Select "Array [lo .. hi] of type" as the data type in the "Data type" column. Replace the
"lo" and "hi" entries in the brackets with the low ("0") and high ("3") values for the
dimensions of the array.
Replace the "type" designation with the "word" data type. The full data type for an array
of 4 tags appears as follows: "Array [0 .. 3] of word".

Fig. 02
Select the PLC in the "Project tree" and click the "Compile" button in the tool bar. The
data block is compiled. Following compilation, the tag array is available for further use in
the project.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

33

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 03
Note
The data block must be compiled before the tag array is available for further use.
2.

Configure the "Job mailbox" area pointer


To configure the "Job mailbox" area pointer, open the "Connections" editor and open the "Area
pointer" tab.
1.

2.
3.

Expand the view of the HMI device in the "Project tree" and double-click the
"Connections" entry. The "Connections" editor opens.

Fig. 04
Open the "Area pointers" tab and enable the "Job mailbox" area pointer by checking the
box in the "Active" column.
Click the navigation button in the "PLC tag" field; the object list opens. Navigate to the
"Data_block_1"data block in the object list and select the "a_jobMailbox" tag in the right
window.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

34

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 05
3.

Enter the parameters in the "Job_mailbox" tag array


The PLC can use the "Job mailbox" to transfer jobs to the HMI Basic Panel in order to trigger
corresponding actions on the HMI device.
The HMI Basic Panel evaluates the "Job mailbox" if the first word of this job is unequal to zero.
This means that the parameters must be entered in the "Job mailbox" first, followed by the job
number. When the HMI Basic Panel accepts the "Job mailbox", the first word is set to 0 again. The
execution of the "Job mailbox" is generally not completed at this point in time.
The first word of the "Job mailbox" contains the job number; this is "14" to set the time.
The second word contains "Parameter 1".
The third word contains "Parameter 2".
The fourth word contains "Parameter 3".

Fig. 06
Read the local time from the PLC

Fig. 07
Enter the parameters in the "Job mailbox" tag.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

35

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 08

Note
The parameters are BCD-coded.

4.

Evaluate the "Job_mailbox"


Enter the job number in the "Job mailbox" tag. This will start the evaluation of the "Job mailbox".

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

36

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 09
The "Job mailbox" is evaluated and the time of the HMI Basic Panel is set to the local time of the
S7-1200 PLC.
5.

Set the date of the HMI Basic Panel


The setting of the date is similar to the setting of the time.
To start the evaluation of the "Job_mailbox" the first word needs to be set to "15".

Fig. 10
Table 01
Requirements

S7-1200 PLC
Ethernet cable
PG / PC
STEP 7 Basic V10.5

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

37

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

(folha em branco)

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

38

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

How can you manage block execution errors detected by the S7-1200 PLC ?
Description
By default, the CPU responds to a block execution error by logging an error in the diagnostics buffer
and switching to STOP mode, as this is the predefined system response.
You can change this behavior by placing one or more "GetError" or "GetErrorID" instructions within
the program block you want to monitor. In this case the CPU does not switch to STOP mode and does
not log an error in the diagnostics buffer. Instead, this block is now set to manage errors within the
block. The error information is reported in the output of the "GetError" or "GetErrorID" instruction.
"GetError"
The "GetError" instruction indicates that a program block execution error has occurred and fills a
predefined error data structure of the data type: "ErrorStruct" with detailed error information.
The "GetError" instruction can also be used to forward an alarm about the error status to the calling
block. To do this, the instruction must be positioned in the last network of the called block.
"GetErrorID"
The "GetErrorID" instruction indicates that a program block execution error has occurred and reports
the ID (identifier code) of the error. Please find a list of the error codes in the online help of STEP 7
Basic, search for the keyword "GetErrorID".
Note
No "GetError" or "GetErrorID" instruction is present when you create a new project.
Evaluating a block execution error event with the "GetError" instruction
Information on the block execution event will be stored in a tag of the "ErrorStruct" system data type.

No. Evaluating a block execution error event with the "GetError" instruction
1 Add the "GetError" instruction

Browse the instructions pane for "Extended instructions > Program control > GetError".
Drag and Drop a "GetError" instruction into the last network of the OB you want to
monitor.
Click the "OK" button.

Please see the figure below for details.

2 Reading out the "ERROR" output information of the "GetError" instruction


You can store the local error information in a global tag as described below:

Create a local "error_local" tag of the data type "ErrorStruct".


Store the value of the "Error" output in the local "error_local" tag.
Browse the instructions pane for "Instructions > Move > MOVE".
Drag and Drop a "MOVE" instruction in the network, where your "GetError" instruction
is located.
Connect the ENO contact of the "GetError" instruction with the EN contact of the
"MOVE" instruction.
Create a global tag "gl_error" of the "ErrorStruct" data type in the "data_block" data
block.
Move the "GetError" tag into the `"data_block".gl_error tag.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

39

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 01
3 Evaluating the "ERROR" output information of the "GetError" instruction
Only tags of the "ErrorStruct" system data type can be specified at the ERROR output. The
"ErrorStruct" system data type specifies the exact structure in which the information about the
error is stored. Using additional instructions, you can evaluate this structure and program an
appropriate response.
The "ErrorStruct" tag contains the following information:

The type of block, in which the error occurred (for example


"data_block".gl_error.block_type)
The number of the block in which the error occurred (for example:
"data_block".gl_error.code_block_number)

Please find a detailed overview in the figure below. A detailed list of the contents of the
"ErrorStruct" data type can be found in the online help of STEP 7 Basic, search for the keyword
"GetError".

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

40

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 02
Table 01
Error conditions indicated by the "ENO" enable output
The output "ENO" of the "GetError" or "GetErrorID" instruction is set only if the two following
preconditions are met:

The input EN is enabled.


Error information is present.

If one of these conditions does not apply, then the remaining program execution is not affected by the
"GetError" instruction. If EN = TRUE and "GetError" or "GetErrorID" executes, then:

ENO = TRUE indicates a code block execution error occurred and error data is present
ENO = FALSE indicates no code block execution error occurred

You can connect error reaction program logic to the "ENO" output which activates after an error occurs.
If an error exists, then the output parameter stores the error data where your program has access to it.
"GetError" and "GetErrorID" can be used to send error information from the currently executing block
(called block) to a calling block. Place the instruction in the last network of the called block program to
report the final execution status of the called block.
Online diagnostics with STEP 7 Basic
When you do not use an "GetError" instruction, and you have online access to your S7-1200 PLC with
STEP 7 Basic, you can use the "Online & diagnostics" function:

Go online to your S7-1200 PLC.


Browse the "Project tree" for the entry "Online & diagnostics".
Browse the navigation area of the "Online Access" window for the entry "Diagnostics buffer".
Select a program block execution error event from the "Events" table.
Beneath the "Events" table, details on the selected event are displayed. Here, you will find the

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

41

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

number of the affected OB and the event ID of the error.

Fig. 03
Note
An "Incoming event" shows the beginning of an event.
An "Outgoing event" shows the end of an event.
Use case
If a directly addressed contact (for example "IW120:P") is not available, you can use the "GetError"
instruction to achieve the following results:

Prevent the CPU from going to STOP mode


Launch an error message
Set up a substitute value on the missing contact

Requirements

S7-1200 PLC
Ethernet cable
PG / PC
STEP 7 Basic V10.5

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

42

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

How can you deal with time errors detected by the S7-1200 CPU ?

Description
Time errors usually occur during commissioning of the S7-1200 PLC. Time errors can be triggered by
any of the following conditions:

Maximum cycle time exceeded


Called OB still being executed
Queue overflow
Interrupt loss due to excessive interrupt load

All time error events trigger the execution of OB 80, if it exists. OB 80 includes startup information that
helps you determine which event and OB generated the time error.
If OB 80 does not exist, then the CPU ignores the error, for when the maximum cycle time is exceeded.

Understanding time error events


No. Understanding time error events
1. "Maximum cycle time exceeded"
If the cyclic program exceeds the maximum cycle time, the reaction will be as follows:
1.

2.

When the cycle time exceeds the cycle monitoring time for the first time, there is an
attempt to start the "Time error interrupt" OB (OB 80).
If there is no "Time error interrupt" OB in the CPU, the CPU generates an error and
continues to execute the user program.
If the event "maximum cycle time exceeded" happens twice within the same program
cycle, without resetting the cycle timer, then the CPU turns to STOP, regardless of
whether OB 80 exists.
You can prevent the CPU from turning to STOP by restarting the CPU cycle monitoring
with the "RE_TRIGR" instruction.

The operating system monitors the execution time of the cyclic program for a configurable upper
limit known as the "Maximum cycle time".

You find the "Maximum cycle time" in the properties of your S7-1200 PLC.

Browse the "Project tree" for your S7-1200 PLC.


Double-click the "Device configuration" item.
Select your S7-1200 PLC in the "Devices & Networks" view.
On the "Properties" tab, browse for the "Cycle time" entry.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

43

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 01

2. "Called OB still being executed"


The called OB is currently being executed. This is possible for time-delay interrupt OBs and
cyclic interrupt OBs.
3. "Queue overflow"
An overflow has occurred in an interrupt OB queue. There is a queue for each interrupt priority
group. If an interrupt event occurs when the corresponding queue is full, a time error event is
generated.
4. "Interrupt loss due to excessive interrupt load"
An interrupt was lost due to the excessive interrupt load.
Table 01

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

44

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

The "RE_TRIGR" instruction

The "RE_TRIGR" instruction (Re-trigger cycle time monitoring) allows you to reset the timer that
measures the cycle time. However, this instruction must be executed in a program cycle OB. The
"RE_TRIGR" instruction is ignored if executed in other blocks (for example OB 80). If the maximum
scan cycle time is exceeded twice within the same program cycle with no "RE_TRIGR" instruction
executed, the CPU will switch to STOP immediately.
To insert a "RE_TRIGR" instruction:

Browse the instructions pane for "Extended instructions" > "Program control" > "RE_TRIGR".
Drag and Drop this instruction into a network of a program cycle OB.

Fig. 02
Note
Use the "RE_TRIGR" instruction with care. Repeated executions of the "RE_TRIGR" instruction can
create an endless loop or a very long scan. As a result of this endless loop, the cyclic program will never
end, and the output process image will never be written. Therefore you will never receive a save state at
the outputs.
Evaluating the time error event with the "Time error interrupt" OB
The operating system calls the "Time error interrupt" OB 80, if one of the previously mentioned events
occurs.

No. Evaluate the time error event with the "Time error interrupt" OB
1. Add the "Time error interrupt" OB

Browse the "Project tree" for the "Add new block" item.
In the "Add new block" window, click the "Organization block" button.
Select the "Time error interrupt" OB from the list.
Click the "OK" button.

Note
You can use only one "Time error interrupt" OB in your program.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

45

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 03
2. Monitoring the start information of the "Time error interrupt" OB

Double-click the "Time error interrupt" OB of your S7-1200 PLC in the "Project tree".
Browse the instructions pane for "Instructions" > "Move" >"Move".
Drag and Drop a move instruction into a network of your "Time error interrupt" OB.
Move the value of the "fault_id" tag into a global tag (for example
""Data_block".by_fault_ID").
Program the other tags you want to monitor in the same way. Please refer to the example
in Fig. 04.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

46

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 04
3. Evaluating the start information of the "Time error interrupt" OB
The "Time error interrupt" OB has the following start information:
"fault_id" (BYTE)
The "fault_id" identifies the type of error.

0x01: Maximum cycle time exceeded


0x02: Called OB still being executed
0x07: Queue overflow
0x09: Interrupt loss due to excessive interrupt load

"csg_OBnr "(OB-ANY)
Number of the OB being executed at the time of the error.
"csg_prio" (UINT)
Priority of the OB being executed at the time of the error.
Table 02
Requirements

S7-1200 PLC
Ethernet cable
PG / PC
STEP 7 Basic V10.5

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

47

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

(folha em branco)

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

48

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

How is numerical integration programmed in STEP 7 Basic V10.5 ?


Instructions
The integral is the mathematical calculation of the area under a given function curve. However, there is
often no mathematical correlation in practice, but rather an analog value which varies over time. The
integral calculation involes totaling the trapezoidal areas, spread between the last two function values
and the time. This trapezoidal area is identical to the product of the average of the two process values
and the time interval.

Fig. 01
Figure 01 illustrates the calculation of the integral of a trapezoidal area:

Calculation: 0.5*(F(t1)+F(t0))*(t1-t0) + 0.5*(F(t2)+F(t1))*(t2-t1) + ...

Fig. 02

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

49

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Parameter

Data
type

Memory
area

Description

EN

BOOL

I, Q, M,
D, L

Block enable input (must always be on)

IN

REAL M, D, L

Enable

BOOL

I, Q, M,
D, L

Enable input (calculation occurs only if it is TRUE; if it is FALSE,


parameter OUT displays the last calculated value)

Reset

BOOL

I, Q, M,
D, L

Reset input (if it is TRUE, parameter OUT will be reset)

SMB

BYTE M

ENO

BOOL

OUT

REAL M, D, L

Integrated value (retentive)

Error

Q, M, D,
BOOL
L

Error output (it is steady TRUE, if the system memory byte is


disabled or not connected and it is TRUE for one cycle, if a power up
occurs while the integration is enabled = sign for a power break down
while integration)

Q, M, D,
L

Value to be integrated

Location of the system memory byte (must be connected!)


Enable output

Downloads
The downloads below contain the library and a sample program for calculating integrals. Copy the ZIP
files into a separate folder, and unpack the files with the WinZip program.
Sample program: Integral calculation with STEP 7 Basic
The "Integral.zip" download contains the STEP 7 Basic program (FB602) program for calculating the
integral. There is one example programmed in the STEP 7 Basic project.

Integral_sample.zip

( 2350 KB )
In the example, an analog input value (IW64, "velocity_INT" variable) is converted to a floating-point
value in Network 1 (MD10, "velocity_REAL" variable). This floating-point value is the input "IN" for
the integrator FB602, which results in the output "OUT" (MD14, "distance"). The calculation of the
integral is started with the "DB_2".Enable bit (which is selected als retentive) on FB602's "Enable"
parameter. The "Error" output must be stored by a retentive counter or a RS-Flip-Flop (Network 3) to
see, that a power failure occurred while integration. M5.0 resets the output value and the error flag
M5.3 in Network 4.
Library "Integral"
The "Integral.zip" library contains the know-how protected, "Integration" function block (FB602). The
password to disable the know-how protection is "1234".

Integral.zip

( 434 KB )

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

50

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 03
To open libraries in STEP 7 Basic, follow these steps:
1.
2.
3.
4.

Open the "Libraries" task card in STEP 7 Basic.


Under "Global libraries" click on the "Open Global Libraries" button in the toolbar.
Browse for the library in the "Open Global Libraries" dialog and select the "Integral.al10" file.
Click the "Open" button.

The "Integral" library with the FB602 "Integration" appears in the "Global libraries".
Validity
This FAQ is valid for

S7-1200 PLCs from firmware version V1.0.0.


STEP 7 Basic from V10.5.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

51

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

(folha em branco)

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

52

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

How can you access an S7-1200 PLC by PC Access and what is to be considered ?
Description
You can establish a connection between PC Access and your S7-1200 PLC. Nevertheless, there are
some restrictions to keep in mind.
Note
Although establishing a connection between an S7-1200 PLC and SIMATIC NET OPC is not officially
supported by Siemens, this FAQ describes a solution. In the following chapters, you will find a
description of how to establish such a connection.
Restrictions
There are certain restrictions to be considered due to the fact that PC Access was originally intended to
access an S7-200 PLC:

Only tags in the data block DB1 of your S7-1200 PLC can be accessed because the S7-200
only had one data block.
DB1 in your S7-1200 PLC needs to be non-symbolic. Please uncheck the checkbox "Symbolic
access only" when creating your DB1 (Figure 01).

Requirements
The following items are the hardware and software requirements:

S7-1200 PLC
Ethernet cable
STEP 7 Basic V10.5
PC Access V1.0.4.10 (SP4)

Create tags in data block DB1 of your S7-1200 PLC project


To create tags in your S7-1200 PLC follow the instructions below.

No. Create tags in data block DB1 of your S7-1200 PLC project
1. Add the data block DB1 to your project
Browse the "project tree" and click on the item "Add new block". Click the button "Data block
(DB)". Uncheck the checkbox "Symbolic access only". Click the "OK" button.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

53

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig.01
2. Allocate the tags in STEP 7 Basic
Double-click DB1. Add the following three tags under "name" and "Data type" and give them an
"initial value".

Item_01: "Byte"
Item_02: "Int"
Item_03: "DWord"

Fig.02
Click the item "Save project" in the tool bar. Download the project by clicking the download
button in the tool bar.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

54

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

3. Monitor the tags in STEP 7 Basic


To cross-check the tag values, use the watch table function of STEP 7 Basic. Browse the "Project
tree" for the item "Add new watch table" and fill in the "Name" and "Address" of the required
tags.
In this example, add the following three tags:

Item_01: "DB1.DBB0"
Item_02: "DB1.DBW2"
Item_03: "DB1.DBD4"

Fig.03
Table 01

Create a new PC Access project and access tags


Follow these instructions to establish a connection between PC Access and your S7-1200 PLC to access
data of your PLC.

No. Create a new PC Access project and access tags


1. Create a new project
Browse the menu bar, and select "File > New". A new project will be created.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

55

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig.04
2. Add a new PLC
Highlight the entry "MicroWin(TCP/IP)" in the "project tree".
Browse the menu bar, and select "Edit > New > PLC". A "NewPLC" object will be added, and
the "PLC properties" dialog window of the new PLC opens. Enter the following parameters into
the input fields of this window:

Name: "S7-1200_PLC"
IP Address: "192.168.0.11" (IP adress of your S7-1200 PLC)
TSAP Local: "10.00." (TSAP of your S7-1200 PLC)
TSAP Remote: "03.01." (TSAP of PC Access)

Click the "OK" button.

Fig.05

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

56

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

3. Add a new item

Highlight your S7-1200 PLC in the "project tree". Browse the menu bar, and select "Edit > New
> Item". The dialog window "Item properties" opens.
To access data in your S7-1200 PLC, perform the following steps:

Enter an item name in the "Name:" input field.


Enter the address of the tag in the "Address:" input field.
Select the type of data in the "Data Type:" input field.

Additionally, you can restrict the memory address access to "read" only or "write" only.
Click the "OK" button.

Fig.06

Note
Please find a list of the accessible items at the end of this document in the table "accessible tags
and items".

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

57

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

4. Save the project


Browse the menu bar, and select "File > Save" to save your project.

Fig,07

Note
Anytime you open or edit a PC Access project, you must click the "Save" button to send tag
configurations to the server.

Fig.08

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

58

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

5. Monitor items via the Test Client


Highlight the items you want to monitor and and click the "Add current items to test client"
button in the tool bar. The selected items will be added to the Test Client.

Fig.09
6. Start the Test Client
Click the "Start Test Client" button in the tool bar. The Test Client will go online and access the
designated data.
In the "Value" column, you can see the actual values of the listed items. If you are connected to
your S7-1200 PLC, the "Quality" of the item is listed as "Good".

Fig.10
Table 02
Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

59

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Accessible items
The following table shows all accessible items, including address examples.

Item

Address example

tags

"VB0", "VX1.0", "VW2", "VD4" etc.

markers

"MB8", "MX9.2", "MW10", "MD12" etc.

inputs

"I0.0", "AI0" etc.

outputs

"Q1.3", "AQ0" etc.

Table 03
Required version of PC Access
The required version of PC Access is V1.0.4.10 (SP4) or higher.
Please download PC access V1.0.4.10 (SP4) .

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

60

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

How can you establish a connection between an S7-1200 PLC and SIMATIC NET OPC ?
Description
Please find a detailed description on how to realize a connection between an S7-1200 PLC and
SIMATIC NET OPC V8.0 in the attached pdf-document.
Click the link "S7-1200_OPC_SIMATIC_NET_e.pdf" and save the document to your computer.

S7-1200_OPC_SIMA
TIC-NET_e.pdf

( 822 KB )

Keywords
client, scout

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

61

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

(folha em branco)

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

62

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

How can you erase the IP address and set your S7-1200 PLC back to factory settings , using the
SIMATIC MC memory card (2MB or 24MB) ?
Description
You can erase the IP address and set your S7-1200 PLC back to factory settings without using the STEP
7 Basic software and without knowing the exact IP address. To do so use any SIMATIC MC memory
card.
Disabling the write protection
Check that the memory card is not write-protected. Slide the protection switch away from the "Lock"
position.

Figure 01

Figure 02

Obtaining a blank SIMATIC MC memory card


There are two ways to obtain a blank SIMATIC MC memory card:

Use a new, blank SIMATIC MC memory card from SIEMENS.


If you habe a SIMATIC MC memory card that is not blank, delete the "SIMATIC.S7S" folder
and the "S7_JOB.S7S" file on the memory card, using an application such as Windows
Explorer.

Deleting the IP address


In order to erase the IP address and set your S7-1200 PLC back to factory settings, you must
1.
2.

insert a blank memory card into the S7-1200 PLC.


power cycle the S7-1200 PLC.

Now the S7-1200 PLC reboots. After rebooting and evaluating the SIMATIC MC memory card, the
internal load memory, this means the device configuration including the IP address, the user program
and any force values, is copied to the memory card. The memory card turns into a program card,
containing the data and IP address stored in the internal load memory before. After the copy has been
completed, the internal load memory of the S7-1200 PLC is erased. The S7-1200 PLC then goes to the
configured startup mode (RUN or STOP).
When the operation is complete, the S7-1200 PLC flashes the maintenance LED to indicate that the
memory card can be removed.
3.
4.

Remove the memory card from the S7-1200 PLC.


Power cycle the S7-1200 PLC.

The internal load memory including the IP address is erased and the S7-1200 PLC is set back to factory
settings.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

63

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

(folha em branco)

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

64

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

How can you change the IP address of an S7-1200 PLC without STEP 7 Basic ?
Description
You can change the IP address of an S7-1200 PLC using the IP TOOL, which you can find attached to
this entry.
This tool is useful when you load a master project to multiple S7-1200 PLCs, connected to the same
network.
Requirements

Operating sytem: Windows XP or Vista


S7-1200 PLC
Ethernet cable
PC / PG with Ethernet interface
IP TOOL V1.1.0.1

Use cases of the IP TOOL


The IP TOOL can change the IP address of an S7-1200 PLC in one of two ways. The proper method is
automatically determined by the state of that IP address:
1.

2.

Assigning an initial IP address:


If the S7-1200 PLC has no IP address, the IP TOOL uses the primary setup function to allocate
an initial IP address to the S7-1200 PLC.
Changing the IP address:
If an IP address already exists, the IP TOOL will modify the hardware configuration (HW
config) of your S7-1200 PLC.

Restrictions

After an IP address is assigned by the IP TOOL, you cannot change it again with the IP TOOL,
until after you have downloaded the hardware configuration to your S7-1200 PLC using STEP
7 Basic.
You cannot communicate with a PLC to which no IP address has been assigned.
An IP address cannot be used more than once in a network; each PLC must have a unique IP
address.

Note
In the IP TOOLs "Update accessible devices" list, PLCs with duplicate IP addresses are shown in
red.Assigning an initial IP address to your S7-1200 PLC

No.
1. Update accessible devices
Double-click the item "Update accessible devices" to show all accessible devices.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

65

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig.01
2. Select an S7-1200 PLC
Double-click the S7-1200 PLC without an IP address. On the right side of the dialog, the
available data of the S7-1200 PLC is displayed.
Identify your S7-1200 PLC on site by clicking the "Flash LED Lights" button.

Fig.02
3. Assign a new IP address

Enter the initial IP address in the "IP address:" input field.


Write the subnet mask in the "Subnet Mask:" input field.
Click the "Set" button.

On the left side of the dialog, the designated IP address is listed.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

66

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig.03
Table 01
Changing the IP address of an S7-1200 PLC
No.
1. Update accessible devices
Double-click the item "Update accessible devices" to show all accessible devices.

Fig.04
2. Select an S7-1200 PLC
Double-click the S7-1200 PLC whose IP address you want to change. On the right side of hte
dialog, the available data of the S7-1200 PLC is displayed.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

67

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Identify your S7-1200 PLC on site by clicking the "Flash LED Lights" button.

Fig.05
3. Assign a new IP address

Enter the new IP address in the "IP address:" input field..


Write the subnet mask in the "Subnet Mask:" input field.
Click the "Set" button.

On the left side of the dialog, the designated IP address is listed.

Fig.06
Table 02

IPToolInstall.zip

( 56907 KB )

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

68

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

How can you download to a network of several S7-1200 PLCs with the same IP address ?
Description
When you first download a PLC program of a STEP 7 Basic project to a network which contains several
S7-1200 PLCs, a situation may occur in which more than one PLC shares the same IP address.
This means you will miss one or more PLCs. In this case, delete the IP addresses of all PLCs to be able
to access them by their MAC addresses.

Figure 01
Deleting the IP address
Delete the IP address of an S7-1200 PLC using a SIMATIC MC memory card.
Identifying PLCs by their MAC address
To address a PLC by its MAC address, enable the checkbox "Show all accessible devices" in the
"Extended download to device" dialog box and select a MAC address from the list.
Downloading to the PLC
Select a MAC address from the list of accessible devices and click the "Load" button.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

69

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Figure
02
Note
A new, unconfigured PLC has no preset IP address.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

70

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

How you reset the IP address of your S7-1200PLC using STEP 7 Basic software ?
Description
You can reset the IP address of your S7-1200 PLC using the function "Reset to factory settings" of the
STEP 7 Basic software. Therefore you need online access to your S7-1200 PLC. This means the IP
address of your S7-1200 PLC needs to be the same as the IP address in your STEP 7 Basic project.
Otherwise you cannot go online.
Adjustingthe IP address
1.

To figure out the IP address of your S7-1200 PLC, highlight your S7-1200 PLC in the project
tree. Browse the menu bar for "Online > Extended download to device..." and check the "Show
all accessible devices" check box. The IP address of your S7-1200 PLC is listed in the
"address" column.

Figure 01
2.

Change the IP address of the S7-1200 PLC in your project. Browse the project tree for the
"Device configuration" of your S7-1200 PLC and click the Ethernet port in the work area.
Open the "Ethernet addresses" properties and enter the IP address which you figured out in step
1.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

71

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Figure 02

Resetting the IP address


1.
2.
3.

Launch STEP 7 Basic, and open the project containing the S7-1200 PLC whose IP address you
want to reset.
In the project tree, browse for the S7-1200 PLC and highlight it.
Click the toolbar command "Go online". The title bar changes to orange. You have online
access to the S7-1200 PLC now.

Figure 03
4.

Double-click item "Online & Diagnostics" in the PLC folder in the project tree. The "Online
access" dialog window of your PLC opens.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

72

Um PLC sem Watchdog


5.
6.

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

In the Navigation area, browse for "Functions > Reset to factory settings".
Select the radio button "Reset IP address" in the work area, and click the "Reset" button.

Figure 04
7.

A "Reset to factory settings" dialog box opens. Click the "OK" button.

The IP address is erased.


Note
Make sure that no SIMATIC MC memory card is inserted in your S7-1200 PLC while deleting the IP
address.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

73

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

(folha em branco)

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

74

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

How can you manage peripheral device errors detected by S7-1200 PLC ?
Description
The S7-1200 PLC can detect and report peripheral device errors for diagnostics-capable devices.
These errors are called diagnostic errors. The following diagnostic errors are supported:

No user power (on the signal module / board)


High limit exceeded (of the value on an analog input or output)
Low limit exceeded (of the value on an analog input or output)
Wire break (on an analog Current output)
Short circuit (on an analog Voltage output)

All diagnostic error events trigger the execution of the "Diagnostic error interrupt" organization block
(OB82).
The "Diagnostic error interrupt" OB82 includes startup information that helps you determine the
circumstances of the error occurrence:

Which device and channel reported the error.


Whether the event is due to the occurrence or removal of an error.

You can program instructions inside OB82 to examine these startup values and to take appropriate
action.
Evaluating the diagnostic error events with the "Diagnostic error interrupt" organization block
(OB82)
The occurrence or removal of any of several different diagnostic error conditions results in a
diagnostic error event if the following preconditions are met:

The OB82 has been added to the program of your S7-1200 PLC.
The diagnostic error event has been enabled for the module.

If OB82 does not exist, then the CPU ignores the error.
The "Diagnostic error interrupt" OB82 interrupts the normal cyclic program execution if a diagnosticscapable module recognizes an error.
Note
No "Diagnostic error interrupt" OB82 is present when you create a new project.
No. Evaluating the diagnostic error events with the "Diagnostic error interrupt" organization
block OB82
1

Add the "Diagnostic error interrupt" OB82

Browse the project tree for the "Add new block" item.
In the "Add new block" window, click the "Organization block" button.
Select the "Diagnostic error interrupt" OB82 from the list.
Click the "OK" button.

Note
You can have only one "Diagnostic error interrupt" OB in your program.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

75

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 01
2

Reading out the start information of the "Diagnostic error interrupt" OB82

Double-click the "Diagnostic error interrupt" OB82 of your S7-1200 PLC in the
"Project tree".
Browse the instructions pane for "Instructions > Move > MOVE".
Drag and Drop a "MOVE" instruction into a network of your "Diagnostic error
interrupt" OB82.
Move the value of the "IOstate" tag into a global tag (for example "`DB1`.w_IOstate").
Program the other tags you want to monitor in the same way. Please find an example in
the figure below.

Fig. 02

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

76

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Evaluating the start information of the "Diagnostic error interrupt" OB82


The "Diagnostic error interrupt" OB82 has the following start information:
"IOstate" (WORD)
The "IOstate" contains the I/O status of the diagnostics-capable module. Please find details on
the "IOstate" tag in Table no. 3.
"ladder" (HW-ANY)
This is the hardware-identifier.
The Hardware identifier (HW-ID) identifies modules or functional units of modules (for
example outputs and high speed counter). The hardware identifier consists of a whole number
and is reported by the system along with diagnostics alarms to allow the faulty module or
functional unit to be localized.
You find the HW-ID of a functional unit in the "Properties" tab of the "Device configuration".
Browse the navigation area for the item "IO addresses/HW identifier" (see figure below).
"Channel" (UINT)
The "Channel" contains the number of the output channel being used on the signal module /
board.
"multierror" (BOOL)
The "multierror" bit indicates that more than one error has occurred.

Fig. 03
Table 01

Enabling and understanding the different diagnostic error events


The operating system monitors the diagnostics-capable devices for the diagnostic errors mentioned
above. Diagnostic error events will be indicated by red blinking LEDs. The following table shows
additional information on the different diagnostic error events, how to enable them, and the indicating
LEDs.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

77

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

No Understanding the different diagnostic error events


.
1

"No user power"


The power supply is insufficient or missing.
The following S7-1200 PLC LEDs will blink (color of blinking LEDs: red):

The "ERROR" LED on the CPU.


All LEDs of the signal module / board.

"Enable power diagnostics"

Browse the "Project tree" for the "Device configuration" of your S7-1200 PLC.
Click your signal module in the "Device configuration" window.
Select the "Properties" tab and click the "AI4/AO2" item from the navigation area.
Click the "Enable power diagnostics" checkbox.

Fig 04
2

"High limit exceeded"

The high limit of an analog input / output has been exceeded (output value greater than
"+32511").
The following S7-1200 PLC LEDs will blink (color of blinking LEDs: red):

The "ERROR" LED on the CPU.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

78

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

The "DIAG" LED, if it is a signal module.


The LED of the associated channel.

"Enable overflow diagnostics"

Browse the "Project tree" for the "Device configuration" of your S7-1200 PLC.
Click your signal module in the "Device configuration" window.
Select the "Properties" tab and click the "AI4/AO2" item from the navigation area.
Scroll down to the channel you want to monitor.
Click the "Enable overflow diagnostics" checkbox.

Fig 05
3

"Low limit exceeded"


The low limit of an analog input /output has been exceeded (output value less than "0" for
Current, less than "-32512" for Voltage).
The following S7-1200 PLC LEDs will blink (color of blinking LEDs: red):

The "ERROR" LED on the CPU.


The "DIAG" LED, if it is a signal module.
The LED of the associated channel.

"Enable underflow diagnostics"

Browse the "Project tree" for the "Device configuration" of your S7-1200 PLC.
Click your signal module in the "Device configuration" window.
Select the "Properties" tab and click the "AI4/AO2" item from the navigation area.
Scroll down to the channel you want to monitor.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

79

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Click the "Enable underflow diagnostics" checkbox.

Please see figure above for details.


4

"Wire break"
The power circuit of an analog Current output is not closed.
The following S7-1200 PLC LEDs will blink (color of blinking LEDs: red):

The "ERROR" LED on the CPU.


The "DIAG" LED, if it is a signal module.
The LED of the associated channel.

"Enable wire break diagnostics"

Browse the "Project tree" for the "Device configuration" of your S7-1200 PLC.
Click your signal module in the "Device configuration" window.
Select the "Properties" tab and click the "AI4/AO2" item from the navigation area.
Scroll down to the channel you want to monitor.
Choose the "Current" analog output type.
Click the "Enable wire break diagnostics" checkbox.

Fig 06
5

"Short circuit"
The contacts of an analog Voltage output are short-circuited.
The following S7-1200 PLC LEDs will blink (color of blinking LEDs: red):

The "ERROR" LED on the CPU.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

80

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

The "DIAG" LED, if it is a signal module.


The LED of the associated channel.

"Enable short circuit diagnostics"

Browse the "Project tree" for the "Device configuration" of your S7-1200 PLC.
Click your signal module in the "Device configuration" window.
Select the "Properties" tab and click the "AI4/AO2" item from the navigation area.
Scroll down to the channel you want to monitor.
Choose the "Voltage" analog output type.
Click the "Enable short circuit diagnostics" checkbox.

Fig 07
Table 02
Online diagnostics with STEP 7 Basic
When you have online access to your S7-1200 PLC with STEP 7 Basic, you can use the "Online &
diagnostics" function:

Go online to your S7-1200 PLC.


Browse the "Project tree" for the entry "Online & diagnostics".
Browse the navigation area of the "Online Access" window for the entry "Diagnostics
buffer".
Select a diagnostic error event from the "Events" table.
Beneath the "Events" table, details on the selected event are displayed. Here, you will find
the HW-ID, the channel number, and the event type.

Note
An "Incoming event" shows the beginning of an event.
An "Outgoing event" shows the end of an event.
Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

81

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 08
"IOstate" tag
The following table shows the possible I/O states of the "IOstate" tag.

IO_state Description
Bit 0

Configuration correct:
1, if the configuration is correct ; 0 , if the configuration is no longer correct

Bit 4

Error:
1, if an error is present (for example a wire break) ; 0, if the error is no longer present

Bit 5

Configuration not correct:


1, if the configuration is not correct ; 0 , if the configuration is once again correct

Bit 6

I/O cannot be accessed:


1, if an I/O access error has occurred. In this case, the "ladder" tag contains the
hardware identifier of the I/O with the access error.
0, if the I/O can be accessed once again

Table 03
Requirements

S7-1200 PLC
Ethernet cable
PG / PC
STEP 7 Basic V10.5
Diagnostics-capable signal module / board

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

82

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

How can you use an analog current output with wire break diagnostics on your S7-1200 PLC ?
Description
You can detect a wire break event at an analog current output with the wire break function of STEP 7
Basic. You evaluate a wire break event using the "Diagnostic error interrupt" organization block
(OB82).
In this description, the signal module SM1234 is used. You can use other signal modules or signal
boards with an analog current output instead.
Adding a signal module with an analog current output to the S7-1200 PLC and enabling the wire
break diagnostics
No. Adding a signal module with an analog current output to the S7-1200 PLC and enabling the
wire break diagnostics
1. Add the signal module to the S7-1200 PLC
You will find a description on how to install a signal module or a signal board in Chapter 2,
"Installation", in the S7-1200 System Manual.

Fig. 01
Note
Please find the S7-1200 System Manual .
2. Add the signal module to the device configuration
Browse the hardware catalog for the signal module. Drag and drop it into the S7-1200 rack in the
device configuration.

Fig. 02
3. Configure the analog output channel and enable the wire break diagnostics

Open the "Device configuration" in the "Project tree".


In the "Device view", select the analog signal module.
Browse the "Properties" of the analog signal module for "Analog outputs" > "Channel
0".
Select "Current" as the analog output type.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

83

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Click the "Enable wire break diagnostics" checkbox.

Fig.03
Note
The range of the substitute values is [0...32511]. For a current output of 20mA, the equivalent
substitute value is 27648.

Table 01
Evaluating the wire break event using the "Diagnostic error interrupt" OB
The "Diagnostic error interrupt" OB is called when a module detects an error.
The "Diagnostic error interrupt" OB will interrupt the cyclic program execution if a diagnostics-capable
module, for which the diagnostic error interrupt has been enabled, detects an error.
The signal module will blink the "DIAG" light and the light of the concerned channel.

No. Evaluating the wire break event using the "Diagnostic error interrupt" OB
1. Add "Diagnostic error interrupt" organization block OB82

Browse the project tree for the item "Add new block".
In the "Add new block" window, click the "Organization block (OB)" button.
Select the "Diagnostic error interrupt" OB.
Click the "OK" button.

Note
Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

84

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

You can use only one diagnostic error interrupt OB in your program.

Fig. 04
2. Read-out the start information of the "Diagnostics error interrupt" OB

Browse the instructions pane for "Instructions" > "Move".


Drag and Drop a move instruction into a network of your "Diagnostic error interrupt"
OB.
Move the value of the tag "IOstate" into a global tag (for example "DB1:w_IOstate").
Program the other tags you want to monitor in the same way. Please find an example in
Fig. 05.

Fig. 05
Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

85

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

3. Evaluate the start information of the "Diagnostics error interrupt" OB


The "Diagnostic error interrupt" OB has the following start information:
"IOstate" (WORD)
The "IOstate" contains the I/O status of the diagnostics-capable module.
Please find details on the "IOstate" tag in Table no. 3.
"laddr"(HW-ANY)
This is the hardware-identifier.
The Hardware identifier (HW-ID) identifies modules or functional units of modules (for example
outputs and high speed counter). The hardware identifier consists of a whole number and is
reported by the system along with diagnostics alarms to allow the faulty module or functional unit
to be localized (see Fig. 07 for details).
To identify the functional unit belonging to the HW-ID, browse the "Project tree" for the "PLC
tags" item. Select the "Constants" tab from the "PLC tags" window. The "Value" column holds a
list of the used HW-IDs (Fig. 06).
"Channel" (UINT)
The "Channel" contains the number of the output channel being used on the signal module.
"multierror" (BOOL)
The "multierror" bit indicates that more than one error has occurred.

Fig. 06
Table 02
Online diagnostics with STEP 7 Basic
When you have online access to your S7-1200 PLC with STEP 7 Basic, you can use the diagnostics
function.

Go online to your S7-1200 PLC. The wrench symbol beside your PLC indicates a diagnostic
error (Fig. 07, blue circle).
Browse the "Project tree" for the entry "Online & diagnostics".
Browse the navigation area of the "Online Access" window for the entry "Diagnostics buffer".
Select the wire break event from the "Events" table.

Beneath the "Events" table, details on the selected event are displayed. Here, you will find the HW-ID,
the channel number, and the type event.
Note
Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

86

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

An "incoming event" shows the beginning of an event, in this case a wire break.
An "Outgoing event" shows the end of an event. The signal module will blink the "DIAG" light and the
light of the concerned channel.

Fig. 07
"IOstate" tag
The following table shows the possible I/O states of the "IOstate" tag.

IO_state Description
Configuration correct:
Bit 0

1, if the configuration is correct


0, if the configuration is no longer correct

Error:
Bit 4

1, if an error is present (for example a wire break)


0, if the error is no longer present

Configuration not correct:


Bit 5

1, if the configuration is not correct


0, if the configuration is once again correct

I/O cannot be accessed:


Bit 6

1, if an I/O access error has occurred.


In this case, the "laddr" tag contains the hardware identifier of the I/O with the
access error.
0, if the I/O can be accessed once again

Table 03

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

87

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Requirements

S7-1200 PLC
Ethernet cable
PG / PC
STEP 7 Basic V10.5
Signal module / board with analog current output

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

88

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

How can you use analog 0-20mA signal modules and signal boards with 4-20mA signals ?
Description
You can use analog 4-20 mA input and output signals with the analog 0-20 mA signal modules and
signal boards. You can scale the signal range of the analog inputs and outputs using the
"Scale_current_input" and "Scale_current_output" predefined functions (FCs), which you can find
attached to this FAQ.
Adding the "Scale_current" Global library
1.
2.
3.

Download the attached library, and unzip it. Open the "Libraries" task card.
Click the "Open global library" button. The "Open global library" dialog window opens.
Browse for the "Scale_current" library folder, and open the "Scale_current.al10" file. Now,
the library is displayed in the "Global libraries" pane in the "Libraries" task card.

Fig. 01
Scaling of the analog input
The range of 0-20 mA without the "Scale_current_input" instruction corresponds to the PLCs internal
signal range of 0-27648. The "Scale_current_input" instruction adapts this internal range to 4-20 mA
linearly, starting with "0" for 4 mA and ending up with "27648" for 20 mA. A limit for wire break
monitoring can be chosen by hand.

Fig. 02

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

89

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

No. Scaling of the analog input


1. Insert the "Scale_Current_input" instruction into a network
Browse the Global libraries tree for the "Scale_current_input" FC. Drag and drop this FC into a
network of your S7-1200 PLC program.

Fig. 03
2. Scaling the analog input signal
Connect the contact "w_input_0-20mA" (2) to your analog hardware input (for example, IW96).
You receive the scaled value at the contact "r_input_4-20mA" (4).
Note
For any input value lower than 4 mA the signal at "r_input_4-20mA" (4) will be set to "0".
Accordingly, any input values higher than 20 mA will not exceed the maximum of "27648".

Fig. 04
Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

90

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

3. Wire break monitoring


At the contact "r_wire_break_limit" (1), enter the limit for the wire break monitoring. The value
"2764.8" for example will set the wire break limit to 2 mA. This means, if your input current is
lower than 2 mA, the contact "b_wire_break" (3) will be set to "1".

Table 01
Scaling of the analog output
The range of 0-20 mA without the "Scale_current_input" instruction corresponds to the PLC1 internal
signal range of 0-27648.
The Scale_current_output" instruction adapts this internal range to 4-20 mA linearly, starting with 4
mA for "0" and ending up with 20 mA for "27648".

Fig. 05

No. Scaling of the analog output


1. Insert the "Scale_current_output" instruction into a network
Browse the Global libraries tree for the "Scale_current_output" FC. Drag and drop this FC into a
network of your S7-1200 PLC program.

Fig. 06
Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

91

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

2. Scaling the analog input signal


Connect the contact "r_output_4-20mA" (1) to your software value. You receive the scaled
value at the contact "w_output_0-20mA" (2) to send it to your analog hardware output (for
example, QW96).
Note
For any input value lower than "0", the signal at "w_output_0-20mA" will be set to 4mA.
Accordingly, any input values higher than "27648"will not exceed the maximum of 20mA.

Fig. 07
Table 02
Requirements

S7-1200 PLC
Ethernet cable
signal board / signal module for analog output / input
STEP 7 Basic V10.5

S7-1200_Scale_curre
nt.zip

( 348 KB )

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

92

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

How do you synchronize the time of the HMI Basic Panel with an S7-1200 PLC ?
Description
Synchronize the system time of your HMI Basic Panel with the system time of your S7-1200 PLC by
configuring tags and blocks and incorporating the configuration in your HMI Basic Panel.
Synchronize the time
Detailed instructions for synchronizing the time are available in PDF format in the section "Instructions
for Synchronizing Time" in the file "S7-1200_HMI_time_sync_HowTo.pdf".
The sample project created in the instructions for STEP 7 Basic V10.5 can be downloaded in the section
"Download" in the file "S7-1200_HMI_time_sync_example.zip".
Instructions for synchronizing the time
Contents:
1.
2.
3.

Configuring the S7-1200 PLC


Configuring the HMI Basic Panel
Using the time functions

Double-click the link "S7-1200_HMI_time_sync.pdf" to open the instructions. You need the
Acrobat Reader program for this.

S7-1200_HMI_time_s
ync_HowTo_e.pdf

( 748 KB )

Download
Right-click the link. In the pop-up menu that opens, select the item "Save target as..." and save
the file on your computer. Unpack the file with WinZip program.

S7-1200_HMI_time_s
ync_example.zip

( 1816 KB )

Validity
This FAQ is valid for

S7-1200 PLCs from firmware version V1.0.0.


STEP 7 Basic from V10.5.

Keywords
CPU, Alignment

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

93

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

(folha em branco)

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

94

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

How do you access S7-1200 tags with a panel or RT configured with WinCC flexible 2008 SP2 ?

Core statement
With WinCC flexible 2008 Service Pack 2 all panels with an Ethernet interface that can be configured with
WinCC flexible 2008 and the WinCC flexible 2008 Runtime can access S7-1200 data blocks using absolute
addresses (no symbolic DBs) via the "SIMATIC S7 300/400" driver.

Compatibility
The following items are supported:

Data type: Bool, Byte, Char, DInt, DWord, Int, Real, Time, Word, String, Array
New S7-1200 data type:
o SInt can be connected in WinCC flexible 2008 SP2 as Char
(range: -128 to 127)
o USInt can be connected in WinCC flexible 2008 SP2 as Byte
(range: 0 to 255)
o UInt can be connected in WinCC flexible 2008 SP2 as Word
(range: 0 to 65535)
o UDInt can be connected in WinCC flexible 2008 SP2 as DWord
(range: 0 to 4294967295)
Structures (Struct, IEC_Counter, IEC_Timer, DTL, IEC_SCounter, IEC_DCounter, IEC_UCounter,
IEC_USCounter, IEC_UDCounter, ErrorStruct) are not supported, but elements of structures can be
connected in WinCC flexible 2008 SP2 separately.
Read and write access to peripheral inputs and outputs
Tag multiplexing
Recipes
Discrete alarms
Analog alarms
Screen number
Project ID
Data records
Coordination
Controller jobs

Procedure
The procedure for the communication with WinCC flexible 2008 Runtime is described below.
No. Remarks
1

Create a data block using an absolute address in STEP 7 Basic V10.5 via "Add new block" and
"Global DB".

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

95

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 01
Remove the check mark for the option "Symbolic access only".
2

In the data block, you create the tags that WinCC flexible 2008 will access.

Fig. 02

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

96

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

In WinCC flexible 2008, you create a connection via "Communication > Connections".

Fig. 03

Select "SIMATIC S7 300/400" as the communication driver.


Select "Ethernet" as the interface.
Enter the IP address for the WinCC flexible Runtime and the S7-1200 station.
Select "S7ONLINE" as the operator panel's access point.
Specify "1" as the PLC's expansion slot.

Open the PG/PC interface under "Start > Control panel > Set PG/PC interface".
In the PG/PC interface, you must set the access point "S7ONLINE" to "TCP/IP -> [Used
network card]".

Fig. 04

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

97

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Create the S7-1200 tags using absolute addresses under "Communication > Tags" (compare
with Fig. 02).

Fig. 05
Table 01
Notice
Service Pack 2 for WinCC flexible 2008 is available.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

98

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

With which devices can the S7-1200 communicate via the PN connection ?
Communication partners of S7-1200
The S7-1200 PLC communicates with the following devices via the PN connection:

Other S7 CPUs (S7-200, S7-300, S7-400, S7-1200)


STEP 7 Basic programming devices
Basic panels
Devices that use the TCP communication protocol or ISOonTCP

Maximum number of connections for the PROFINET port


The PROFINET port on the CPU supports the following simultaneous communication connections:

3 connections for HMI to CPU communication


1 connection for programming device (PG) to CPU communication
8 connections for S7-1200 program communication using the T-block instructions (TSEND_C,
TRCV_C, TCON, TDISCON, TSEND, TRCV)
3 connections for a passive S7-1200 CPU communicating with an active S7 CPU:
o The active S7 CPU uses GET and PUT instructions (S7-300 and S7-400) or ETHx_XFER
instructions (S7-200).
o An active S7-1200 communication connection is only possible with the T-block instructions.

Figure 01

Validity
This FAQ is valid from

S7-1200 CPUs with firmware version V1.0.0.


Software version STEP 7 Basic V10.5 without Service Pack.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

99

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

PN connection of the S7-1200


(1) PN connection (Ethernet interface RJ-45) of the S7-1200 PLC:

Figure 02
Supported protocols
The S7-1200 PLC supports the following protocols via the PN connection:

Firmware version

Transmission Control Protocol


(TCP)

ISOonTCP
(RFC 1006)

PROFINET IO
(PNIO)

V1.0.0

--

Table 01
Additional information
More information on this topic is available in chapter 7 in the system manual of the S7-1200 PLC.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

100

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

How do you compensate for the string mismatch caused by the RCV_PTP and SEND_PTP blocks ?
Description
When dealing with string tags, the PTP (point-to-point) communication blocks ignore the specific properties of
maximum string length and actual string length (Fig.01).
When writing data to a string tag, the RCV_PTP block will overwrite the string header data (Fig.02).
When reading data from a string tag, the SEND_PTP block will read the string header information as part of the
virtual string data and send them as well (Fig.03).
Structure of a string tag
A string tag in STEP 7 Basic consists of three parts:

Maximum length of the string


Actual length of the string
Virtual string data

Fig. 01
From the point of view of PTP communication, a string tag consists of the virtual string data only.
Characteristics of the RCV_PTP block
The RCV_PTP block writes the received virtual string data to the prepared string tag in the S7-1200 PLC,
without the necessary length data in the first two bytes. As a result, the processing of this data cannot be
continued, due to the nonexistent string tag header.

Fig. 02
Characteristics of the SEND_PTP block

The SEND_PTP block reads the requested string data including the string header data, which are sent as the first
two bytes of the requested data string.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

101

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 03
Preconditions

The data block (DB), in which the string tag is created, needs to be "non-symbolic".
Absolute addressing of the buffer is required.

Creating a string tag in a non-symbolic data block


Browse the "Project tree" and double-click the item "Add new block" of your PLC. In the "Add new block"
dialog window, click the "Data Block (DB)" button and uncheck the checkbox "symbolic access only". To
match the absolute addresses used in this example, set the number of this data block manually to "2". Click the
"OK" button.

Fig. 04
Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

102

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Browse the "Project tree", and double-click the data-block "Data_block_2 (DB2)". In the "Static" column of the
table, enter a tag with a "String[8]" data type.

Fig.05
Compensation of string mismatch using the RCV_PTP block
For compensation, the string length information has to be handled separately.
In this example, a string tag with a length of eight bytes is used.

No. Compensation of string mismatch using the RCV_PTP block


1. Write the virtual string data into the string tag
To keep the string header data, the received virtual string data needs to be written in the string tag starting
at the third byte. Absolute addressing of the buffer makes thsi possible.
In this example, the string tag has a length of eight bytes. It begins at offset 10.0 (DB2.DBBX10.0), so the
virtual string data begins at offset 12.0 (DB2.DBBX12.0).
The address expression consists of the following items:

Pointer "P#".
Absolute address of the 1st bit of the 3rd byte, (for example DB2.DBX12.0).
Number of bytes you want to write into the string tag, separated by a blank. This should be the
maximum length of the string tag (for example BYTE 8).

Fig. 06

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

103

Um PLC sem Watchdog

2.

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Copy the maximum and actual string length into the string header

Fig. 07
Note
Before you copy the "actual length" value, you need to convert its data type from UINT to BYTE.
Table 01
Compensation of string mismatch using the SEND_PTP block
For compensation, the string length information has to be handled separately.
In this example, a string tag with a length of eight bytes is used.
No. Compensation of string mismatch using the SEND_PTP block
1. Replace the actual string length in the SEND_PTP block

Fig. 08
Note
Before you replace the "#length" value, you need to convert its data type from BYTE to UINT.
2.

Read the virtual string data from the string tag

To prevent the string header data from being sent, the SEND_PTP block needs to start reading at the 3rd
byte of the string tag. Absolute addressing of the buffer makes this possible.
In this example, the string tag has a length of eight bytes. It begins at offset 10.0 (DB2.DBBX10.0), so the
virtual string data begins at offset 12.0 (DB2.DBBX12.0). The address expression is similar to the
expression used in table 01, Figure 06.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

104

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 09
Table 02
Requirements

S7-1200 PLC
Ethernet cable
PC / PG with Ethernet interface
STEP 7 Basic V10.5

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

105

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

(folha em branco)

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

106

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

How can you reduce memory usage with Multi instancing ?


Description
When you call counters or timers in STEP 7 Basic V10.5, the "Call options" dialog appears to assign the
instance data block for this function.

Figure 01
If you call the counter or timer in a function block (FB), you can choose either a "Single Instance" DB or the
"Multi Instance" DB of the FB.
Otherwise, you can only choose a "Single Instance" DB.
Thus, in this case, you generate a single instance DB for every counter or timer, which makes your project
confusing and increases the load memory.
To avoid this situation, you can create a global DB with multi instance properties as follows (example for
counters)
No. Remarks
1

Add a new global DB in your project.

Fig. 02

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

107

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Choose the property "Symbolic access only" property if you want to select several
counters as retentive.
2

Open the new generated DB, and add a static tag using data type "IEC_Counter" (or,
depending on the counter range, one of the other data types: "IEC_SCounter",
"IEC_DCounter", "IEC_UCounter", "IEC_USCounter" or "IEC_UDCounter").

Fig. 03
In the "Retain" column, you can select the counter as retentive:

For DBs with disabled "Symbolic access only", you can select the whole DB
as retentive.
For DBs with enabled "Symbolic access only", you can select several items of
the DB as retentive.

Cancel the "Call options" when calling your counter function.

Fig. 04

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

108

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Double click on the three question marks ("<???>") above the counter block, click on
the "eye" icon (which lists available parameters) and select the newly generated
"Multi_instance_DB".

Fig. 05
By inserting a dot (".") after the symbolic name of the DB, you can choose the required
tag element.
Choose the symbolic name of the added counter structure ("IEC_Counter_0").
5

Repeat step 2 through 4 for every additional counter.

Note

Please find further information about, how the property "Symbolic access only" affects the design of
data blocks .
Please find further information about the SIMATIC S7-1200 in the System Manual or in the help
files of STEP 7 Basic V10.5.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

109

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

(folha em branco)

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

110

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

How many high-speed counters (HSCs) are provided by SIMATIC S7-1200

PLC ?

Description
With the SIMATIC S7-1200 PLC you can use up to 6 high-speed counters.
Depending on the CPU, the signal board and the high-speed counting specification you can use some or
all of them.
The attached document provides detailed information about this, as well as an overview in the summary
to find the solution for your high-speed counting task quickly.
Double-click the link "S7-1200_HSCs.pdf" to open the instructions. You need the Acrobat Reader
program for this.

S7-1200_HSCs_e.pd
f

( 659 KB )

Note

Please find further information about the SIMATIC S7-1200 HSCs in the SIMATIC S7-1200
System Manual or in the help files of STEP 7 Basic V10.5.
If you don't find your selected signal board in STEP 7 Basic V10.5 please update the Hardware
Catalog with the STEP 7 Basic V10.5 Hardware Support Packages .

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

111

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

(folha em branco)

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

112

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

How do you connect a sensor to the analog signal modules of the SIMATIC
Description
A field sensor with the following attributes:

S7-1200 ?

Resolution: 12 bit + sign bit


Range: +/-10V, +/-5V or +/-2.5V for voltage or
Range: 0 to 20 mA for current

can be connected to the following S7-1200 analog signal modules:

SM 1231 AI 4 x 13 Bit
SM 1231 AI 8 x 13 Bit
SM 1234 AI 4 x 13 Bit / AQ 2 x 14 Bit

The measurement type (voltage or current) is selectable in groups of 2 channels.


Sample connections for various sensor types (power supply: 24V DC) to the analog signal module SM
1231 AI 4 x 13 Bit (channel 0) are shown in the figures below:

Figure 01: 4-wire sensor connection

Figure 02: 3-wire sensor connection

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

113

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Figure 03: Current measurement via 2-wire sensor


Note

When using a 4mA to 20mA sensor, you must convert the measured value accordingly.
Please find further information about the SIMATIC S7-1200 in the SIMATIC S7-1200 System
Manual .

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

114

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

How can you back up parameters before loading a new control program ?
Description
When you load a new control program into your S7-1200 with STEP 7 Basic V10.5, all the data is
overwritten. Thus, when you change programs, the plant-specific or optimized parameters are lost.
The current version does not permit uploading of the data block content to an offline project.
Therefore, you must use STEP 7 Basic V10.5 to read out such parameters manually from the relevant
data blocks and configure them as Start values in the new control program.
Backing up and configuring the parameters
No. Procedure:
1

Backing up the parameters from the control program used


Make sure that you can access your S7-1200 online with STEP 7 Basic.

Navigate to your monitoring table (watch table) in the project structure via
"<Project_name>" -> "<CPU_designation>" -> "Watch tables".
In the "Address" column you specify the appropriate absolute addresses of the
parameters required or you specify the corresponding symbolic name in the "Name"
column.
Click on the button for monitoring the parameters. The current values are displayed in
the "Monitor value" column.
Save the values with a screenshot, for example.

Fig. 01
Note
To add a monitoring (watch) table, under "Watch tables" you double-click on the item "Add
new Watch table".
2

Configuring the parameters in the new control program

Open the new control program for your S7-1200.


Navigate to your data block in the project structure via "<Project_name>" ->
"<CPU_designation>" -> "Program blocks".
In the "Initial value" column you configure the values read out previously for your
parameters.
Save your changed project.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

115

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 02
Note
The initial values are transferred when you load into your S7-1200.
Table 01
Validity
This FAQ is valid for

S7-1200 CPUs up to and including firmware version V1.0.0.


STEP 7 Basic V10.5.

Keywords:
Variable, Constant, Remanent, Retentivity

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

116

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

How can you determine the coordinates of your S7-1200 PLC with a standard GPS receiver?
Description
Receive a standard GPS frame of the RMC data type according to the NMEA 0183 standard with your
S7-1200 PLC. The GPS frames are read using a GPS receiver at the RS 232 interface of the S7-1200
CM1241 RS232 communication module.
The "gps_rcv" function block provided by the attached library will provide you with the Latitude and
Longitude value of your actual position.
The "gps_rcv" function block will preset the hardware configuration with the parameters shown in table
01. No additional port configuration of the S7-1200 CM1241 RS232 communication module is
neccessary.
The "gps_rcv" function block is processed in one CPU cycle. The actual position values are only
available in this evaluation cycle.
Please find further information on the tags in table 05.
Communication parameters
This "gps_rcv" function block is designed to work with a standard GPS receiver according to the NMEA
0183 standard. The specifications are:

Parameter

Setting

Baud rate

38400 bit Not tested with other rates, the GPS receiver used only has one rate available.

Parity

No

Data bits

8 bits

8 bits per character

Stop bits

Flow control No

Comment

Table 01
Hardware setup
In this example, a NAVILOCK NL-403P has been used together with a navilock connection cable
(MD6 to RS232).

Fig. 01

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

117

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Preparing the hardware configuration of your S7-1200 PLC

No. Preparing the hardware configuration of your S7-1200 PLC


1. Connect your GPS receiver to your S7-1200 PLC
Follow these steps:

Add a CM 1241 RS232 communication module to your S7-1200 PLC.


Connect your GPS receiver to the communication module.

Note
This standard GPS receiver requires a 5V DC power supply. The communication module does not
provide any power supply for the GPS receiver. Therefore you need an additional 5V DC power
supply (for example a LOGO! POWER 5V DC/3A unit).
2. Add the communication module to the "Device configuration"
Follow these steps:

Browse the "Project tree for the "Device configuration". Select the "Device view" tab.
Drag and drop "Communication module" > "RS232" form the "Hardware catalog" pane
into the device view. Note, that you might need to expand the left side of the S7-1200
rack in the "Device view".

Fig. 02
Table 02
Evaluating the position values of your S7-1200 PLC
Please find an example project in the attached "gps_rcv_proj.zip" zip archive.

No. Synchronizing the system time and date of your S7-1200 PLC
1. Download and open the attached "gps_rcv" S7-1200 global library
Follow these steps:

Download, unzip and open the attached "gps_rcv.zip" S7-1200 global library.
Click the "Open global library" button, browse for the library, and open it.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

118

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 03
2. Connect the "gps_rcv" function block
Follow these steps:

Drag and Drop the "gps_rcv" function block into a cyclic called network.
Connect the inputs and outputs of the "gps_rcv" function block according to table 04.

Fig. 04

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

119

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

3. Note:

The DTL tag does not include a valid "Day of week" value.
The UTC time provided by the RMC GPS telegram does not support nanoseconds but
only milliseconds.

Table 03
Connectors of the "gps_rcv" function block

Connector

cmd_get_
time_n_date

Data
type

Comment

BOOL A rising edge starts the evaluation of an RMC GPS telegram.


The example program has a periodic trigger taken from the clock memory bits.
In the "Device configuration" of your S7-1200 PLC go to the "Properties" tab
and select the "System and clock memory" entry. Check the checkbox to
enable the use of the clock memory byte. Enter a location for the clock
memory byte. In this example the 0,5 Hz memory bit has the location M10.7.

Fig.05

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

120

Um PLC sem Watchdog

cmd_hw_id

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

PORT Enter the HW ID of your communication module. Please find the HW ID in


the "Device configuration" >"Properties of CM1241" > "IO addresses/HW
identifier".

Fig. 06
return_done

BOOL optional; tag is true for the cycle in which the GPS frame was successfully
received.

return_aborted BOOL optional; tag is true for the cycle in which the receive of the GPS frame failed.

Table 04
Tags holding Latitude and Longitude
These tags are accessible via the instance data block of the "gps_rcv" function block (for example,
"gps_rcv_DB.gps_latitude_LReal").

Tag

Data type Comment

"gps_rcv_DB.gps_latitude_LReal"

LReal

This tag holds the actual Latitude position.

"gps_rcv_DB.gps_longitude_LReal"

LReal

This tags holds the actual Longitude position.

Table 05
Creation environment

S7-1200 PLC
Communication module CM1241 RS232
Ethernet cable
PG / PC
STEP 7 Basic V10.5 / STEP 7 Basic V11.0
GPS receiver NAVILOCK NL-403P
Connector cable for NAVILOCK GPS receiver (MD6 to RS 232)

Downloads

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

121

Um PLC sem Watchdog

Software

STEP 7
Basic V10.5

Library

gps_rcv.zip

( 797 KB )

STEP 7
Basic V11.0

gps_rcv_V11.zip

( 638 KB )

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Project sample

Comment

gps_rcv_proj.zip

( 2682 KB )

gps_rcv_proj_V11.zi
p

( 2642 KB )

The navigation tags (longitude and


latitude) are defined as outputs of the
FB175 "gps_rcv" (data type REAL and
LREAL).

Table 06

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

122

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

How can you establish a connection between an S7-1200 PLC and SIMATIC NET OPC?

Description
Please find a detailed description on how to realize a connection between an S7-1200 PLC and
SIMATIC NET OPC V8.0 in the attached pdf-document.
Click the link "S7-1200_OPC_SIMATIC_NET_e.pdf" and save the document to your computer.

39960679_S7-1200_
OPC_SIMATIC-NET_e.pdf

( 820 KB )
Keywords
client, scout

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

123

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

(folha em branco)

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

124

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

How do you implement a weekly timer for the SIMATIC S7-1200 in STEP 7 V11?
Description
You can use the global library "S7-1200_WeeklyTimer" below to implement the function of a weekly
timer in STEP 7 V11.
Instructions
The global library "S7-1200_WeeklyTimer" consists of the three master copies below:

Master
copies

Program
blocks

Parts

Description

Cams_data

Data block with variable required for transfer to the "WeeklyTimer" FB

WeeklyTimer

Function block for controlling a binary output dependent on a weekly


switch-on and switch-off time that can be parameterized.

Cam

PLC data type for transferring a weekly switch-on and switch-off time
(cam) that can be parameterized.

Time

PLC data type for transferring a weekly time (switch-on or switch-off)


that can be parameterized.

Watch
table_1

Watch table for displaying and parameterizing the data block


"Cams_data".

PLC data
types

Watch table

The "WeeklyTimer" function block is called cyclically in the STEP 7 V11 project.

Fig. 01
The "WeeklyTimer" function block consists of the interfaces below:

Data
type

Description

Cam

"Cam"

Transfer of the weekly switch-on and switch-off time (cam).

DTL

DTL

Transfer of the current DTL in time format.

Interface Name

Input

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

125

Um PLC sem Watchdog

Output

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

OUT Boolean

Binary output that is controlled depending on the weekly input and


output time (cam).

The data type has the data structures below:

Data type Element


name
name

Data type

Description

On Time

"Time"

Weekly cam switch-on time

Off Time

"Time"

Weekly cam switch-off time

Weekday

Selection of weekday (multiple choice is possible; if no


Array [1..7] of
weekday is selected, the switch-on or switch-off time is
Boolean
deactivated).

Hour

USInt

Specification of the switch-on or switch-off hour (value


range: 0 to 23).

Minute

USInt

Specification of the switch-on or switch-off minute (value


range: 0 to 59).

Cam

Time

Function description
The "S7-1200_WeeklyTimer" weekly timer is implemented as a function block.
It has a setting cam ("Cam") which you can use to parameterize a time window.
Via the cam you specify the switch-on time ("On Time") and switch-off time ("Off Time") in the form
of the required weekday (1=Sunday...7=Saturday), hour (0...23) and minute (0...59).
You transfer the cam settings via the "Cam" input. Specify "Cam" as data type from a global data block
with parameterization via the start values.
At the "DTL" input you transfer the current time with which the cam setting is to be compared. To read
this out you select the extended date and time statements "RD_SYS_T" and "RD_LOC_T".
At a switch-on time the weekly timer switches on the "OUT" output if it is not already switched on. The
weekly timer resets the output to the switch-off time.
Special features when parameterizing
It is possible to select multiple weekdays.
The shortest switching period is thus one minute.
If no weekday is selected for the switch-on or switch-off time, the parameterized time is irrelevant in
each case.
If the switch-on time and switch-off time (weekday and time) are identical, resetting of the output has
priority.
If multiple cams are required, call the "S7-1200_WeeklyTimer" function block again and connect the
outputs via an OR operation.
Sample project
The download "S7-1200_WeeklyTimer_project.zip" includes a sample project with the cam
specifications below:
Cam 1:
Cam 2:

Monday 08:00 until Tuesday 04:15


Saturday and Sunday 16:30 until 23:10

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

126

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 02: Sample parameterization of Cam 1


Downloads

Version

Library "S7-1200_WeeklyTimer" for STEP 7 V11

Sample project "S7-1200_WeeklyTimer_project" for STEP 7 V11

Code

S7-1200_WeeklyTim
er.zip

S7-1200_WeeklyTim
er_project.zip

( 602 KB )

( 1652 KB )

Note
Service Pack 1 for STEP 7 V11 is available under Entry-ID 51696778.
Requirements

S7-1200
Ethernet cable
STEP 7 (Professional or Basic) V11 SP1

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

127

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

(folha em branco)

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

128

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

With which devices can the S7-1200 communicate via the integrated PROFINET interface and
which protocols support the S7-1200?
Communication partners of S7-1200
The S7-1200 CPU communicates with the following devices via the integrated PROFINET interface:

Other S7 CPUs (S7-200, S7-300, S7-400, S7-1200)


programming devices
HMI devices (e. g. SIMATIC Basic Panals and SIMATIC Comfort Panals)
devices that support Open User Communications

Maximum number of simultaneous, asynchronous communication connections


The S7-1200 CPU supports the following maximum number of simultaneous, asynchronous
communication connections:

connection type

description and max. number of connections

Open User
Communications

The S7-1200 CPU supports 8 connections for Open User Communications


(active or passive) using the following instructions: TSEND_C, TRCV_C,
TCON, TDISCON, TSEND and TRCV.

S7 communication

3 connections for a passive S7-1200 CPU communicating with an


active S7 CPU, that means the S7-1200 is S7 server. The active S7
CPU establishs the connection and uses GET and PUT instructions
(S7-300 and S7-400) or ETHx_XFER instructions (S7-200) to read
and write data.
8 connections for a active S7-1200 CPU communicating with a
passive S7 CPU, that means the S7-1200 is S7 client. The active
S7-1200 CPU establishs the connection and uses GET and PUT
instructions to read and write data.

HMI connections

The S7-1200 CPU provides dedicated HMI connections to support up to 3


HMI devices.

PG connections

The S7-1200 CPU provides connections to support 1 programming device


(PG)

Webserver (HHTP)
connections

The S7-1200 CPU provides connections for the Webserver.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

129

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Figure 01
PROFINET
For PROFINET the S7-1200 CPU supports maximum 8 PROFINET IO devices and 128 submodules,
whichever is reached first.
Validity
This FAQ is valid from:

S7-1200 CPUs with firmware version V1.0.0


STEP 7 Basic V10.5 without Service Pack

Integrated PROFINET interface of the S7-1200


The integrated PROFINET interface of the S7-1200 PLC is a RJ45 socket:

Figure 02

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

130

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Supported protocols
The S7-1200 CPU supports the following protocols via the integrated PROFINET interface:

Protocol

from firmware version

TCP

V1.0

ISO on TCP (RFC 1006)

V1.0

UDP

V2.0

PROFINET RT - Basic Services and IO controller

V2.0

S7 communication (S7 server)

V1.0

S7 communication with PUT / GET instructions (S7 client)

V2.0

Webserver

V2.0

Modbus TCP

V2.1

HTTP - Hyper Text Transfer Protocol

V2.0

HTTPS - Hyper Text Transfer Protocol Secure

V2.0

SNMP - Simple Network Management Protocol

V2.0

LLDP- Link Layer Discovery Protocol

V2.0

DCP - Discovery & Configuration Protocol

V2.0

NTP - Network Time Protocol

V2.0

ARP - Address Resolution Protocol

V2.0

RPC - Remote Procedure Call

V2.0

Additional information
Additional information on communication wih S7-1200 CPU is available in the manual of the S7-1200,
in Entry ID: 36932465.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

131

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

(folha em branco)

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

132

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

How can you access tags of the S7-1200 with WinCC ?

Description
It is possible to access tags of the S7-1200 from WinCC via the OPC.
For this, you create a PC station with an OPC server. You can access the OPC server with WinCC.
A detailed description of the required procedure is available in chapters 1 to 5 of the PDF in Entry ID
39960679.

Validity
This FAQ is valid for

S7-1200 CPUs up to and including firmware version V1.0.2.


WinCC up to and including version V7.0 SP2.

Keywords
HMI

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

133

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

(folha em branco)

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

134

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

How can you change the IP address of an S7-1200 without using STEP 7 Basic?
Description
The S7-1200 tool enables you to specify the IP address of one or several S7-1200 CPUs without using
the STEP 7 Basic software.
This tool is particularly useful for mass filling; if, for example, you download a project by means of a
memory card to multiple CPUs in a network and then have to change the IP address for each CPU.
Setting the PG/PC interface

No.
1. Click the "PG/PC Interface" button.

Fig. 01
2.

1.
2.

3.

Select the access point below for the application: "S7IPTool".


For "Interface Parameter Assignment Used:" you select "TCP/IP" and the network card
you are using. You achieve the best results with the "TCP/IP(Auto)" for automatic
configuration of the network card you are using.
Apply the settings with "OK".

Fig. 02
Table 01

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

135

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Manual assignment of an IP address for your S7-1200

No.
1. Double-click the "Update accessible devices" button to update the list of accessible nodes.

Fig. 03
2. The S7-1200 tool displays the MAC address of CPUs without an assigned IP address.

Fig. 04
3.

1.
2.

Select the CPU to be configured from the list of accessible devices.


Click the "Flash LED lights" button to flash the status LEDs of the CPU selected.

Fig. 05
4. Click the "Stop CPU" button to put the CPU into STOP mode.

Fig. 06

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

136

Um PLC sem Watchdog

1.
2.

5.

3.

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Specify the IP address, subnet mask and gateway address for the CPU selected.
Then click the "Set" button.
If you enable the "Set as Default" option, the current settings are saved as "Default"
settings when you click the "Set" button.
Click the "Use Defaults" button to load the saved "Default" settings.

Fig. 07
6. Click the "Start CPU" button to put the CPU into RUN mode.

Fig. 08
Table 02
Network Mapping

No.
1. Mark the network card folder in the tree view.
A table is displayed listing all the connected S7-1200 CPUs.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

137

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 09
2. Click the "Export..." button to generate a CSV file with the current network settings of all the
connected S7-1200 CPUs.
Save this file on your computer.

Fig. 10
3. Open the exported CSV file with Notepad.
Each line in the CSV file contains a MAC address, IP address, subnet mask and gateway address
for each separate S7-1200 CPU.
You can change the network settings of each CPU as required. You must not change the MAC
address.
You can use the "#" character to insert comments in the CSV file.

Fig. 11

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

138

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

4. Click the "Import..." button and select the modified CSV file from Step 3.

Fig. 12
5. Your changes are shown in the Network Mapping table .
Click the "Update" button to apply the new network settings of all the CPUs.

Fig. 13
6.

A green circle next to the S7-1200 CPU indicates that the update has been successful.
A red circle indicates that the update has failed.
A yellow circle indicates that the S7-1200 CPU is in the process of being updated.

Fig. 14
Table 03

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

139

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Additional Functions

No.
1. Click the "Fault Capture" button to read out system information from the selected S7-1200 CPU.
This information can be forwarded to Siemens for analysis.

Fig. 15
2. Click the "Reset To Factory Defaults" button to reset the selected S7-1200 CPU back to its
original factory settings. All the data including the IP address will be deleted.

Fig. 16
Table 04
Requirements

Operating system: Windows XP, Windows Vista or Windows 7 (32-bit versions are supported)
S7-1200
Ethernet cable
PC/PG with Ethernet interface
S7-1200 Tool V2.0.0.5

S7-1200Tool.zip

( 55566 KB )
Keywords
IPTool, IP TOOL, IP-Tool

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

140

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

What is the connection between subnet masks and IP addresses with regard to subnetting and
supernetting (classless inter domain routing CIDR)?
Configuration Notes
With CIDR, there is no fixed assignment of an IP address to a network class and possible subnetting in
other networks or supernetting of several networks in a class. There is only one network mask that splits
the IP address into a network part and a host part.
The CIDR function (classless inter domain routing) thus includes subnetting and supernetting.
The following Industrial Ethernet CPs support the "Subnetting" function and "Supernetting" function:

6GK7343-1EX21-0XE0 from firmware V1.2 onwards


6GK7343-1EX30-0XE0
6GK7343-1GX21-0XE0 from firmware V1.1 onwards
6GK7343-1GX30-0XE0
6GK7343-1CX10-0XE0
6GK7343-1FX00-0XE0
6FL4343-1CX10-0XE0
6GK7443-1EX20-0XE0
6GK7443-1EX40-0XE0 from firmware V2.4 onwards
6GK7443-1EX41-0XE0
6GK7443-1GX20-0XE0

The following CPUs with integrated PROFINET interface support the "Subnetting" function and
"Supernetting" function:

IM151-8(F) PN/DP CPU


IM154-8(F) CPU
CPU 314C-2PN/DP
CPU315(F)-2PN/DP from firmware V2.3 onwards
CPU317(F)-2PN/DP from firmware V2.3 onwards
CPU319(F)-3PN/DP
CPU412-2 PN
CPU414(F)-3PN/DP
CPU416(F)-3PN/DP
S7-1200 CPUs from firmware V1.0 onwards

The following Industrial Ethernet PC modules support the "Subnetting" function and "Supernetting"
function:

CP1616 from V2.0


CP1604 from V2.0

It is only possible to configure the "Subnetting"function for the remaining Industrial Ethernet PC
modules like IE general, CP1613 (A2), CP1623, CP1612 and CP1512. It is not possible to configure the
"Supernetting" function in STEP 7 / NCM PC for these modules. This is prevented in STEP 7 / NCM
PC by an error message (see Fig. 05).
In these modules that support the TCP/IP protocol it is possible to set both the IP address and the
associated subnet mask in the hardware configuration of STEP 7. The IP address and associated subnet
mask are entered in the Properties window of the CP's or CPU's Ethernet interface. After inserting the
Industrial Ethernet CP or CPU with integrated PN interface in the hardware configuration, you are
offered the following default settings (see Fig. 01) in the Properties window of the CP's or CPU's
Ethernet interface.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

141

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

IP address: 192.168.0.1
Subnet mask: 255.255.255.0

Fig. 01: Properties window of a CP's Ethernet interface


If you wish to change these default settings for the IP address and subnet mask, you need information on
the connection between classes of IP addresses and subnet masks. The following makes clear the
connection between classes of IP addresses and subnet masks.
Connection between class of the IP address and subnet mask
In principle there are 5 classes of IP addresses. These are the classes A to E. Each class has its own
subnet mask. The connections are given in the table below.

Class Class bits IP network address range

Subnet mask

Network share Computer share

0xxxxxxx 0.x.x.x - 127.x.x.x

255.0.0.0

1 byte

3 bytes

10xxxxxx 128.0.x.x - 191.255.x.x

255.255.0.0

2 bytes

2 bytes

110xxxxx 192.0.0.x - 223.255.255.x

255.255.255.0 3 bytes

D & E 111xxxxx 224.0.0.0-255.255.255.255

---

1 byte

Multicasting addresses

Class A network
IP addresses from Class A begin with the bit sequence 0-..., e.g. the IP address range lies between
0.x.x.x and 127.x.x.x.
Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

142

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

The subnet mask identifies the range that includes the address information for identifying the subnet. In
Class A networks the first byte, that is to say the first 8 bits correspond to the IP address of the subnet
address. Thus Class A networks are defined by the following subnet mask: 255.0.0.0 = 1111 1111 0000
0000 0000 0000 0000 0000. The last three bytes (24 bits) of the IP address identify a node in this
subnet.
The total number of Class A networks can be calculated as follows:

28-1-2 = 27-2 = 126 networks (since the IP address always begins with the bit sequence 0-...,
0.0.0.0 and 127.0.0.0 are not permitted)

The number of computers in a Class A network can be calculated as follows:

224-2 = 16 777 214 computers (x.0.0.0 -> network address and x.255.255.255 -> broadcast
address are not permitted)

Fig. 02: Class A network


Class B network
IP addresses from Class B begin with the bit sequence 1-0-... and the address range lies between
128.0.x.x and 191.255.x.x. In Class B networks the first two bytes, that is to say the first 16 bits
correspond to the IP address of the subnet address. Thus Class B networks are defined by the following
subnet mask: 255.255.0.0 = 1111 1111 1111 1111 0000 0000 0000 0000. The last two bytes (16 bits)
identify a node in this subnet.
The total number of Class B networks can be calculated as follows:

216-2 = 214 = 16384 networks (since the IP address always begins with the bit sequence 1-0...)

The number of computers in a Class B network can be calculated as follows:

216-2 = 65534 computers (x.x.0.0 -> network address and x.x.255.255 -> broadcast address are
not permitted)

Fig. 03: Class B network

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

143

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Class C network
IP addresses from Class C begin with the bit sequence 1-1-0... and the address range lies between
192.0.0.x and 223.255.255.x. In Class C networks the first three bytes, that is to say the first 24 bits
correspond to the IP address of the subnet address. Thus Class C networks are defined by the following
subnet mask: 255.255.255.0 = 1111 1111 1111 1111 1111 1111 0000 0000. The last byte (8 bits)
identifies a node in this subnet.
The total number of Class C networks can be calculated as follows:

224-3 = 221 = 2 097 152 networks (since the IP address always begins with the bit sequence 1-10...)

The number of computers in a Class C network can be calculated as follows:

28-2 = 254 computers (x.x.x.0 -> network address and x.x.x.255 -> broadcast address are not
permitted)

Fig. 04: Class C network


Class D subnetwork
The class D subnetwork consists of special addresses that are used for multicast addressing.
This splitting up of IP addresses in network share and computer share leads to the following
conclusions:

A Class A network is larger than a Class C network, because there is a much greater address
area available for addressing the computers.
There are much less Class A networks than Class C networks because the address area of the
subnets is much smaller.

Reserved addresses

The Class A network address 127.x.x.x is reserved for the Loopback function of all
computers, i.e.:
all IP addresses that have the value 127 in the first byte may only be used for internal tests of
computers.
The 255 values are reserved as broadcast addresses. Thus, for example, the address
140.80.255.255 is a broadcast address to all computers in the Class B network 140.80.0.0.
The following ranges are reserved for private networks. All IP addresses in these ranges are not
routed in the Internet.
10.0.0.0 - 10.255.255.255
172.16.0.0 - 172.31.255.255
192.168.0.0 - 192.168.255.255

Until now, the connection between the class of the IP address and subnet mask has been explained.
Furthermore, it is possible to extend the subnet mask with the so-called "Subnetting" procedure.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

144

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Subnetting
Subnetting can be implemented in a Class A network, for example. It is possible to divide the computers
of this Class A network into further logical units (subnets). We will observe the Class A network
86.x.x.x as an example. The subnet mask of this Class A network is 255.0.0.0 (1111 1111 0000 0000
0000 0000 0000 0000). The address area can be divided further into logical subnets by extending the
subnet mask by 1 bit. The subnet mask is then 255.128.0.0 (1111 1111 1000 0000 0000 0000 0000
0000).
This means the following for addressing:

Only the addresses 86.0.0.1 to 86.127.255.254 can communicate directly with each other, i.e.
without router, because these computers have the same value (in this case "0") in the first bit
after the subnet mask.
Only the addresses 86.128.0.1 to 86.255.255.254 can communicate directly with each other, i.e.
without router, because these computers have the same value (in this case "1") in the first bit
after the subnet mask.
The address area of the computers in this Class A network has been divided into two subnets.

Conclusion
By extending the subnet mask you can divide the address area of the computers into more logical units
(subnets). The address area has been divided into two subnets in the example. By adding more bits you
can quickly multiply the number of subnets. You can extend a subnet as you wish.
Supernetting
Supernetting is the grouping together of multiple networks with partially the same network share in one
single route. The underlying technology is the opposite to subnetting and in principle means a procedure
for addressing a large number of hosts within one IP network. With supernetting the host share of a
network class is increased. Thus the network share of this network class is decreased.
We will observe the Class C network 192.168.178.0 as an example. The subnet mask of this Class C
network is 255.255.255.0 (1111 1111 1111 1111 1111 1111 0000 0000). Now 2 bits are added to the
host share. The subnet mask is then 255.255.252.0 (1111 1111 1111 1111 1111 1100 0000 0000).

The lowest IP address of the network to be assigned is


192.168.176.1 (1111 1111.1111 1111. 1011 0000. 0000 0001)
The highest IP address of the network to be assigned is
192.168.179.254 (1111 1111.1111 1111. 1011 0011. 1111 1110)
The addresses 192.168.176.1 to 192.168.179.254 can communicate directly with each other,
i.e. without router.

Requirement
The use of the "Supernetting" function requires that the modules in the network support the function
"classless inter domain routing" (CIDR).
Note:
If the module configured in STEP 7 does not support the "Subnetting" unction or the "Supernetting"
function, then use of these functions is prevented by an error message in STEP 7 (see Fig. 05 "STEP 7
error message").
The input of subnet masks in the form 255.5.0.0 = 1111 1111 0000 0101 0000 0000 0000 0000 is
prevented by STEP 7. Here, it is not the next two consecutive bits that are used for subnet addressing,
but any two other bits. Since this method is very difficult to handle and provokes very many user errors,
we strongly recommend not to use it. STEP 7 prevents configuration of such a subnet mask in the
Properties window of the CP's Ethernet interface by output of the following error message.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

145

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

Fig. 05: STEP 7 error message


The subnet mask must always contain a series of "1" values without interruption by a zero. The STEP 7
Online Help gives the following information.

Fig. 06: STEP 7 Online Help


Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

146

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

How does startup work in an S7-1200?


Description
The startup mode "Warm restart - operating mode before POWER OFF" is set by default in the device
configuration. This prevents the CPU from changing unintentionally to the RUN mode during the
commissioning phase when the power returns. An unintentional change to the RUN mode will set the
outputs and start any machines to which the outputs are connected. However, with this default setting
you need a PG with STEP 7 V10.5, STEP 7 V11 or the S7-1200 Tool (see Entry ID 41737437) to be
able to change the CPU from STOP mode to RUN mode. The CPU can change to STOP mode for one
of the following reasons:

Inserting an SD card
Failure of an expansion module
Other reasons

If STOP mode occurs, you need software for changing to RUN mode.
Remedy
We recommend setting the startup mode "Warm restart RUN". Then, the CPU changes automatically
back into RUN mode when power returns. In this way, neither you nor your customers need customer
supports assistance to set the CPU back into RUN mode.
The table below shows the startup modes of the S7-1200 CPU.

Startup mode

CPU behavior

No startup

CPU remains in STOP mode.

Warm restart RUN

CPU goes into RUN mode when power


returns.

Warm restart - operating mode before POWER OFF CPU goes into the same mode as before loss of
power.

Note
As from STEP 7 V11 and firmware version V2.0 you have the option of changing operating modes
using the web server if activated.
Proceed as follows.
1.
2.
3.
4.

Open the internet browser and start the web server.


Log on as "admin".
Select the "Start page".
Use the "Go to RUN" and "Go to STOP" buttons to change the operating mode accordingly.

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

147

Um PLC sem Watchdog

[001] FAQs do micro PLC S7-1200 da SIEMENS (Simatic)

(folha em branco)

Doc. tcnico do blog Um PLC sem WatchDog (www.plcsemwatchdog.blogspot.com)

148

Das könnte Ihnen auch gefallen