版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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北师大二下全册可编辑教学课件
- 2026中国水泥行业市场竞争分析及增长潜力研究报告
- 2026自动驾驶测试平台衬套动态响应精度校准规范
- 2026中国智能手机行业技术创新与应用前景评估研究文档
- LED照明及视力关系
- 2026叶黄素酯行业环保政策影响与绿色生产技术发展报告
- 三年级数学正方长方形的面积
- 2026年起重机械指挥工理论考核试卷及答案
- 台风来袭施工现场应急方案
- 2026汽车配件市场供需关系运营潜力分析研究投资评估规划报告
- 深基坑施工方案(一体化污水提升泵站)
- DB61-T 142-2021造林技术规范
- 眼科医院感染监测指南
- 大学生创新创业能力的测试与评估研究
- 北师大版数学五年级下册分数乘除混合运算练习100题及答案
- 感觉统合与感觉统
- 陕西诺正生物科技有限公司年产20000吨农药原药及中间体生产线建设项目环境影响报告
- 明源广晟泗县大杨风电场项目环境影响报告表
- WB/T 1116-2021阁楼式货架
- GB/T 3478.5-2008圆柱直齿渐开线花键(米制模数齿侧配合)第5部分:检验
- GB/T 26148-2010高压水射流清洗作业安全规范
评论
0/150
提交评论