×
Siemens Industry Online Support
Siemens AG
Entry type: FAQ Entry ID: 10024793, Entry date: 07/01/2015
(0)
Rate

How do you install block protection for the S7-GRAPH blocks?

  • Entry
  • Associated product(s)
To install block protection for an S7-GRAPH FB you must add the function KNOW_HOW_PROTECT to the S7-GRAPH source. Then compile the source and the S7-GRAPH FB is protected.

Instructions
STEP 7 provides the KNOW_HOW_PROTECT function for protecting the program code. If you open a block with the KNOW_HOW_PROTECT property, then you can only view the block interface (IN, OUT and IN/OUT parameters) and the block comment. The program code, the temporary and static tags and the network comments are not displayed.

Note
Unlike the STEP 7 blocks (creation language: STL, LAD and FBD) two sources must be generated for installing the KNOW_HOW_PROTECT for each S7-GRAPH block:

  • one source (type: GRAPH source) that is generated from the S7-GRAPH editor and
  • one source (type: STL source) that is generated from the LAD/STL/FBD editor.

You can only install the block protection in an STL source. After saving the S7-GRAPH FB in the LAD/STL/FBD editor, the block created in S7-GRAPH receives a new language code and can then no longer be edited in the original S7-GRAPH language (not even after removing the block protection). However, if the block created in S7-GRAPH is to be edited again in the original S7-GRAPH language, you must recompile the GRAPH source. This GRAPH source then serves to save the S7-GRAPH FB.

  1. Open the S7-GRAPH FB and create a GRAPH source via "File > Generate Source File...".
     
  2. In the dialog that opens you enter an object name, "Source_FB", for example.
       

    Fig. 1
     
  3. Save with OK and the GRAPH source is generated. Then close the S7-GRAPH FB again.
     
  4. In the Windows operating system you open the LAD/STL/FBD editor. This can be found in Windows 7 via "Start > All Programs > Siemens Automation > SIMATIC > STEP 7 > LAD, STL, FBD - Program S7 blocks".
       

    Fig. 2
     
  5. In the LAD/STL/FBD editor you select your STEP 7 project via "File > Open..." .
     
  6. Mark the relevant block folder and then open the block created in S7-GRAPH.

    The function block created in S7-GRAPH is opened in the STL language.
     

  7. Save the block either via the floppy disk symbol or via "File > Save". Now you get a message indicating that this block has been created in a different programming language and that upon saving it will no longer be possible to edit the block in the language in which it was originally created (GRAPH). Click the "Yes" button. The function block created in S7-GRAPH now receives the STL language code.
     

  8. In the LAD/STL/FBD editor you generate a source via "File > Generate source...".
     

  9. In the dialog that opens you enter an object name,"Protect_FB", for example.
     

  10. The "Source < Name > Generate" dialog opens. Here in the left window you mark the block for which the STL source is to be generated and use the arrow key to move this block into the "Blocks Selected" window on the right.
     

  11. Confirm with OK and the STL source is generated. Close the LAD/STL/FBD editor again.
       


    Fig. 3
     
  12. Now you have two sources in your "Sources" folder:
       

    the STL source (Protect_FB),
    for the KOW_HOW_PROTECT of the block with the STL language code.
    the GRAPH source (Source_FB),
    for deactivating the KNOW_HOW_PROTECT and returning to the original S7-GRAPH language.

     

  13. Open the STL source "Protect_FB" and insert a line with the command "KNOW_HOW_PROTECT" in the declaration section of the block under "TITLE".
       


    Fig. 4
     
  14. Save and compile the STL source via "File > Save" and "File > Compile". The S7-GRAPH FB is now block protected.

Now, if you want to remove the block protection for the S7-GRAPH FB, proceed as follows.

  1. In the block folder of your STEP 7 project you delete the block-protected function block.
  2. In the Sources folder you open the GRAPH source "Source-FB". The source is opened in the GRAPH language in which it was created.
  3. Compile the S7-GRAPH source via "File > Compile".
  4. The "Select Instance DB" dialog opens. You can accept the instance DB from the presetting or enter a new instance DB. Then confirm with "OK". After compilation of the source, the function block is once again available in the GRAPH language and you can edit it again with S7-GRAPH.

Creation Environment
The screens in this FAQ response were created with STEP 7 V5.5 and STEP 7 V5.3.

Security information
In order to protect technical infrastructures, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art IT security concept. Siemens’ products and solutions constitute one element of such a concept. For more information about cyber security, please visit
https://www.siemens.com/cybersecurity#Ouraspiration.