A simple yet common problem when programming a Siemens Simatic S7-300 PLC is losing the data already stored in the PLC after downloading an updated data block.
If you are simply adding items to the end of a flat data block (not adding items to a user-defined type (udt) within the data block, for example) then to retain the values of the data block follow these quick steps.
- Go online with all of the blocks in Simatic Manager.
- Copy the online version of the data block whose values you would like to retain into your offline project.
- Add the items to end of the data block
- Download - your values will be retained.
If you need to make a more complicated change to the data block such as adding items to a udt used with the data block, a few more steps are needed. Even if you have first saved a copy of your online values prior to making the change, the values will be lost after you save the change. Therefore, follow these extra steps.
- Follow steps 1 and 2 above.
- Open the datablock and Generate Source for the data block. File -> Generate Source. This will save a version of your data block and the values in a file in the Sources folder.
- Make all changes that you need to the data block then Save and Close the data block.
- Open the Source file you created and compile it. This will set all values in the data block equal to the values you see in the Source file.
- Download - your values have been retained.
Learn more about DMC's expertise in Siemens S7 PLC programming.