文档详情

Abb 800xA train doc -chapter 3 - Project Framework.ppt

发布:2016-04-21约7.18千字共57页下载文档
文本预览下载声明
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 项目构架 变量与数据类型 功能块图(FBD)程序 结构化文本(ST)程序 任务 MMS通信 目录 ST 使用ST语言的优点 1. 自由布局程序代码和注释 2. 在在线模式下,可以切换到功能块图或梯形图视图显示 3. 可以使用任何文本编辑器来编写ST代码(如MS Word) 4. ST语言易写易读,是最高效率的代码编写方式 5. SFC程序的代码只能使用ST语言,所以,如果您需要使用SFC程序,就必须学习ST语言。 下图为一个采用ST语言编写的程序示例: ST ST程序编辑器 声明区 代码窗口 消息窗口 ST基本语言元素 注释 Operator Description 示例 (*…*) Comment according to IEC 1131-3. (* This is not (* Inner Comment *) allowed *) (#…#) Comment that can be nested (ABB extension). 赋值语句 Operator Description 示例 := Assigns a value (number, logical or string) to a variable AverageFlow := (Flow1 + Flow2)/2; ( ) Parentheses. Commonly used to change the priority of an expression. 注意:ST语言中一个语句以分号“;”结束 ST ST基本语言元素 BOOL运算符 Operator Description NOT, Negates the Boolean value (1/0, on/off or True/False). AND Boolean AND. Boolean AND. See AND. XOR Boolean XOR. OR Boolean OR. 算术运算符 Operator Description ** Exponential, i.e. raising to the power. * Multiplication / Division. + Addition. - Subtraction. MOD Modulus. 关系运算符 Operator Description Less than. Greater than. = Less than or equal to. = Greater than or equal to. = Equal to. Not equal to. 示例 ST ST基本语言元素 条件语句 运算符 说明 If..then.. end_if; 根据一个或多个表达式的值,有条件地执行一组 语句,条件语句总是以if 开始,以end_if结束。 If..then.. else.. end_if; 根据一个或多个表达式的值,有条件地执行一组或另 组语句,条件语句总是以if 开始,以end_if 结束。 If..then.. elsif.. else.. end_if; 根据一个或多个表达式的值,有条件地执行多组语句 中的一组,条件语句总是以if 开始,以end_if结束。 case integer of integer literal : statements end_case; 根据一个整型变量或整型表达式的值,执行一条语句 。integer literal 是一个或多个整型值或整型值范围 case integer of integer literal : statements integer literal : statements integer literal : statements else statements end_case; 同上,只是多了一个else,即整型值不在所选择的范 围之内,执行else下面的语句。 ST ST基本语言元素 循环语句 运算符 说明 For 允许一个语句按For语句中给定的次数重复执行。重复执行过程中可以在语句中使用计数器。 While 条件为真时,语句重复执行直到条件为假。与For于不同,和repeat语句类似。 Repeat 允许语句重复执行直到条件为真。与Fo语句不同,和repeat语句类似。 Exit 中断循环立即退出,继续执行循环结构后面的语句。 RETURN语句 运算符 说明 Return 退出当前代码的执行,该指令常见
显示全部
相似文档