Lock & Unlock in Step 7

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

CÁCH 1

How do you install the improved block protection for FBs and FCs in STEP 7 V5.5 onwards?
Display part number

Instructions
In STEP 7 version V5.5 onwards you can install an encrypted block protection for functions
and function blocks in the Offline and Online views. The table below gives the procedure for
using the "S7 Block Privacy" program to encrypt your blocks and protect the block code against
unauthorized access.

No. Procedure
1 Preparation:
To be able to use the improved block protection in STEP 7 V5.5 you must first install the
"S7 Block Privacy" program from the STEP 7 DVD.

1. Insert the STEP 7 DVD in the drive of your programming device.


2. Open the "CD_2 > Optional Components > S7 Block Privacy" folder on the STEP
7 DVD.
3. Start the "Setup.exe" program and follow the installation instructions.

After installation, select the "Block Protection" function in the SIMATIC Manager under
"Tools > Block protection...".
2 For this you mark the block folder in the SIMATIC Manager and select the "Tools >
Block protection..." function in the menu bar. Alternatively, you can right-click on the
block folder and select the "Block protection..." function in the pop-up menu.
3 Open the object hierarchy tree in the "S7 Block Privacy" dialog. This gives you a list of all
the blocks that you can encrypt with the "S7 Block Privacy" program. The "S7 Block
Privacy" party can only encrypt FBs and FCs.
4 Right-click on the block that you want to encrypt and select "Encrypt block..." in the pop-
up menu.
5 In the "Block Encryption" dialog you now have to enter your password (Enter key) of at
least 12 characters. Repeat the password to confirm in the next line and confirm with OK.
Fig. 01

Note:
Check that the "Also encrypt decompilation information" option is enabled as in Fig. 01. If
you do not select this option, you can no longer decrypt the block after encryption. The
code is then permanently encrypted.
6 Acknowledge the subsequent message with "OK". When you open an encrypted block,
you can no longer see and edit the program code.

Note:
After encryption, you can only edit the block again after decryption with your password.
We recommend that you save the password.
7 If you want to encrypt multiple blocks at the same time, click the boxes on the left of the
blocks. If you want to encrypt all the blocks at the same time, click the box on the left of
the block folder. This checks all the boxes. Then you only have to encrypt once as
described in steps 4 to 7.
The encrypted blocks are marked red and with a key in the SIMATIC Manager. Proceed as
described in the table below to decrypt the blocks.

No. Procedure
1 For this you mark the block folder in the SIMATIC Manager and select the "Tools >
Block protection..." function in the menu bar. Or you right-click block folder and click the
"User protection..." function in the pop-up menu.
2 Open the object hierarchy tree in the "S7 Block Privacy" dialog and mark the blocks (set
check mark) that you want to decrypt.
3 Right-click one of these blocks and select "Decrypt block...".
4 When the "Block Encryption" dialog opens you enter your password and click OK to
confirm.
5 Close the "S7 Block Privacy" program. The blocks you selected are decrypted and you can
edit them again.
Further Information
Press the F1 key in the "S7 Block Privacy" program to receive more information on encrypting
blocks.

Note
Block encrypting via the "Know_How_Protect" command and compilation of the source block
are also possible. More information on this is available in Entry ID: 10025431

Creation environment
The figures in this FAQ were created with STEP 7 V5.5.

Keywords
Know-how protection

CÁCH 2
The password protection for the STEP 7 online functions is a protection against access to the
CPU.
Using the password protection you can

 Protect the user program and data in the CPU against unauthorized changes (write
protection).
 Protect the know-how contained in your user program (read protection).
 Prohibit online functions that would damage the process.

The steps below describe how to configure password protection in your CPU.

1. Double-click the CPU to open the properties of your CPU in the hardware configuration.
2. Switch to the "Protection" tab and parameterize the desired protection level.

Fig. 01
 
3. Close the the dialog with OK and save and compile the HW Config.
4. Load the HW Config into the CPU.

Depending on the protection level set, a check is performed before every online function to
establish whether the function is allowed to be executed at the selected protection level.
Consequently, as from protection level 2 a password must be entered for every write-access
before executing the function. Depending on the protection level set, diagnostic functions can be
performed and variable declaration tables can be read out. For example, protection level 3
permits the diagnostic buffer to be read out. You can call up the dialog box for entering the
password directly via "PLC > Access Authorization > Setup". No further password queries
appear until the SIMATIC Manager session is terminated or unless the password entry is
cancelled with "PLC > Access Authorization > Cancel".

Note
You can only protect the program with a password in a module if the module supports this
functionality.

 All 300-series CPUs delivered since 04/98 support this functionality.


 All 400-series CPUs delivered since 03/98 support this functionality.
 STEP 7 supports this functionality as from version V4.0.2.

Enabling Protection Level 2 (write protection) via the STEP 7 program


If you have set Protection Level 1 in the HW Config, you can use the SFC 109 "PROTECT"
system function to switch to Protection Level 2 or back again to 1. Calling SFC 109 has no effect
in the cases below:

 If you have set Protection Level 2 or 3 in the HW Config.


 If you have set Protection Level 1 with the "Can be bypassed with password" option (Fig.
1) in the HW Config.

More information on SFC109 "PROTECT" and how to parameterize is available in the STEP 7
Online Help by marking the SFC109 in the SIMATIC Manager and pressing the "F1" key. As
from STEP 7 V5.4+SP2 this system function is included in the Standard Library.

CÁCH 3
How can you install block protection for self-created blocks?
Display part number

Instructions:
STEP 7 provides the KNOW_HOW_PROTECT function for protecting the programs. If you
open a block protected by this function, then you can only view the block interface (IN, OUT
and IN/OUT parameters) and the block comment. The program code, the temporary/static
variables and the network comments are not displayed. It is not possible to change the protected
block.

The table below describes the procedure for installing the KNOW_HOW_PROTECT function
for your program blocks (FBs, FCs and DBs).

No. Procedure
1 Open the function block to be edited and in the LAD/STL/FBD editor you generate a
source via "File > Generate source...".
2 In the dialog that opens you enter an object name, e.g. "Protect_FB".
3 The "Generate source <Name>" dialog opens. Here 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. Confirm with OK and the STL source is generated. Close
the LAD/STL/FBD editor again.
4 Open the newly created source in the "Sources" folder of your S7 program.
5 Insert a line with the "KNOW_HOW_PROTECT" command in the declaration section of
the source block under "TITLE".

Fig. 02
6 Save and compile the STL source via "File > Save" and "File > Compile". The block is
now protected.
Note:
The block protection can only be removed again via the STL source. If the STL sources are no
longer available to the program or project via the "KNOW_HOW_PROTECT" command, you
can no longer remove the protection for the blocks.

The table below describes the procedure for deactivating the KNOW_HOW_PROTECT
function for your program blocks (FBs, FCs and DBs).

No. Procedure
1 Open your source.
2 Remove the "KNOW_HOW_PROTECT" entry or comment it out with two slashes.
3 Save and compile the STL source via "File > Save" and "File > Compile".
4 The block protection is now deactivated.

You might also like