长沙工控帮教育科技有限公司整理
Step 14: Downloading and Debugging the User Program
4. Call up the PLC > Download menu command
3.16 Monitoring and Testing the Program
3.16.1 Monitoring the Program Status
Monitoring the program status provides the possibility of visually tracking the execution of a program in the CPU. The current progress through the individual states and transitions is displayed and current information on the instruction tables currently being processed is shown on the screen.
This enables you to find errors that were not displayed by the formal consistency check when creating the program or by the syntax check during compilation. These errors are, for example:
• Programming errors, for example, incorrectly specified monitoring times
• Logic errors in the program structure, meaning the programmed states and transitions do not match the required process sequence.
However, take into account that the debugging function delays the program execution and can thus cause malfunctions or the cycle time to be exceeded.
There are two display possibilities for the program status:
• Program status of graph groups (status overview)
• Program status of state graphs
!
WarningDebugging while the plant is running can cause serious damage to persons or equipment if malfunctions or program errors occur!Ensure that dangerous states cannot occur before carrying out this function!
3.16.2 Displaying in Program Status
The following possibilities of monitoring are available in the various windows:
• Program status for graph groups:
The status overview is displayed here: You can see all the instances of the current graph group. The current state is displayed in each instance.
• Program status for state graphs
The following detailed status information for a selected instance is displayed here.
- The active state is highlighted in color.
- The transition which led to this state is marked in color.
长沙工控帮教育科技有限公司整理
- A table with status information is displayed for the transition with the highest priority leading from the active state. You can choose to display information of another instruction table if more than one is being processed.
- The table with the status information contains the following:
Column Meaning
RLO The result of logic operation (RLO).
STA The status bit.
STD The standard status displays a timer word, counter word or the contents of ACCU 1, depending on the operation used in an instruction.
OPD Current parameter which was assigned to the formal parameter of this instruction.
Display of the program status
长沙工控帮教育科技有限公司整理
3.16.3 Prerequisites for Starting the Program Status
The following preconditions have to be fulfilled before the monitoring functions can be carried out:
• The programming device must be connected ONLINE to the CPU.
• The program must have been compiled without errors.
• The program (comprising FB, DB, and OB) must have been downloaded to the CPU.
• The CPU must be in RUN mode (read) or RUN-P mode (read and write).
• The HiGraph FC must be called from a cyclically executed block (for example, OB1).
3.16.4 Steps for Displaying the Program Status
In order to debug your user program you must first download the corresponding program parts, the FC and DB, to the CPU and call them via an organization block (for example, OB1) for cyclic processing.
Proceed as follows to start monitoring the program status:
1. Select the Debug > Monitor menu command while the graph group is open.
The status overview for this graph group is displayed.
2. Select an instance for monitoring.
3. Select the menu command Edit > Open Object.
The selected instance is opened ONLINE. The detailed status information is displayed.
4. The table with status information is displayed first for the transition with the highest priority leading from the active state. If required, you can select another instruction table to display its status information.
5. In order to select a different instance for monitoring change back to the status overview, select the desired instance and use again the Edit > Open Object menu command.
6. In order to terminate the display of the program status, deactivate the Debug > Monitor menu command.
Note
Depending on the capacity of the CPU used, it is possible that not all the program statuses of all the instances contained in very large graph groups can be displayed. In such cases the instances which were selected at the beginning of monitoring are taken first into consideration.
In order to display the program status of a specific instance which is not displayed initially proceed as follows:
长沙工控帮教育科技有限公司整理
!
WarningDebugging while the plant is running can cause serious damage to persons or equipment if malfunctions or program errors occur!Ensure that dangerous states cannot occur before carrying out this function!
3.16.5 STEP 7 Test Functions
Monitoring and controlling variables This function allows you to:
• display current values of variables from your user program (monitoring)
• assign fixed values to the variables for test purposes (controlling) Proceed as follows:
1. Select the Debug > Select Variable menu command.
2. Select the required instances and their variables in the subsequent dialog box.
3. Click on the "OK" button.
The STEP 7 variable table is opened. It already contains the selected variables. You can monitor and control the variables here.
Note
You will find more information on this function in the STEP 7 documentation.
长沙工控帮教育科技有限公司整理
Evaluating the diagnostic buffer
The following events can be entered in the diagnostic buffer of the S7-CPU during the program execution:
• Operating message incoming/outgoing (16#A150/16#A050)
• Fault message incoming/outgoing (16#B153/16#A053).
Requirements:
• The HiGraphErrEmitterFB (FB 20) and HiGraphMsgEmitterFC (FC 101) blocks as well as the system function block SFC 52 must exist in the "Blocks"
container of the S7 program.
• Before compiling a graph group you must have selected the "Format converter diagnosis" option in the "Diagnostic" register tab by using the
Options > Settings for Status Graphs/Graph Groups menu command in the case of graph groups in HiGraph V5 save format.
Evaluating the CPU messages
In the SIMATIC Manager you can use the PLC > CPU Messages menu command to trigger the display of operating and fault messages.
长沙工控帮教育科技有限公司整理
3.17 Printing
3.17.1 Printing a Program Documentation
After you have finished creating the program for your automation solution, you can print out all the important data by means of the print function integrated in
S7-HiGraph, thus creating a program documentation.
Printable program components
The following program components can be printed out directly in S7-HiGraph:
• The state graphs in graphic or textual form
• The graph groups in graphic form
• The variable declaration with names, data types, addresses, initial values and comments for the declared variables
• A list of the current parameters with the names of the formal parameters, the symbolic names and absolute addresses of the current parameters and the comments from the symbol table.
• A list of the global addresses with their symbolic names, absolute addresses and the comments from the symbol table.
Further program data can be printed out by using the STEP 7 print functions, such as for example:
• The object tree (project structure)
• The symbol table
• The diagnostic buffer contents
• The reference data
For further information on printing these objects please refer to the documentation of STEP 7.
We recommend using a Postscript printer to print out the data.
3.17.2 Printing Steps
Proceed as follows to print a program documentation:
1. Open the state graph or the graph group which you want to print out.
2. Select the File > Print menu command.
3. Select the program components which you want to print in the "Print" dialog
长沙工控帮教育科技有限公司整理
4. In the same dialog box select further print setting, such as
• The zoom factor,
• The print order and
• The graphic or textual display of the object 5. Confirm by clicking on "OK".
The file is output on the set printer. If the printout has more than one page, two periods are printed after the page number in the bottom right corner of the page.
The last page does not have these periods, indicating no more pages are to follow.
This makes it easy to see whether the printout is complete.
Print settings for the entire application
If you wish to output several objects with the same print settings, you have the possibility of setting the print option for the entire application. To do so, select the Options > Application Settings menu command and enter the options in the
"Graph group settings" or "state graph" settings.
Setting the printer
Use the File > Print Setup menu command to select a printer and set further options which depend on the printer used.
Setting the paper format for the printout
Select the File > Print Setup menu command to set the paper format. You can carry out the following settings in the subsequent dialog box:
• Paper size (A4, Letter, etc.)
• Portrait or landscape format
In order to set the paper format with page margin select the File > Page Setup menu command and set the desired format in the subsequent dialog box (for example, A4 margin). A margin is then set at the left-hand margin of the print document which can then be used for punching and filing.
Setting headers and footers
Project-specific headers and footers can be set in the SIMATIC Manager by using the File > Headers/Footers menu command.
Displaying the Print Preview
Use the File > Print Preview menu command to check the settings used in the print preview before you send the document to the printer. You cannot edit in the