Presentation is loading. Please wait.

Presentation is loading. Please wait.

Concept V2.5 Lesson 17 Objectives: After completing this lesson, the learner will be able to: –Program logic using the ST Editor. –Demonstrate an Understanding.

Similar presentations


Presentation on theme: "Concept V2.5 Lesson 17 Objectives: After completing this lesson, the learner will be able to: –Program logic using the ST Editor. –Demonstrate an Understanding."— Presentation transcript:

1 Concept V2.5 Lesson 17 Objectives: After completing this lesson, the learner will be able to: –Program logic using the ST Editor. –Demonstrate an Understanding of ST Language.

2 Concept V2.5 Overview ST is a high level language, similar to PASCAL or BASIC. ST is a distinct language that has been specifically developed for industrial control applications. ST has a comprehensive range of constructs for assigning values to variables, calling FFBs, creating expressions, for conditional evaluation of selected statements, or for iteration, i.e. repeating selected section of code.

3 Concept V2.5 Advantages Fairly straight forward and easy to learn and to use. Compact formulation of a complex programming task. Clear program construction by instruction blocks. Powerful constructs for controlling the instruction flow. Useful for complex mathematic solutions. Simple solutions for difficult problems in FBD, LD or IL.

4 Concept V2.5 Executed operations Logical, arithmetic, compare operations and allocations. Complex instructions and instruction groups unconditioned / conditioned. Declaration of functions and function blocks. Execute functions and function blocks unconditioned / conditioned.

5 Concept V2.5 Invocation of Function Blocks Each FFB instance must be invoked once Multiple invocation (instantiation) is allowed FFB-call: with a list of input parameters

6 Concept V2.5 Statements, Expressions and Operators A structured text program contains: statements. A statement contains: Expressions Keywords An expression contains one or more: Operators with Operands Admissible Operands Literals, all variables, elements of multi-element variables, FFB outputs or direct addresses

7 Concept V2.5 Statements must close with semicolons (;) One line may contain several statements, separated by (;) The following statements are available: VAR... END_VARDeclaration of FFB's Function Block CallsInvoking of FFBs IF... THEN... END_IFConditioned execution of statements ELSIF... THENConditioned execution of statements, if the preceded expression is not fulfilled (false). ELSE...Execution of statements, if expressions of preceded statements are not fulfilled (false). NOTE: (... means condition/expression)

8 Concept V2.5 CASE... OF... END_CASE A list of statements with given labels. Execution, if the label is true. FOR... TO... BY... DO... END_FOR Repeated execution of statements up to a given number. WHILE...DO...END_WHILE Repeated execution of statements up to preceded condition = 0. REPEAT... UNTIL... END_REPEAT Repeated execution of statements up to succeeded condition = 0. EXIT To terminate repeat statements (FOR, WHILE, REPEAT) before the end condition is true. NOTE: (... means condition/expression)

9 Concept V2.5 Keywords That Can Not Be used TYPE...END_TYP VAR_INPUT...END_VAR VAR_OUTPUT...END_VAR VAR_IN_OUT...END_VAR VAR_EXTERNAL...END_VAR FUNCTION...END_FUNCTION FUNCTION_BLOCK...END_FUNCTION_BLOCK PROGRAM...END_PROGRAM STEP...END_STEP TRANSITION...END_TRANSITION ACTION...END_ACTION SEGMENT_SCHEDULER RETURN

10 Concept V2.5 Operators Operators are generic, i.e. they automatically adjust to the data type of the operand. The evaluation of an expression consists of applying the operators to the operands in the order defined by the rule of precedence of the operators. The operator with the highest rule of precedence in an expression will be executed first. Operators with the same precedence are executed from left to right, as described in the expression. This order can be changed through bracketing.

11 Concept V2.5 ( )ExpressionBracketing1 (highest) FUNCNAME ANYFunction editing (call) 2 * * REAL, ANY_NUMRaising to a power3 ­ ANY_NUM Negation4 NOTANY_BITComplement4 * ANY_NUM or TIMEMultiplication5 / ANY_NUM Division5 MODANY_NUM Modulo5 All operands also: Expression, literal, variable, direct address OperatorOperand SignificancePrecedence

12 Concept V2.5 +ANY_NUM or TIMEAddition6 ­ANY_NUM or TIMESubtraction6 <ANY_ELEMLess than 7 >ANY_ELEMGreater than 7 < = ANY_ELEMLess or equal 7 > =ANY_ELEMGreater or equal 7 =ANY_ELEMEquality8 ANY_ELEMInequality8 &, ANDANY_BITLogic AND9 XORANY_BITLogic exclusive OR10 ORANY_BITLogic OR11 All operands also: Expression, literal, variable, direct address OperatorOperand Significanceprecedence

13 Concept V2.5 InputOutputDefault Data TypePossible Data Types %IX,%QXBOOLBOOL %I%Q %IB%QBBYTEBYTE %IW%QWINTINT, UINT, WORD %ID%QDREALREAL, DINT, UDINT, TIME Example: %IX1 means address 100001 (input bit 1) %QW1 means address 400001 (output word 1)

14 Concept V2.5 Keywords, Separators and Comments When entering keywords, separators and comments, there is an immediate spell check If a keyword, a separator or a comment is detected, it is identified with a color shading. If unauthorized keywords (instructions or operators) are entered, this will be identified through color shading as well. Spaces and tabs have no effect on syntax, they can be used anywhere.

15 Concept V2.5 The Objects Menu

16 Concept V2.5 Example: Entering a direct function call No declaration is required!

17 Concept V2.5 Example: Entering a function block IN, PT, Q, and ET are the labels of the pins on a TON timer

18 Concept V2.5 Handling, general Create or open ST Section Type or select statement, operator etc.:  Objects... Type or select operand:  Edit  Lookup variables Type or select FFB:  Objects  Insert FFB or click on Insert FFB see next slide

19 Concept V2.5 Insert FFB Browse and select FFB Declaration Invocation Assignment

20 Concept V2.5 Use Expand statement to complete e.g., VAR... END_VAR Use Go to counterpart to find e.g., second bracket ( ) Enter comments, consider Options, Preferences! Syntax check:  Project  Analyze Section. Any errors found are displayed in the message window. Double click on the first line means: go to the line with the first error in ST.

21 Concept V2.5

22 Code generation together with the syntax check will be performed when the section is closed. creates additional information for process diagnosis during code generation Tests loops within ST (and IL) sections generates a runtime­optimized code Concept V2.5 Before closing the ST section, go to  Project  Code generation options This area used for Upload function

23 Concept Programming in ST ST Example  Comment  FFB-Declaration  AND-Function with Allocation  FFB call with Allocation  AND-Function with Allocation  FFB call with Allocation

24 Watch Selected Inspect Selected Concept V2.5

25 Select variable with double click Animation Selected mode or Go to Online  Watch Selected Repeat for next variable Remains open until it is closed or the animation is terminated A dialog box can be opened for each section

26 Concept V2.5 Select variable with double click go to menu Online  Inspect Selected set cursor to any position on section click left mouse button Set cursor into cyan field depress right mouse button select operation mode: Move field to another position Delete field or Options... see next slide

27 Concept V2.5 Select operation mode options... Enter Minimum/Maximum Notice the color change YellowMagenta

28

29

30


Download ppt "Concept V2.5 Lesson 17 Objectives: After completing this lesson, the learner will be able to: –Program logic using the ST Editor. –Demonstrate an Understanding."

Similar presentations


Ads by Google