How can you install block protection for self-created blocks?
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).
|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".
|6||Save and compile the STL source via "File > Save" and "File > Compile". The block is now protected.|
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).
|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.|