文档介绍:word
word
1 / 99
word
第一章 PLC编程人员参考概述
此手册供开放式架构数控系统PA 8类型,也就是说在函数名的后面必需紧跟冒号和一个数据类型。
下面是一个正确的函数定义:
FUNCTION INDUAL :INT
就是说函数名被用作输出变量。函数定义的以关键字FUNCTION开始,以END_FUNCTION 结尾。Example in IL of a function that takes three input variables and returns the product of the first two divided by the third:
Image : Function
{bmc }Error! Reference source not found.
x Example of a function in IL
函数没有任何的内部条件,就是说当用相同的输入变量时就会得出相同的结果(输出)。
x Examples for calling up the function described aboveError! Reference source not found.
Examples for calling up the function described above:
in ST:
Result := Fct(7, 2, 4);
程序(Program)
程序是一种程序结构单元,在运行过程中返回一定数量的值。程序在整个工程中都可以被识别。
word
word
5 / 99
word
{bmc }Error! Reference source not found.
xExample of a program
程序能够被调用,但不允许在函数中调用程序。如果在程序结构单元中调用程序时程序的返回值有变化,这些变化将保持到下一次程序调用,即使程序程序是从其它程序结构单元调用的。
程序由起始关键字Error! Reference source not ,END_PROGRAM结束。.
x Examples of calls of the program described aboveError! Reference source not found.
in ST:
PRGExample;
Res := ;
If the variable PAR from the program PRGexample is initialized by a main program with 0, and then one after the other programs are called with above named program calls, then the RES result in the programs will have the values 1, 2, and 3. If one exchanges the sequence of the calls, then the values of the given result parameters also change in a corresponding fashion.
PLC_PRG
PLC_PRG 是一个特殊的预先定义的程序结构单元,任何工程都必须含有这个特殊的程序。每次循环的过程中调用一次PLC_PRG 。
在新工程建立之后第一次执行"Project" "Object Add"Error! Reference source not ,程序结构单元对话框中的初始输入项就是名为PLC_PRG的程序类型。
注意:不要删除或者重命名PLC_PRG
word
word
6 / 99
word
Resources
设置和组织工程所需的资源Error! Reference source not found.:
·全局变量 Global VariablesError! Reference source not found.
·PLC设置 PLC ConfigurationError! Reference source not found.
·任务配置 Task ConfigurationError! Reference source not found.
·采样轨迹Samplin