How do you evaluate the status of system blocks in STEP 7 (TIA Portal)?
Depending on the application, the information at the "STATUS" parameter is only available for the duration of one cycle. Since the CPUs work in the millisecond range, the information cannot always be noticed by the user. The "DONE" parameter indicates that the data record for this system block has been transferred, but the last block "STATUS" has already been overwritten.
There are multiple options for evaluating the block status.
Option 1: Evaluation with MOVE
Using the "MOVE" instruction you can temporarily store the information at the "STATUS" parameter in a data block, for example. In this way, this information is still available even after the cycle.
Fig. 1 shows an example of the status evaluation for the "WRREC" instruction (write data record). The data from the "DB.wrrecStatus" tag is transferred to the "DB.error" tag if the "DB.wrrecError" tag has the True signal.
You can also program the status evaluation shown in Fig. 1 in the programming languages STL, FBD and SCL.
Option 2: Evaluation with the "SaveStatus" FB
The library attached to this entry includes the "SaveStatus" FB which you can use to store the status values one after the other in a data block. This means that the status values remain available until they are deleted by a reset. Parameterize the "status" output parameter with a tag of the data type "Array[1..10] of DWord". You can also extend this sample program with other array elements. The status values read are then stored one after the other in the array elements.
- Before reading the status values you have to reset the array elements to zero with the "reset" parameter.
- A value can only be stored in an array element when the value of the array element is zero.
- For each new status value a query is run in the "SaveStatus" FB to determine the next available free array element.
- If an array element is already occupied with a value (apart from zero), the new value is entered in the next array element.
- If all the array elements are occupied by a value, the last array element is overwritten with each additional status value.
- To be able to store new values in the other array elements you have to do a reset.
The "SaveStatus" FB has been created in the SCL programming language and includes German and English comments. The table below describes the block parameters.
|readStatus||DWord||Reading in of the status values|
|status||Array[1..10] of DWord||Status values stored one after the other|
Evaluation of the status information
- Via the Online Help:
Select the system block and press the "F1" key. The STEP 7 (TIA Portal) Online Help gives you detailed information about the instruction and the "STATUS" parameter.
- Via the manual:
Further status information is available in the manual of STEP 7 (TIA Portal) under Parameter STATUS (S7-1200, S7-1500).
The download includes the STEP 7 (TIA Portal) library with the block described above for the S7-1200 and for the S7-1500. Unpack one of the two Zip files for your version of STEP 7 (TIA Portal) in a separate directory on your hard disk. Then you can open and edit the library with STEP 7 (TIA Portal).
- For STEP 7 (TIA Portal) V13:
109745539_SaveStatus_Lib_STEP7_TIA_Portal_V13.zip (1.0 MB).
- For STEP 7 (TIA Portal) V14:
109745539_SaveStatus_Lib_STEP7_TIA_Portal_V14.zip (299.9 KB).
You can only open and edit the library in STEP 7 (TIA Portal). Further information about opening libraries is available in Entry ID: 37364723.
The screen and download in this FAQ response were created with STEP 7 (TIA Portal) V14.