版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Concept V2.6Lesson 14 Objectives:After completing this lesson, the learner will be able to:Program logic using the ST Editor.Demonstrate an Understanding of ST Language.Concept V2.6OverviewST is a high level language, similar to PASCAL or BASIC.ST is a distinct language that has been specifically de
2、veloped 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.Concept V2.6AdvantagesFairly stra
3、ight 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.Conce
4、pt V2.6Executed operationsLogical, arithmetic, compare operations and allocations.Complex instructions and instruction groupsunconditioned / conditioned.Declaration of functions and function blocks.Execute functions and function blocksunconditioned / conditioned. Concept V2.6Invocation of Function B
5、locksEach FFB instance must be invoked onceMultiple invocation (instantiation) is allowedFFB-call: with a list of input parametersConcept V2.6Statements, Expressions and OperatorsA structured text program contains:statements.A statement contains: Expressions KeywordsAn expression contains one or mor
6、e: Operators with Operands Admissible OperandsLiterals, all variables, elements of multi-element variables, FFB outputs or direct addressesConcept V2.6Statements must close with semicolons (;) One line may contain several statements, separated by (;)The following statements are available:VAR . END_V
7、ARDeclaration of FFBsFunction Block CallsInvoking of FFBsIF . THEN . END_IFConditioned execution of statementsELSIF . THENConditioned execution of statements, if the preceded expression is notfulfilled (false).ELSE .Execution of statements, ifexpressionsof preceded statements are not fulfilled(false
8、).NOTE: ( . means condition/expression)Concept V2.6CASE . OF . END_CASEA list of statements with given labels. Execution, if the label is true.FOR . TO . BY . DO . END_FORRepeated execution of statements up to a given number. WHILE.DO.END_WHILERepeated execution of statements up to preceded conditio
9、n = 0.REPEAT . UNTIL . END_REPEATRepeated execution of statements up to succeeded condition = 0.EXITTo terminate repeat statements(FOR, WHILE, REPEAT) before the end condition is true.NOTE: ( . means condition/expression)Concept V2.6Keywords That Can Not Be usedTYPE.END_TYP VAR_INPUT.END_VARVAR_OUTP
10、UT.END_VARVAR_IN_OUT.END_VARVAR_EXTERNAL.END_VARFUNCTION.END_FUNCTIONFUNCTION_BLOCK.END_FUNCTION_BLOCKPROGRAM.END_PROGRAMSTEP.END_STEPTRANSITION.END_TRANSITIONACTION.END_ACTIONSEGMENT_SCHEDULER RETURNConcept V2.6OperatorsOperators are generic, i.e. they automatically adjust to the data type of the o
11、perand.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
12、 to right, as described in the expression.This order can be changed through the use of parenthesis.Concept V2.6( )ExpressionBracketing1 (highest)FUNCNAME ANYFunction editing (call)2* *REAL, ANY_NUMRaising to a power3ANY_NUM Negation4NOTANY_BITComplement4*ANY_NUM or TIMEMultiplication5/ANY_NUM Divisi
13、on5MODANY_NUM Modulo5All operands also: Expression, literal, variable, direct addressOperatorOperand SignificancePrecedenceConcept V2.6+ANY_NUM or TIMEAddition6ANY_NUM or TIMESubtraction6ANY_ELEMGreater than 7 =ANY_ELEMGreater or equal 7=ANY_ELEMEquality8ANY_ELEMInequality8&, ANDANY_BITLogic AND9XOR
14、ANY_BITLogic exclusive OR10ORANY_BITLogic OR11All operands also: Expression, literal, variable, direct addressOperatorOperand SignificanceprecedenceConcept V2.6 InputOutputDefault Data TypePossible Data Types%IX,%QXBOOLBOOL%I%Q%IB%QBBYTEBYTE%IW%QWINTINT, UINT, WORD%ID%QDREALREAL, DINT,UDINT, TIMEExa
15、mple: %IX1 means address 100001 (input bit 1) %QW1 means address 400001 (output word 1)Concept V2.6Keywords, Separators and CommentsWhen entering keywords, separators and comments, there is an immediate spell checkIf a keyword, a separator or a comment is detected, it is identified with a color shad
16、ing.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.Concept V2.6The Objects MenuConcept V2.6Example: Entering a direct function callNo declaration is required!C
17、oncept V2.6Example: Entering a function blockIN, PT, Q, and ETare the labels of thepins on a TON timerConcept V2.6Handling, generalCreate or open ST SectionType or select statement, operator etc.: Objects.Type or select operand: Edit Lookup variablesType or select FFB: Objects Insert FFB or click on
18、Insert FFB see next slideConcept V2.6Insert FFBBrowse and select FFBDeclarationInvocationAssignmentConcept V2.6Use Expand statement to complete e.g.,VAR . END_VARUse Go to counterpart to find e.g.,second bracket ( )Enter comments, consider Options, Preferences!Syntax check: Project Analyze Section.A
19、ny 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.Concept V2.6Code generation together with the syntax check will be performed when the section is closed.creates additional information forprocess diagnosis during code
20、generationTests loops within ST (and IL) sectionsgenerates a runtimeoptimized codeConcept V2.6Before closing the ST section, go to Project Code generation optionsThis area used for Upload functionConcept Programming in STST ExampleCommentFFB-DeclarationAND-Function with AllocationFFB call with AllocationAND-Function with Allocation FFB call with Allocation Watch Sele
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026陕西旅游集团秋招面笔试题及答案
- 18.2电功率教案(表格式)2025-2026学年初中物理人教版九年级全一册
- 2026山西焦煤集团校招试题及答案
- 2026软件开发工程师招聘面试题及答案
- 2026年安徽省合肥市合肥幼教集团熙岸雅轩幼儿园招聘备考题库附答案详解(培优a卷)
- 2026广东深圳大学材料学院先进功能复合材料团队副研究员、专职科研岗招聘备考题库带答案详解(培优a卷)
- 2026广东广州市黄埔区林业工作站招聘政府初级雇员2人备考题库及1套参考答案详解
- 2026上海市气功研究所工作人员招聘5人备考题库及参考答案详解1套
- 2026广东江门市台山市应急救援和保障中心招聘7人备考题库及答案详解(新)
- 2026上半年贵州事业单位联考印江自治县招聘83人备考题库附答案详解(基础题)
- 小学生飞机科普教学
- 美术馆施工组织设计方案
- 2022-2023学年北京市延庆区八年级(上)期末数学试卷(含解析)
- 档案数字化加工上墙制度
- 2026年黑龙江农业经济职业学院单招综合素质考试参考题库附答案详解
- 干菌子委托加工协议书
- 中国肺癌合并肺结核临床诊疗指南(2025版)
- 混凝土搅拌与运输信息化系统设计
- TCFLP0030-2021国有企业网上商城采购交易操作规范
- DRG付费下病种成本预算策略
- 制定应急培训计划
评论
0/150
提交评论