In this tutorial, you will learn how to protect your code and PLC hardware against unwanted people. If you missed it, check out the last post where we explain how to communicate with your hardware using Modbus TCP communication.
Parts Required
Software:
- Siemens TIA Portal
Hardware:
- s7-1200 1214 DC/DC/DC PLC
TIA Portal
First, you will need to know that there are two ways to protect your work against unwanted people. There are two ways, one that protects your code against write permission and the other against know-how protection.
Against Write permission
This means that you can protect parts of your code that you know that its too important to have no mistakes and want to protect against everybody that could change your code and provoke a loss of money. This permission allows everybody to read the code and understand it but anyone could write/change your code.
To do that you can click with the right mouse button in the block you want to protect and that opens the properties separator as you can see in Figure[1].

After that, you need to select the protection group and in the write protection separator click on Define password as you can see in Figure[2].

A little window as Figure[3] shows where you can define your password and confirm that. Don’t forget your password because when you download the program with that protection you cannot write any code in this block without the password.

After that, you have a little check box above the “change password” button that you must select. This will pop up a window where you have to insert the password that you define. When you insert the password, a message above your code as you can see in Figure[4] informs you that you cannot write more code in this block until you uncheck the “write protection” box that have selected.

At this point, you can see that if you try to add some code to this network or try to create a new network you can’t. However, you can download it, go online, and see everything happening with the code that you have written before. This is the greatest difference between write protection and know-how protection.
Against Know-How protection
If you want to define the know-how protection first you have to uncheck the write protection box. To do that make the inverse steps that you learn above.
To create the know-how protection you will need to right-click on the function you want to protect and click on properties. Above the write protection separator, there is a separator where you can define the password to create the know-how protection as you can see in Figure[5].

After creating this password you can check that in the know-how separator you have now “The block is protected. (1G4)”.
As a result of that action, as soon as you click on the “OK” button will appear one more time a message alerting you that “The block is read-only because it is know-how protected” as you can see in Figure[6]. Also, you can check in the tree code, that the function that we select to be protected as know-how, has a little padlock.

Now, as you can see the code of the Main function block “disappears”. To see it again, you can double-click on main, and will pop up a little window where you can insert your password and unlock the code.
This is the sixth post on the Siemens TIA Portal. You have learned how to protect your code against unwanted people.
If you like this kind of post, if you want to know more about Siemens TIA Portal, or if you have doubts about the Industrial Automation area don’t forget to leave a comment.