Siemens Industry Online Support
Siemens AG
Entry type: Application example Entry ID: 6184284, Entry date: 07/26/2001

creating a checksum over values in a data block

  • Entry
  • Associated product(s)

How can I create a checksum over the values in a data block?

In the sample program attached, the function FC1 is used to create a checksum over the values stored in a data block (e.g. DB1). In order to obtain the checksum, in the function you must specify the data block "DB_NO", the initial address "START_ADD" and the length "LENGTH".

Parameters of the function FC1:



Data type





Data block over which the checksum is to be created.




Initial address at which the checksum is to start being created




Specifies the length in bytes over how many elements the checksum is to be created.




Output of the checksum.

Using the function FC1, all the values in the data block that are covered by the parameters "START_ADD" and "LENGTH" are linked consecutively via an XOR function. The result is presented as checksum at the output "CHECKSUM".

The example contains a STEP 7 V5 project with the described function FC1 and a sample call from the organization block OB1. The data block DB1 is also included. In this example a checksum is created over the first seven values of the data block DB1. You can adapt the function as you wish to suit your requirements.


Copy the "check_sum1.exe" file into a separate directory and then start it with a double-click. The S7 V5 project is now unpacked automatically with all the associated subdirectories. You can then open and process the unpacked project with the SIMATIC Manager.

Search terms:
CRC, Value change

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
Rate entry
no rating
Requests and feedback
What do you want to do?
Note: The feedback always relates to the current entry / product. Your message will be forwarded to our technical editors working in the Online Support. In a few days, you will receive a response if your feedback requires one. If we have no further questions, you will not hear from us.