长沙工控帮教育科技有限公司整理
Step 14: Downloading and Debugging the User Program
1. Select the Options > Application Settings menu command
3.8 Programming Instructions
3.8.1 Instructions in States and Transitions/Permanent Instructions
Instructions represent a process control command. They control, for example, inputs, outputs and bit memories or call blocks. You can assign states or transitions to instructions. In addition you can program so-called permanent instructions, which are executed irrespective of states or transitions.
In a state graph diagram instructions are represented in tabular form:
The table contains the following information.
(1) Instruction block
Instructions are subdivided into instruction blocks. Each block is represented by a line in the instruction table.
Several instruction blocks of the same type can occur (for example, the example in the figure contains two instruction blocks of Type E).
It is advisable to place each instruction in its own block. However, if desired, you can also insert several instructions into a common block.
(2) Instruction type S7-HiGraph differentiates among several instruction types which determine more specifically when an instruction is executed (for example, when entering the state, during the state or when leaving the state). The instruction types are represented by the abbreviations E, C-, C and X.
(3) (4) Instruction The instruction itself consists of an operation (3) and an absolute or symbolic address (4)
长沙工控帮教育科技有限公司整理
3.8.2 Instruction Types
Possible instruction types in the transition
? = M7.4;
Possible instruction types in the state
1
The following instruction types exist:
Instruction type Identifier Description Can be used in
Entry actions E Actions which are carried out once when
entering a state
States Preceding cyclic actions C- Actions which are carried out during a state
before the outgoing transitions are checked and which contain state-specific preceding logic operations for conditions.
States Permanent instructions Cyclic actions C Actions which are carried out during a state
after the transitions have been checked
States Permanent instructions
Exit actions X Actions which are carried out once when
exiting from a state
States
Waiting times WT Specifies whether the control system is to stay in a state for a minimum period.
States Monitoring times MT Specifies whether the duration of the state is to
be monitored.
States
Conditions ? These instructions describe the conditions
which must be fulfilled before a state change can take place.
Transitions
Transition actions ! These instructions are carried out once when the transition is activated.
Transitions
长沙工控帮教育科技有限公司整理
3.8.3 Rules for Entering STL Instructions
The following basic rules must be observed when entering STL instructions:
Topic Rule
Syntax The syntax follows the rules for STL sources. For an exact description of the syntax refer to the online help, "STL language description"
chapter.
Lines Each instruction stands in a separate line.
Instruction blocks The instructions of one type can be arranged in various instruction blocks in order to improve the structure. This facilitates the automatic resetting of signals which were set during the state.
Semicolon Every line ends with a semicolon.
Upper/lower case The program is not case-sensitive for the entry of operations, symbols or absolute addresses.
Addresses In order to ensure that state graphs can be used several times, you should only use such variables as addresses which you have declared in the variable declaration window. After you have inserted the state graph as an instance in a graph group you can assign symbolic or absolute addresses to these variables as current parameters.
RLO Processing of an instruction table always starts with the result of logic operation RLO = 1.
Nesting stack Monitor the depth of the nesting stack yourself, because this is not checked during compiling. The nesting stack can contain a maximum of seven entries. Exceeding of this limit is not rejected as an error.
Indirect addressing Indirect addressing is not permitted.
长沙工控帮教育科技有限公司整理
3.8.4 Settings for STL Instructions
Setting the mnemonics
You can use two types of mnemonics when programming instructions:
• SIMATIC mnemonics (for example, E1.0)
• International mnemonics (for example, I1.0)
In order to inform S7-HiGraph which mnemonics you want to use, select the Options > Settings menu command and set the mnemonic in the "Language"
register tab before opening an S7-HiGraph source in the SIMATIC Manager.
S7-HiGraph then interprets your entries in accordance with the mnemonics set.
Note that instructions which have already been entered are not adapted automatically.
3.8.5 Steps for Entering STL Instructions
Enter the instructions as follows:
1. Double-click on the element for which you want to program an instruction. This can be a state, a transition or the field "Permanent instructions". The instruction window is opened.
2. Select an instruction type in the left-hand section of the instruction window (for example, entry action, cyclic action etc.).
3. The instructions of various types are arranged in blocks in order to improve the structure.
Select an existing instruction block, or select the "Insert" command from the pop-up menu in order to insert a new instruction block.
4. Enter the instructions in the right-hand partial window.
5. In order to use symbolic names which are defined in the symbol table, select the Insert > Symbol menu command. A list of all the symbols is then displayed.
6. A syntax check is carried out when you have finished entering a line. The incorrect line is displayed in red, the syntax error is described in a message window. You can either eliminate the error immediately or accept the incorrect instruction and correct the error later.
7. The instructions are displayed in a table in the working window. Drag this table to a suitable position in the working window.
The "STL language description" section contains an overview of all the instructions which can be used in S7-HiGraph.