show the entry list

STEP 7 (TIA Portal) -- Creating S7 programs -- Calling blocks and functions 
How do you program and parameterize Modbus/TCP communication between S7-1500 CPUs and S7-1200 CPUs? 
What should you watch out for in STEP 7 (TIA Portal) when transferring FC and FB parameters for new S7-1200/S7-1500 controllers? 
What is the maximum number of parameters you are allowed to define in STEP 7 (TIA Portal) for a function in the S7-1200/S7-1500 CPU? 
How do you read out the IP address of the PROFINET interface of a S7-1500 CPU in the user program? 
How do you program and parameterize Modbus TCP communication between two S7-1200 CPUs? 
In STEP 7 (TIA Portal), how can you read out diagnostics data of a hardware object with the GET_DIAG instruction? 
What are the block protection facilities available in STEP 7 to protect the the know-how of your blocks? 
Why is the "GET_NAME" instruction not executed in STEP 7 (TIA Portal) V12? 
Why should whole structures instead of many single components be transferred for the S7-1500 when a block is called? 
What differences should you watch out for between optimized data storage and the standard type of block access in STEP 7 (TIA Portal) V12? 
What types of access, value columns and operator input options are available for the global data blocks in STEP 7 (TIA Portal) V12? 
How do you program the TSEND_C and TRCV_C instructions for open user communication over the integrated PROFINET interface of the S7-1200 CPU? 
How do you program the TC_CONFIG instruction to change the parameters of a CP1242-7 configured in STEP 7? 
How are the automatic PID controller settings (optimization) made for asymmetrical temperature control paths in STEP 7 (TIA Portal) V11 and higher? 
How do you change the pulse length for the pulse width modulation (PWM) in the user program of the S7-1200 CPU? 
How do you compile blocks with know-how protection in STEP 7 (TIA Portal) V11 when they have been copied from another project? 
Where can you download the F FBs for the Mobile Panel 277F IWLAN for the Safety option of STEP 7 V5.5, STEP 7 Professional V11 and STEP 7 Professional V12? 
Which organization blocks can you use in STEP 7 (TIA Portal)? 
How in STEP 7 V11 do you save the value of an "HSC" (high-speed counter) for the S7-1200 after STOP mode or after a restart? 
Which Motion Control functions are there in STEP 7 (TIA Portal) V11 and how do you use these functions? 
In STEP 7 (TIA Portal) how do you configure data blocks with the "Only store in load memory" attribute? 
How do you open blocks that are know-how protected in STEP 7 V11 in a different project when they have been downloaded from the CPU? 

How do you program and parameterize Modbus/TCP communication between S7-1500 CPUs and S7-1200 CPUs?Go to beginning
Part number:

Description
Modbus/TCP communication between S7-1500 CPUs and S7-1200 CPUs is presented. The instructions "MB_CLIENT" and "MB_SERVER" are called and parameterized in the user program of the S7-1500 CPU and the S7-1200 CPU.

The "MB_CLIENT" instruction communicates as Modbus/TCP client over the PROFINET connection of the CPU. You use the "MB_CLIENT" instruction to establish a connection between the client and the server, send requests and receive responses, and control disconnection of the connection.

The "MB_SERVER" instruction communicates as Modbus/TCP server over the PROFINET connection of the CPU. The "MB_SERVER" instruction processes connection requests of a Modbus/TCP client, receives requests from Modbus functions and sends response messages.

In this example a Modbus function is demonstrated via two Modbus/TCP connections.
The S7-1500 CPU establishes the first connection as Modbus TCP client. The S7-1200 CPU is Modbus TCP server.
The S7-1200 CPU establishes the second connection as Modbus TCP client. The S7-1500 CPU is Modbus TCP server.

The Modbus/TCP connections are established each via a block pair (MB_CLIENT and MB_SERVER).


Fig. 01

The document below describes the following:

  • Call and parameterization of the "MB_CLIENT" and "MB_SERVER" instructions in the user program of the S7-1500 CPU.
  • Call and parameterization of the "MB_CLIENT" and "MB_SERVER" instructions in the user program of the S7-1200 CPU.

NET_Modbus_TCP_S7-1500_S7-1200_en.pdf ( 2594 KB )

Download
The download includes the "ModbusTCP_S71500_V13.zip" project.
Copy the "ModbusTCP_S71500_V13.zip" file into a separate directory and then start the file with a double-click. You can then use STEP 7 to open and process the extracted project data.

ModbusTCP S71500_V13.zip ( 4883 KB )

Further Information
Detailed information about the "MB_CLIENT" und "MB_SERVER" instructions is available in Entry ID 89515142.

Creation environment
The pictures and downloads in this FAQ response were created with STEP 7 Professional V13.

What should you watch out for in STEP 7 (TIA Portal) when transferring FC and FB parameters for new S7-1200/S7-1500 controllers?Go to beginning
Part number:

Description
The following description applies to S7-1200 and S7-1500 firmware V4.0 and higher.

During program execution, the block parameters in STEP 7 (TIA Portal) are processed differently by functions and function blocks. A distinction is made between two types of access:

  • Parameters are transferred as parameter pointers. The calling block can directly access the operand which is specified as the actual parameter.
    • Writing a parameter in the called block leads to modification of the actual parameter in the calling block.
    • Read access to a block parameter reads the actual parameter directly.
  • Parameters are transferred as copies. The called block always works with the value that the actual parameter had when the block was called.
    • When the block is called, the value of the actual parameter is copied to the temporary data of the calling block.
    • Writing a parameter in the called block does not lead to modification of the actual parameter in the calling block.
    • Read access accesses the formal parameter, not the actual parameter.

Elementary data types (E, A, M, P, L) are not transferred as pointers but as copies (In, Out and InOut).

In the case of structured data types parameterized at the InOut interfaces

  • A pointer to the structure or to the PLC data type is transferred if the block access is identical (optimized in each case or not optimized in each case).
  • The structure or the PLC data type is transferred as copy if the block access is different (optimized and not optimized).

In the case of new controllers the cyclic program execution is interrupted by an HMI communication request, because the HMI communication has a higher priority than the cyclic program execution.

Once the block has been run through, the values transferred as copies are written back. In this way the values changed by the visualization while the block is being run through are changed again on completion of the block.

Further Information
Further information is available in the system manual of STEP 7 (TIA Portal) in Entry ID 89515142 on page 2190.
Further information is also available in the STEP 7 (TIA Portal) Online Help under "Access to block parameters during program execution".

What is the maximum number of parameters you are allowed to define in STEP 7 (TIA Portal) for a function in the S7-1200/S7-1500 CPU?Go to beginning
Part number:

Description
The maximum number of parameters for an S7-300/S7-400/S7-1200/S7-1500 CPU is limited to 126 for a function (FC). These can be IN, OUT or IN_OUT parameters. In addition to the limitation of the FC parameters for all CPU modules there are additional restrictions for the S7-1200/S7-1500. With these modules the precise number also depends on the selected data types, sections and other factors.

Note
Unlike the functions, the number of parameters for a function blocks in an S7-300/S7-400/S7-1200/S7-1500 CPU is not limited to a specific number, but is restricted by the maximum size of the instance data block.

Additional Keywords
Restriction

How do you read out the IP address of the PROFINET interface of a S7-1500 CPU in the user program?Go to beginning
Part number:

Description
This entry shows how to read out the IP address of the PROFINET interface of a S7-1500 CPU in the user program. You read out the IP address using the system function block SFB52 "RDREC".

The sample program supplied in this entry includes the function block FB10 "Read_IP". The FB10 "Read_IP" internally calls the SFB52 "RDREC" to read out the address parameters of the PROFINET interface of an S7-1500 CPU.


Fig. 01

Note
The FB10 "Read_IP" can also be used on an S7-1200 CPU to read out the IP address of the integrated PROFINET interface. The S7-1200 CPU also supports the data record w#16#8080.

The document below includes a description of the function block FB10 "Read_IP" and the system function block SFB52 "RDREC".

NET_Read_IPAddress_S7-1500_en.pdf ( 610 KB )

Download
The download contains the project "Read_OwnIpAddress.zip".
Copy the "Read_OwnIpAddress.zip" file into a separate directory and then start the file with a double-click. You can then use STEP 7 to open and process the extracted project data.

Read_Own_IPaddress.zip ( 3242 KB )

Further Information

  • Detailed information about STEP 7 Professional V12 SP1 Upd2 (TIA Portal) is available in the manual in Entry ID 77991795.

Creation environment
The screens and downloads in this FAQ response were created with STEP Professional V12 SP1 Upd2 (TIA Portal).

How do you program and parameterize Modbus TCP communication between two S7-1200 CPUs?Go to beginning
Part number:

Description
Modbus TCP communication between two S7-1200 CPUs is presented. The instructions "MB_CLIENT" and "MB_SERVER" are called and parameterized in the user program of the S7-1200 CPU.

The "MB_CLIENT" instruction communicates as Modbus TCP client over the PROFINET connection of the S7-1200 You do not need any additional hardware to use the instruction. You use the "MB_CLIENT" instruction to establish a connection between the client and the server, send requests and receive responses, and control the connection disconnection of the Modbus TCP server.

The "MB_CLIENT" instruction communicates as Modbus TCP server over the PROFINET connection of the S7-1200 You do not need any additional hardware to use the instruction. The "MB_SERVER" instruction processes connection requests of a Modbus TCP client, receives requests from Modbus functions and sends response messages.

In this example 5 Modbus functions are presented. For each Modbus function a Modbus TCP connection is established over a Modbus block pair (MB_CLIENT and MB_SERVER).

The following figure shows an overview of the Modbus functions presented in this example and the Modbus block pair assignment.


Figure 01

The document below describes the following:

  • Call and parameterization of the "MB_CLIENT" in the user program of the Modbus/TCP client.
  • Call and parameterization of the "MB_SERVER" in the user program of the Modbus/TCP server.

83130159_NET_S7-1200_MODBUS_TCP_en.pdf ( 1219 KB )  

Download
The download includes the "Modbus_TCP_S7-1200.zip" project.
Copy the "Modbus_TCP_S7-1200.zip" file into a separate directory and then start the file with a double-click. You can then use STEP 7 to open and process the extracted project data.

Modbus_TCP_S7-1200.zip ( 3281 KB )

Further Information
Detailed information about STEP 7 Professional V12 SP1 (TIA Portal) is available in Entry ID 77991795.

Creation environment
The screens and downloads in this FAQ response were created with STEP 7 Professional V12 SP1 Upd2.

In STEP 7 (TIA Portal), how can you read out diagnostics data of a hardware object with the GET_DIAG instruction?Go to beginning
Part number:

Description
The GET_DIAG instruction for the LAD/STL/FBD editor and also for SCL is in the "Instructions" task card under "Advanced instructions > Diagnostics". Drag-and-drop the "GET_DIAG" instruction to the program editor and parameterize the IN, OUT and InOut parameters. The following examples show how to read out the diagnostics information of a hardware object for an S7-1500.

Using the GET_DIAG (SFC117) instruction you can evaluate all the system messages received in the CPU. Detailed information is also available in the STEP 7 (TIA Portal) Online Help:

  • Look under "GET_DIAG: read diagnostics information"
  • Mark the GET_DIAG instruction and press the "F1" key.

Fig. 01 shows the call and parameters of the GET_DIAG instruction in the LAD programming language. With "1" at the MODE parameter you define which diagnostics data of the addressed hardware object is to be output. Here you need the DIS structure for defining the diagnostics status.


Fig. 01

Fig. 02 shows the call and parameters of the GET_DIAG instruction in the SCL programming language. With "2" at the MODE parameter you define which diagnostics data for the lower-level modules of the addressed hardware object is to be output. Here you need the DNN and Diagnostic Details structures for defining the diagnostics status.


Fig. 02

In order to deliver the structures to the "DIAG" and "DETAIL" parameters of the GET_DIAG instruction you must define in a data block variables of the data types "DIS", "DNN" and "Diagnostic Details". You parameterize these structured DB variables with parameters of the data type "Variant". Fig. 03 shows a declaration of the DB variables in the "Diag_DB" data block.


Fig. 03
 
Name of the DB variables Structured data type Parameterization of the
"Variant" data type
Ai_Dis DIS "Diag_DB".Ai_Dis
Ai_Dnn DNN "Diag_DB".Ai_Dnn
Ai_Diagdetail DiagnosticDetail "Diag_DB".Ai__Diagdetail

At the "LADDR" parameter you define the hardware identifier. 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 hardware identifier (HW ID) of a functional unit in the "Properties" tab of the "Device configuration". Select the "HW identifier" item in the navigation area (see Fig. 04).


Fig. 04

After saving, compiling and downloading the project into the CPU you can read out the diagnostics data in the monitoring table. Enter the DB variables into the monitoring table as shown in Fig. 05 and click the spectacles symbol. Fig. 05 shows the monitoring values of the DB variable "Diag_DB".AI_Dis (Structure DIS).


Fig. 05

According to the table for the DIS structure from the STEP 7 (TIA Portal) Online Help, the following information can be obtained for diagnosis:

  • Errors in at least one channel or component
  • PNIO module, isolated
  • Maintenance status of the module: Error

Note
Do not enter the setup of the structures yourself manually, but just the name of the structure in the "Data type" column. Otherwise you might get this error message after downloading: "8081: the selected mode does not support the type at the DIAG parameter". If you enter the variable with the required data type (DIS, for example) in the data block, the system automatically creates the structure. The data type itself is not in the selection window.

Creation environment
The screens in this FAQ response were created with STEP 7 (TIA Portal) V12.

What are the block protection facilities available in STEP 7 to protect the the know-how of your blocks?Go to beginning
Part number:

Description
STEP 7 V5.x and STEP 7 (TIA Portal) provide various block protection facilities to protect the know-how of your programs in the blocks against unauthorized persons. You can also encrypt programs created in S7-SCL, S7-GRAPH and CFC and protect the block code against unauthorized access. The program code, the temporary/static variables and the network comments are then not displayed. It is not possible to change the protected block. The following table gives you an overview of the know-how protection facilities.
 
SIMATIC STEP 7  Setting up block protection Password

STEP 7 V5.x

LAD / FBD / STL Input: "KNOW_HOW_PROTECT" in the STL source
Additional information is available in Entry ID: 10025431
No
S7-SCL Input: "KNOW_HOW_PROTECT" in the S7-SCL source
Additional information is available in Entry ID: 14761527
No
S7-GRAPH Input: "KNOW_HOW_PROTECT" in the S7-GRAPH source
Additional information is available in Entry ID: 10024793
No
CFC Enable the "KNOW_HOW_PROTECT" function
in the CFC chart and SCL source
Additional information is available in Entry ID: 14761890
No
STEP 7 V5.5
LAD / FBD / STL / SCL Using the function: S7-Block Privacy
Additional information is also available in Entry ID 45632073
Yes

STEP 7 (TIA Portal)

(S7-300/400)
LAD / FBD / STL / SCL / GRAPH
Enable the block protection with the "Edit > Know-How Protection" function

Additional information is available in the STEP 7 (TIA Portal) Online Help under:

  • Setting up know-how protection
  • Opening know-how protected blocks
  • Removing know-how protection
Yes
(S7-1200)
LAD / FBD / SCL
(S7-1500)
LAD / FBD / STL / SCL

Why is the "GET_NAME" instruction not executed in STEP 7 (TIA Portal) V12?Go to beginning
Part number:

Description
The "GET_NAME" instruction reads out the name of a device that is displayed in the Network View and in the Properties of the module. Refer to the information in the STEP 7 (TIA Portal) V12 Online Help under "GET_NAME: Reading the name of a module".

  • The "LADDR" parameter must include the hardware ID of the PROFINET IO system and the "STATION_NO" parameter the device number.
  • The "DATA" parameter must be parameterized with a variable of the "VARIANT" data type. More information about how to use the "VARIANT" data type is available in Entry ID: 42603286.
  • The area addressed by the "DATA" parameter must be at least as long or longer than the length of the module name at the "LEN" parameter.
  • When using the "GET_NAME" instruction we recommend that for remote devices the station name and the name of the header module (device) are identical.

Note
In STEP 7 (TIA Portal) V12, the "STATUS" parameter does not output the expected error code "W#16#8093" if you do not parameterize the "DATA" parameter correctly. This behavior will be cleared with SP1 (Service Pack 1).

Note on the "LADDR" parameter
Using the "LADDR" parameter you can interconnect the name of the module. A system constant is created under this name, which ensures correct interconnection. Of course, you can still also enter the hardware ID.

Why should whole structures instead of many single components be transferred for the S7-1500 when a block is called?Go to beginning
Part number:

Description
In this entry we deal with the topic of the "Transfer of whole structures instead of many single components" and the different ways of proceeding in STEP 7 V5.x and STEP 7 (TIA Portal) V12.

You can create your programs so that whole data records (machine data, recipes, ...) can be processed in different blocks, whereby each block processes part of the data. Synchronization of the processing is done using the data record with simple transfer of data.

Procedure in STEP 7 V5.x
In STEP 7 V5.x you structure the declarations in data blocks mostly as an anonymous structure. The blocks themselves are then written in such a way that the values of the structure are transferred as actual parameters and the calculated values are copied back into the structure. You can also transfer the DB number and address absolutely in the block. Here you must note that the number of parameters that you have to supply is often very large. The actual data is stored in the DBs and the calculated values are transferred again to other blocks. Symbols are no longer available for the transfer of the data block variables.

Procedure in STEP 7 TIA Portal
You can transfer structures as parameters also in STEP 7 (TIA Portal). If a block has an input parameter of the STRUCT type, as actual parameter you must transfer a STRUCT with the identical structure. This means that the names and data types of all structure components must be identical. You can also transfer single elements of a STRUCT as actual parameters if the element corresponds to the data type of the formal parameter. We recommend programming structures as PLC data types. PLC data types make the programming easier for you because they can be used many times over and changed centrally.

  1. Create a data record description as the structured PLC data type with an appropriate name like "Machine data", for example.
  2. Use this data type for declaring a data block or a DB variable.
  3. Define the formal parameter as VAR_IN_OUT variable in the block interface.
  4. For the block call you parameterize the whole data record (DB or variable of a DB) as one parameter.
  5. You can read the results directly on the data record.

Advantages

  • Simplified call interface through reduced number of parameters to supply
  • Memory space savings because processing is done directly in the data record
  • Enhanced performance because there is no superfluous copying
  • Also possible for optimized block access

Fig. 01 shows the call and parameters of the function block with the two DB variables. The data type of the DB variable (Array[1..10] of Bool) and the PLC data type (User Data Type) are identical with the data types of the FB1 parameters.


Fig. 01

More detailed information on the topic of "Creating PLC data types in an S7-1500 controller" is available in Entry ID: 67599090.

Maximum number of structures with S7-1500
You can define a maximum of 252 structures with S7-1500 in one data block, independent of the data types in the structures.

Note on security
Caution
The functions and solutions described in this article confine themselves predominantly to the realization of the automation task. Furthermore, please take into account that corresponding protective measures have to be taken in the context of Industrial Security when connecting your equipment to other parts of the plant, the enterprise network or the internet. More information is available in Entry ID: 50203404.

Creation environment
The figures in this FAQ response were created with STEP 7 V12.

Discuss this FAQ response
You have a different solution or another application?
This solution does not help you?

Discuss this FAQ response here!

What differences should you watch out for between optimized data storage and the standard type of block access in STEP 7 (TIA Portal) V12?Go to beginning
Part number:

Description
In this entry we deal with the topic of the "Storage of FB declarations with optimum PLC runtime performance" and the different ways of proceeding in STEP 7 V5.x and STEP 7 (TIA Portal) V12.

Using optimized data storage you can run your programs on the S7-1200/1500 at optimum performance. In this way you achieve a cycle time that is shorter on average by a factor of 3.

Procedure STEP 7 V5.x
You can address all declarations in function blocks absolutely with known addresses in compliance with the SIMATIC rules. This data is displayed by the system and is also stored in the CPU's memory in the SIMATIC format. However, in some more recent S7-300 CPU modules this led to a reduction in performance, because their processors did not have optimum access to that SIMATIC data storage.

Procedure in the TIA Portal
After migration, you must set each function block for the S7-15xx to optimized access in the Properties. Proceed as follows to enable optimized block access.

  1. Open the "Program Blocks" folder in the project navigation.
  2. Right-click the function block and select the "Properties..." in the pop-up menu.
  3. In the "Attribute" tab you enable the "Optimized block access" function.
  4. Then click OK and confirm the next message with "OK".


Fig. 01

In this way you have now set the temporary variables to optimized access. The Input, Output, InOut and Static variables continue to have the "Standard" type of access. These variables are still set to "Set in IDB" in the "Retain" column.

  1. In the declaration you use the drop-down menu to change all these variables in the "Retain" column to "Non-retain".
    Note
    This procedure is not possible for declarations with the keyword "AT".
     
  2. Save and compile your program. If an error message is issued, it could be caused by one of the following:
  • The instance DBs of the processed FBs are being accessed with absolute addressing.
  • The BLKMOV instruction is accessing data in the FB or in its instance DB.


Fig. 02

Otherwise you must reset these variables to "Set in IDB" in the declaration.

The tables below explain the differences between standard and optimized block access.
 
  Standard Block Access Optimized Block Access
CPU modules S7-1200/1500, compatible with S7-300/400 Only for the S7-1200/1500
Data storage You can structure a storage-optimized or any type of data structure according to the declaration. Is managed and optimized by the system. You can set up any type of structure without forfeiting memory.
Performance High-performance access to the S7-1200/1500 depends on the declaration of the data. Access is always as fast as possible because the data storage is optimized by the system and is independent of the declaration.
Susceptibility to errors Absolute access (from HMI or indirect addressing, for example) can lead to inconsistencies when changing the declaration. None, because access is generally symbolic. Declaration changes do not lead to access errors, because HMI access, for example, is symbolic.
Retentivity Block - granular Variables - granular
Table 01
 
Types of Access Standard Block Access Optimized Block Access
Symbolic Yes Yes
Indexed (fields) Yes Yes
Slice access Yes Yes
AT instruction Yes No
Absolute Yes No
Indirect (pointer) Yes No
Loading without reinitialization No Yes, planned for S7-1200
Table 02

Note
Standard blocks are more flexible in their access mechanisms but are more susceptible to errors. Optimized blocks permit only type-safe access and provide extremely good performance. We recommend you avoid mixing standard and optimized blocks as far as possible. The system automatically implements the data models upon access between the blocks, but that costs resources.

Note on security
Caution
The functions and solutions described in this article confine themselves predominantly to the realization of the automation task. Furthermore, please take into account that corresponding protective measures have to be taken in the context of Industrial Security when connecting your equipment to other parts of the plant, the enterprise network or the internet. More information is available in Entry ID: 50203404.

Creation environment
The screens in this FAQ response were created with STEP 7 (TIA Portal) V12.

What types of access, value columns and operator input options are available for the global data blocks in STEP 7 (TIA Portal) V12?Go to beginning
Part number:

Description
In STEP 7 (TIA Portal) V12 you have the optimized access and standard access available for accessing data values in data blocks. More information about the differences between standard and optimized block access is available in Entry ID: 67655611.

If you insert a new global data block for the S7-300/400 in the project navigation, it is given the "Standard" access type. Fig. 01 shows a global data block for an S7-300/400 CPU module.


Fig. 01

In STEP 7 V12, if you add a new global data block for the S7-1200/1500, it is stored automatically in the program block folder with optimized block access. Unlike STEP 7 V11, you can change the type of block access in the block properties as often as you want in STEP 7 V12.

Proceed as follows to change the type of block access.

  1. Open the "Program Blocks" folder in the project navigation.
  2. Right-click the global data block and select the "Properties..." item in the pop-up menu.
  3. In the "Attribute" tab you change the "Optimized block access" function.
  4. Then click OK and confirm the next message with "OK".

Fig. 02 shows a global data block for an S7-1200/1500 CPU module with optimized block access.


Fig. 02

Note
If you disable the "Optimized block access" function, the retentive settings change in the block interface. The block must be recompiled after each change.

  • If you have marked only single variables as retentive in the DB, these markings are lost after the change.
  • If you have marked all the variables as retentive in the DB, the retentive marking is retained after the change.

Fig. 03 shows a global data block for an S7-1200/1500 CPU module with the "Standard - compatible with S7-300/400" block access.


Fig. 03

You should always program symbolically with the S7-1200/1500 and use the "Optimized block access" setting. Variables stored optimally must be accessed symbolically, because the memory addresses are assigned by the compiler and are not known.

  • If you assign symbols for the variables, it is easier to read the programs, which in turn means that you need less comments in the program.
  • You achieve better performance using optimized data storage.


Fig. 04

If you wish to show more columns in your data block or hide columns, right-click in one of the upper fields of the columns and in the pop-up menu select the menu command "Show/Hide". The next drop-down menu displays a list of the columns that you can enable (set a check mark) or disable.

The toolbar of the data block presents you with functions for loading and online operation.


Fig. 05

The table below gives you an overview of the functions associated with the symbols shown in Fig. 05.
 
No. Description
1* With the "Monitor value" function you can monitor online all the data values in data blocks.
2* Transfer setpoint values from the "Snapshot" column to the "Start value" column
  • Start value: Value that is to be assigned to the variable at start
  • Snapshot: shows the values loaded from the device
  • Setpoint values: values finely adjusted during commissioning
3* Transfer all values from the "Snapshot" column to the "Start value" column
4* Snapshot of monitored values
  • Monitored values: shows the values loaded from the device
5* Update interface: updates the declaration table when an FB interface or a PLC data type has been changed.
6* Reset start values: variables defined for a start value are reset to the default value.
7* Loading without reinitialization

Using the "Loading without reinitialization" you can load program changes into the CPU without affecting the controlled process. The following requirements must be met for this:

  • Installation of STEP 7 (TIA Portal) V12 or higher and only for CPUs of the S7-1500 series.
  • For blocks created in LAD, FBD, STL or SCL.
  • For blocks with optimized access (default setting when blocks are created).
  • The blocks were created by the user (no supplied blocks).
Table 01

If you put the CPU into STOP mode during the downloading of data blocks and then into RUN mode again, the monitoring values in the main memory will be overwritten with the start values. This applies also for the data blocks executed with the instructions "READ_DBL" and "WRIT_DBL".

To save the monitoring values you should establish an online connection before the download procedure. Right-click the data block and run the "Apply snapshots as start values" function from the pop-up menu. This ensures that the monitoring values are restored after the download procedure.

Additional Information
More information about the separate columns is available in the STEP 7 V12 Online Help under

  • "Structure of the declaration table for data blocks"
  • "Applying values from the online program as start values".

Security notes
Siemens offers products and solutions with industrial security functions which support the secure operation of plants, solutions, machines, devices and/or networks. They are important components in a comprehensive industrial security concept. The Siemens products and solutions continue to be developed under this aspect. Siemens recommends that you keep yourself regularly informed about product updates.
For the safe operation of Siemens products and solutions it is necessary to take appropriate security measures (cell protection concept, for example) and to integrate each component in an overall industrial security concept which is state of the art. This should also cover the third-party products used. Additional information about industrial security is available at:
http://www.siemens.com/industrialsecurity.
In order to keep yourself informed about product updates, we recommend subscribing to our product-specific newsletter. Additional information about this is available at:
http://support.automation.siemens.com.

Creation environment
The screens in this FAQ response were created with STEP 7 (TIA Portal) V12.

How do you program the TSEND_C and TRCV_C instructions for open user communication over the integrated PROFINET interface of the S7-1200 CPU?Go to beginning
Part number:

Description
You can use the open communication by means of the TSEND_C and TRCV_C instructions for data exchange over the integrated PROFINET interface of the S7-1200 CPU.

In STEP 7 V11 SP2 (TIA Portal) you will find the TSEND_C and TRECV_C instructions in the "Instructions" task card in the "Communication > Open User Communication" palette.
 
Instruction Description
TSEND_C The TSEND_C instruction is executed asynchronously and has the functions below:
  • Configure and establish communication connection
  • Send data through the existing communication connection
  • Disconnect communication connection
TRCV_C The TRCV_C instruction is executed asynchronously and has the functions below:
  • Configure and establish communication connection
  • Receive data through the existing communication connection
  • Disconnect communication connection

The protocols below are supported for this:

  • ISO-on-TCP
  • TCP
  • UDP

Description of the sample program
The S7 program contains the call of the "TSEND_C" and "TRCV_C" instructions and the parameterization of an ISO-on-TCP connection for data exchange between two S7-1200 CPUs. The connection parameters for establishing the ISO-on-TCP connection are saved in the DB2 "CONNECT" data block.

The document below describes the sample program.

NET_S7-1200_ISOonTCP_en.pdf ( 1186 KB )

Download
The download includes the "T_COMMUNICATION_S7-1200.zip" project.
Copy the "T_COMMUNICATION_S7-1200.zip" file into a separate directory and then start the file with a double-click. You can then use STEP 7 to open and process the extracted project data.

T_COMMUNICATION_S7-1200.zip ( 2324 KB )

Additional Information
Detailed information about the TSEND_C and TRCV_C instructions and about the parameterization of the communication connection for open user communication is available in the manuals below.
 
Manual Entry ID
STEP 7 Basic V11 SP2 57199536
STEP 7 Professional V11 SP2 57185407
SIMATIC S7-1200 Automation System 36932465

Creation environment
The screens and downloads in this FAQ response were created with STEP 7 Professional V11 SP2 Update 5.

How do you program the TC_CONFIG instruction to change the parameters of a CP1242-7 configured in STEP 7?Go to beginning
Part number:

Description
Using the TC_CONFIG instruction you can change the parameters of a CP1242-7 configured in STEP 7. The configured values are overwritten non-retentively. The overwritten values remain valid until the next call of TC_CONFIG or until the next startup of the station. (Cold restart through power OFF > ON).

A description of the TC_CONFIG instruction is available in the CP1242-7 manual, chapter "TC_CONFIG: Transfer configuration data to CP" in Entry ID 61029644.

The CONFIG parameter of the TC_CONFIG instruction indicates the memory area with the configuration data. The configuration data is stored in a data block (DB). The structure of the DB is predefined by the IF_CONF system data type (SDT). Details about parameterizing IF_CONF are likewise available in the CP1242 manual, chapter "IF_CONF: SDT for telecontrol configuration data" in Entry ID 61029644.

IF_CONF consists of a header and subsequent blocks which correspond to the parameters or parameter areas of the CP1242-7 in the device properties of the STEP 7 project:
 
Block for the parameter or parameter area Data type
GPRS access IF_CONF_APN
CP identification IF_CONF_Login
Telecontrol server access

Note
This block is to be used only if the telecontrol server is addressed with a name that is resolvable with DNS.

IF_CONF_TCS_Name
Telecontrol server access

Note
This block is used if the telecontrol server is addressed with its IP address.

IF_CONF_TCS_IP_V4
Operating mode IF_CONF_GPRS_MODE
SMSC (node number of the SMS center) IF_CONF_SMS_Provider
PIN IF_CONF_PIN
Monitoring times IF_CONF_TC_Timeouts
Wakeup authorization IF_CONF_WakeupList
Preferred GSM networks IF_CONF_PrefProvider
DNS configuration IF_CONF_DNS
Time-of-day synchronization IF_CONF_NTP
for enabling / disabling TeleService users IF_CONF_GPRS_UserList
for parameterizing the TeleService access (DNS name of the server) IF_CONF_TS_Name
for parameterizing the TeleService access (IP address of the server) IF_CONF_TS_IF_V4
Table 01

Proceed as described below to change the parameters of a CP1242-7 from the user program.
 
No. Action
1 Create a data block (DB) of the "Global DB" type with the "Standard" block access or use an existing data block.
2 Create a structure ("Struct" data type) in the table of the DB's parameter configuration.
You can choose any name for the structure.


Fig. 01

3 Insert a header as first element in this structure by assigning the name of the header and keying it into the cell of the "IF_CONF_Header" data type.


Fig. 02

4 Create the blocks for the parameters to be changed by keying in the required data type, "IF_CONF_APN", for example, into the data type cell.

In this example we create blocks for the parameter areas and parameters below.

GPRS access "IF_CONF_APN"

  • PIN "IF_CONF_PIN"


Fig. 03

Note

  • The number of blocks can vary, but must be made known to the block.
  • You can choose any names for the blocks.
5 Update the number of blocks in the "subfieldCount" parameter of the header. Change the value of the "subfieldCount" according to the number of blocks you have created.

In this example we have created two blocks:

  • IF_CONF_APN
  • IF_CONF_PIN

You must therefore set the "subfieldCount" parameter value to 2.

The TC_CONFIG instruction requires the number of blocks in the structure for processing.


Fig. 04

6 Set the parameters of the blocks according to your structure. The CP1242-7 manual provides information about the functions and valid values for the separate parameters of the blocks.


Fig. 05

Note

  • The only valid value for the "Mode" parameter is 2 (temporary change). If you set the value of the "Mode" parameter to 1, the change would be made permanently. However, the CP1242-7 does not support this. You must therefore set the "Mode" parameter value to 2 in all blocks.
  • The "Id" and "Length" parameters a permanently set in each block and must not be changed.
7 Call the TC_CONFIG instruction in the user program.

Specify the structure just created at the "CONFIG" input of the TC_CONFIG instruction.


Fig. 06

8 Specify the hardware ID of the CP1242-7 at the "INTERFACE" input of the TC_CONFIG instruction.


Fig. 07

The hardware ID of the CP1242-7 is stored in a system constant of the data type "Hw_Interface".
The system constant is created automatically when the CP1242-7 is configured and is to be found in the "System constants" tab of the standard tag table.
You specify the system constants at the "INTERFACE" input of the TC_CONFIG instruction.


Fig. 08

Download
The download includes the "S7_Project.zip" project.
Copy the "S7_Project.zip" file into a separate directory and then start the file with a double-click. You can then use STEP 7 to open and process the extracted project.

EXAMPLE_TC_CONFIG.zip ( 2426 KB )

Creation environment
The screens and downloads in this FAQ response were created with STEP 7 V11 SP2 Update 5.

How are the automatic PID controller settings (optimization) made for asymmetrical temperature control paths in STEP 7 (TIA Portal) V11 and higher?Go to beginning
Part number:

Description
You must observe a specific time sequence for the automatic optimization of PID controllers ("PID_Compact" or "PID_3Step") for temperature control paths with asymmetrical time behavior.

Generally, with automatic optimization it is assumed that the time constant is approximately identical for heating and for cooling. This is not always the case in some paths (as shown in Fig. 01).


Fig. 01 shows the typical curve of an asymmetrical temperature control path

When controlling in automatic mode, asymmetrical oscillations often occur when the setpoint value is approached. This is shown in the example below in Fig. 02. Here, too, you can see that there are different times for heating (A) and cooling (B).


Fig. 02

Fig. 02 shows typical controller behavior for temperature control paths with overshooting, which can lead to the behavior below:

  • The PID parameters can only be calculated imprecisely.
  • The automatic optimization (also called automatic tuning) takes a very long time.
  • The automatic tuning might abort with very slow paths where time limits are exceeded.

Remedy
In order to optimize the PID controller for temperature control paths we recommend the three steps below.

  1. Achieve engaged status
    Control and stabilize the process up to the setpoint value. Use manual mode for this or let the PID controller control automatically to the desired setpoint value with its default values.
     
    1. Manual mode: Set the controller to manual mode ("sRet.i_Mode" = 4) and select an appropriate manual value. Approach the desired setpoint value by changing the manual value. When the actual value reaches the setpoint value and this does not change any more, proceed as in Step 2.
    2. Automatic mode: Put the controller into automatic mode ("sRet.i_Mode" = 3) and specify the desired setpoint value. Let the controller control up to the setpoint value and wait until the process engages. Under circumstances, this might take quite a long time. If it takes too long, continue with Point a.
       
  2. Change to automatic mode
    Change to automatic mode by assigning the value "3" (automatic mode) to the static variable "sRet.i_Mode". Alternatively, you can also enable manual mode in the commissioning dialog under "Online status of the controller".

    Note
    It is important that the process is in a stable state and is as close as possible to the setpoint value. You can see this from the control output in automatic mode. The control output should remain constant for a long period of time.
     
  3. Start optimization
    Now start optimization by assigning the value "2" (optimization) to the static variable "sRet.i_Mode". The temperature control paths normally have very large time constants which means that optimization takes a long time.

Note
You can only change the mode using the "sRet.i_Mode" variable by changing the value. Proceed as below to ensure a safe change:

  • Before each change you assign first the value of the output parameter "State" of the static variable.
  • Then assign the desired value ("2" for optimization, for example) to the variable.

More information about "PID_Compact" and "PID_3Step" is available in the STEP 7 (TIA Portal) Online Help under

  • PID_Compact
  • PID_3Step

Note on S7-1500
As from STEP 7 V12 you can also use controller optimization with "PID_Compact" and "PID_3Step" for the S7-1500.

How do you change the pulse length for the pulse width modulation (PWM) in the user program of the S7-1200 CPU?Go to beginning
Part number:

Description
You can change the pulse length for the pulse width modulation (PWM) in the user program. Proceed as follows.
 
No. Procedure
1 In STEP 7 Basic V11 you open the device configuration of the S7-1200 CPU in your project.
2 In the inspector window you switch to the "Properties" tab.
3 In the "Properties" tab you select "Pulse generators (PTO/PWM) > PTO1/PWM1 > General".
Enable the "Enable this pulse generator" option.


Fig. 01

4 In the "Properties" tab you select "Pulse generators (PTO/PWM) > PTO1/PWM1 > I/O addresses".
Here you define the output addresses. In this example, the output word AW1000 is defined and assigned as output address.


Fig. 02

5 In this example the enable pulse generator has the following ID:
  • 266 (dec) = 10A (hex)

The hardware ID of the pulse generator is created as a system constant in the PLC variable table of the S7-1200 CPU.


Fig. 03

6 In the user program, insert the MOVE instruction at the point where the pulse length is to be changed. In this example the MOVE instruction is inserted in Network 1 of the Main(OB1) program block. The MOVE instruction is to be found in the task card "Instructions" > "Basic instructions > Move operations" palette.
Specify the new pulse length at the IN input (value range: 0 to 100).
At the OUT1 output you specify the output word AW1000. The output word AW1000 is the assigned output word of the pulse generator.


Fig. 04

7 Insert the CTRL_PWM instruction after the MOVE instruction. In this example the CTRL_PWM instruction is inserted in Network 2 of the Main(OB1) program block. The CTRL_PWM instruction is to be found in the task card "Instructions" > "Advanced instructions > Move operations" palette.
You specify the hardware identifier of the pulse generator at the PWM input. For the hardware ID of the pulse generator you select the corresponding system constant from the drop-down list box.


Fig. 05

8 The pulse generator is enable and disabled through the ENABLE input.


Fig. 06

Table 01

How do you compile blocks with know-how protection in STEP 7 (TIA Portal) V11 when they have been copied from another project?Go to beginning
Part number:

Description
When you copy blocks with know-how protection that have been created in a different project into your project, it might happen that you cannot compile the encrypted blocks in your project.

The table below includes a number of cases when you want to copy one or more know-how-protected blocks from another project and then compile your program. Here you must decide whether with the know-how-protected blocks you use the PLC tags or only the temporary and static tags (with function blocks.
 
No.

Description

1 FBs and FCs with block protection that do not contain PLC tags
If you are not using PLC tags in a function or function block and copy that know-how-protected block to another project, the block can be compiled in the new project. The behavior described above does not occur with blocks with only temporary and static tags.
2 FCs with block protection that contain PLC tags
If you are using PLC tags in a function and copy that know-how-protected block to another project, the block cannot be compiled in the new project.

Remedy
In your second project, to which you have copied the know-how-protected blocks, you also need the PLC tags.

  1. Copy the PLC tags also into the new project.
  2. Open the know-how-protected blocks and enter the password when requested.
  3. Quite the opened block and save and compile the program.
  4. The know-how-protected block can now be compiled with 0 errors. Close the block again.

Now you can continue to process the program and download it into the CPU without having to disable the block protection.

3 FBs with block protection that contain PLC tags
If you are using PLC tags in a function block and copy that know-how-protected block to another project, the block cannot be compiled in the new project.

Remedy
Copy the PLC tags also into the "PLC tags" folder. After copying the PLC tag table to the new project you can compile the know-how-protected block.

Table 01

If you have copied a large number of know-how-protected blocks, we recommend copying the complete program folder and the PLC tags to the new project. The table below shows an example for when you want to copy a large number of know-how-protected blocks from the "Copy" project to the "Paste" project. The advantage here is that you do not need the password.
 
No.

Procedure

1 Insert a new device into the "Paste" project to which you want to copy the know-how-protected blocks and save the project. In this way you also create a new "Program blocks" folder in which you can temporarily store the blocks to be copied.
2 Mark the encrypted blocks in the "Copy" project and drag and drop them to the "Program blocks" folder in the "Paste" project (see "a" in Fig. 01). The encrypted blocks are first stored there temporarily.
3 From the "Copy" project you copy the PLC tag table to the "Paste" project (see "b" in Fig. 01). For this, in the "Copy" project, you click the PLC tag table and drag and drop this to the PLC table of the newly PLC folder in the "Paste" project.
4 Save and compile the program inserted in the "Paste" project.
5 Now, in the inserted "Program blocks" folder, you mark all the know-how-protected blocks to be copied (see "c" in Fig. 01) and drag and drop them to the "Program blocks" folder of your chosen CPU ("PLC_1" folder, for example).


Fig. 01

Note
If the "Program blocks" folder already contains blocks with the same symbolic name, you get a message asking whether the objects are to be renamed or replaced. Decide for one of the options and click "OK". Then change the addressing of the blocks if necessary.

6 Also copy the PLC tag table to your chosen CPU (see "d" in Fig. 01).
7 Now compile the complete program in the target folder. The know-how-protected blocks can now be compiled with 0 errors.
8 Delete the PLC folder you created in Point 1 and save your project.
Table 02

More information is available in the STEP 7 V11 Online Help under "Protecting blocks".

Additional Keywords
Protection mechanism

Where can you download the F FBs for the Mobile Panel 277F IWLAN for the Safety option of STEP 7 V5.5, STEP 7 Professional V11 and STEP 7 Professional V12?Go to beginning
Part number:

Description
In this entry you can download the F FBs for the Mobile Panel 277F IWLAN for the Safety option of STEP 7 Professional V12, STEP 7 Professional V11 and  STEP 7 V5.5.

Download for STEP 7 Professional V12

277_IWLAN_Safety_Setup_V12.zip ( 91427 KB )

Download for STEP 7 Professional V11

277_IWLAN_Safety_Setup_V11.zip ( 382908 KB )

Download for STEP 7 V5.5

 277_IWLAN_Safety_Setup_V5_5.zip ( 2835 KB )

Further information
More information about how to use the F FBs is available in the manual in Entry ID: 31255853.
"SIMATIC HMI Fail-safe Operation of the Mobile Panel 277F IWLAN > Configuration > S7 Distributed Safety > Use of the F-FBs".

Additional Keywords
Configuration, Programming, FB161 F_FB_MP, FB162 F_FB_RNG_4, FB163 F_FB_RNG_16, F blocks

Which organization blocks can you use in STEP 7 (TIA Portal)?Go to beginning
Part number:

Description
The two tables below give an overview of the organization blocks available in STEP 7 (TIA Portal). Proceed as follows to incorporate an organization block in your program:

  1. Open your STEP 7 project and in the project navigation you navigate to the "Program Blocks" folder.
  2. Under "Program Blocks" you double-click the "Add new block" command.
  3. Then in the dialog that opens you click the "Organization block" (OB) button.
  4. Select the type of OB you need for your program.
  5. Confirm with "OK" to insert the OB in your program.

To obtain more detailed information, mark the OB (event class) concerned in the "Add new block" dialog and click the "More..." link. This opens the Online Help for the organization block marked. The table below shows the OBs for the S7-1200/1500:
 
Overview of the organization blocks for the S7-1200/1500
Organization blocks cyclic program processing (S7-1200/1500)
Higher-level code blocks that are processed cyclically in the program and in which you can program instructions or call other blocks. OB1 is the default block for cyclic execution of the user program.
  • Event class: Program cycle, Name: Main (OB1)
Organization blocks for startup (S7-1200/1500)
Startup OBs are processed once when the operating mode of the CPU changes from STOP to RUN.
  • Event class: Startup (OB100)
Organization blocks for time delay interrupt (S7-1200/1500)
After expiry of a defined time, the time delay interrupt OBs interrupt the cyclic program processing.
  • Event class: Time delay interrupt (OB20)
Organization blocks for cyclic interrupts (S7-1200/1500)
The cyclic interrupt OBs interrupt the cyclic program processing at defined intervals.
  • Event class: Cyclic interrupt (OB30)
Organization blocks for HSC hardware interrupts (S7-1200/1500)
The hardware interrupt OBs interrupt the cyclic program processing at the occurrence of a hardware event. The hardware interrupts are not only for "Hardware interrupt HSCs", but also for hardware interrupts of digital channels.
  • Event class: Hardware interrupt (OB40)
Organization block for diagnostic error interrupt (S7-1200/1500)
If the diagnostics-compatible module, for which you have enabled the diagnostic error interrupt, detects an error, the diagnostic error interrupt OB interrupts the cyclic program processing.
  • Event class: Diagnostic error interrupt (OB82)
Organization block for the time error interrupt (S7-1200/1500)
If the maximum cycle time is exceeded, the time error interrupt OB interrupts the cyclic program processing.
  • Event class: Time error interrupt (OB80)
Organization block for pulling and plugging (S7-1500)
The operating system of the CPU calls the OB when a configured and non-disabled module or submodule of the distributed IO is pulled or plugged.
  • Event class: Pull or plug of modules (OB83)
Organization block for the rack error of a PROFINET IO system (S7-1500)
When a DP master system, slave or part of the submodules fails, the operating system of the CPU calls the OB.
  • Event class: Rack or station failure (OB86)
Organization block for the programming error (S7-1500)
The operating system of the CPU calls the OB if a programming error occurs while processing an instruction of the user program.
  • Event class: Programming error (OB121)
Organization block for the IO access error (S7-1500)
The operating system of the CPU calls the OB if an error during direct access to IO data occurs while processing an instruction of the user program.
  • Event class: IO access error (OB122)
Organization block for the time-of-day interrupt (S7-1500)
The OBs can be started periodically or once at a specific time.
  • Event class: Time of day (OB10 to OB17)
Organization block for the MC Interpolator (S7-1500)
When creating a technology object (Motion) the OB "MC Interpolator" is called automatically for processing the technology objects (Motion).
  • Event class: MC Interpolator (OB92)
Organization block for the MC Servo (S7-1500)
When creating a technology object (Motion) the OB "MC Servo" is called automatically for processing the technology objects (Motion).
  • Event class: MC Servo (OB91)
Organization block for the clocked interrupt (S7-1500)
Program parts can be started synchronized with the DP cycle clock or PN send cycle clock.
  • Event class: Synchronous (OB61)
Organization block for the status interrupt (S7-1500)
The operating system of the CPU calls the OB if a status interrupt occurs.
  • Event class: Status (OB55)
Organization block for the update interrupt (S7-1500)
The operating system of the CPU calls the OB if an update interrupt occurs.
  • Event class: Update (OB56)
Organization block for the manufacturer- or profile-specific interrupt (S7-1500)
The operating system of the CPU calls the OB if a manufacturer- or profile-specific interrupt occurs.
  • Event class: Profile (OB57)

The table below shows the OBs for the S7-300/400
Organization blocks for the S7-300/400
Default block for cyclic execution of the user program
  • Event class: Main (OB1)
Time-of-day interrupt OBs
  • Event class: Time of day (OB10 to OB17)
Time delay interrupt OBs
  • Event class: Time delay (OB20 to OB23)
Cyclic interrupt OBs
  • Event class: Cyclic (OB30 to OB38)
Process alarm OBs
  • Event class: Hardware interrupts (OB40 to OB47)
Status interrupt OB
  • Event class: Alarm (OB55)
Update alarm OB
  • Event class: Alarm (OB56)
OB for manufacturer-specific alarms
  • Event class: Alarm (OB57)
Clocked interrupt OB
  • Event class: Alarm (OB61 to OB64)
Time error interrupt OB
  • Event class: Fault interrupts (OB80)
Power supply failure OB
  • Event class: Fault interrupts (OB81)
Diagnostics alarm OB
  • Event class: Fault interrupts (OB82)
Pull/plug OB
  • Event class: Fault interrupts (OB83)
CPU hardware error OB
  • Event class: Fault interrupts (OB84)
Program runtime error OB
  • Event class: Fault interrupts (OB85)
Subrack failure OB
  • Event class: Fault interrupts (OB86)
Communications error OB
  • Event class: Fault interrupts (OB87)
Processing abortion OB
  • Event class: Fault interrupts (OB88)
Background OB
  • Event class: Fault interrupts (OB90)
Startup OBs
  • Event class: Startup (OB100, OB101 and OB102)
Programming error OB
  • Event class: Fault interrupts (OB121)
IO access error OB
  • Event class: Fault interrupts (OB122)

More information about the organization blocks is available in the STEP 7 (TIA Portal) Online Help under:

  • Creating organization Blocks
  • Organization blocks (S7-1200)
  • Organization blocks (S7-1500)
  • Organization blocks (S7-300/400)

How in STEP 7 V11 do you save the value of an "HSC" (high-speed counter) for the S7-1200 after STOP mode or after a restart?Go to beginning
Part number:

Instructions
With the "Control high-speed counters" [CTRL_HSC] operation you can call and parameterize the high-speed counters supported by the CPU in your program. These high-speed counters are used to count the pulses generated by a rotary transducer, for example.

After changing from STOP to RUN mode or after switching the power supply off and on again, the high-speed counters "HSC" are reinitialized and the counters are reset to zero. The table below explains how to proceed to retain or save the values of the high-speed counters after a CPU STOP.
 
No. Procedure
1 To execute the "Control high-speed counters" [CTRL_HSC] operation, you must enable the high-speed counters "HSC" in the device configuration.
  1. In the project navigation, open the device configuration in the mark the "PLC_1..." folder.
  2. In the device configuration, open the "Properties" of the CPU and open the "High-speed counters (HSC)" folder in the area navigation. The properties of the high-speed counters are displayed in the right window.
  3. To enable the high-speed counter "(HSC)1", you activate the "Enable this high-speed counter for use" option.
  4. For the high-speed counter (Name: "HSC_1") you define the functions as shown in the example in Fig 01.


Fig. 01

2 Create a global data block with the symbolic name "DB HSC retain", for example, and define the variable "HSC_1" of data type "DInt" in the DB. The counter value is saved in this DB variable.


Fig. 02

Note
The current counter value is not provided for in the parameters for the "Control high-speed counters" [CTRL_HSC] operation. The address for the process image is assigned to the high-speed counter in the hardware configuration and includes the current counter value. You can read out the counter value directly via the program logic. The value output in your program is a correct counter value for the moment in which the counter was read. The counter continues counting high-speed results. The actual counter value can therefore change before your program has completed a process with an old counter value.

3 Create a time interrupt OB (OB201) with a cycle time of 10 ms, for example, and insert the "MOVE" instruction in Network 1.
  1. Parameterize the input parameter of the "MOVE" instruction with the initial address of the high-speed counter "HSC_1" and define a symbolic variable for this ("HSC1_CV", for example). The initial address for the high-speed counter HSC_1 is ED1000 by default.
  2. Parameterize the output parameter with the DB variable "DB HSC retain.HSC_1".

When the program is executed, the counter value of the high-speed counter "HSC_1" is transferred to the DB variable every 10 ms.


Fig. 03

4
  1. Create a start OB (OB100) and insert the "MOVE" instruction in Network 1.
  2. Parameterize the input parameter of the "MOVE" instruction with the DB variable "DB HSC retain.HSC_1" and the output parameter with the defined variable "NEW_CV1" (MD24). The "NEW_CV1" variable is also assigned to the "NEW_CV" parameter of the "Control high-speed counters" [CTRL_HSC] operation.
  3. Now do a restart. The counter value in the DB variable is transferred as start value to the "NEW_CV1" variable with which the high-speed counter begins to count again.
5 To enable the counter value, insert the "Set output" [S] instruction in another network and parameterize the operands with the defined variable "CV1" (M10.1).


Fig. 04

6 Now, call the "Control high-speed counters" [CTRL_HSC] operation in a block (OB1, for example) and parameterize the input and output parameters. Once the current counter value has been enabled with the variable "CV1" (M10.1), the parameter "CV" is reset again. Insert the "Reset output" [R] instruction in another network and parameterize the operands with the variable "CV1" (M10.1).


Fig. 05

7 Compile your program by right-clicking on the "PLC_1..." folder in the project navigation and executing the menu command "Compile > All" from the pop-up menu. Then save your project.

More information is available in the STEP 7 (TIA Portal) V11 Online Help under "CRTL_HSC: Control high-speed counters (S7-1200)".

Creation environment
The screens in this FAQ response were created with STEP 7 (TIA Portal) V11.

Which Motion Control functions are there in STEP 7 (TIA Portal) V11 and how do you use these functions?Go to beginning
Part number:

Description
In addition to the Online Help for Motion Control functions in STEP 7 (TIA Portal) V11, there is also the PDF document available for downloading below. The following topics and chapters are in this document:

  1. Using Motion Control

1.1 Introduction
1.2 Basic Principles for Working with Motion Control
1.3 Guidelines for Using Motion Control
1.4 Add Technology Object Axis
1.5 Motion Control Tool - Configuring
1.6 Loading into the CPU
1.7 Motion Control Tool - Commissioning (Control Panel)
1.8 Programming
1.9 Motion Control Tool - Diagnostics
1.10 Working with Monitoring Tables
1.11 Appendix

  1. MC Functions References

2.1 MC_Power
2.2 MC_Reset
2.3 MC_Home
2.4 MC_Halt
2.5 MC_MoveAbsolute
2.6 MC_MoveRelative
2.7 MC_MoveVelocity
2.8 MC_MoveJog

Download
Double-click the link "Motion_STEP_7_Basic_en.pdf" link to open the document. You need the Acrobat Reader program for this.

Motion_STEP_7_Basic_en.pdf ( 2433 KB )

Keywords
Stepper motor, Servomotor, S7-1200, TIA Portal

In STEP 7 (TIA Portal) how do you configure data blocks with the "Only store in load memory" attribute?Go to beginning
Part number:

Description
Data blocks with the "Only store in load memory" attribute (unlinked DBs) are data blocks that do not occupy any space in the main memory of the controller and only use space in the load memory of the CPU. They are therefore suitable for storing large volumes of data that are not needed often in the controller's program. You need the following to be able to use these DBs for the S7-1200/S7-1500:

  • Firmware 2.0 (or higher) and STEP 7 (TIA Portal) V11+SP2 (or higher) for the S7-1200.
  • STEP 7 (TIA Portal) V12 (or higher) for the S7-1500.

Example
Since the main memory has only a limited size, for recipe management, for example, multiple data blocks with different recipe values can only be stored in the load memory. Then, in the main memory there is only a working DB that contains the current recipe. If the DBs mentioned above are configured and loaded into the CPU, then those data blocks are only available in the CPU's load memory and hence do not take up any space in the main memory.


Fig. 01

Fig. 01 shows an example of data transfer between the unlinked DBs in the load memory and the sequence-relevant DB in the main memory. Use the two instructions below to program data transfer:

  • READ_DBL: read from the data block in the load memory
  • WRIT_DBL: write to the data block in the load memory

Attached is a sample program for an S7-1500 with the WRITE-READ function. The DB in the load memory was create with the CREATE_DB function.

Below we explain how to proceed to generate an unlinked DB.

  1. Open the project navigation and create a global data block.
  2. Right-click the newly created global data block and select the "Properties..." item in the pop-up menu.
  3. Select the "Attributes" tab and enable the "Only store in load memory" attribute.


Fig. 02

  1. Confirm with OK.

Note
For further applications it is useful to store the unlinked DB created in the global library. In this way you can use the element for other projects too. Avoid periodic writing to the load memory, because the number of write cycles and thus the service life of the load memory is limited.

Further information is available in the STEP 7 (TIA Portal) Online Help under

  • READ_DBL: Read from the data block in the load memory
  • WRIT_DBL: Write to the data block in the load memory

Download
The download includes the project "STEP7_TIA_Portal_Write_Read_DBL_V13.zip".
Copy the "STEP7_TIA_Portal_Write_Read_DBL_V13.zip" file into a separate directory and then start the file with a double-click. You can then use STEP 7 (TIA Portal) to open and process the extracted project data.

STEP7_TIA_Portal_Write_Read_DBL_V13.zip ( 2354 KB )  

Security notes
Siemens offers products and solutions with industrial security functions which support the secure operation of plants, solutions, machines, devices and/or networks. They are important components in a comprehensive industrial security concept. The Siemens products and solutions continue to be developed under this aspect. Siemens recommends that you keep yourself regularly informed about product updates.
For the safe operation of Siemens products and solutions it is necessary to take appropriate security measures (cell protection concept, for example) and to integrate each component in an overall industrial security concept which is state of the art. This should also cover the third-party products used. Additional information about industrial security is available at:
http://www.siemens.com/industrialsecurity.
In order to keep yourself informed about product updates, we recommend subscribing to our product-specific newsletter. Additional information about this is available at
http://support.automation.siemens.com.

Creation environment
The screens and download in this FAQ response were created with STEP 7 (TIA Portal) V13.

How do you open blocks that are know-how protected in STEP 7 V11 in a different project when they have been downloaded from the CPU?Go to beginning
Part number:

Description
If you download a know-how-protected block from the CPU into another project, you need the restore data for the know-how protection to open the block and remove or change the password.

  • If you download a know-how-protected block into an S7-300/400 CPU, the restore data for the know-how-protection is not loaded with it. You need the original project to open the block.
  • If you download a know-how-protected block into one of the more recent S7-1200 CPU modules, then the necessary restore data is transferred with it and the relevant block can be opened again with a password after uploading in a new project. You do not need the original project for this.

You recognize the know-how-protected blocks in the project navigation by the padlock marked on the left. The know-how protection allows you to protect one or several blocks of type OB, FB, FC and DB from unauthorized access, with a password. All the tags are displayed (even the temporary and static tags). Only the networks of the code area are hidden. So the program code cannot be changed and copied.

Note
The cross-references to the tags of the inputs and outputs used are not shown in the know-how-protected blocks. Not even if the block has been opened after password entry.

More information is available in the Online Help of STEP 711 under:

  • Setting up know-how protection
  • Removing know-how protection
  • Opening know-how-protected blocks
  • Printing know-how-protected blocks
  • Changing passwords
  • Protecting blocks

Additional Keywords
Block protection, Point of usage

 Entry ID:50379058   Date:2014-10-08 
I regard this article....as helpfulas not helpful                                 






























mySupport
My Documentation Manager 
Newsletter 
CAx-Download-Manager 
Support Request
To this entry
Print
Create PDF 
Send to a friend
QuickLinks
Compatibility tool 
Topics
Help
Online Help
Guided Tour